Контрольная работа: Сглаженная поверхность для границы трех атомов в пространстве
dg1=sqrt(xc1+yc1+zc1)-double(r[1])-Rc;
dg2=sqrt(xc2+yc2+zc2)-double(r[2])-Rc;
dg3=sqrt(xc3+yc3+zc3)-double(r[3])-Rc;
if (abs(int(dg1))<=1) nom++;
if (abs(int(dg2))<=1) nom++;
if (abs(int(dg3))<=1) nom++;
if (nom==3) {break;}
j++;
}
R4=(sqrt((Xc-Xvr)*(Xc-Xvr)+(Zc-Zvr)*(Zc-Zvr)));
double x1,x2,y1,y2;
x1=Xc-Xvr;x2=R4;y1=Zc-Zvr;y2=0;
alp4=(x1*x2+y1*y2)/((sqrt(x1*x1+y1*y1)))/(sqrt(x2*x2+y2*y2));
al4=acos(alp4)*180/M_PI;
printf("Xc=%10.10f\n",Xc);
printf("Yc=%10.10f\n",Yc);
printf("Zc=%10.10f\n",Zc);
xc1=Xc-x[1];xc2=Xc-x[2];xc3=Xc-x[3];
yc1=Yc-y[1];yc2=Yc-y[2];yc3=Yc-y[3];
zc1=Zc-z[1];zc2=Zc-z[2];zc3=Zc-z[3];
XYc1=(-xc1*y[1]+yc1*x[1])/yc1;XYc2=(-xc2*y[2]+yc2*x[2])/yc2;XYc3=(-xc3*y[3]+yc3*x[3])/yc3;
ZYc1=(-zc1*y[1]+yc1*z[1])/yc1;ZYc2=(-zc2*y[2]+yc2*z[2])/yc2;ZYc3=(-zc3*y[3]+yc3*z[3])/yc3;
M1=((Rc*Rc)-(Xc*Xc+Yc*Yc+Zc*Zc))/(-2);
M2=((r[1]*r[1])-(x[1]*x[1]+y[1]*y[1]+z[1]*z[1]))/(-2);
M3=((r[2]*r[2])-(x[2]*x[2]+y[2]*y[2]+z[2]*z[2]))/(-2);
M4=((r[3]*r[3])-(x[3]*x[3]+y[3]*y[3]+z[3]*z[3]))/(-2);
Ykos1=(M1-M2-XYc1*Xc+XYc1*x[1]-ZYc1*Zc+ZYc1*z[1])/(xc1*Xc/yc1-xc1*x[1]/yc1+(Yc-y[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