Skip to main content

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
triangle edge vectors
Figure 1. triangle edge vectors
  • Winding: (B−A)×(C−A); reversed vertex order → reversed normal, unchanged area
triangle winding normal
Figure 2. triangle winding normal
  • Barycentric coordinates: P=αA+βB+γC with α+β+γ=1; coplanar point inside or on boundary when all weights nonnegative
barycentric coordinates
Figure 3. barycentric coordinates
  • Interpolation: same weights for vertex colors or other linear attributes; perspective-correct interpolation after perspective projection
triangle barycentric interpolation
Figure 4. triangle barycentric interpolation
  • 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

K=12∥(B−A)×(C−A)∥,G=A+B+C3K=\frac12\|(\mathbf B-\mathbf A)\times(\mathbf C-\mathbf A)\|,\qquad \mathbf G=\frac{\mathbf A+\mathbf B+\mathbf C}{3} u=B−A,v=C−A,w=P−AD=(u⋅u)(v⋅v)−(u⋅v)2β=(v⋅v)(w⋅u)−(u⋅v)(w⋅v)Dγ=(u⋅u)(w⋅v)−(u⋅v)(w⋅u)Dα=1−β−γ,D≠0\begin{aligned} \mathbf u&=B-A,\quad \mathbf v=C-A,\quad \mathbf w=P-A\\ D&=(\mathbf u\cdot\mathbf u)(\mathbf v\cdot\mathbf v)-(\mathbf u\cdot\mathbf v)^2\\ \beta&=\frac{(\mathbf v\cdot\mathbf v)(\mathbf w\cdot\mathbf u)-(\mathbf u\cdot\mathbf v)(\mathbf w\cdot\mathbf v)}{D}\\ \gamma&=\frac{(\mathbf u\cdot\mathbf u)(\mathbf w\cdot\mathbf v)-(\mathbf u\cdot\mathbf v)(\mathbf w\cdot\mathbf u)}{D}\\ \alpha&=1-\beta-\gamma,\qquad D\ne0 \end{aligned}

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
CasePredictionCalculated resultViewer output (optional)
KK
GG
(α,β,γ)=(1/2,1/2,0): P(\alpha,\beta,\gamma)=(1/2,1/2,0):\ P
  • Optional extension: Vertex scalars 0, 30, 60; centroid value 30

Exercises​

  1. Problem: KK
  2. Problem: GG
  3. Problem: (α,β,γ)=(1/2,1/2,0): P(\alpha,\beta,\gamma)=(1/2,1/2,0):\ P
  4. Problem: Negative barycentric weight
Answers and checks
  1. Answer: 6 m26\ \mathrm{m^2}
  2. Answer: (2,11/3,0) m(2,11/3,0)\ \mathrm m
  3. Answer: (2.5,3,0) m(2.5,3,0)\ \mathrm m
  4. Answer: Outside the triangle, assuming coplanarity

Connections​