- Barycentric coordinates (mathematics)
In

mathematics ,**barycentric coordinates**are coordinates defined by the vertices of asimplex (a triangle,tetrahedron , etc). Barycentric coordinates are a form ofhomogeneous coordinates .Let "x"

_{1}, ..., "x"_{"n"}be the vertices of a simplex in avector space "A". If, for some point "p" in "A",:$(a\_1\; +\; cdots\; +\; a\_n),\; p\; =\; a\_1\; ,\; x\_1\; +\; cdots\; +\; a\_n\; ,\; x\_n$

then we say that the coefficients ("a"

_{1}, ..., "a"_{"n"}) are "barycentric coordinates" of "p" with respect to "x"_{1}, ..., "x"_{"n"}. The vertices themselves have the coordinates (1, 0, 0, ..., 0), (0, 1, 0, ..., 0), ..., (0, 0, 0, ..., 1). Barycentric coordinates are not unique: for any "b" not equal to zero, ("b a"_{1}, ..., "b a"_{"n"}) are also barycentric coordinates of "p".When the coordinates are not negative, the point "p" lies in the

convex hull of "x"_{1}, ..., "x"_{"n"}, that is, in the simplex which has those points as its vertices.If we imagine masses equal to "a"

_{1}, ..., "a"_{"n"}attached to the vertices of the simplex, the center of mass (thebarycenter ) is then "p". This is the origin of the term "barycentric", introduced (1827) byAugust Ferdinand Möbius .See also

ternary plot .**Barycentric coordinates on triangles**In the context of a

triangle , barycentric coordinates are also known as**areal coordinates**, because the coordinates of "P" with respect to triangle "ABC" are proportional to the (signed) areas of "PBC", "PCA" and "PAB". Areal andtrilinear 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, andGaussian quadrature tables are often presented in terms of area coordinates.First let us consider a triangle

**T**defined by three vertices $extbf\{v\}\_\{1\},$, $extbf\{v\}\_\{2\},$ and $extbf\{v\}\_\{3\},$. Any point $extbf\{r\}$ located on this triangle may then be written as a weighted sum of these three vertices, i.e.:$extbf\{r\}\; =\; lambda\_\{1\}\; extbf\{v\}\_\{1\}\; +\; lambda\_\{2\}\; extbf\{v\}\_\{2\}\; +\; lambda\_\{3\}\; extbf\{v\}\_\{3\},$

where $lambda\_\{1\},$, $lambda\_\{2\},$ and $lambda\_\{3\},$ are the area coordinates. These are subjected to the constraint

:$lambda\_\{1\}\; +\; lambda\_\{2\}\; +\; lambda\_\{3\}\; =\; 1,$

which means that

:$lambda\_\{3\}\; =\; 1\; -\; lambda\_\{1\}\; -\; lambda\_\{2\},$

Following this, the integral of a function $f(\; extbf\{r\})$ on

**T**is:$int\_\{T\}\; f(\; extbf\{r\})\; ds\; =\; 2A\; int\_\{0\}^\{1\}\; int\_\{0\}^\{1\; -\; lambda\_\{2\; f(lambda\_\{1\}\; extbf\{v\}\_\{1\}\; +\; lambda\_\{2\}\; extbf\{v\}\_\{2\}\; +(1\; -\; lambda\_\{1\}\; -\; lambda\_\{2\})\; extbf\{v\}\_\{3\})\; dlambda\_\{1\}\; dlambda\_\{2\},$Note that the above has the form of a linear interpolation. Indeed, area coordinates will also allow us to perform a

linear interpolation at all points in the triangle if the values of the function are known at the vertices.**Converting to barycentric coordinates**Given a point $extbf\{r\},$ inside a triangle it is also desirable to obtain the area coordinates $lambda\_\{1\},$, $lambda\_\{2\},$ and $lambda\_\{3\},$ at this point. We can write the barycentric expansion of vector $extbf\{r\}$ having

Cartesian coordinates $(x,\; y),$ in terms of the components of the triangle vertices ($extbf\{r\}\_1$, $extbf\{r\}\_2$, $extbf\{r\}\_3$) as:$egin\{matrix\}x\; =\; lambda\_\{1\}\; x\_\{1\}\; +\; lambda\_\{2\}\; x\_\{2\}\; +\; lambda\_\{3\}\; x\_\{3\}\; \backslash y\; =\; lambda\_\{1\}\; y\_\{1\}\; +\; lambda\_\{2\}\; y\_\{2\}\; +\; lambda\_\{3\}\; y\_\{3\}\; \backslash end\{matrix\},$

substituting $lambda\_\{3\}\; =\; 1\; -\; lambda\_\{1\}\; -\; lambda\_\{2\},$ into the above gives

:$egin\{matrix\}x\; =\; lambda\_\{1\}\; x\_\{1\}\; +\; lambda\_\{2\}\; x\_\{2\}\; +\; (1\; -\; lambda\_\{1\}\; -\; lambda\_\{2\})\; x\_\{3\}\; \backslash y\; =\; lambda\_\{1\}\; y\_\{1\}\; +\; lambda\_\{2\}\; y\_\{2\}\; +\; (1\; -\; lambda\_\{1\}\; -\; lambda\_\{2\})\; y\_\{3\}\; \backslash end\{matrix\},$

Rearranging, this is

:$egin\{matrix\}lambda\_\{1\}(x\_\{1\}\; -\; x\_\{3\})\; +\; lambda\_\{2\}(x\_\{2\}\; -\; x\_\{3\})\; +\; x\_\{3\}\; -\; x\; =\; 0\; \backslash lambda\_\{1\}(y\_\{1\}\; -\; y\_\{3\})\; +\; lambda\_\{2\}(y\_\{2\}\; -\; y\_\{3\})\; +\; y\_\{3\}\; -\; y\; =\; 0\; \backslash end\{matrix\},$

This

linear transformation may be written more succinctly as:$extbf\{T\}\; cdot\; lambda\; =\; extbf\{r\}-\; extbf\{r\}\_3,$

Where $lambda$ is the

vector of area coordinates, $extbf\{r\}$ is thevector ofCartesian coordinates , and $extbf\{T\}$ is a matrix given by:$extbf\{T\}\; =\; left(egin\{matrix\}x\_1-x\_3\; x\_2-x\_3\; \backslash y\_1-y\_3\; y\_2-y\_3\; \backslash end\{matrix\}\; ight)$

Now the matrix $extbf\{T\}$ is invertible, since $extbf\{r\}\_1$, $extbf\{r\}\_2$, and $extbf\{r\}\_3$ are

linearly independent (if this was not the case, they would becolinear and would not form a triangle). Thus, we can rearrange the above equation to get:$left(egin\{matrix\}lambda\_1\; \backslash \; lambda\_2end\{matrix\}\; ight)\; =\; extbf\{T\}^\{-1\}\; (\; extbf\{r\}-\; extbf\{r\}\_3\; ),$

Finding the barycentric coordinates has thus been reduced to finding the inverse matrix of $extbf\{T\}$, a trivial problem in the case of 2×2 matrices.

**Determining if a point is inside a triangle**Since barycentric coordinates are a

linear transformation of Cartesian coordinates, it follows that they vary linearly along the edges and over the area of the triangle. If a point lies in the interior of the triangle, all of the Barycentric coordinates lie in theopen interval $(0,1)$. If a point lies on an "edge" of the triangle, at least one of the area coordinates $lambda\_\{1...3\}$ is zero, while the rest lie in theclosed interval $[0,1]$.Summarizing,:Point $extbf\{r\}$ lies inside the triangle

iff $0\; <\; lambda\_i\; <\; 1\; ;forall;\; i\; ext\{\; in\; \}\; 1,2,3$.:Otherwise, $extbf\{r\}$ lies on the edge or corner of the triangle if $0\; leq\; lambda\_i\; leq\; 1\; ;forall;\; i\; ext\{\; in\; \}\; 1,2,3$.:Otherwise, $extbf\{r\}$ lies outside the triangle.**Interpolation on a triangular unstructured grid**Barycentric coordinates provide a convenient way to

interpolate a function on anunstructured grid ormesh , as long as the function's value is known at all vertices of the mesh.To interpolate a function $f$ at a point $extbf\{r\}$, we go through each triangular element and transform $extbf\{r\}$ into the barycentric coordinates of that triangle. If $0\; leq\; lambda\_i\; leq\; 1\; ;forall;\; i\; ext\{\; in\; \}\; 1,2,3$, then the point lies in the triangle or on its edge (explained in the previous section). Now, we interpolate the value of $f(\; extbf\{r\})$ as

:$f(\; extbf\{r\})\; =\; lambda\_1\; f(\; extbf\{r\}\_1)\; +\; lambda\_2\; f(\; extbf\{r\}\_2)\; +\; lambda\_3\; f(\; extbf\{r\}\_3)$

This linear interpolation is automatically normalized since $lambda\_1+lambda\_2+lambda\_3=1$.

**Barycentric coordinates on tetrahedra**Barycentric coordinates may be easily extended to three dimensions. The 3D

simplex is atetrahedron , apolyhedron having four triangular faces and four vertices. Once again, the barycentric coordinates are defined so that the first vertex $extbf\{r\}\_1$ maps to barycentric coordinates $lambda\; =\; (1,0,0,0)$, $extbf\{r\}\_2\; o\; (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 $extbf\{r\}$ with respect to a tetrahedron:

:$left(egin\{matrix\}lambda\_1\; \backslash \; lambda\_2\; \backslash \; lambda\_3end\{matrix\}\; ight)\; =\; extbf\{T\}^\{-1\}\; (\; extbf\{r\}-\; extbf\{r\}\_4\; ),$

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

:$extbf\{T\}\; =\; left(egin\{matrix\}x\_1-x\_4\; x\_2-x\_4\; x\_3-x\_4\backslash y\_1-y\_4\; y\_2-y\_4\; y\_3-y\_4\backslash z\_1-z\_4\; z\_2-z\_4\; z\_3-z\_4end\{matrix\}\; ight)$

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.**References***

*

***External links*** [

*http://www.cut-the-knot.org/triangle/glasses.shtml Barycentric coordinates: A Curious Application*] "(solving the "three glasses" problem)" atcut-the-knot

* [*http://www.math.fau.edu/yiu/barycentricpaper.pdf The uses of homogeneous barycentric coordinates in plane euclidean geometry*]

*Wikimedia Foundation.
2010.*