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>
|
typedef std::tuple< double, double, bool > | Intersection2D |
|
typedef std::tuple< osg::Vec3f, bool > | Intersection3D |
|
|
| 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) |
|
|
virtual bool | getIntersection2D (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, const osg::Vec3f ¢er, const osg::Plane &plane, double &u, double &v) |
|
virtual bool | getIntersection3D (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, const osg::Vec3f ¢er, const osg::Plane &plane, osg::Vec3f &P) |
|
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:
- Geometry::getCenter() for a global center point within the Geometry's plane.
- Geometry::getPlane()` to obtain osg::Plane type.
- Geometry::getMatrix() to obtain model matrix of the provided type.
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)
.
§ VirtualPlaneIntersector()
template<typename Geometry>
Default constructor.
- Parameters
-
g | is the user provided Geometry type whose points are assuminly lying within the same plane in 3D. |
§ getIntersection2D() [1/2]
template<typename Geometry >
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 >
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 >
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: