# 已知6点，求两平面夹角

double fcos(double x1,double y1,double z1,double x2,double y2,double z2,double x3,double y3,double z3,
double x11,double y11,double z11,double x22,double y22,double z22,double x33,double y33,double z33){
double vect1[3],vect2[3],nomal1[3],nomal2[3];
vect1[0] = x2 - x1;vect1[1] = y2 - y1;vect1[2] = z2 - z1;
vect2[0] = x3 - x1;vect2[1] = y3 - y1;vect2[2] = z3 - z1;
//平面一法线
nomal1[0] = vect1[1]*vect2[2] - vect1[2]*vect2[1];
nomal1[1] = vect1[2]*vect2[0] - vect1[0]*vect2[2];
nomal1[2] = vect1[0]*vect2[1] - vect1[1]*vect2[0];

vect1[0] = x22 - x11;vect1[1] = y22 - y11;vect1[2] = z22 - z11;
vect2[0] = x33 - x11;vect2[1] = y33 - y11;vect2[2] = z33 - z11;
//平面二法线
nomal2[0] = vect1[1]*vect2[2] - vect1[2]*vect2[1];
nomal2[1] = vect1[2]*vect2[0] - vect1[0]*vect2[2];
nomal2[2] = vect1[0]*vect2[1] - vect1[1]*vect2[0];
//返回cos
return(-1 * fabs(nomal1[0]*nomal2[0]+nomal1[1]*nomal2[1]+nomal1[2]*nomal2[2])
/(sqrt(SQR(nomal1[0])+SQR(nomal1[1])+SQR(nomal1[2]))*sqrt(SQR(nomal2[0])+SQR(nomal2[1])+SQR(nomal2[2]))));
• 本文已收录于以下专栏：

举报原因： 您举报文章：已知6点，求两平面夹角 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)