码迷,mamicode.com
首页 > 其他好文 > 详细

objectarx之判断给定的三点是否共线

时间:2019-11-11 09:14:48      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:near   判断   int   ble   return   turn   fabs   epo   point   

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之判断给定的三点是否共线

标签:near   判断   int   ble   return   turn   fabs   epo   point   

原文地址:https://www.cnblogs.com/Pond-ZZC/p/11832832.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!