Triangles
- Situation: A triangle hit and interpolated vertex data
- Target: Edges · Winding · Barycentric coordinates
- Convention: Right-handed orthonormal frame; column vectors; rightmost matrix first; angles in radians unless marked °; lengths in m · Overview
Core concepts
- Edges: B−A and C−A; three noncollinear vertices for a nonzero area
- Winding: (B−A)×(C−A); reversed vertex order → reversed normal, unchanged area
- Barycentric coordinates: P=αA+βB+γC with α+β+γ=1; coplanar point inside or on boundary when all weights nonnegative
- Interpolation: same weights for vertex colors or other linear attributes; perspective-correct interpolation after perspective projection
- Degeneracy: collinear or repeated vertices → zero area and no unique barycentric solution; tolerance scaled to geometry
Worked example
Shared triangle: A=(1,1,0), B=(4,5,0), C=(1,5,0) m → K=6 m², G=(2,11/3,0) m; P=(2,2,0) → (α,β,γ)=(3/4,1/3,−1/12), outside
Practice
- Preparation → prediction → calculation: Paper or calculator; predict the centroid location → calculate area and weights → compare centroid, edge midpoint and P; triangle and weights retained for ray 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: Vertex scalars 0, 30, 60; centroid value 30
Exercises
- Problem:
- Problem:
- Problem:
- Problem: Negative barycentric weight
Answers and checks
- Answer:
- Answer:
- Answer:
- Answer: Outside the triangle, assuming coplanarity
Connections
- Previous: Circles and Spheres
- Next: Bounding Boxes