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


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

本文整理汇总了C++中BoundingBox::doesLineIntersect方法的典型用法代码示例。如果您正苦于以下问题:C++ BoundingBox::doesLineIntersect方法的具体用法?C++ BoundingBox::doesLineIntersect怎么用?C++ BoundingBox::doesLineIntersect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BoundingBox的用法示例。


在下文中一共展示了BoundingBox::doesLineIntersect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fireRay

    /**
     * Fire the test ray at the instrument and perform a bread-first search of the 
     * object tree to find the objects that were intersected.
     * @param testRay :: An input/output parameter that defines the track and accumulates the
     *        intersection results
     */
    void InstrumentRayTracer::fireRay(Track & testRay) const
    {
      // Go through the instrument tree and see if we get any hits by
      // (a) first testing the bounding box and if we're inside that then
      // (b) test the lower components.
      std::deque<IComponent_const_sptr> nodeQueue;

      //Start at the root of the tree
      nodeQueue.push_back(m_instrument);

      IComponent_const_sptr node;
      while( !nodeQueue.empty() )
      {
        node = nodeQueue.front();
        nodeQueue.pop_front();
        BoundingBox bbox;
        node->getBoundingBox(bbox);
        // Quick test. If this suceeds moved on to test the children
        if( bbox.doesLineIntersect(testRay) )
        {
          if( ICompAssembly_const_sptr assembly = boost::dynamic_pointer_cast<const ICompAssembly>(node) )
          {
            assembly->testIntersectionWithChildren(testRay, nodeQueue);
          }
          else
          {
            throw Kernel::Exception::NotImplementedError("Implement non-comp assembly interactions");
          }
        }
      }

    }
开发者ID:,项目名称:,代码行数:38,代码来源:

示例2: interceptSurface

/**
 * Given a track, fill the track with valid section
 * @param UT :: Initial track
 * @return Number of segments added
 */
int MeshObject::interceptSurface(Geometry::Track &UT) const {

  int originalCount = UT.count(); // Number of intersections original track
  BoundingBox bb = getBoundingBox();
  if (!bb.doesLineIntersect(UT)) {
    return 0;
  }

  std::vector<Kernel::V3D> intersectionPoints;
  std::vector<TrackDirection> entryExit;

  getIntersections(UT.startPoint(), UT.direction(), intersectionPoints,
                   entryExit);
  if (intersectionPoints.empty())
    return 0; // Quit if no intersections found

  // For a 3D mesh, a ray may intersect several segments
  for (size_t i = 0; i < intersectionPoints.size(); ++i) {
    UT.addPoint(entryExit[i], intersectionPoints[i], *this);
  }
  UT.buildLink();

  return UT.count() - originalCount;
}
开发者ID:mantidproject,项目名称:mantid,代码行数:29,代码来源:MeshObject.cpp


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