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);
}

上一篇:【Unity3D】AR应用中,关于东南西北方位的判断。


下一篇:poj 2155 B - Matrix 二维树状数组