Skip to content

Commit ce97f02

Browse files
committed
swapped the y and z in latex
1 parent f482039 commit ce97f02

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

books/RayTracingTheNextWeek.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,23 +1151,23 @@
11511151
unit radius sphere on the origin is:
11521152

11531153
$$ x = \cos(\phi) \cos(\theta) $$
1154-
$$ y = \sin(\phi) \cos(\theta) $$
1155-
$$ z = \sin(\theta) $$
1154+
$$ z = \sin(\phi) \cos(\theta) $$
1155+
$$ y = \sin(\theta) $$
11561156
</div>
11571157

11581158
<div class='together'>
11591159
We need to invert that. Because of the lovely `<cmath>` function `atan2()` which takes any number
1160-
proportional to sine and cosine and returns the angle, we can pass in $x$ and $y$ (the
1160+
proportional to sine and cosine and returns the angle, we can pass in $z$ and $x$ (the
11611161
$\cos(\theta)$ cancel):
11621162

1163-
$$ \phi = \text{atan2}(y, x) $$
1163+
$$ \phi = \text{atan2}(z, x) $$
11641164
</div>
11651165

11661166
<div class='together'>
11671167
The $atan2$ returns values in the range $-\pi$ to $\pi$, so we need to take a little care there.
11681168
The $\theta$ is more straightforward:
11691169

1170-
$$ \theta = \text{asin}(z) $$
1170+
$$ \theta = \text{asin}(y) $$
11711171

11721172
which returns numbers in the range $-\pi/2$ to $\pi/2$.
11731173
</div>

0 commit comments

Comments
 (0)