Barycentric coordinate system

Not to be confused with Barycentric coordinates (astronomy).
A 3-simplex, with barycentric subdivisions of 1-faces (edges) 2-faces (triangles) and 3-faces (body).

In geometry, the barycentric coordinate system is a coordinate system in which the location of a point of a simplex (a triangle, tetrahedron, etc.) is specified as the center of mass, or barycenter, of usually unequal masses placed at its vertices. Coordinates also extend outside the simplex, where one or more coordinates become negative. The system was introduced (1827) by August Ferdinand Möbius.

Definition

Let \mathbf{x}_1, \ldots, \mathbf{x}_n be the vertices of a simplex in an affine space A. If, for some point \mathbf{p} in A,

 ( a_1 + \cdots + a_n ) \mathbf{p} = a_1 \, \mathbf{x}_1 + \cdots + a_n \, \mathbf{x}_n

and at least one of a_1, \ldots, a_n does not vanish then we say that the coefficients (a_1, \ldots, a_n) are barycentric coordinates of \mathbf{p} with respect to \mathbf{x}_1, \ldots, \mathbf{x}_n. The vertices themselves have the coordinates \mathbf{x}_1=(1, 0, 0, \ldots, 0), \mathbf{x}_2=(0, 1, 0, \ldots, 0), \ldots, \mathbf{x}_n=(0, 0, 0, \ldots, 1). Barycentric coordinates are not unique: for any b not equal to zero, (b a_1, \ldots, b a_n) are also barycentric coordinates of p.

When the coordinates are not negative, the point \mathbf{p} lies in the convex hull of \mathbf{x}_1, \ldots, \mathbf{x}_n, that is, in the simplex which has those points as its vertices.

Barycentric coordinates, as defined above, are a form of homogeneous coordinates: indeed, the "usual" homogeneous coordinates are the barycentric coordinates defined in the extended affine n-space on the simplex whose vertices are the points at infinity on the coordinate axes, plus the origin. Sometimes values of coordinates are restricted with a condition

\sum a_i = 1

which makes them unique; then, they are affine coordinates.

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.

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 sidelengths of the triangle. Conversely, a point with barycentrics α : β : γ has trilinears α/a : β/b : γ/c.

Equations in barycentric coordinates

Using the above conversion between barycentric and trilinear coordinates, the various equations given in Trilinear coordinates#Formulas can be rewritten in terms of barycentric coordinates.

Distance between points

Displacement vector of two normalized points P=(p_1,p_2,p_3) and Q=(q_1,q_2,q_3) is

\overrightarrow{P Q}=(p_1-q_1,p_2-q_2,p_3-q_3) [1]

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

d^2=\left | P Q \right |^2 = -a^2yz - b^2zx - c^2xy [1]

where a, b, c are the sidelengths of the triangle.

Barycentric coordinates can be calculated based on distances to 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^2_A - d^2_B\\
d^2_A - d^2_C\\
1
\end{matrix}\right)
.

Application: 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.
Otherwise, \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.
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.

Application: Interpolation on a triangular unstructured grid

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, we can approximate these values 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, we can use this kind of technique 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}, we must first find a triangle that contains it. To do so, we first transform \mathbf{r} into the barycentric coordinates of each triangle. If we find some triangle 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). We can then interpolate the value of f(\mathbf{r}) as described above.

These methods have many applications, such as the finite element method (FEM).

Application: Integration over a triangle

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.

Examples of special points

The circumcenter of a triangle ABC has barycentric coordinates[1][2][3]

 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,

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

The orthocenter has barycentric coordinates[1]

 (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.

The incenter has barycentric coordinates[1]

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

The nine-point center has barycentric coordinates

a\cos(B-C):b\cos (C-A):c\cos (A-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 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)

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 polytope 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 vertices of the given polytope. 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 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 [4]

See also

References

  1. 1 2 3 4 5 Schindler, Max; Chen, Evan (July 13, 2012). "Barycentric Coordinates in Olympiad Geometry" (PDF). Retrieved 14 January 2016.
  2. Clark Kimberling's Encyclopedia of Triangles http://faculty.evansville.edu/ck6/encyclopedia/ETC.html
  3. Wolfram page on barycentric coordinates
  4. ONUFRIEV, VG; DENISIK, SA; FERRONSKY, VI, BARICENTRIC MODELS IN ISOTOPE STUDIES OF NATURAL-WATERS. NUCLEAR GEOPHYSICS, 4, 111-117 (1990)

External links

This article is issued from Wikipedia - version of the Saturday, March 26, 2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.