
clg

[p,e,t]=initmesh(g,'hmax',.5); 
pdeplot(p,e,t)
hold on


disp('choose of point in graph'); 
[x,y]=ginput(1); 
plot(x,y,'o'); 
[k,w]=inwhichtri( p,t,x,y) % calculate the triangle

corners = p(:,t([1,2,3,1],k)); 
plot(corners(1),point(2),'m');   % plot the triangle
point  = p(:,t(1:3,k))*w; 
plot(point(1),point(2),'x'); 

disp 'the error '

disp( norm(point - [x;y] ))

