Barycentric coordinate is a coordinate system in which the location of a point is specified by reference to points on a simplex (i.e., a line, triangle, tetrahedron, etc.) rather than with respect to global coordinates.

We can view Barycentric coordinates as normalized weighted average of vertices. 1 Another way to view Barycentric coordinates is to view the coordinates as masses assigned to vertices. In this case, the point is at the geometric centroid of the shape. 2

Aside: affine combination and convex combination

A linear combination that expresses multiple points as a normalized weighted sum (where sum of weight is equal to ) is an affine combination if the weights can be any value and and a convex combination if they are limited between .

Barycentric coordinates are useful in both rasterization and ray-triangle intersection, and can be used for interpolation during shading.

Lines

See also: lerp and inverse lerp

Barycentric coordinate can be seen as a generalization of linear interpolation (lerp). With lerp, we represent a point between two points and as

If we let and , we will have a barycentric coordinates of . 1

Triangles

For triangles, barycentric coordinate expresses the location of any point coplanar with a triangle in three scale , , and . The position of that point is at where are the coordinates of the three vertices of the triangle.

The three coordinates satisfy the relationship and if a point is inside a triangle, . Notice that from two of the coordinates we can find the third one .

Barycentric coordinates are proportion to area of sub-triangles.For this reason, it is also known as areal coordinates: 3

To find barycentric coordinate of a point, we can calculate the area of the triangle and sub-triangles. The area of triangle is the area of the parallelogram formed by two edges divided by 2. In 3D, we can use cross product for this purpose:

We can similarly compute the area of a sub-triangles, and use this information for barycentric coordinates:

Tetrahedra

Barycentric coordinates for Tetrahedra and higher dimension is analogous to it for triangles and lines. 14

See Also

Footnotes

  1. Barycentric Coordinates / T.J. Jankun-Kelly | Observable 2 3

  2. Geometric Centroid — from Wolfram MathWorld

  3. Scratchapixel: Barycentric Coordinates

  4. 4.2.2 Tetrahedron Barycentric Coordinates