Barycentric coordinate system

In geometry, a barycentric coordinate system is a coordinate system in which the location of a point is specified by reference to a simplex (a triangle for points in a plane, a tetrahedron for points in three-dimensional space, etc.). The barycentric coordinates of a point can be interpreted as masses placed at the vertices of the simplex, such that the point is the center of mass (or "barycenter") of these masses. These masses can be zero or negative; they are all positive if and only if the point is inside the simplex.
Every point has barycentric coordinates, and their sum is not zero. Two tuples of barycentric coordinates specify the same point if and only if they are proportional; that is to say, if one tuple can be obtained by multiplying the elements of the other tuple by the same non-zero number. Therefore, barycentric coordinates are either considered to be defined up to multiplication by a nonzero constant, or normalized for summing to unity.
Barycentric coordinates were introduced by 
August Ferdinand Möbius in 1827. They are special homogenous coordinates. Barycentric coordinates are strongly related with Cartesian coordinates and, more generally, to affine coordinates (see ).
Barycentric coordinates are particularly useful in triangle geometry for studying properties that do not depend on the angles of the triangle, such as Ceva's theorem. In Computer-aided design, they are useful for defining some kinds of Bézier surfaces. 
Definition.
Let formula_1 be points in a Euclidean space, a flat or an affine space formula_2 of dimension that are affinely independent; this means that there is no affine subspace of dimension that contains all the points, or, equivalently that the points define a simplex. Given any point formula_3 there are scalars formula_4 that are not all zero, such that 
for any point . (As usual, the notation formula_6 represents the translation vector or free vector that maps the point to the point .)
The elements of a tuple formula_7 that satisfies this equation are called "barycentric coordinates" of with respect to formula_8 The use of colons in the notation of the tuple means that barycentric coordinates are a sort of homogeneous coordinates, that is, the point is not changed if all coordinates are multiplied by the same nonzero constant. Moreover, the barycentric coordinates are also not changed if the auxiliary point , the origin, is changed.
The barycentric coordinates of a point are unique up to a scaling. That is, two tuples formula_7 and formula_10 are barycentric coordinates of the same point if and only if there is a nonzero scalar formula_11 such that formula_12 for every .
In some contexts, it is useful to make unique the barycentric coordinates of a point. This is obtained by imposing the condition
or equivalently by dividing every formula_14 by the sum of all formula_15 These specific barycentric coordinates are called normalized or absolute barycentric coordinates. Sometimes, they are also called affine coordinates, although this term refers commonly to a slightly different concept.
Sometimes, this is the normalized barycentric coordinates that are called "barycentric coordinates". In this case the above defined coordinates are called "homogeneous barycentric coordinates".
With above notation, the homogeneous barycentric coordinates of are all zero, except the one of index . When working over the real numbers (the above definition is also used for affine spaces over an arbitrary field), the points whose all normalized barycentric coordinates are nonnegative form the convex hull of formula_16 which is the simplex that has these points as its vertices.
With above notation, a tuple formula_17 such that
does not define any point, but the vector 
is independent from the origin . As the direction of this vector is not changed if all formula_14 are multiplied by the same scalar, the homogeneous tuple formula_7 defines a direction of lines, that is a point at infinity. See below for more details.
Relationship with Cartesian or affine coordinates.
Barycentric coordinates are strongly related to Cartesian coordinates and, more generally, affine coordinates. For a space of dimension , these coordinate systems are defined relative to a point , the origin, whose coordinates are zero, and points formula_22 whose coordinates are zero except that of index that equals one.
A point has coordinates 
for such a coordinate system if and only if its normalized barycentric coordinates are
relatively to the points formula_25
The main advantage of barycentric coordinate systems is to be symmetric with respect to the defining points. They are therefore often useful for studying properties that are symmetric with respect to points. On the other hand, distances and angles are difficult to express in general barycentric coordinate systems, and when they are involved, it is generally simpler to use a Cartesian coordinate system.
Relationship with projective coordinates.
Homogeneous barycentric coordinates are also strongly related with some projective coordinates. However this relationship is more subtle than in the case of affine coordinates, and, for being clearly understood, requires a coordinate-free definition of the projective completion of an affine space, and a definition of a projective frame.
The "projective completion" of an affine space of dimension is a projective space of the same dimension that contains the affine space as the complement of a hyperplane. The projective completion is unique up to an isomorphism. The hyperplane is called the hyperplane at infinity, and its points are the points at infinity of the affine space.
Given a projective space of dimension , a "projective frame" is an ordered set of points that are not contained in the same hyperplane. A projective frame defines a projective coordinate system such that the coordinates of the th point of the frame are all equal, and, otherwise, all coordinates of the th point are zero, except the th one.
When constructing the projective completion from an affine coordinate system, one defines commonly it with respect to a projective frame consisting of the intersections with the hyperplane at infinity of the coordinate axes, the origin of the affine space, and the point that has all its affine coordinates equal to one. This implies that the points at infinity have their last coordinate equal to zero, and that the projective coordinates of a point of the affine space are obtained by completing its affine coordinates by one as th coordinate.
When one has points in an affine space that define a barycentric coordinate system, this is another projective frame of the projective completion that is convenient to choose. This frame consists of these points and their centroid, that is the point that has all its barycentric coordinates equal. In this case, the homogeneous barycentric coordinates of a point in the affine space are the same as the projective coordinates of this point. A point is at infinity if and only if the sum of its coordinates is zero. This point is in the direction of the vector defined at the end of .
Barycentric coordinates on triangles.
In the context of a triangle, barycentric coordinates are also known as area coordinates or areal coordinates, because the coordinates of "P" with respect to triangle "ABC" are equivalent to the (signed) ratios of the areas of "PBC", "PCA" and "PAB" to the area of the reference triangle "ABC". Areal and trilinear coordinates are used for similar purposes in geometry.
Barycentric or areal coordinates are extremely useful in engineering applications involving triangular subdomains. These make analytic integrals often easier to evaluate, and Gaussian quadrature tables are often presented in terms of area coordinates.
Consider a triangle formula_26 defined by its three vertices, formula_27, formula_28 and formula_29. Each point formula_30 located inside this triangle can be written as a unique convex combination of the three vertices. In other words, for each formula_30 there is a unique sequence of three numbers, formula_32 such that formula_33 and
The three numbers formula_35 indicate the "barycentric" or "area" coordinates of the point formula_30 with respect to the triangle. They are often denoted as formula_37 instead of formula_35. Note that although there are three coordinates, there are only two degrees of freedom, since formula_33. Thus every point is uniquely defined by any two of the barycentric coordinates.
To explain why these coordinates are signed ratios of areas, let us assume that we work in the Euclidean space formula_40. Here, consider the Cartesian coordinate system formula_41 and its associated basis, namely formula_42. Consider also the positively oriented triangle formula_43 lying in the formula_44 plane. It is known that for any basis formula_45 of formula_40 and any free vector formula_47 one has
where formula_49 stands for the mixed product of these three vectors.
Take formula_50, where formula_51 is an arbitrary point in the plane formula_44, and remark that
A subtle point regarding our choice of free vectors: formula_54 is, in fact, the equipollence class of the bound vector formula_55.
We have obtained that
Given the positive (counterclockwise) orientation of triangle formula_43, the denominator of both formula_58 and formula_59 is precisely the double of the area of the triangle formula_43. Also,
and so the numerators of formula_58 and formula_59 are the doubles of the signed areas of triangles formula_64 and respectively formula_65.
Further, we deduce that
which means that the numbers formula_67, formula_58 and formula_59 are the barycentric coordinates of formula_51. Similarly, the third barycentric coordinate reads as
This formula_72-letter notation of the barycentric coordinates comes from the fact that the point formula_51 may be interpreted as the center of mass for the masses formula_74, formula_58, formula_59 which are located in formula_77, formula_78 and formula_79.
Switching back and forth between the barycentric coordinates and other coordinate systems makes some problems much easier to solve.
Conversion between barycentric and Cartesian coordinates.
Given a point formula_30 in a triangle's plane one can obtain the barycentric coordinates formula_81, formula_82 and formula_83 from the Cartesian coordinates formula_84 or vice versa.
We can write the Cartesian coordinates of the point formula_30 in terms of the Cartesian components of the triangle vertices formula_86, formula_87, formula_88 where formula_89 and in terms of the barycentric coordinates of formula_30 as
That is, the Cartesian coordinates of any point are a weighted average of the Cartesian coordinates of the triangle's vertices, with the weights being the point's barycentric coordinates summing to unity.
To find the reverse transformation, from Cartesian coordinates to barycentric coordinates, we first substitute formula_92 into the above to obtain
Rearranging, this is
This linear transformation may be written more succinctly as
where formula_11 is the vector of the first two barycentric coordinates, formula_30 is the vector of Cartesian coordinates, and formula_98 is a matrix given by
Now the matrix formula_98 is invertible, since formula_101 and formula_102 are linearly independent (if this were not the case, then formula_86, formula_87, and formula_88 would be collinear and would not form a triangle). Thus, we can rearrange the above equation to get
Finding the barycentric coordinates has thus been reduced to finding the 2×2 inverse matrix of formula_98, an easy problem.
Explicitly, the formulae for the barycentric coordinates of point formula_30 in terms of its Cartesian coordinates ("x, y") and in terms of the Cartesian coordinates of the triangle's vertices are:
Another way to solve the conversion from Cartesian to barycentric coordinates is to rewrite the problem in matrix form so that
with formula_113
and
formula_114.
Then, the condition formula_115
reads formula_116
and the barycentric coordinates can be solved as the solution of
the linear system
Conversion between barycentric and trilinear coordinates.
A point with trilinear coordinates "x" : "y" : "z" has barycentric coordinates "ax" : "by" : "cz" where "a", "b", "c" are the side lengths of the triangle. Conversely, a point with barycentrics formula_118 has trilinears formula_119
Equations in barycentric coordinates.
The three sides "a, b, c" respectively have equations
The equation of a triangle's Euler line is
Using the previously given conversion between barycentric and trilinear coordinates, the various other equations given in Trilinear coordinates#Formulas can be rewritten in terms of barycentric coordinates.
Distance between points.
The displacement vector of two normalized points formula_122 and formula_123 is
The distance formula_125 between formula_51 and formula_127, or the length of the displacement vector formula_128 is
where "a, b, c" are the sidelengths of the triangle. The equivalence of the last two expressions follows from formula_130 which holds because formula_131
The barycentric coordinates of a point can be calculated based on distances "d""i" to the three triangle vertices by solving the equation
Applications.
Determining location with respect to a triangle.
Although barycentric coordinates are most commonly used to handle points inside a triangle, they can also be used to describe a point outside the triangle. If the point is not inside the triangle, then we can still use the formulas above to compute the barycentric coordinates. However, since the point is outside the triangle, at least one of the coordinates will violate our original assumption that formula_133. In fact, given any point in cartesian coordinates, we can use this fact to determine where this point is with respect to a triangle.
If a point lies in the interior of the triangle, all of the Barycentric coordinates lie in the open interval formula_134 If a point lies on an edge of the triangle but not at a vertex, one of the area coordinates formula_135 (the one associated with the opposite vertex) is zero, while the other two lie in the open interval formula_134 If the point lies on a vertex, the coordinate associated with that vertex equals 1 and the others equal zero. Finally, if the point lies outside the triangle at least one coordinate is negative.
Summarizing,
In particular, if a point lies on the opposite side of a sideline from the vertex opposite that sideline, then that point's barycentric coordinate corresponding to that vertex is negative.
Interpolation on a triangular unstructured grid.
If formula_143 are known quantities, but the values of formula_144 inside the triangle defined by formula_145 is unknown, they can be approximated using linear interpolation. Barycentric coordinates provide a convenient way to compute this interpolation. If formula_30 is a point inside the triangle with barycentric coordinates formula_81, formula_82, formula_83, then
In general, given any unstructured grid or polygon mesh, this kind of technique can be used to approximate the value of formula_144 at all points, as long as the function's value is known at all vertices of the mesh. In this case, we have many triangles, each corresponding to a different part of the space. To interpolate a function formula_144 at a point formula_30, first a triangle must be found that contains formula_30. To do so, formula_30 is transformed into the barycentric coordinates of each triangle. If some triangle is found such that the coordinates satisfy formula_156, then the point lies in that triangle or on its edge (explained in the previous section). Then the value of formula_157 can be interpolated as described above.
These methods have many applications, such as the finite element method (FEM).
Integration over a triangle or tetrahedron.
The integral of a function over the domain of the triangle can be annoying to compute in a cartesian coordinate system. One generally has to split the triangle up into two halves, and great messiness follows. Instead, it is often easier to make a change of variables to any two barycentric coordinates, e.g. formula_158. Under this change of variables,
where formula_77 is the area of the triangle. This result follows from the fact that a rectangle in barycentric coordinates corresponds to a quadrilateral in cartesian coordinates, and the ratio of the areas of the corresponding shapes in the corresponding coordinate systems is given by formula_161. Similarly, for integration over a tetrahedron, instead of breaking up the integral into two or three separate pieces, one could switch to 3D tetrahedral coordinates under the change of variables
formula_162where formula_163 is the volume of the tetrahedron.
Examples of special points.
The three vertices of a triangle have barycentric coordinates formula_164
The centroid has barycentrics formula_165
The circumcenter of a triangle "ABC" has barycentric coordinates
where are edge lengths respectively of the triangle.
The orthocenter has barycentric coordinates
The incenter has barycentric coordinates
The excenters' barycentrics are
The nine-point center has barycentric coordinates
Barycentric coordinates on tetrahedra.
Barycentric coordinates may be easily extended to three dimensions. The 3D simplex is a tetrahedron, a polyhedron having four triangular faces and four vertices. Once again, the four barycentric coordinates are defined so that the first vertex formula_86 maps to barycentric coordinates formula_175, formula_176, etc.
This is again a linear transformation, and we may extend the above procedure for triangles to find the barycentric coordinates of a point formula_30 with respect to a tetrahedron:
where formula_98 is now a 3×3 matrix:
and formula_181with the corresponding Cartesian coordinates:formula_182Once again, the problem of finding the barycentric coordinates has been reduced to inverting a 3×3 matrix. 3D barycentric coordinates may be used to decide if a point lies inside a tetrahedral volume, and to interpolate a function within a tetrahedral mesh, in an analogous manner to the 2D procedure. Tetrahedral meshes are often used in finite element analysis because the use of barycentric coordinates can greatly simplify 3D interpolation.
Generalized barycentric coordinates.
Barycentric coordinates that are defined with respect to a finite set of points instead of a simplex are called "generalized barycentric coordinates". For these, the equation
is still required to hold where are the given points. If these given points do not form a simplex, the generalized barycentric coordinates of a point are not unique (up to a scalar multiplication). As for the case of a simplex, the points with nonnegative generalized coordinates form the convex hull of .
Thus, the definition is formally unchanged but while a simplex with "n" vertices needs to be embedded in a vector space of dimension of at least "n-1", a polytope may be embedded in a vector space of lower dimension. The simplest example is a quadrilateral in the plane. Consequently, even normalized generalized barycentric coordinates (i.e. coordinates such that the sum of the coefficients is 1) are in general not uniquely determined anymore while this is the case for normalized barycentric coordinates with respect to a simplex.
More abstractly, generalized barycentric coordinates express a convex polytope with "n" vertices, regardless of dimension, as the "image" of the standard formula_184-simplex, which has "n" vertices – the map is onto: formula_185 The map is one-to-one if and only if the polytope is a simplex, in which case the map is an isomorphism; this corresponds to a point not having "unique" generalized barycentric coordinates except when P is a simplex.
Dual to generalized barycentric coordinates are slack variables, which measure by how much margin a point satisfies the linear constraints, and gives an embedding formula_186 into the "f"-orthant, where "f" is the number of faces (dual to the vertices). This map is one-to-one (slack variables are uniquely determined) but not onto (not all combinations can be realized).
This use of the standard formula_184-simplex and "f"-orthant as standard objects that map to a polytope or that a polytope maps into should be contrasted with the use of the standard vector space formula_188 as the standard object for vector spaces, and the standard affine hyperplane formula_189 as the standard object for affine spaces, where in each case choosing a linear basis or affine basis provides an "isomorphism," allowing all vector spaces and affine spaces to be thought of in terms of these standard spaces, rather than an onto or one-to-one map (not every polytope is a simplex). Further, the "n"-orthant is the standard object that maps "to" cones.
Applications.
Generalized barycentric coordinates have applications in computer graphics and more specifically in geometric modelling. Often, a three-dimensional model can be approximated by a polyhedron such that the generalized barycentric coordinates with respect to that polyhedron have a geometric meaning. In this way, the processing of the model can be simplified by using these meaningful coordinates. Barycentric coordinates are also used in geophysics 