Skip to content

Commit 9af65e1

Browse files
committed
Correct PDF sampling math check
This also corrects a MathJax problem with the text "solid_angle". Resolves #1280
1 parent 09f31bb commit 9af65e1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

books/RayTracingTheRestOfYourLife.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3493,15 +3493,15 @@
34933493
$$ \cos(\theta_{max}) = \sqrt{1 - \frac{R^2}{length^2(\mathbf{c} - \mathbf{p})}} $$
34943494

34953495
We also need to evaluate the PDF of directions. For a uniform distribution toward the sphere the PDF
3496-
is $1/\mathit{solid_angle}$. What is the solid angle of the sphere? It has something to do with the
3497-
$C$ above. It is -- by definition -- the area on the unit sphere, so the integral is
3496+
is $1/\text{solid_angle}$. What is the solid angle of the sphere? It has something to do with
3497+
the $C$ above. It is -- by definition -- the area on the unit sphere, so the integral is
34983498

3499-
$$ \mathit{solid angle} = \int_{0}^{2\pi} \int_{0}^{\theta_{max}} \sin(\theta)
3499+
$$ \text{solid_angle} = \int_{0}^{2\pi} \int_{0}^{\theta_{max}} \sin(\theta)
35003500
= 2 \pi \cdot (1-\cos(\theta_{max})) $$
35013501

35023502
It’s good to check the math on all such calculations. I usually plug in the extreme cases (thank you
35033503
for that concept, Mr. Horton -- my high school physics teacher). For a zero radius sphere
3504-
$\cos(\theta_{max}) = 0$, and that works. For a sphere tangent at $\mathbf{p}$,
3504+
$\cos(\theta_{max}) = 1$, and that works. For a sphere tangent at $\mathbf{p}$,
35053505
$\cos(\theta_{max}) = 0$, and $2\pi$ is the area of a hemisphere, so that works too.
35063506

35073507

0 commit comments

Comments
 (0)