# 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 tuple 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 Affine space § Relationship between barycentric and affine coordinates).

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 sort of Bézier surfaces. 

## Definition

Let $A_{0},\ldots ,A_{n}$  be n + 1 points in a Euclidean space, a flat or an affine space $\mathbf {A}$  of dimension n that are affinely independent; this means that there is no affine subspace of dimension n that contains all the points, or, equivalently that the points define a simplex. Given any point $P\in \mathbf {A} ,$  there are scalars $a_{1},\ldots ,a_{n}$  that are not all zero, such that

$(a_{0}+\cdots +a_{n}){\overrightarrow {OP}}=a_{0}{\overrightarrow {OA_{0}}}+\cdots +a_{n}{\overrightarrow {OA_{n}}},$

for any point O. (As usual, the notation ${\overrightarrow {AB}}$  represents the translation vector or free vector that maps the point A to the point B.)

The elements of a (n + 1)tuple $(a_{0}:\dotsc :a_{n})$  that satisfies this equation are called barycentric coordinates of P with respect to $A_{0},\ldots ,A_{n}.$  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 O, the origin, is changed.

The barycentric coordinates of a point are unique up to a scaling. That is, two tuples $(a_{0}:\dotsc :a_{n})$  and $(b_{0}:\dotsc :b_{n})$  are barycentric coordinates of the same point if and only if there is a nonzero scalar $\lambda$  such that $b_{i}=\lambda a_{i}$  for every i.

In some contexts, it is useful to make unique the barycentric coordinates of a point. This is obtained by imposing the condition

$\sum a_{i}=1,$

or equivalently by dividing every $a_{i}$  by the sum of all $a_{i}.$  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 Ai are all zero, except the one of index i. 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 $\{A_{0},\ldots ,A_{n}\},$  which is the simplex that has these points as its vertices.

With above notation, a tuple $(a_{1},\ldots ,a_{n})$  such that

$\sum _{i=0}^{n}a_{i}=0$

does not defines any point, but the vector

$a_{0}{\overrightarrow {OA_{0}}}+\cdots +a_{n}{\overrightarrow {OA_{n}}}$

is independent from the origin O. As the direction of this vector is not changed if all $a_{i}$  are multiplied by the same scalar, the homogeneous tuple $(a_{0}:\dotsc :a_{n})$  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 n, these coordinate systems are defined relative to a point O, the origin, whose coordinates are zero, and n points $A_{1},\ldots ,A_{n},$  whose coordinates are zero except that of index i that equals one.

A point has coordinates

$(x_{1},\ldots ,x_{n})$

for such a coordinate system if and only if its normalized barycentric coordinates are

$(1-x_{1}-\cdots -x_{n},x_{1},\ldots ,x_{n})$

relatively to the points $O,A_{1},\ldots ,A_{n}.$

The main advantage of barycentric coordinate systems is to be symmetric with respect to the n + 1 defining points. They are therefore often useful for studying properties that are symmetric with respect to n + 1 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 n 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 n, a projective frame is an ordered set of n + 2 points that are not contained in the same hyperplane. A projective frame defines a projective coordinate system such that the coordinates of the (n + 2)th point of the frame are all equal, and, otherwise, all coordinates of the ith point are zero, except the ith 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 (n + 1)th coordinate.

When one has n + 1 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 § Definition.

## Barycentric coordinates on triangles

Barycentric coordinates $(\lambda _{1},\lambda _{2},\lambda _{3})$  on an equilateral triangle and on a right triangle.

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 $T$  defined by its three vertices, $\mathbf {r} _{1}$ , $\mathbf {r} _{2}$  and $\mathbf {r} _{3}$ . Each point $\mathbf {r}$  located inside this triangle can be written as a unique convex combination of the three vertices. In other words, for each $\mathbf {r}$  there is a unique sequence of three numbers, $\lambda _{1},\lambda _{2},\lambda _{3}\geq 0$  such that $\lambda _{1}+\lambda _{2}+\lambda _{3}=1$  and

$\mathbf {r} =\lambda _{1}\mathbf {r} _{1}+\lambda _{2}\mathbf {r} _{2}+\lambda _{3}\mathbf {r} _{3},$

The three numbers $\lambda _{1},\lambda _{2},\lambda _{3}$  indicate the "barycentric" or "area" coordinates of the point $\mathbf {r}$  with respect to the triangle. They are often denoted as $\alpha ,\beta ,\gamma$  instead of $\lambda _{1},\lambda _{2},\lambda _{3}$ . Note that although there are three coordinates, there are only two degrees of freedom, since $\lambda _{1}+\lambda _{2}+\lambda _{3}=1$ . 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 $\mathbf {E} ^{3}$ . Here, consider the Cartesian coordinate system $Oxyz$  and its associated basis, namely $\{\mathbf {i} ,\mathbf {j} ,\mathbf {k} \}$ . Consider also the positively oriented triangle $ABC$  lying in the $Oxy$  plane. It is known that for any basis $\{\mathbf {e} ,\mathbf {f} ,\mathbf {g} \}$  of $\mathbf {E} ^{3}$  and any free vector $\mathbf {h}$  one has

$\mathbf {h} ={\frac {1}{(\mathbf {e} ,\mathbf {f} ,\mathbf {g} )}}\cdot \left[(\mathbf {h} ,\mathbf {f} ,\mathbf {g} )\mathbf {e} +(\mathbf {e} ,\mathbf {h} ,\mathbf {g} )\mathbf {f} +(\mathbf {e} ,\mathbf {f} ,\mathbf {h} )\mathbf {g} \right],$

where $(\mathbf {e} ,\mathbf {f} ,\mathbf {g} )=(\mathbf {e} \times \mathbf {f} )\cdot \mathbf {g}$  stands for the mixed product of these three vectors.

Take $\mathbf {e} ={\vec {AB}},\,\mathbf {f} ={\vec {AC}},\,\mathbf {g} =\mathbf {k} ,\,\mathbf {h} ={\vec {AP}}$ , where $P$  is an arbitrary point in the plane $Oxy$ , and remark that

$(\mathbf {e} ,\mathbf {f} ,\mathbf {h} )=({\vec {AB}}\times {\vec {AC}})\cdot {\vec {AP}}=(\vert {\vec {AB}}\times {\vec {AC}}\vert \mathbf {k} )\cdot {\vec {AP}}=0.$

A subtle point regarding our choice of free vectors: $\mathbf {e}$  is, in fact, the equipollence class of the bound vector ${\vec {AB}}$ .

We have obtained that

${\vec {AP}}=m_{B}\cdot {\vec {AB}}+m_{C}\cdot {\vec {AC}},\,{\mbox{ where }}\,m_{B}={\frac {({\vec {AP}},{\vec {AC}},\mathbf {k} )}{({\vec {AB}},{\vec {AC}},\mathbf {k} )}},\,m_{C}={\frac {({\vec {AB}},{\vec {AP}},\mathbf {k} )}{({\vec {AB}},{\vec {AC}},\mathbf {k} )}}.$

Given the positive (counterclockwise) orientation of triangle $ABC$ , the denominator of both $m_{B}$  and $m_{C}$  is precisely the double of the area of the triangle $ABC$ . Also,

$({\vec {AP}},{\vec {AC}},\mathbf {k} )=({\vec {PC}},{\vec {PA}},\mathbf {k} )\,{\mbox{ and }}\,({\vec {AB}},{\vec {AP}},\mathbf {k} )=({\vec {PA}},{\vec {PB}},\mathbf {k} )$

and so the numerators of $m_{B}$  and $m_{C}$  are the doubles of the signed areas of triangles $APC$  and respectively $ABP$ .

Further, we deduce that

${\vec {OP}}=(1-m_{B}-m_{C})\cdot {\vec {OA}}+m_{B}\cdot {\vec {OB}}+m_{C}\cdot {\vec {OC}}$

which means that the numbers $1-m_{B}-m_{C}$ , $m_{B}$  and $m_{C}$  are the barycentric coordinates of $P$ . Similarly, the third barycentric coordinate reads as

$m_{A}=1-m_{B}-m_{C}={\frac {({\vec {PB}},{\vec {PC}},\mathbf {k} )}{({\vec {AB}},{\vec {AC}},\mathbf {k} )}}.$

This $m$ -letter notation of the barycentric coordinates comes from the fact that the point $P$  may be interpreted as the center of mass for the masses $m_{A}$ , $m_{B}$ , $m_{C}$  which are located in $A$ , $B$  and $C$ .

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 $\mathbf {r}$  in a triangle's plane one can obtain the barycentric coordinates $\lambda _{1}$ , $\lambda _{2}$  and $\lambda _{3}$  from the Cartesian coordinates $(x,y)$  or vice versa.

We can write the Cartesian coordinates of the point $\mathbf {r}$  in terms of the Cartesian components of the triangle vertices $\mathbf {r} _{1}$ , $\mathbf {r} _{2}$ , $\mathbf {r} _{3}$  where $\mathbf {r} _{i}=(x_{i},y_{i})$  and in terms of the barycentric coordinates of $\mathbf {r}$  as

${\begin{matrix}x=\lambda _{1}x_{1}+\lambda _{2}x_{2}+\lambda _{3}x_{3}\\y=\lambda _{1}y_{1}+\lambda _{2}y_{2}+\lambda _{3}y_{3}\\\end{matrix}}$

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 $\lambda _{3}=1-\lambda _{1}-\lambda _{2}$  into the above to obtain

${\begin{matrix}x=\lambda _{1}x_{1}+\lambda _{2}x_{2}+(1-\lambda _{1}-\lambda _{2})x_{3}\\y=\lambda _{1}y_{1}+\lambda _{2}y_{2}+(1-\lambda _{1}-\lambda _{2})y_{3}\\\end{matrix}}$

Rearranging, this is

${\begin{matrix}\lambda _{1}(x_{1}-x_{3})+\lambda _{2}(x_{2}-x_{3})+x_{3}-x=0\\\lambda _{1}(y_{1}-y_{3})+\lambda _{2}(y_{2}-y_{3})+y_{3}-y=0\\\end{matrix}}$

This linear transformation may be written more succinctly as

$\mathbf {T} \cdot \lambda =\mathbf {r} -\mathbf {r} _{3}$

where $\lambda$  is the vector of the first two barycentric coordinates, $\mathbf {r}$  is the vector of Cartesian coordinates, and $\mathbf {T}$  is a matrix given by

$\mathbf {T} =\left({\begin{matrix}x_{1}-x_{3}&x_{2}-x_{3}\\y_{1}-y_{3}&y_{2}-y_{3}\\\end{matrix}}\right)$

Now the matrix $\mathbf {T}$  is invertible, since $\mathbf {r} _{1}-\mathbf {r} _{3}$  and $\mathbf {r} _{2}-\mathbf {r} _{3}$  are linearly independent (if this were not the case, then $\mathbf {r} _{1}$ , $\mathbf {r} _{2}$ , and $\mathbf {r} _{3}$  would be collinear and would not form a triangle). Thus, we can rearrange the above equation to get

$\left({\begin{matrix}\lambda _{1}\\\lambda _{2}\end{matrix}}\right)=\mathbf {T} ^{-1}(\mathbf {r} -\mathbf {r} _{3})$

Finding the barycentric coordinates has thus been reduced to finding the 2×2 inverse matrix of $\mathbf {T}$ , an easy problem.

Explicitly, the formulae for the barycentric coordinates of point $\mathbf {r}$  in terms of its Cartesian coordinates (x, y) and in terms of the Cartesian coordinates of the triangle's vertices are:

$\lambda _{1}={\frac {(y_{2}-y_{3})(x-x_{3})+(x_{3}-x_{2})(y-y_{3})}{\det(T)}}={\frac {(y_{2}-y_{3})(x-x_{3})+(x_{3}-x_{2})(y-y_{3})}{(y_{2}-y_{3})(x_{1}-x_{3})+(x_{3}-x_{2})(y_{1}-y_{3})}}\,,$
$\lambda _{2}={\frac {(y_{3}-y_{1})(x-x_{3})+(x_{1}-x_{3})(y-y_{3})}{\det(T)}}={\frac {(y_{3}-y_{1})(x-x_{3})+(x_{1}-x_{3})(y-y_{3})}{(y_{2}-y_{3})(x_{1}-x_{3})+(x_{3}-x_{2})(y_{1}-y_{3})}}\,,$
$\lambda _{3}=1-\lambda _{1}-\lambda _{2}\,.$

Another way to solve the conversion from Cartesian to barycentric coordinates is to rewrite the problem in matrix form so that

$\mathbf {r} =\mathbf {R} {\boldsymbol {\lambda }}$

with $\mathbf {R} =\left({\begin{matrix}\mathbf {r} _{1}|\mathbf {r} _{2}|\mathbf {r} _{3}\end{matrix}}\right)$  and ${\boldsymbol {\lambda }}=\left(\lambda _{1},\lambda _{2},\lambda _{3}\right)^{\top }$ . Then, the condition $\lambda _{1}+\lambda _{2}+\lambda _{3}=1$  reads $\left(1,1,1\right){\boldsymbol {\lambda }}=1$  and the barycentric coordinates can be solved as the solution of the linear system

$\left({\begin{matrix}x_{1}&x_{2}&x_{3}\\y_{1}&y_{2}&y_{3}\\1&1&1\end{matrix}}\right){\boldsymbol {\lambda }}=\left({\begin{matrix}x\\y\\1\end{matrix}}\right)$

### 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 $\lambda _{1}:\lambda _{2}:\lambda _{3}$  has trilinears $\lambda _{1}/a:\lambda _{2}/b:\lambda _{3}/c.$

### Equations in barycentric coordinates

The sides a, b, c respectively have equations

$\lambda _{1}=0,\quad \lambda _{2}=0,\quad \lambda _{3}=0.$

The equation of a triangle's Euler line is

${\begin{vmatrix}\lambda _{1}&\lambda _{2}&\lambda _{3}\\1&1&1\\\tan A&\tan B&\tan C\end{vmatrix}}=0.$

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 $P=(p_{1},p_{2},p_{3})$  and $Q=(q_{1},q_{2},q_{3})$  is

${\overrightarrow {PQ}}=(p_{1}-q_{1},p_{2}-q_{2},p_{3}-q_{3}).$

The distance $d$  between $P$  and $Q$ , or the length of the displacement vector ${\overrightarrow {PQ}}=(x,y,z),$  is

$d^{2}=\left|PQ\right|^{2}=-a^{2}yz-b^{2}zx-c^{2}xy={\frac {1}{2}}[x^{2}(b^{2}+c^{2}-a^{2})+y^{2}(c^{2}+a^{2}-b^{2})+z^{2}(a^{2}+b^{2}-c^{2})].$

where a, b, c are the sidelengths of the triangle. The equivalence of the last two expressions follows from $x+y+z=0,$  which holds because $x+y+z=(p_{1}-q_{1})+(p_{2}-q_{2})+(p_{3}-q_{3})=(p_{1}+p_{2}+p_{3})-(q_{1}+q_{2}+q_{3})=1-1=0.$

The barycentric coordinates of a point can be calculated based on distances di to the three triangle vertices by solving the equation

$\left({\begin{matrix}-c^{2}&c^{2}&b^{2}-a^{2}\\-b^{2}&c^{2}-a^{2}&b^{2}\\1&1&1\end{matrix}}\right){\boldsymbol {\lambda }}=\left({\begin{matrix}d_{A}^{2}-d_{B}^{2}\\d_{A}^{2}-d_{C}^{2}\\1\end{matrix}}\right).$

### Applications

Two solutions to the 8, 5 and 3 L water pouring puzzle using a barycentric plot. The yellow area denotes combinations achievable with the jugs. The solid red and dashed blue paths show pourable transitions. When a vertex lands on the dotted triangle, 4 L has been measured.

#### 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 $\lambda _{1...3}\geq 0$ . 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 $(0,1).$  If a point lies on an edge of the triangle but not at a vertex, one of the area coordinates $\lambda _{1...3}$  (the one associated with the opposite vertex) is zero, while the other two lie in the open interval $(0,1).$  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,

Point $\mathbf {r}$  lies inside the triangle if and only if $0<\lambda _{i}<1\;\forall \;i{\text{ in }}{1,2,3}$ .
$\mathbf {r}$  lies on the edge or corner of the triangle if $0\leq \lambda _{i}\leq 1\;\forall \;i{\text{ in }}{1,2,3}$  and $\lambda _{i}=0\;{\text{, for some i in }}{1,2,3}$ .
Otherwise, $\mathbf {r}$  lies outside the triangle.

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

Surface (upper part) obtained from linear interpolation over a given triangular grid (lower part) in the x,y plane. The surface approximates a function z=f(x,y), given only the values of f on the grid's vertices.

If $f(\mathbf {r} _{1}),f(\mathbf {r} _{2}),f(\mathbf {r} _{3})$  are known quantities, but the values of $f$  inside the triangle defined by $\mathbf {r} _{1},\mathbf {r} _{2},\mathbf {r} _{3}$  is unknown, they can be approximated using linear interpolation. Barycentric coordinates provide a convenient way to compute this interpolation. If $\mathbf {r}$  is a point inside the triangle with barycentric coordinates $\lambda _{1}$ , $\lambda _{2}$ , $\lambda _{3}$ , then

$f(\mathbf {r} )\approx \lambda _{1}f(\mathbf {r} _{1})+\lambda _{2}f(\mathbf {r} _{2})+\lambda _{3}f(\mathbf {r} _{3})$

In general, given any unstructured grid or polygon mesh, this kind of technique can be used to approximate the value of $f$  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 $f$  at a point $\mathbf {r}$ , first a triangle must be found that contains $\mathbf {r}$ . To do so, $\mathbf {r}$  is transformed into the barycentric coordinates of each triangle. If some triangle is found such that the coordinates satisfy $0\leq \lambda _{i}\leq 1\;\forall \;i{\text{ in }}1,2,3$ , then the point lies in that triangle or on its edge (explained in the previous section). Then the value of $f(\mathbf {r} )$  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. $\lambda _{1},\lambda _{2}$ . Under this change of variables,

$\int _{T}f(\mathbf {r} )\ d\mathbf {r} =2A\int _{0}^{1}\int _{0}^{1-\lambda _{2}}f(\lambda _{1}\mathbf {r} _{1}+\lambda _{2}\mathbf {r} _{2}+(1-\lambda _{1}-\lambda _{2})\mathbf {r} _{3})\ d\lambda _{1}\ d\lambda _{2}$

where $A$  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 $2A$ . 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

$\int \int _{T}f(\mathbf {r} )\ d\mathbf {r} =6V\int _{0}^{1}\int _{0}^{1-\lambda _{3}}\int _{0}^{1-\lambda _{2}-\lambda _{3}}f(\lambda _{1}\mathbf {r} _{1}+\lambda _{2}\mathbf {r} _{2}+\lambda _{3}\mathbf {r} _{3}+(1-\lambda _{1}-\lambda _{2}-\lambda _{3})\mathbf {r} _{4})\ d\lambda _{1}\ d\lambda _{2}\ d\lambda _{3}$

where $V$  is the volume of the tetrahedron.

### Examples of special points

The three vertices of a triangle have barycentric coordinates $1:0:0,\quad 0:1:0,\quad {\text{and}}\quad 0:0:1.$ 

The centroid has barycentrics $1:1:1.$ 

The circumcenter of a triangle ABC has barycentric coordinates

$a^{2}(-a^{2}+b^{2}+c^{2}):\;b^{2}(a^{2}-b^{2}+c^{2}):\;c^{2}(a^{2}+b^{2}-c^{2})$
$=\sin 2A:\sin 2B:\sin 2C=(1-\cos B\cos C):(1-\cos C\cos A):(1-\cos A\cos B).$

where a, b, c are edge lengths BC, CA, AB respectively of the triangle.

The orthocenter has barycentric coordinates

$(a^{2}+b^{2}-c^{2})(a^{2}-b^{2}+c^{2}):\;(-a^{2}+b^{2}+c^{2})(a^{2}+b^{2}-c^{2}):\;(a^{2}-b^{2}+c^{2})(-a^{2}+b^{2}+c^{2})$
$=\tan A:\tan B:\tan C=a\cos B\cos C:b\cos C\cos A:c\cos A\cos B.$

The incenter has barycentric coordinates

$a:b:c=\sin A:\sin B:\sin C.$

The excenters' barycentrics are

$-a:b:c\quad \quad a:-b:c\quad \quad a:b:-c.$

The nine-point center has barycentric coordinates

$a\cos(B-C):b\cos(C-A):c\cos(A-B)=(1+\cos B\cos C):(1+\cos C\cos A):(1+\cos A\cos B)$
$=[a^{2}(b^{2}+c^{2})-(b^{2}-c^{2})^{2}]:[b^{2}(c^{2}+a^{2})-(c^{2}-a^{2})^{2}]:[c^{2}(a^{2}+b^{2})-(a^{2}-b^{2})^{2}].$

## 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 $\mathbf {r} _{1}$  maps to barycentric coordinates $\lambda =(1,0,0,0)$ , $\mathbf {r} _{2}\to (0,1,0,0)$ , etc.

This is again a linear transformation, and we may extend the above procedure for triangles to find the barycentric coordinates of a point $\mathbf {r}$  with respect to a tetrahedron:

$\left({\begin{matrix}\lambda _{1}\\\lambda _{2}\\\lambda _{3}\end{matrix}}\right)=\mathbf {T} ^{-1}(\mathbf {r} -\mathbf {r} _{4})$

where $\mathbf {T}$  is now a 3×3 matrix:

$\mathbf {T} =\left({\begin{matrix}x_{1}-x_{4}&x_{2}-x_{4}&x_{3}-x_{4}\\y_{1}-y_{4}&y_{2}-y_{4}&y_{3}-y_{4}\\z_{1}-z_{4}&z_{2}-z_{4}&z_{3}-z_{4}\end{matrix}}\right)$

and $\lambda _{4}=1-\lambda _{1}-\lambda _{2}-\lambda _{3}$ with the corresponding Cartesian coordinates:

${\begin{matrix}x=\lambda _{1}x_{1}+\lambda _{2}x_{2}+\lambda _{3}x_{3}+(1-\lambda _{1}-\lambda _{2}-\lambda _{3})x_{4}\\y=\lambda _{1}y_{1}+\lambda _{2}y_{2}+\lambda _{3}y_{3}+(1-\lambda _{1}-\lambda _{2}-\lambda _{3})y_{4}\\z=\lambda _{1}z_{1}+\lambda _{2}z_{2}+\lambda _{3}z_{3}+(1-\lambda _{1}-\lambda _{2}-\lambda _{3})z_{4}\\\end{matrix}}$

Once 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 (a1, ..., an) that are defined with respect to a finite set of points instead of a simplex are called generalized barycentric coordinates. For these, the equation

$(a_{1}+\cdots +a_{n})p=a_{1}x_{1}+\cdots +a_{n}x_{n}$

is still required to hold where x1, ..., xn are the given points. If these given points do not form a simplex, the generalized barycentric coordinates of a point p 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 x1, ..., xn.

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 $(n-1)$ -simplex, which has n vertices – the map is onto: $\Delta ^{n-1}\twoheadrightarrow P.$  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 $P\hookrightarrow (\mathbf {R} _{\geq 0})^{f}$  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 $(n-1)$ -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 $K^{n}$  as the standard object for vector spaces, and the standard affine hyperplane $\{(x_{0},\ldots ,x_{n})\mid \sum x_{i}=1\}\subset K^{n+1}$  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