Lines and Rays
- Situation: Rejecting hits behind a ray or beyond a segment
- Target: Parameter domain · Distance · Closest point
- Convention: Right-handed orthonormal frame; column vectors; rightmost matrix first; angles in radians unless marked °; lengths in m · Overview
Core concepts
- Parameter domain: line t∈R, ray t≥0, segment A+t(B−A) with 0≤t≤1; equation and domain jointly defining the primitive
-
Distance: |t|‖d‖; dimensionless t for d in meters, distance parameter s in meters for dimensionless unit d̂
-
Closest point: projection onto direction, then domain clamp; ray max(0,t), segment clamp(t,0,1)
- Degeneracy: d=0 or A=B as a single point; denominator test before projection
- 2D forms: y=mx+b excluding vertical lines; n·P=c with n perpendicular to direction including vertical lines
Worked example
Shared path: A=(1,1,0), d=(3,4,0) m; t=−1,0,0.5,1,2 → (−2,−3,0),(1,1,0),(2.5,3,0),(4,5,0),(7,9,0) m
Practice
- Preparation → prediction → calculation: Predict membership for five t values; calculate positions and line/ray/segment membership; midpoint with t=0.5 versus s=2.5 m; retain parameter domains for hit tests
- 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) |
|---|---|---|---|
- Optional extension: Closest point to Q=(5,1,0) m: projection t=12/25=0.48, on both line and segment
Exercises
- Problem:
- Problem:
- Problem:
- Problem: Segment membership at t=−0.1
Answers and checks
- Answer:
- Answer:
- Answer:
- Answer: Outside; closest clamped endpoint A
Connections
- Previous: Dot and Cross Products
- Next: Planes