Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have to do what described in the picture below.

enter image description here

Consider the planar triangle $[p_1,p_2,p_3]$ with vertices $p_1=\begin{pmatrix}-2\\-1\end{pmatrix}$, $p_2=\begin{pmatrix}3\\-1\end{pmatrix}$, $p_3=\begin{pmatrix}1\\4\end{pmatrix}$, compute the barycentric coordinates of the point $p=\begin{pmatrix}2\\1\end{pmatrix}$, and verify that $p$ can indeed be expressed as the convex combination $\lambda_1p_1+\lambda_2p_2+\lambda_3p_3$. Repeat this computation with the point $p'=\begin{pmatrix}3\\3\end{pmatrix}$. Finally transform the triangle and the point $p$ with the linear mapping $\phi \colon \mathbb R^2\to\mathbb R^2$, $\phi\begin{pmatrix}x\\y\end{pmatrix}=\begin{pmatrix}2x-1\\x-3y+2\end{pmatrix}$, and compute the barycentric coordinates of the transformed point $q=\phi(p)$ with respect to the transformed triangle $[q_1,q_2,q_3]$, where $q_i=\phi(p_i)$, for $i=1,2,3$.

Any ideas on how to do this?

share|cite|improve this question
@EdGorcenski I am using this formula at the moment…. – kokos Oct 17 '12 at 22:48
@EdGorcenski If you have something to propose me I am glad to know! – kokos Oct 17 '12 at 22:50

To calculate the barycentric cooordinates of a point wrt a given triangle, the wikipedia formulae are fine. You can write the formulae in terms of triangle areas or vector cross products, instead, if you want. This makes them look tidier, certainly, and provides some intuituion:

If you're writing code, the formulae based on areas or cross products will be more convenient if you already have functions for computing the latter.

Again, if you're writing code, you have to think about which two coordinates you will get from the quotient formulae, and which one you'll compute by subtraction. Some calculations will be more stable than others.

share|cite|improve this answer

By definition you want to find $\lambda_1$, $\lambda_2$, $\lambda_3$ such that $p=\lambda_1p_1+\lambda_2p_2+\lambda_3p_3$ and $\lambda_1+\lambda_2+\lambda_3=1$. This give you three linear equations with three variables. For example, in the case of the point $p$ you will get $$ \begin{align*} \lambda_1+\lambda_2+\lambda_3&=1\\ -2\lambda_1+3\lambda_2+\lambda_3&=2\\ -\lambda_1-\lambda_2+4\lambda_3&=1\\ \end{align*} $$

If you solve this system, you get $\lambda_1=\frac1{25}$, $\lambda_2=\frac{14}{25}$, $\lambda_3=\frac25$. You can try to solve the remaining ones in this way. (Please, include what you get to show your work.)

The second part is related to the fact that affine functions preserve barycentric combinations.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.