Simon Hammett schrieb:
2009/5/21 Matthias Gabriel <[email protected]>:
Hi,
today i wanted to build my own "LineSegmentIntersector" - well some kind
of... while doing this, i looked into the sourcecode of the
LineSegmentIntersector. There I saw, that the tests in
"LineSegmentIntersector::intersects(..)" refer to start and end point of the
lsi on the one hand, and to boundsphere.center()/radius() on the other hand.
But here is my Problem. Start and end- points are in world coordinates,
while the boundingsphere is in local coordinates...somewhere here in the
newsgroup a read, that boundingssphere only refers to their children..

I came to this problem, while implementing my own
Intersect-Bounding-Algorithms, where i get wrong results... Why is the
original LinesegmentIntersector working or: is it actually working?

At which point am i missunderstanding this?

Thanks für your Help,
MG

As you traverse the scene graph, you maintain a matrix stack in the same way
that open gl does.
Enter a transform, push your stack, multiply the transform into it.
Leave a transform and pop your stack.

Then when you want to do the intersection, you can either transform the bounding
sphere into world coordinates or transform your pick ray into local coordinates.

It's easier to transform the ray, but then you have to pay for a matrix invert.


Hi Simon,

i looked at the source code and then i saw my mistake. In the iv->apply(osg::Transform); method, the IntersectionVisitor pushs the model matrix. After that, the LinesegmentIntersector will be transformed to this local coordinate system via the lsi->clone() method... So in every case we will compute (and pay for) the matrix inverse (except traversing upwards?!).

Thank you for your reply, now i know how it is working!

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to