本文整理汇总了C++中BoundingBox::GetTop方法的典型用法代码示例。如果您正苦于以下问题:C++ BoundingBox::GetTop方法的具体用法?C++ BoundingBox::GetTop怎么用?C++ BoundingBox::GetTop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoundingBox
的用法示例。
在下文中一共展示了BoundingBox::GetTop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsCollisionInXY
////////////////////////////////////////////////////////////////////////////////////
///
/// \brief This method is used to check if the object intersects with a segment
/// in the XY plane.
///
/// The zHigh and zLow values are used to eliminate obstacles above or
/// below a Z axis threshold of the XY planes.
///
/// \param[in] segment The segment to check for collision with.
/// \param[in] zHigh The upper boundary in the zPlane for collision detection.
/// \param[in] zLow The lower boundary in the zPlane for collision detection.
///
/// \return True if there is a collision, otherwise false.
///
////////////////////////////////////////////////////////////////////////////////////
bool Line::IsCollisionInXY(const Segment3D& segment,
const double zHigh, const double zLow) const
{
bool result = false;
// Translate to XY plane.
Segment3D segmentXY1(Point3D(mLine.mPoint1.mX, mLine.mPoint1.mY, 0.0),
Point3D(mLine.mPoint2.mX, mLine.mPoint2.mY, 0.0),
mLine.mWidth);
Segment3D segmentXY2(Point3D(segment.mPoint1.mX, segment.mPoint1.mY, 0.0),
Point3D(segment.mPoint2.mX, segment.mPoint2.mY, 0.0),
segment.mWidth);
BoundingBox bbox = BoundingBox::CreateBoundingBox(mLine);
// Check that our object is within the z boundaries.
if(bbox.GetTop() >= zLow && bbox.GetBottom() <= zHigh)
{
// My z value is within the boundaries, so now check if we are
// within the distance to the segment.
if(Segment3D::GetDistanceToSegment(segmentXY1, segmentXY2) <= 0.0)
{
result = true;
}
}
return result;
}