objectarx之判断给定的三点是否共线
Posted pond-zzc
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了objectarx之判断给定的三点是否共线相关的知识,希望对你有一定的参考价值。
bool ThreePointIsCollinear(const AcGePoint2d &pt1, const AcGePoint2d &pt2, const AcGePoint2d &pt3)
{
double xy = pt1.x * pt1.x + pt1.y * pt1.y;
double xyse = xy - pt3.x * pt3.x - pt3.y * pt3.y;
double xysm = xy - pt2.x * pt2.x - pt2.y * pt2.y;
xy = (pt1.x - pt2.x) * (pt1.y - pt3.y) - (pt1.x - pt3.x) * (pt1.y - pt2.y);
return (fabs(xy) < 1.0E-5);
}
AcGePoint2d ToPoint2d(const AcGePoint3d &point3d)
{
return AcGePoint2d(point3d.x, point3d.y);
}
以上是关于objectarx之判断给定的三点是否共线的主要内容,如果未能解决你的问题,请参考以下文章