home/ atoms/ ray-as-parametric-function

A ray is modeled as the parametric function P(t) = A + t*b to enable intersection math

The foundational data structure of ray tracing is the ray expressed as P(t) = A + t*b, where A is the ray origin, b is the direction vector, and t is the parameter controlling position along the ray. Setting t > 0 gives the forward half (in front of the camera). Ray-object intersection reduces to solving for the value of t where P(t) lands on the surface. This parameterization unifies camera ray generation, shadow rays, and reflected/scattered rays under one representation, and the scalar t becomes the depth value used for visibility ordering.

Examples

To hit a sphere centered at C with radius r: substitute P(t) into the sphere equation |P-C|^2 = r^2 and solve the resulting quadratic in t.

Assessment

Given P(t) = (0,0,0) + t*(1,0,0) and a sphere centered at (3,0,0) radius 1, compute the two t values of intersection.

“Let's think of a ray as a function P(t) = A + t b. Here P is a 3D position along a line in 3D. A is the ray origin and b is the ray direction.”