在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
/// <summary> /// 判断点和直线的位置关系 /// </summary> /// <param name="LinePntA">直线上的一点</param> /// <param name="LinePntB">直线上的另一点</param> /// <param name="PntM">需要判断的点</param> /// <returns></returns> private int JudgePointToLine(Point3d LinePntA, Point3d LinePntB, Point3d PntM) { int nResult = 0; double ax = LinePntB.X - LinePntA.X; double ay = LinePntB.Y - LinePntA.Y; double bx = PntM.X - LinePntA.X; double by = PntM.Y - LinePntA.Y; double judge = ax * by - ay * bx; if (judge > 0) { nResult = 1; } else if (judge < 0) { nResult = -1; } else { nResult = 0; } return nResult; }
|
请发表评论