function out = coordinates(theta)
L1 = 3; L3 = 3; L2 = 3*(2^.5);
gamma = pi/4;
p1 = 5; p2=9 ; p3=3;x1=5;x2=0;y2=6;
A2=L3*cos(theta)-x1; B2=L3*sin(theta); 
A3=L2*cos(theta+gamma)-x2;B3=L2*sin(theta+gamma)-y2;
N1=B3.*(p2^2-p1^2-A2.^2-B2.^2)-B2.*(p3^2-p1^2-A3.^2-B3.^2);
N2=-A3.*(p2^2-p1^2-A2.^2-B2.^2)+A2.*(p3^2-p1^2-A3.^2-B3.^2);
D=2*(A2.*B3-B2.*A3);

u1=N1/D;
v1=N2/D;
u2=u1+L2.*cos(theta+gamma);
v2=v1+L2.*sin(theta+gamma);
u3=u1+L3.*cos(theta);
v3=v1+L3.*sin(theta);

p1Check=sqrt(u1^2+v1^2) 
p2Check=sqrt((u3-x1)^2+v3^2)
p3Check=sqrt((u2-x2)^2+(v2-y2)^2)

figure(1);
plot([u1 u2 u3 u1],[v1 v2 v3 v1],'r');
hold on
figure(1);
plot([0 x1 x2],[0 0 y2], 'bo');
hold on
figure(1);
line([0,u1],[0,v1]);
line([x2,u2],[y2,v2]);
line([x1,u3],[0,v3]);
out=[[u1,v1]; [u2,v2] ;[u3,v3]];
