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!
==== Edge approach ==== Given a point <math>\mathbf{r}</math> in a triangle's plane one can obtain the barycentric coordinates <math>\lambda_1</math>, <math>\lambda_2</math> and <math>\lambda_3</math> from the [[Cartesian coordinates]] <math>(x, y)</math> or vice versa. We can write the Cartesian coordinates of the point <math>\mathbf{r}</math> in terms of the Cartesian components of the triangle vertices <math>\mathbf{r}_1</math>, <math>\mathbf{r}_2</math>, <math>\mathbf{r}_3</math> where <math>\mathbf{r}_i = (x_i, y_i)</math> and in terms of the barycentric coordinates of <math>\mathbf{r}</math> as <math display=block>\begin{align} x &= \lambda_1 x_1 + \lambda_2 x_2 + \lambda_3 x_3 \\[2pt] y &= \lambda_1 y_1 + \lambda_2 y_2 + \lambda_3 y_3 \end{align}</math> 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 <math>\lambda_3 = 1 - \lambda_1 - \lambda_2</math> into the above to obtain <math display=block>\begin{align} x &= \lambda_1 x_1 + \lambda_2 x_2 + (1 - \lambda_1 - \lambda_2) x_3 \\[2pt] y &= \lambda_1 y_1 + \lambda_2 y_2 + (1 - \lambda_1 - \lambda_2) y_3 \end{align}</math> Rearranging, this is <math display=block>\begin{align} \lambda_1(x_1 - x_3) + \lambda_2(x_2 - x_3) + x_3 - x &= 0 \\[2pt] \lambda_1(y_1 - y_3) + \lambda_2(y_2 -\, y_3) + y_3 - \, y &= 0 \end{align}</math> This [[linear transformation]] may be written more succinctly as <math display=block> \mathbf{T} \cdot \lambda = \mathbf{r}-\mathbf{r}_3 </math> where <math>\lambda</math> is the [[coordinate space|vector]] of the first two barycentric coordinates, <math>\mathbf{r}</math> is the [[Euclidean vector|vector]] of [[Cartesian coordinates]], and <math>\mathbf{T}</math> is a [[matrix (mathematics)|matrix]] given by <math display=block> \mathbf{T} = \left(\begin{matrix} x_1-x_3 & x_2-x_3 \\ y_1-y_3 & y_2-y_3 \end{matrix}\right) </math> Now the matrix <math>\mathbf{T}</math> is [[invertible matrix|invertible]], since <math>\mathbf{r}_1-\mathbf{r}_3</math> and <math>\mathbf{r}_2-\mathbf{r}_3</math> are [[linearly independent]] (if this were not the case, then <math>\mathbf{r}_1</math>, <math>\mathbf{r}_2</math>, and <math>\mathbf{r}_3</math> would be [[Line (geometry)|collinear]] and would not form a triangle). Thus, we can rearrange the above equation to get <math display=block> \left(\begin{matrix}\lambda_1 \\ \lambda_2\end{matrix}\right) = \mathbf{T}^{-1} ( \mathbf{r}-\mathbf{r}_3 ) </math> Finding the barycentric coordinates has thus been reduced to finding the [[Matrix inversion#Inversion of 2Γ2 matrices|2Γ2 inverse matrix]] of <math>\mathbf{T}</math>, an easy problem. Explicitly, the formulae for the barycentric coordinates of point <math>\mathbf{r}</math> in terms of its Cartesian coordinates (''x, y'') and in terms of the Cartesian coordinates of the triangle's vertices are: <math display="block">\begin{align} \lambda_1 =&\ \frac{(y_2-y_3)(x-x_3) + (x_3-x_2)(y-y_3)}{\det(\mathbf T)} \\[4pt] &= \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)} \\[4pt] &= \frac{(\mathbf{r}-\mathbf{r_3})\times(\mathbf{r_2}-\mathbf{r_3})}{(\mathbf{r_1}-\mathbf{r_3})\times(\mathbf{r_2}-\mathbf{r_3})} \\[12pt] \lambda_2 =&\ \frac{(y_3-y_1)(x-x_3) + (x_1-x_3)(y-y_3)}{\det(\mathbf T)} \\[4pt] &= \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)} \\[4pt] &= \frac{(\mathbf{r}-\mathbf{r_3})\times(\mathbf{r_3}-\mathbf{r_1})}{(\mathbf{r_1}-\mathbf{r_3})\times(\mathbf{r_2}-\mathbf{r_3})} \\[12pt] \lambda_3 =&\ 1 - \lambda_1 - \lambda_2 \\[4pt] &= 1-\frac{(\mathbf{r}-\mathbf{r_3})\times(\mathbf{r_2}-\mathbf{r_1})}{(\mathbf{r_1}-\mathbf{r_3})\times(\mathbf{r_2}-\mathbf{r_3})} \\[4pt] &= \frac{(\mathbf{r}-\mathbf{r_1})\times(\mathbf{r_1}-\mathbf{r_2 })}{(\mathbf{r_1}-\mathbf{r_3})\times(\mathbf{r_2}-\mathbf{r_3})} \end{align}</math>When understanding the last line of equation, note the identity <math>(\mathbf{r_1}-\mathbf{r_3})\times(\mathbf{r_2}-\mathbf{r_3})=(\mathbf{r_3}-\mathbf{r_1})\times(\mathbf{r_1}-\mathbf{r_2})</math>.
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)