k=0;
x=[150,85,150,145,130,0];
y=[140,85,155,50,150,0];
v=[243,236,220.5,159,230,52];
for i=1:5
for j=i+1:6
a=x(i)-x(j);
b=y(i)-y(j);
p(i)=v(i)*3.14/180;
p(j)=v(j)*3.14/180;
c=800*(cos(p(i))+sin(p(i))*i);
d=800*(cos(p(j))+sin(p(j))*i);
if a==0
t=pi/2;
else
t=atan(b/a);
end
e(i,j)=atan((sin(p(i)-t)-sin(p(j)-t))/(cos(p(i)-t)-cos(p(j)-t)));
e(j,i)=e(i,j);
% f=e-atan(b/a);
h(i,j)=asin(8/sqrt(a*a+b*b));
h(j,i)=h(i,j);
if abs(e(i,j))<h(i,j)
k=k+1;
l=[i,j];
end
end
end
if k>0
y0=[0.01,0.01,0.01,0.01,0.01,0.01];
options(1)=0;
y=constr('fun',y0)
end
function [f,g]=fun(y)
h=[ 0 0.0941 0.5625 0.0889 0.3659 0.0390
0.0941 0 0.0838 0.1154 0.1014 0.0666
0.5625 0.0838 0 0.0762 0.3985 0.0371
0.0889 0.1154 0.0762 0 0.0792 0.0522
0.3659 0.1014 0.3985 0.0792 0 0.0403
0.0390 0.0666 0.0371 0.0522 0.0403 0];
e=[ 0 -1.2367 0.9012 0.4202 -0.1231 0.2513
-1.2367 0 -1.5531 -0.7390 1.5285 0.1558
0.9012 -1.5531 0 0.2161 -1.0280 0.0042
0.4202 -0.7390 0.2161 0 0.1025 -0.0625
-0.1231 1.5285 -1.0280 0.1025 0 0.0322
0.2513 0.1558 0.0042 -0.0625 0.0322 0];
f=y(1)*y(1)+y(2)*y(2)+y(3)*y(3)+y(4)*y(4)+y(5)*y(5)+y(6)*y(6);
g(1)=h(1,2)^2-2*((y(1)+y(2))/2)*e(1,2)-((y(1)+y(2))/2)^2-e(1,2)^2;
g(2)=h(1,3)^2-2*((y(1)+y(3))/2)*e(1,3)-((y(1)+y(3))/2)^2-e(1,3)^2;
g(3)=h(1,4)^2-2*((y(1)+y(4))/2)*e(1,4)-((y(1)+y(4))/2)^2-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