VR-Forces 4.0.4 Class Documentation
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
makVrv::DtOsgIntersector Class Reference

DtOsgIntersector is the OSG-specific implementation of the DtIntersector class. More...

Inheritance diagram for makVrv::DtOsgIntersector:
Inheritance graph
[legend]

List of all members.

Public Types

typedef std::vector
< DtOsgIntersectorResult
DtOsgIntersections

Public Member Functions

 DtOsgIntersector (DtDe &de, int modelSet)
 CTOR.
virtual ~DtOsgIntersector ()
 DTOR.
virtual bool findNearestIntersectionToPoint (double x, double y, double z, double vx, double vy, double vz, DtIntersectorResult &intersection, IntersectProperties properties=AllNodes, std::vector< DtElementID > *ignoreList=0, bool returnTriangle=false, double maxIsectorLength=-1., bool useHighLod=false)
 Find the nearest scene intersection from a point (x,y,z) along a vector(vx,vy,vz) The useHighLod argument tells the intersector that if the terrain is an osgEarth terrain, don't settle for whatever is paged in; get the highest LOD from the map server for this location and use that Note that if maxIsectorLength is not set, the default is the diameter of the database, which for large (and especially geocentric) databases and world databases, may be too large to get adequate precision when trying to interect small (high resolution) triangles.
virtual bool findAllIntersectionsThroughPoint (double x, double y, double z, double vx, double vy, double vz, DtIntersections &intersections, IntersectProperties properties=AllNodes, std::vector< DtElementID > *ignoreList=0, bool sort=true, bool useHighLod=false)
 Return a list of all intersections along the line passing through <x,y,z> and directed by <vx, vy, vz> The useHighLod argument tells the intersector that if the terrain is an osgEarth terrain, don't settle for whatever is paged in; get the highest LOD from the map server for this location and use that.
virtual bool findFirstIntersectWithLineSegment (double x, double y, double z, double end_x, double end_y, double end_z, DtIntersectorResult &intersection, IntersectProperties properties=AllNodes, std::vector< DtElementID > *ignoreList=0, bool useHighLod=false)
 find first intersection along segment x,y,z to end_x, end_y, end_z.
virtual bool findAllIntersectWithLineSegment (double x, double y, double z, double end_x, double end_y, double end_z, DtIntersections &intersections, IntersectProperties properties=AllNodes, std::vector< DtElementID > *ignoreList=0, bool sort=true, bool useHighLod=false)
 find all intersections along segment x,y,z to end_x, end_y, end_z.
virtual bool pick (DtChannel &channel, double mx, double my, DtIntersectorResult &intersection, IntersectProperties properties=AllNodes, std::vector< DtElementID > *ignoreList=0)
 Find the object (if any) under the mouse mx, my are in window coordinates.
virtual bool pickAll (DtChannel *channel, double mx, double my, DtIntersections &intersections, IntersectProperties properties=AllNodes, std::vector< DtElementID > *ignoreList=0)
 Find all the objects (if any) under the mouse mx, my are in window coordinates.
bool findNearestIntersection (double x, double y, double z, double vx, double vy, double vz, DtOsgIntersectorResult &intersection, const DtOsgRenderer::RootList &intersectionRoots, osg::Node::NodeMask mask=DtOsgNodeFlags::FlagAllOn, std::list< osg::Node * > *excludeNodeList=0, bool returnHitTriangle=false, double maxIsectorLength=-1.0, bool useHighLod=false)
 Find the nearest intersection from a point (x,y,z) along a vector(vx,vy,vz) stored in a collision point (cx,cy,cz) with normal (normal_x, normal_y, normal_z)
bool findIntersectionsThroughPoint (double x, double y, double z, double vx, double vy, double vz, DtOsgIntersector::DtOsgIntersections &intersections, const DtOsgRenderer::RootList &intersectionRoots, osg::Node::NodeMask mask=DtOsgNodeFlags::FlagAllOn, std::list< osg::Node * > *excludeNodeList=0, bool returnHitTriangle=false, double maxIsectorLength=-1.0, bool sort=true, bool useHighLod=false)
 intersect the scene with a line segment going through (x,y,z), directed by <vx, vy,vz>, and large enough to cover the entire sceneGraph, and return all intersections The useHighLod argument tells the intersector that if the terrain is an osgEarth terrain, don't settle for whatever is paged in; get the highest LOD from the map server for this location and use that Note that if maxIsectorLength is not set, the default is the diameter of the database, which for large (and especially geocentric) databases and world databases, may be too large to get adequate precision when trying to interect small (high resolution) triangles.
bool intersectLineSegmentWithScene (double x, double y, double z, double end_x, double end_y, double end_z, DtOsgIntersectorResult &intersection, const DtOsgRenderer::RootList &intersectionRoots, osg::Node::NodeMask mask=DtOsgNodeFlags::FlagAllOn, std::list< osg::Node * > *excludeNodeList=0, bool returnHitTriangle=false, bool useHighLod=false)
 intersect the scene with a (directed) line segment and return the intersection closest to the initial (x,y,z) The useHighLod argument tells the intersector that if the terrain is an osgEarth terrain, don't settle for whatever is paged in; get the highest LOD from the map server for this location and use that
bool intersectLineSegmentWithScene (double x, double y, double z, double end_x, double end_y, double end_z, DtOsgIntersector::DtOsgIntersections &intersections, const DtOsgRenderer::RootList &intersectionRoots, osg::Node::NodeMask mask=DtOsgNodeFlags::FlagAllOn, std::list< osg::Node * > *excludeNodeList=0, bool returnHitTriangle=false, bool sort=true, bool useHighLod=false)
 intersect the scene with a (directed) line segment and return all intersections The useHighLod argument tells the intersector that if the terrain is an osgEarth terrain, don't settle for whatever is paged in; get the highest LOD from the map server for this location and use that
virtual bool pick (osgViewer::View &view, double mx, double my, DtOsgIntersectorResult &intersection, osg::Node::NodeMask mask=DtOsgNodeFlags::FlagAllOn, std::list< osg::Node * > *excludeNodeList=0, bool returnHitTriangle=false)
 returns the element id of the object under the mouse (mx, my) if one exists
virtual bool pick (osgViewer::View &view, double mx, double my, DtOsgIntersector::DtOsgIntersections &intersections, osg::Node::NodeMask mask=DtOsgNodeFlags::FlagAllOn, std::list< osg::Node * > *excludeNodeList=0, bool returnHitTriangle=false)
 returns the element ids of the objects under the mouse (mx, my) if any exists
void getExcludeNodesFromIgnoreList (std::vector< DtUniqueID > *ignoreList, std::list< osg::Node * > &excludeNodes)

Static Public Member Functions

static osg::Node::NodeMask nodeMaskFromIntersectProperties (IntersectProperties properties)
static bool anyNodeInNodePath (std::list< osg::Node * > *n, osg::NodePath const &path)

Protected Member Functions

osg::Vec3d worldIntersectPoint (const osgUtil::Hit &hit)
 Convert a Vec3 from local to world coordinates, maximizing precision.
osg::Vec3d worldIntersectPoint (const osgUtil::LineSegmentIntersector::Intersection &hit)
osg::Vec3d localToWorld (const osg::Vec3 &local, const osg::Matrix &localToWorld)
bool findIdFromNodePath (const osg::NodePath &nodePath, DtUniqueID &id)
bool fillResultFromHit (DtOsgIntersectorResult &result, const osgUtil::Hit &hit, bool returnHitTriangle)
bool fillResultFromHit (DtOsgIntersectorResult &result, const osgUtil::LineSegmentIntersector::Intersection &hit, bool returnHitTriangle)
osgUtil::IntersectVisitor::HitList & getLineSegmentIntersection (osgUtil::IntersectVisitor &collisionVisitor, double x, double y, double z, double end_x, double end_y, double end_z, const DtOsgRenderer::RootList &intersectionRoots, osg::Node::NodeMask mask)
 Get the intersection of a line segment with the part of the sceneGraph under instersectRoot.
bool processLineSegmentIntersection (osgUtil::IntersectVisitor::HitList &hitList, std::list< osg::Node * > *excludeNodeList, bool returnHitTriangle, DtOsgIntersectorResult &intersection)
 returns the first intersection in the hitList (not necessarily the closest)
bool processLineSegmentIntersection (const osg::Vec3d &testPoint, osgUtil::IntersectVisitor::HitList &hitList, std::list< osg::Node * > *excludeNodeList, bool returnHitTriangle, DtOsgIntersectorResult &intersection)
 returns the intersection closest to the specified test point
bool processLineSegmentIntersection (const osg::Vec3d &testPoint, osgUtil::IntersectVisitor::HitList &hitList, std::list< osg::Node * > *excludeNodeList, bool returnHitTriangle, DtOsgIntersector::DtOsgIntersections &intersections, bool sort)
 returns all intsersections in the hit list
bool processPickIntersection (osgUtil::LineSegmentIntersector::Intersections &hitList, std::list< osg::Node * > *excludeNodeList, bool returnHitTriangle, DtOsgIntersectorResult &intersection)
 returns the first pick in the hit list (closest? I think so)
bool processPickIntersection (osgUtil::LineSegmentIntersector::Intersections &hitList, std::list< osg::Node * > *excludeNodeList, bool returnHitTriangle, DtOsgIntersector::DtOsgIntersections &intersections)
 returns all the objects picked

Protected Attributes

int myModelSet

Detailed Description

DtOsgIntersector is the OSG-specific implementation of the DtIntersector class.

It provides a variety of methods for finding intersections with the OSG scene graph.


Member Typedef Documentation


Constructor & Destructor Documentation

makVrv::DtOsgIntersector::DtOsgIntersector ( DtDe de,
int  modelSet 
)

CTOR.

DTOR.


Member Function Documentation

virtual bool makVrv::DtOsgIntersector::findNearestIntersectionToPoint ( double  x,
double  y,
double  z,
double  vx,
double  vy,
double  vz,
DtIntersectorResult intersection,
IntersectProperties  properties = AllNodes,
std::vector< DtElementID > *  ignoreList = 0,
bool  returnTriangle = false,
double  maxIsectorLength = -1.,
bool  useHighLod = false 
) [virtual]

Find the nearest scene intersection from a point (x,y,z) along a vector(vx,vy,vz) The useHighLod argument tells the intersector that if the terrain is an osgEarth terrain, don't settle for whatever is paged in; get the highest LOD from the map server for this location and use that Note that if maxIsectorLength is not set, the default is the diameter of the database, which for large (and especially geocentric) databases and world databases, may be too large to get adequate precision when trying to interect small (high resolution) triangles.

It is recommended that you set the isector length to something more specific if possible, like the altitude of the observer + a constant, for example; or, for osgEarth databases, useHighLod=true, which will also eliminate the problem.

Return values:
falseif no intersection was found (and the isect record is NOT set).

Implements makVrv::DtIntersector.

virtual bool makVrv::DtOsgIntersector::findAllIntersectionsThroughPoint ( double  x,
double  y,
double  z,
double  vx,
double  vy,
double  vz,
DtIntersections intersections,
IntersectProperties  properties = AllNodes,
std::vector< DtElementID > *  ignoreList = 0,
bool  sort = true,
bool  useHighLod = false 
) [virtual]

Return a list of all intersections along the line passing through <x,y,z> and directed by <vx, vy, vz> The useHighLod argument tells the intersector that if the terrain is an osgEarth terrain, don't settle for whatever is paged in; get the highest LOD from the map server for this location and use that.

Return values:
falseif no intersection was found (and the isect record list has size 0).

Implements makVrv::DtIntersector.

virtual bool makVrv::DtOsgIntersector::findFirstIntersectWithLineSegment ( double  x,
double  y,
double  z,
double  end_x,
double  end_y,
double  end_z,
DtIntersectorResult intersection,
IntersectProperties  properties = AllNodes,
std::vector< DtElementID > *  ignoreList = 0,
bool  useHighLod = false 
) [virtual]

find first intersection along segment x,y,z to end_x, end_y, end_z.

The useHighLod argument tells the intersector that if the terrain is an osgEarth terrain, don't settle for whatever is paged in; get the highest LOD from the map server for this location and use that

Return values:
falseif no intersection was found (and the isect record is NOT set).

Implements makVrv::DtIntersector.

virtual bool makVrv::DtOsgIntersector::findAllIntersectWithLineSegment ( double  x,
double  y,
double  z,
double  end_x,
double  end_y,
double  end_z,
DtIntersections intersections,
IntersectProperties  properties = AllNodes,
std::vector< DtElementID > *  ignoreList = 0,
bool  sort = true,
bool  useHighLod = false 
) [virtual]

find all intersections along segment x,y,z to end_x, end_y, end_z.

The useHighLod argument tells the intersector that if the terrain is an osgEarth terrain, don't settle for whatever is paged in; get the highest LOD from the map server for this location and use that

Return values:
falseif no intersection was found (and the isect record list has size 0).

Implements makVrv::DtIntersector.

virtual bool makVrv::DtOsgIntersector::pick ( DtChannel channel,
double  mx,
double  my,
DtIntersectorResult intersection,
IntersectProperties  properties = AllNodes,
std::vector< DtElementID > *  ignoreList = 0 
) [virtual]

Find the object (if any) under the mouse mx, my are in window coordinates.

Object is defined as something with a DtUniqueID in it's userData field

Return values:
falseif no intersection was found (and the isect record is NOT set).

Implements makVrv::DtIntersector.

virtual bool makVrv::DtOsgIntersector::pickAll ( DtChannel channel,
double  mx,
double  my,
DtIntersections intersections,
IntersectProperties  properties = AllNodes,
std::vector< DtElementID > *  ignoreList = 0 
) [virtual]

Find all the objects (if any) under the mouse mx, my are in window coordinates.

Return values:
falseif no intersection was found (and the isect record list has size 0).

Implements makVrv::DtIntersector.

bool makVrv::DtOsgIntersector::findNearestIntersection ( double  x,
double  y,
double  z,
double  vx,
double  vy,
double  vz,
DtOsgIntersectorResult intersection,
const DtOsgRenderer::RootList intersectionRoots,
osg::Node::NodeMask  mask = DtOsgNodeFlags::FlagAllOn,
std::list< osg::Node * > *  excludeNodeList = 0,
bool  returnHitTriangle = false,
double  maxIsectorLength = -1.0,
bool  useHighLod = false 
)

Find the nearest intersection from a point (x,y,z) along a vector(vx,vy,vz) stored in a collision point (cx,cy,cz) with normal (normal_x, normal_y, normal_z)

Return values:
falseif no intersection was found (and the intersectionResult is NOT set). Starts the intersection search from intersectionRoot(s).

Will not intersect with excludeNode. Will constrain the Isector used to the specified length if > 0.0 The useHighLod argument tells the intersector that if the terrain is an osgEarth terrain, don't settle for whatever is paged in; get the highest LOD from the map server for this location and use that Note that if maxIsectorLength is not set, the default is the diameter of the database, which for large (and especially geocentric) databases and world databases, may be too large to get adequate precision when trying to interect small (high resolution) triangles. It is recommended that you set the isector length to something more specific if possible, like the altitude of the observer + a constant, for example; or, for osgEarth databases, useHighLod=true, which will also eliminate the problem.

bool makVrv::DtOsgIntersector::findIntersectionsThroughPoint ( double  x,
double  y,
double  z,
double  vx,
double  vy,
double  vz,
DtOsgIntersector::DtOsgIntersections intersections,
const DtOsgRenderer::RootList intersectionRoots,
osg::Node::NodeMask  mask = DtOsgNodeFlags::FlagAllOn,
std::list< osg::Node * > *  excludeNodeList = 0,
bool  returnHitTriangle = false,
double  maxIsectorLength = -1.0,
bool  sort = true,
bool  useHighLod = false 
)

intersect the scene with a line segment going through (x,y,z), directed by <vx, vy,vz>, and large enough to cover the entire sceneGraph, and return all intersections The useHighLod argument tells the intersector that if the terrain is an osgEarth terrain, don't settle for whatever is paged in; get the highest LOD from the map server for this location and use that Note that if maxIsectorLength is not set, the default is the diameter of the database, which for large (and especially geocentric) databases and world databases, may be too large to get adequate precision when trying to interect small (high resolution) triangles.

It is recommended that you set the isector length to something more specific if possible, like the altitude of the observer + a constant, for example; or, for osgEarth databases, useHighLod=true, which will also eliminate the problem.

bool makVrv::DtOsgIntersector::intersectLineSegmentWithScene ( double  x,
double  y,
double  z,
double  end_x,
double  end_y,
double  end_z,
DtOsgIntersectorResult intersection,
const DtOsgRenderer::RootList intersectionRoots,
osg::Node::NodeMask  mask = DtOsgNodeFlags::FlagAllOn,
std::list< osg::Node * > *  excludeNodeList = 0,
bool  returnHitTriangle = false,
bool  useHighLod = false 
)

intersect the scene with a (directed) line segment and return the intersection closest to the initial (x,y,z) The useHighLod argument tells the intersector that if the terrain is an osgEarth terrain, don't settle for whatever is paged in; get the highest LOD from the map server for this location and use that

bool makVrv::DtOsgIntersector::intersectLineSegmentWithScene ( double  x,
double  y,
double  z,
double  end_x,
double  end_y,
double  end_z,
DtOsgIntersector::DtOsgIntersections intersections,
const DtOsgRenderer::RootList intersectionRoots,
osg::Node::NodeMask  mask = DtOsgNodeFlags::FlagAllOn,
std::list< osg::Node * > *  excludeNodeList = 0,
bool  returnHitTriangle = false,
bool  sort = true,
bool  useHighLod = false 
)

intersect the scene with a (directed) line segment and return all intersections The useHighLod argument tells the intersector that if the terrain is an osgEarth terrain, don't settle for whatever is paged in; get the highest LOD from the map server for this location and use that

virtual bool makVrv::DtOsgIntersector::pick ( osgViewer::View &  view,
double  mx,
double  my,
DtOsgIntersectorResult intersection,
osg::Node::NodeMask  mask = DtOsgNodeFlags::FlagAllOn,
std::list< osg::Node * > *  excludeNodeList = 0,
bool  returnHitTriangle = false 
) [virtual]

returns the element id of the object under the mouse (mx, my) if one exists

virtual bool makVrv::DtOsgIntersector::pick ( osgViewer::View &  view,
double  mx,
double  my,
DtOsgIntersector::DtOsgIntersections intersections,
osg::Node::NodeMask  mask = DtOsgNodeFlags::FlagAllOn,
std::list< osg::Node * > *  excludeNodeList = 0,
bool  returnHitTriangle = false 
) [virtual]

returns the element ids of the objects under the mouse (mx, my) if any exists

void makVrv::DtOsgIntersector::getExcludeNodesFromIgnoreList ( std::vector< DtUniqueID > *  ignoreList,
std::list< osg::Node * > &  excludeNodes 
)
static osg::Node::NodeMask makVrv::DtOsgIntersector::nodeMaskFromIntersectProperties ( IntersectProperties  properties) [static]
static bool makVrv::DtOsgIntersector::anyNodeInNodePath ( std::list< osg::Node * > *  n,
osg::NodePath const &  path 
) [static]
osg::Vec3d makVrv::DtOsgIntersector::worldIntersectPoint ( const osgUtil::Hit &  hit) [protected]

Convert a Vec3 from local to world coordinates, maximizing precision.

Use these instead of getWorldIntersectPoint() and getWorldIntersectNormal

osg::Vec3d makVrv::DtOsgIntersector::worldIntersectPoint ( const osgUtil::LineSegmentIntersector::Intersection &  hit) [protected]
osg::Vec3d makVrv::DtOsgIntersector::localToWorld ( const osg::Vec3 &  local,
const osg::Matrix &  localToWorld 
) [protected]
bool makVrv::DtOsgIntersector::findIdFromNodePath ( const osg::NodePath &  nodePath,
DtUniqueID id 
) [protected]
bool makVrv::DtOsgIntersector::fillResultFromHit ( DtOsgIntersectorResult result,
const osgUtil::Hit &  hit,
bool  returnHitTriangle 
) [protected]
Return values:
Returnstrue if an id is found, false otherwise
bool makVrv::DtOsgIntersector::fillResultFromHit ( DtOsgIntersectorResult result,
const osgUtil::LineSegmentIntersector::Intersection &  hit,
bool  returnHitTriangle 
) [protected]
Return values:
Returnstrue if an id is found, false otherwise
osgUtil::IntersectVisitor::HitList& makVrv::DtOsgIntersector::getLineSegmentIntersection ( osgUtil::IntersectVisitor &  collisionVisitor,
double  x,
double  y,
double  z,
double  end_x,
double  end_y,
double  end_z,
const DtOsgRenderer::RootList intersectionRoots,
osg::Node::NodeMask  mask 
) [protected]

Get the intersection of a line segment with the part of the sceneGraph under instersectRoot.

bool makVrv::DtOsgIntersector::processLineSegmentIntersection ( osgUtil::IntersectVisitor::HitList &  hitList,
std::list< osg::Node * > *  excludeNodeList,
bool  returnHitTriangle,
DtOsgIntersectorResult intersection 
) [protected]

returns the first intersection in the hitList (not necessarily the closest)

bool makVrv::DtOsgIntersector::processLineSegmentIntersection ( const osg::Vec3d &  testPoint,
osgUtil::IntersectVisitor::HitList &  hitList,
std::list< osg::Node * > *  excludeNodeList,
bool  returnHitTriangle,
DtOsgIntersectorResult intersection 
) [protected]

returns the intersection closest to the specified test point

bool makVrv::DtOsgIntersector::processLineSegmentIntersection ( const osg::Vec3d &  testPoint,
osgUtil::IntersectVisitor::HitList &  hitList,
std::list< osg::Node * > *  excludeNodeList,
bool  returnHitTriangle,
DtOsgIntersector::DtOsgIntersections intersections,
bool  sort 
) [protected]

returns all intsersections in the hit list

bool makVrv::DtOsgIntersector::processPickIntersection ( osgUtil::LineSegmentIntersector::Intersections &  hitList,
std::list< osg::Node * > *  excludeNodeList,
bool  returnHitTriangle,
DtOsgIntersectorResult intersection 
) [protected]

returns the first pick in the hit list (closest? I think so)

bool makVrv::DtOsgIntersector::processPickIntersection ( osgUtil::LineSegmentIntersector::Intersections &  hitList,
std::list< osg::Node * > *  excludeNodeList,
bool  returnHitTriangle,
DtOsgIntersector::DtOsgIntersections intersections 
) [protected]

returns all the objects picked


Member Data Documentation


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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)