cherish
VirtualPlaneIntersector.h
1 #ifndef VIRTUALPLANEINTERSECTOR_H
2 #define VIRTUALPLANEINTERSECTOR_H
3 
4 #include <tuple>
5 
6 #include <osg/Referenced>
7 #include <osgGA/GUIEventAdapter>
8 #include <osgGA/GUIActionAdapter>
9 
10 #include "Canvas.h"
11 #include "DraggableWire.h"
12 
25 template <typename Geometry>
26 class VirtualPlaneIntersector : public osg::Referenced
27 {
28 public:
29  typedef std::tuple<double, double, bool> Intersection2D;
30  typedef std::tuple<osg::Vec3f, bool> Intersection3D;
31 
35  VirtualPlaneIntersector(Geometry* g);
36 
42  virtual Intersection2D getIntersection2D(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa);
43 
49  virtual Intersection3D getIntersection3D(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa);
50 
56  virtual Intersection3D getIntersection3D(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, const osg::Plane& plane);
57 
58 protected:
64  virtual bool getIntersection2D(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa,
65  const osg::Vec3f& center, const osg::Plane& plane, double& u, double& v);
66 
70  virtual bool getIntersection3D(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa,
71  const osg::Vec3f& center, const osg::Plane& plane, osg::Vec3f& P);
72 
73 protected:
74  Geometry* m_geometry;
75 };
76 
77 #endif // VIRTUALPLANEINTERSECTOR_H
Class that allows calculation of a local intersection point between the raycast and provided geometry...
Definition: VirtualPlaneIntersector.h:26
virtual Intersection3D getIntersection3D(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
Definition: VirtualPlaneIntersector.cpp:23
virtual Intersection2D getIntersection2D(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
Definition: VirtualPlaneIntersector.cpp:13
VirtualPlaneIntersector(Geometry *g)
Definition: VirtualPlaneIntersector.cpp:6