|
[code]int CArcBlockJigEntity::PtInLeftOfLine(const AcGePoint2d &ptStart, const AcGePoint2d &ptEnd, const AcGePoint2d &pt, double tol /*= 1.0E-7*/)
{
return PtInLeftOfLine(ptStart.x, ptStart.y, ptEnd.x, ptEnd.y, pt.x, pt.y, tol);
}
int CArcBlockJigEntity::PtInLeftOfLine(double x1, double y1, double x2, double y2, double x3, double y3, double tol /*= 1.0E-7*/)
{
// 两个矢量的叉乘结果是一个,矢量的行列式值是这两个矢量确定的平行四边形的面积
double a = (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1);
if (fabs(a) < tol)
{
return 0;
}
else if (a > 0)
{
return 1;
}
else
{
return -1;
}[/code] |
|