Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Barycentric coordinate system
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Applications=== [[File:3_jugs_puzzle_barycentric_plot.svg|thumb|upright=1.25|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 <math>\lambda_{1...3}\geq 0</math>. 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]] <math>(0,1).</math> If a point lies on an edge of the triangle but not at a vertex, one of the area coordinates <math>\lambda_{1...3}</math> (the one associated with the opposite vertex) is zero, while the other two lie in the open interval <math>(0,1).</math> 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 <math>\mathbf{r}</math> lies inside the triangle [[if and only if]] <math>0 < \lambda_i < 1 \;\forall\; i \text{ in } {1,2,3}</math>. <math display=block>\mathbf{r}</math> lies on the edge or corner of the triangle if <math>0 \leq \lambda_i \leq 1 \;\forall\; i \text{ in } {1,2,3}</math> and <math>\lambda_i = 0\; \text {, for some i in } {1, 2, 3}</math>. :Otherwise, <math>\mathbf{r}</math> lies outside the triangle. In particular, if a point lies on the far side of a line the barycentric coordinate of the point in the triangle that is not on the line will have a negative value. ====Interpolation on a triangular unstructured grid ==== [[File:Piecewise linear function2D.svg|thumb|upright=1.3|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 <math>f(\mathbf{r}_1),f(\mathbf{r}_2),f(\mathbf{r}_3)</math> are known quantities, but the values of {{mvar|f}} inside the triangle defined by <math>\mathbf{r}_1,\mathbf{r}_2,\mathbf{r}_3</math> is unknown, they can be approximated using [[linear interpolation]]. Barycentric coordinates provide a convenient way to compute this interpolation. If <math>\mathbf{r}</math> is a point inside the triangle with barycentric coordinates <math>\lambda_1</math>, <math>\lambda_2</math>, <math>\lambda_3</math>, then <math display=block>f(\mathbf{r}) \approx \lambda_1 f(\mathbf{r}_1) + \lambda_2 f(\mathbf{r}_2) + \lambda_3 f(\mathbf{r}_3)</math> In general, given any [[unstructured grid]] or [[polygon mesh]], this kind of technique can be used to approximate the value of {{mvar|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 {{mvar|f}} at a point <math>\mathbf{r}</math>, first a triangle must be found that contains <math>\mathbf{r}</math>. To do so, <math>\mathbf{r}</math> is transformed into the barycentric coordinates of each triangle. If some triangle is found such that the coordinates satisfy <math>0 \leq \lambda_i \leq 1 \;\forall\; i \text{ in } 1,2,3</math>, then the point lies in that triangle or on its edge (explained in the previous section). Then the value of <math>f(\mathbf{r})</math> 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 [[Integration by substitution|change of variables]] to any two barycentric coordinates, e.g. <math>\lambda_1,\lambda_2</math>. Under this change of variables, <math display=block> \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 </math> where {{mvar|A}} is the [[Triangle#Using coordinates|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 <math>2A</math>. 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 <math display="block"> \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 </math>where {{mvar|V}} is the volume of the tetrahedron.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)