cherish
PolyLineIntersector.h
1 #ifndef POLYLINEINTERSECTOR_H
2 #define POLYLINEINTERSECTOR_H
3 
4 #include <vector>
5 #include <osgUtil/LineSegmentIntersector>
6 
13 class PolyLineIntersector : public osgUtil::LineSegmentIntersector
14 {
15 public:
17  PolyLineIntersector(const osg::Vec3& start, const osg::Vec3& end);
18  PolyLineIntersector(CoordinateFrame cf, double x, double y);
19  PolyLineIntersector(CoordinateFrame cf, const osg::Vec3d& start, const osg::Vec3d& end);
20 
21  void setOffset(float offset);
22  float getOffset() const;
23  void getHitIndices(int& first, int& last) const;
24 
25  virtual Intersector* clone( osgUtil::IntersectionVisitor& iv );
26  virtual void intersect(osgUtil::IntersectionVisitor& iv, osg::Drawable* drawable);
27 
28 protected:
29  virtual bool isRightPrimitive(const osg::Geometry* geometry);
30 
31  float m_offset;
32  std::vector<unsigned int> m_hitIndices;
33 };
34 
35 #endif // POLYLINEINTERSECTOR_H
A class that allows to catch intersections with line loops and polyline OpenGL types. It uses shortest distance between the cast ray and the geometry line which is calculated as a distance between skew lines. In addition, it filters out the geometries whose primitive sets are different than line-types.
Definition: PolyLineIntersector.h:13