Skip to content
Part IA Michaelmas Term

Barycentric Coordinates

Definition

Barycentric coordinates (α,β,γ)(\alpha, \beta, \gamma) express a point inside a triangle as a weighted combination of the vertices:

P=αA+βB+γC\mathbf{P} = \alpha\mathbf{A} + \beta\mathbf{B} + \gamma\mathbf{C}

where α+β+γ=1\alpha + \beta + \gamma = 1 and α,β,γ0\alpha, \beta, \gamma \geq 0 for points inside the triangle.

Triangle with barycentric coordinates showing point P inside

Computing Barycentric Coordinates

Given triangle vertices (xA,yA)(x_A, y_A), (xB,yB)(x_B, y_B), (xC,yC)(x_C, y_C) and point (x,y)(x, y):

Define implicit line equation: fAB(x,y)=(yAyB)x+(xBxA)y+xAyBxByAf_{AB}(x, y) = (y_A - y_B)x + (x_B - x_A)y + x_A y_B - x_B y_A

Then: α=fBC(x,y)fBC(xA,yA)\alpha = \frac{f_{BC}(x, y)}{f_{BC}(x_A, y_A)} β=fAC(x,y)fAC(xB,yB)\beta = \frac{f_{AC}(x, y)}{f_{AC}(x_B, y_B)} γ=1αβ\gamma = 1 - \alpha - \beta

Interpolating Attributes

Any attribute QQ (colour, normal, texture coordinates) can be interpolated:

Q(x,y)=αQA+βQB+γQCQ(x, y) = \alpha Q_A + \beta Q_B + \gamma Q_C

Used for:

  • Colour interpolation (Gouraud shading)
  • Normal interpolation (Phong shading)
  • Texture coordinate interpolation

Point-in-Triangle Test

A point is inside the triangle if and only if: α>0 and β>0 and γ>0\alpha > 0 \text{ and } \beta > 0 \text{ and } \gamma > 0

Summary

  • Barycentric coordinates express points as vertex weights
  • Sum to 1 inside triangle; all positive for interior points
  • Enable smooth attribute interpolation across triangle

Past Paper Questions

2025 Paper 3 Question 4(b)(iv): What are barycentric coordinates, and where are they needed in the OpenGL rendering pipeline? [3 marks]