Hi Robert, An independent RayIntersector class is more legible and extensible to me. The pronunciation of the word 'Ray' is also the same as my first name so it sounds good enough to have an intersector by the name of mine. :-)
The implementation of linesegment/triangle and line/triangle can be similar with each other. But as you pointed out, the testing and clipping by bounding spheres can be different. I'd also like to consider have a SphereIntersector which computes if a sphere is intersected with the scene graph, which may help implement an internal collision test mechanism for OSG scene. Cheers, Wang Rui 2012/8/28 Robert Osfield <[email protected]>: > Hi Rui and John, > > I've done a quick review of Rui's code, your emails and had a more > general think about the issues. > > My current feeling is that we possible should have a completely > different type of interesector for infinite rays, this is both a > conceptual and an implementation issue. > > From the conceptual standpoint the LineSegmentIntersector intersects > the scene graph with a Line Segment, and a Line Segment is not some > one would usually think of as a unbounded at one or both ends. > > Implementation wise the intersection ratio works well for a Line > Segment as it allows would to easily compute the position of the > intersection and any of interpolated attributes along the line > segment. > > For a ray emanating from a point isn't somewhat different, one really > would want to work with a start point and a direction, and the > intersection value you'd likely want to report would be a distance > from the start point. > > So conceptually and interface wise I think we might be better served > by introduce a RayIntersector class for these unbounded intersections > tests. Implementation wise repeating lots of code isn't great so I do > wonder if a RayIntersector might be able to leverage some of the > present LineSegmentIntersector/KdTree code, perhaps either by a > refactor of the LineSegmentIntersector or having the RayIntersector > use a LineSegmentIntersector internally. > > Implementation wise there is obvious a big different between a ray and > line segment for the first test against the scene graph as the ray is > obvious unbounded either at one or both ends, but once you intersect > the topmost bounding sphere of the scene graph being intersected one > now has two end points and therefore a line segment so now one > potentially could leverage the LineSegmenetIntersector and KdTree > codes. > > Thoughts? > Robert. > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
