liveBook · Manning

Ray

As explained in Geometry for Programmers

A ray is a geometric object consisting of an endpoint and all points extending indefinitely in one direction from it.

A ray starts at a point P and extends indefinitely in direction d. Its parametric form is R = P + td, with t >= 0; restricting t to nonnegative values distinguishes the ray from the whole line. section 3.8.2

In 3D geometry, rays provide a practical way to test whether directed paths meet triangles. Raytracers emit one ray per screen pixel, while collision systems use similar tests against triangle meshes. section 3.8.1

A ray-triangle intersection test combines two parameterizations:

  • Parameterize the ray as R = P + td, allowing t to range from zero toward infinity. section 3.8.2
  • Parameterize a triangle ABC as S = A + uAB + vAC, then reject plane points that fall outside the triangle. section 3.8.2
  • Solve the resulting linear system to determine whether the ray reaches the triangle and where the intersection occurs. section 3.10

Testing a directed path

For a ray beginning at P = (0.5, 0.5, 0.5, 1) with direction d = (0, 0, 0, -1), the supplied test reports a true intersection condition; reversing the direction to (0, 0, 0, 1) reports false. section 3.10

Figure 3.15 A ray may or may not intersect a triangle in 3D.
03-15

Use the figure to compare a ray that intersects a 3D triangle with one that misses it. section 3.8.1

How Geometry for Programmers covers it

How deep it goes
Defines the parameterization, triangle coordinates, filtering constraints, and linear-system solution, but stops short of implementation details.
Examples
Uses 3D ray-triangle figures, parameterized points, and concrete direction tests solved with SymPy.
What it assumes
Assumes point and vector notation plus 3D line equations, while introducing parameter restrictions and triangle-based coordinates.
What you can do after
Apply parametric ray equations and SymPy-based linear systems to test intersections and calculate candidate points.
How it connects
Connects rays to parametric equations, vectors, triangles, linear equations, ray tracing, and collision detection.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Geometry for Programmers. The section links point to the parts of the book it draws on.