File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 351
351
Rays, a Simple Camera, and Background
352
352
====================================================================================================
353
353
354
+ < div class='together'>
354
355
The one thing that all ray tracers have is a ray class, and a computation of what color is seen
355
356
along a ray. Let’s think of a ray as a function $\mathbf{p}(t) = \mathbf{a} + t \vec{\mathbf{b}}$.
356
357
Here $\mathbf{p}$ is a 3D position along a line in 3D. $\mathbf{a}$ is the ray origin and
357
358
$\vec{\mathbf{b}}$ is the ray direction. The ray parameter $t$ is a real number (`double` in the
358
359
code). Plug in a different $t$ and $p(t)$ moves the point along the ray. Add in negative $t$ and you
359
360
can go anywhere on the 3D line. For positive $t$, you get only the parts in front of $\mathbf{a}$,
360
- and this is what is often called a half-line or ray. The example $\mathbf{c} = p(2)$ is shown here:
361
+ and this is what is often called a half-line or ray.
361
362
362
363
![Figure [lerp]: Linear interpolation](../images/fig.lerp.jpg)
363
364
365
+ </ div>
366
+
364
367
< div class='together'>
365
368
The function $p(t)$ in more verbose code form I call `ray::at(t)`:
366
369
You can’t perform that action at this time.
0 commit comments