本文整理汇总了C++中ON_BoundingBox::IsPointIn方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_BoundingBox::IsPointIn方法的具体用法?C++ ON_BoundingBox::IsPointIn怎么用?C++ ON_BoundingBox::IsPointIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_BoundingBox
的用法示例。
在下文中一共展示了ON_BoundingBox::IsPointIn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PointInPolyline
bool PointInPolyline(
const ON_3dPoint& P,
const ON_Polyline pline,
double tol
)
{
if (!pline.IsClosed(tol)) { /* no inside to speak of */
return false;
}
/* First we need to find a point that's in the plane and outside the polyline */
ON_BoundingBox bbox;
PolylineBBox(pline, &bbox);
ON_3dPoint adder;
int i;
for (i = 0; i < pline.Count(); i++) {
adder = P - pline[i];
if (!VNEAR_ZERO(adder, tol)) {
break;
}
}
ON_3dPoint DistantPoint = P;
int multiplier = 2;
do {
DistantPoint += adder*multiplier;
multiplier = multiplier*multiplier;
} while (bbox.IsPointIn(DistantPoint, false));
bool inside = false;
int rv;
ON_3dPoint result[2];
for (i = 0; i < pline.Count() - 1; i++) {
rv = SegmentSegmentIntersect(P, DistantPoint, pline[i], pline[i + 1], result, tol);
if (rv == 1) {
inside = !inside;
} else if (rv == 2) {
bu_exit(-1, "This is very unlikely bug in PointInPolyline which needs to be fixed\n");
}
}
return inside;
}