AI Glossary / Computer vision and multimodal AI / Intermediate
Barycentric coordinates
Definition
Barycentric coordinates describe a point as a weighted combination of reference vertices. For a non-degenerate triangle, three normalized weights sum to one and locate the point relative to the triangle's three corners, making them useful for geometry and interpolation.
What it means
Ordinary Cartesian coordinates locate a point using axes such as x and y. Barycentric coordinates instead use a particular triangle as the reference. Each weight states how much one vertex contributes to the point's position.
Inside the triangle, all three normalized weights are nonnegative. At a vertex, its weight is one and the others are zero. On an edge, the weight of the opposite vertex is zero. Points outside the triangle can still be represented, but at least one weight is negative.
The coordinates depend on the chosen triangle and vertex order. The same spatial point has different barycentric coordinates relative to another triangle. Their usefulness comes from expressing local relationships and interpolating values attached to the vertices.
How it works
For vertices A, B and C, write P = aA + bB + cC with a + b + c = 1. A non-degenerate triangle gives a unique set of such weights for a point in its plane. The weights can be found by solving a small linear system or through signed area relationships.
Once the weights are known, a scalar attribute can be interpolated as v(P) = av(A) + bv(B) + cv(C). Texture coordinates and other vector attributes can be treated similarly. Interpolated surface normals generally need normalization before they are used as unit directions.
The coordinate space matters. In perspective rendering, directly interpolating attributes with screen-space weights is not generally equivalent to interpolation on the original surface. Perspective-correct interpolation accounts for the projection relationship. Degenerate or nearly degenerate triangles also require numerical care.
Three practical examples
- A renderer interpolates texture coordinates across a triangle using weights associated with a surface location.
- A geometry tool checks whether a point falls inside a triangle by examining its normalized barycentric weights.
- A mesh-processing workflow transfers a scalar measurement from triangle vertices to an interior point.
Think of it this way
Think of balancing a point using contributions from three corners of a triangular frame. Moving more weight towards one corner pulls the weighted position towards it. The analogy is limited: mathematical weights can be negative for points outside the triangle, which does not correspond to ordinary positive masses placed on a physical frame.
Worked example
Let A = (0, 0), B = (4, 0) and C = (0, 2). Choose barycentric weights (a, b, c) = (0.25, 0.5, 0.25). They sum to one, and the resulting point is P = 0.25A + 0.5B + 0.25C = (2, 0.5).
Suppose a scalar attribute at the vertices is 10, 20 and 30 respectively. Linear interpolation gives 0.25 × 10 + 0.5 × 20 + 0.25 × 30 = 20.
All weights are nonnegative, so P lies within the triangle. If the weights were (−0.25, 1, 0.25), they would still sum to one, but the negative first weight would place the point outside. The weights describe geometry; they are not probabilities of vertex membership.
Illustrative case study
Fictional example: Meshfield Studio displays a simulated scalar value over a triangular surface. Each vertex stores a value from an upstream calculation, and the viewer uses barycentric interpolation to produce smooth variation within each face.
The team checks a few interior points by hand and verifies the vertex ordering used by the renderer. It also inspects very thin triangles, where small coordinate errors can produce unstable-looking results. The displayed interpolation is clearly separated from the accuracy of the original simulation values.
This fictional case illustrates consistent value transfer. A smooth color map does not prove that the underlying physical quantity varies linearly or that the upstream model is valid.
Common misconceptions and mistakes
Barycentric weights are not automatically probabilities. Their sum-to-one property resembles probabilities, but outside points can have negative weights and their purpose is geometric.
Three weights do not create three independent degrees of freedom because the sum constraint removes one. A triangle with collinear vertices cannot provide the usual unique two-dimensional coordinate system. Also, affine interpolation of color or other attributes must respect the intended representation; a mathematically correct weighted average can still be inappropriate for nonlinear encoded values or unit-length directions.
Business use
These coordinates provide a compact way to connect points with mesh geometry and vertex data. They support rendering, picking, interpolation, deformation and data transfer between representations.
For a reliable workflow, keep vertex ordering and coordinate spaces explicit. Validate edge cases at vertices, along edges and near degenerate triangles. Distinguish geometric interpolation from domain assumptions about the quantity being interpolated. If the result feeds a measurement or simulation display, retain the source values and document how interior values were produced.
People also ask
Why are there three coordinates for a point on a two-dimensional triangle?
The three weights must sum to one, leaving only two independent values.
Can a negative weight be valid?
Yes. Normalized barycentric coordinates can represent points outside the triangle, where negative weights occur.
Do barycentric coordinates work only in two-dimensional images?
No. They can describe points on triangles embedded in three-dimensional space and generalize to higher-dimensional simplices.
Check your understanding
A point has normalized triangle weights (0.2, 0.3, 0.5). Is it inside the triangle, assuming the triangle is non-degenerate?
Answer: Yes. The weights sum to one and are all nonnegative, so the point lies in the triangle's convex region.
Related terms
- Triangle mesh
- interpolation
- affine combination
- convex combination
- texture coordinates
- perspective-correct interpolation
- simplex
- Cartesian coordinates
Learn next
Plot the worked triangle and locate several points from chosen weights. Test a vertex, an edge midpoint, the centroid and an outside point. Then interpolate a scalar value at those locations. Finally, compare interpolation before and after perspective projection to understand why screen-space weights need special handling in rendering.
More in Computer vision and multimodal AI
- B-rep - B-rep, short for boundary representation, describes a three-dimensional shape through its boundary elements and how they connect.
- Background subtraction - Background subtraction is a computer-vision technique that identifies image regions differing from an estimated background scene.
- Banding - Banding is the appearance of visible steps or stripes in a region that should change smoothly in brightness or color.
- Bayer pattern - A Bayer pattern is a repeating arrangement of red, green and blue color filters over a single image sensor.
- Bayesian filtering - Bayesian filtering is a recursive method for estimating a changing hidden state from noisy observations.
- Beier - Neely field warping - Beier - Neely field warping is an image-deformation method controlled by corresponding line segments.
Sources
Pharr, Jakob and Humphreys, Physically Based Rendering, Triangle Meshes: https://www.pbr-book.org/3ed-2018/Shapes/Triangle_Meshes Physically Based Rendering, numerical considerations for barycentric interpolation: https://www.pbr-book.org/4ed/Shapes/Managing_Rounding_Error The triangle values and mesh-viewer case are original examples. The article describes normalised barycentric coordinates for non-degenerate triangles unless stated otherwise.
Previous: Bartlett's test Next: Barzilai - Borwein method