本文整理汇总了C++中Box2d::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ Box2d::contains方法的具体用法?C++ Box2d::contains怎么用?C++ Box2d::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box2d
的用法示例。
在下文中一共展示了Box2d::contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _hitTestBox
bool MgArc::_hitTestBox(const Box2d& rect) const
{
if (!getExtent().isIntersect(rect))
return false;
Point2d points[16];
int n = mgcurv::arcToBezier(points, getCenter(), getRadius(), 0, getStartAngle(), getSweepAngle());
return rect.contains(getCenter()) || mgnear::beziersIntersectBox(rect, n, points);
}
示例2: crossWithPath
bool MgPath::crossWithPath(const MgPath& p, const Box2d& box, Point2d& ptCross) const
{
MgPathCrossCallback cc(box, ptCross);
if (isLine() && p.isLine()) {
return (mglnrel::cross2Line(getPoint(0), getPoint(1),
p.getPoint(0), p.getPoint(1), ptCross)
&& box.contains(ptCross));
}
if (isLines() && p.isLines()) {
for (int m = getCount() - (isClosed() ? 0 : 1), i = 0; i < m; i++) {
Point2d a(getPoint(i)), b(getPoint(i + 1));
for (int n = p.getCount() - (p.isClosed() ? 0 : 1), j = 0; j < n; j++) {
Point2d c(p.getPoint(j)), d(p.getPoint(j + 1));
if (mglnrel::cross2Line(a, b, c, d, cc.tmpcross)
&& box.contains(cc.tmpcross)) {
float dist = cc.tmpcross.distanceTo(box.center());
if (cc.mindist > dist) {
cc.mindist = dist;
ptCross = cc.tmpcross;
}
}
}
}
}
else if (isLine() && p.getSubPathCount() == 1) {
cc.a = getPoint(0);
cc.b = getPoint(1);
p.scanSegments(cc);
}
else if (p.isLine() && getSubPathCount() == 1) {
cc.a = p.getPoint(0);
cc.b = p.getPoint(1);
scanSegments(cc);
}
return cc.mindist < box.width();
}