Geometric Tests
- Situation: The nearest hit along one ray
- Target: Ray parameter · Plane hit · Sphere hit
- Convention: Right-handed orthonormal frame; column vectors; rightmost matrix first; angles in radians unless marked °; lengths in m · Overview
Core concepts
-
Ray parameter: R(t)=O+td, t≥0; distance equal to t only for unit d
-
Plane hit: t=(c−n·O)/(n·d); zero denominator with zero numerator → coplanar, otherwise parallel miss
-
Sphere hit: quadratic in t; negative discriminant → miss, zero → tangent; smallest nonnegative root as first forward hit
-
Box slabs: intersect three axis parameter intervals with [0,∞); zero direction component → reject outside slab, no bound inside slab
-
Triangle and robustness: plane hit followed by barycentric test; explicit boundary tolerance, zero-direction rejection and front/back-face policy
Worked example
Input: O=(2,2,6) m, d=(0,0,−1), sphere Q=(2,2,3) m with r=2 m; sphere t=1,5 m, box interval [3,6] m, floor t=6 m; floor point outside triangle
Practice
- Preparation → prediction → calculation: Prior plane, sphere, triangle and box; predict hit order → solve each test → sort valid parameters; recorded misses as well as hits
- Record: Assumed exercise inputs; predictions before calculation; calculated answers and optional viewer output in separate columns; no physical measurements
| Case | Prediction | Calculated result | Viewer output (optional) |
|---|---|---|---|
| First sphere hit from Q with unit direction |
- Optional extension: Ray origin at sphere center; negative entry root and positive exit root
Exercises
- Problem:
- Problem:
- Problem: First sphere hit from Q with unit direction
- Problem: Box hit implies triangle hit
Answers and checks
- Answer:
- Answer:
- Answer: t=2 m, exit surface
- Answer: No; floor hit (2,2,0) has a negative barycentric weight
Connections
- Previous: Bounding Boxes
- Next: Matrices