cherish
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
VirtualPlaneIntersector< Geometry > Class Template Reference

Class that allows calculation of a local intersection point between the raycast and provided geometry's plane. It is a template class and the template type must posses the following methods: More...

#include <VirtualPlaneIntersector.h>

Inheritance diagram for VirtualPlaneIntersector< Geometry >:

Public Types

typedef std::tuple< double, double, bool > Intersection2D
 
typedef std::tuple< osg::Vec3f, bool > Intersection3D
 

Public Member Functions

 VirtualPlaneIntersector (Geometry *g)
 
virtual Intersection2D getIntersection2D (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
 
virtual Intersection3D getIntersection3D (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
 
virtual Intersection3D getIntersection3D (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, const osg::Plane &plane)
 

Protected Member Functions

virtual bool getIntersection2D (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, const osg::Vec3f &center, const osg::Plane &plane, double &u, double &v)
 
virtual bool getIntersection3D (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, const osg::Vec3f &center, const osg::Plane &plane, osg::Vec3f &P)
 

Protected Attributes

Geometry * m_geometry
 

Detailed Description

template<typename Geometry>
class VirtualPlaneIntersector< Geometry >

Class that allows calculation of a local intersection point between the raycast and provided geometry's plane. It is a template class and the template type must posses the following methods:

It is assumed that all the points of the Geometry type lie within the same plane in 3D. The return result is expressed through the local coordinate system, i.e., (u,v).

Constructor & Destructor Documentation

§ VirtualPlaneIntersector()

template<typename Geometry>
VirtualPlaneIntersector< Geometry >::VirtualPlaneIntersector ( Geometry *  g)

Default constructor.

Parameters
gis the user provided Geometry type whose points are assuminly lying within the same plane in 3D.

Member Function Documentation

§ getIntersection2D() [1/2]

template<typename Geometry >
VirtualPlaneIntersector< Geometry >::Intersection2D VirtualPlaneIntersector< Geometry >::getIntersection2D ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  aa 
)
virtual

A convinience method to obtain a local intersection point between the raycast and a virtual plane of the presented Geometry.

Returns
A tuple of a form (double, double, bool), where the first two variables are the local intersection coordinates, and the last variables denotes whether intersection has occured or not.

§ getIntersection2D() [2/2]

template<typename Geometry >
bool VirtualPlaneIntersector< Geometry >::getIntersection2D ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  aa,
const osg::Vec3f &  center,
const osg::Plane &  plane,
double &  u,
double &  v 
)
protectedvirtual

Algorithm: use ray-tracking techinique; calcualte near and far point in global 3D; intersect that segment with plane of canvas - 3D intersection point; extract local 3D coords so that to create a stroke (or append that point to a current stroke)

Returns
true if the no errors occured, false otherwise

§ getIntersection3D() [1/3]

template<typename Geometry >
VirtualPlaneIntersector< Geometry >::Intersection3D VirtualPlaneIntersector< Geometry >::getIntersection3D ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  aa 
)
virtual

A convinience method to obtain a global intersection point between the raycast and a virtual plane of the presented Geometry.

Returns
A tuple of a form (osg::Vec3f, bool), where the first variable is the global intersection coordinates, and the last variable denotes whether intersection has occured or not.

§ getIntersection3D() [2/3]

template<typename Geometry >
VirtualPlaneIntersector< Geometry >::Intersection3D VirtualPlaneIntersector< Geometry >::getIntersection3D ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  aa,
const osg::Plane &  plane 
)
virtual

A convinience method to obtain global intersection point between the raycast and a virtual plane given the plane equation. \ param plane is the virtual plane equation. That means, only Geometry's center is used.

Returns
A tuple of a form (osg::Vec3f, bool), where the first variable is the global intersection coordinates, and the last variable denotes whther the intersection has occured or not.

§ getIntersection3D() [3/3]

template<typename Geometry >
bool VirtualPlaneIntersector< Geometry >::getIntersection3D ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  aa,
const osg::Vec3f &  center,
const osg::Plane &  plane,
osg::Vec3f &  P 
)
protectedvirtual

Algorithm: use ray-tracking techinique; calcualte near and far point in global 3D; intersect that segment with plane of canvas and obtain a 3D intersection point.

Returns
true if the no errors occured, false otherwise

The documentation for this class was generated from the following files: