//=================================================================== // 点到直线距离(垂直距离) // dist_Point_to_Line(): get the distance of a point to a line // Input: a Point P and a Line L (in any dimension) // Return: the shortest distance from P to L public static double dist_Point_to_Line(Point3D P, RgLine L) { Vector3d v = L.P1 - L.P0; Vector3d w = P - L.P0; double c1 = RgMath.dot(w, v); double c2 = RgMath.dot(v, v); double b = c1 / c2; RgPoint Pb = L.P0 + b * v; return(RgMath.d(P, Pb)); }
/// <summary> /// 点在直线上 /// </summary> /// <param name="rPt"></param> /// <param name="rLine"></param> /// <returns></returns> public static bool IsInLine(RgPoint rPt, RgLine rLine) { bool flag = false; return(flag); }