当前位置: 首页>>代码示例>>C++>>正文


C++ BoundingBox::GetTop方法代码示例

本文整理汇总了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;
}
开发者ID:ShowLove,项目名称:Robotics_Club,代码行数:40,代码来源:line.cpp


注:本文中的BoundingBox::GetTop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。