function [ alpha,beta,gama ] = barycentric_coordinates( face_point,dt )
%barycentric_coordinates will give the coordinates alpha, beta ,gama of the
%matrix face_point. alpha, beta, gama are called barucentric_coordinates.
% face_point is the point [x,y]' from the mean shape of the face. dt is 3
% by 2 matrix that will have the coordinates corresponding 2 the vertces
% of a triangle. for eg for a triangle with vertices [v1, v2, v3] v1 will
% have coordinates [x1,y1] so dt will contain the matrix [x1 y1; x2 y2;
% x3 y3]
%
x1=dt(1,:);
x2=dt(2,:);
x3=dt(3,:);
a=[x(1),x2(1),x3(1); x1(2),x2(2),x3(2); 1,1,1];
b=[face_point(1); face_point(2);1];
x=inv(a)*b;
alpha=x(1);
beta=x(2);
gama=x(3);
end