1.空间中平面方程的一般形式为:
Ax+By+Cz+D=0 (参数,A,B,C,D是描述平面空间特征的常数)
已知空间中3个点的坐标(x1,y1,z1),(x2,y2,z2),(x3,y3,z3),求解平面方程。
解法1.根据已知的3个点,建立3个联合方程组,进行消元;
2.根据克莱姆法则,
代码:
//求点到平面的距离
public double PointToFaceDistance(XYZ point1,XYZ point2,XYZ point3,XYZ p0)
{
矩阵的定义和初始化
//var matrix1 = new DenseMatrix(3); //3维方阵
//var matrix2 = new DenseMatrix(3,2); //3×2矩阵
double S = 0;
double[,] a = { { 1, 1, 1 }, { point1.Y, point2.Y, point3.Y }, { point1.Z, point2.Z, point3.Z } };
double[,] b = { { point1.X, point2.X, point3.X }, { 1, 1, 1 }, { point1.Z, point2.Z, point3.Z } };
double[,] c = { { point