OpenSceneGraph/include
Robert Osfield 30a06a033e From Peter Hrenka, (note from Robert Osfield, renamed GenericPrimitiveFunctor mention below to TemplatePrimitiveFunctor).
"Since we desperately needed a means for picking Lines
and Points I implemented (hopefully!) proper geometrical tests
for the PolytopeIntersector.

First of all I implemented a new "GenericPrimiteFunctor"
which is basically an extended copy TriangleFunctor which also
handles Points, Lines and Quads through suitable overloads of
operator(). I would have liked to call it "PrimitiveFunctor"
but that name was already used...
I used a template method to remove redundancy in the
drawElements method overloads. If you know of platforms where
this will not work I can change it to the style used
in TriangleFunctor.

In PolytopeIntersector.cpp I implemented a
"PolytopePrimitiveIntersector" which provides the needed
overloads for Points, Lines, Triangles and Quads to
the GenericPrimitiveFunctor. This is then used in the
intersect method of PolytopeIntersector.

Implementation summary:
- Points: Check distance to all planes
- Lines: Check distance of both ends against each plane.
  If both are outside -> line is out
  If both are in -> continue checking
  One is in, one is out -> compute intersection point (candidate)
  Then check all candidates against all other polytope
  planes. The remaining candidates are the proper
  intersection points of the line with the polytope.
- Triangles: Perform Line-Checks for all edges of the
  triangle as above. If there is an proper intersection
  -> done.
  In the case where there are more than 2 polytope
  plane to check against we have to check for the case
  where the triangle encloses the polytope.
  In that case the intersection lines of the polytope
  planes are computed and checked against the triangle.
- Quads: handled as two triangles.

This is implementation is certainly not the fastest.
There are certainly ways and strategies to improve it.


I also enabled the code for PolytopeIntersector
in osgkeyboardmouse and added keybindings to
switch the type of intersector ('p') and the picking
coordinate system ('c') on the fly. Since the
PolytopeIntersector does not have a canonical
ordering for its intersections (as opposed to
the LineSegementIntersector) I chaged the
implementation to toggle all hit geometries.


I tested the functionality with osgkeyboardmouse
and several models and it seems to work for
polygonal models. Special nodes such as billboards
do not work.


The next thing on my todo-list is to implement
a an improved Intersection-Structure for the
PolytopeIntersector. We need to know
which primitives where hit (and where).

"
2007-05-23 11:05:59 +00:00
..
osg From Peter Hrenka, (note from Robert Osfield, renamed GenericPrimitiveFunctor mention below to TemplatePrimitiveFunctor). 2007-05-23 11:05:59 +00:00
osgDB From Mike Weiblen, with mods of using references by Robert Osfield for efficiency. Submission notes from Mike: 2007-05-09 10:01:15 +00:00
osgFX Updated copyright years. 2006-07-18 15:21:48 +00:00
osgGA From Rafa Giatan and Robert Osfield, added support for User defined events, by adding 2007-05-19 13:39:55 +00:00
osgIntrospection From David Callu, " bug: 2007-03-16 14:28:27 +00:00
osgManipulator Added static build support to export macros 2007-05-21 07:54:01 +00:00
osgParticle Removed deprecated drawImplementation(State&) method from Drawable and Drawable::DrawCallback 2007-03-28 11:30:38 +00:00
osgShadow From Eric Wing, pedantic warning fixes 2007-04-06 15:36:13 +00:00
osgSim Fixed const method type 2007-05-21 11:49:37 +00:00
osgTerrain Added TerrainNode::init() and s/getTreatBoundariesToValidDataAsDefaultValue flag. 2007-05-13 09:54:51 +00:00
osgText Reorganised the managment of margins around glyphs so that is done entirely 2007-05-04 12:05:29 +00:00
osgUtil Added code to better compute the view frustum that is appropriate for a traversed 2007-05-15 17:04:57 +00:00
osgViewer Added extra checks to make sure that graphics operations arn't done on no longer valid graphics contexts 2007-05-21 18:46:57 +00:00