A polytope tells you wants inside or outside or bisecting. A BoundingBox is not a good choice to test against as it can get sheared by transforms in the scene graph, while a polytope can handle this just fine, so convert the bounding box into a polytope then do the testing.
On 6/26/06, David Johansson <[EMAIL PROTECTED]> wrote:
Hi Robert, thanks for the reply! Well, its kindof what i want. As of now im working with picking objects in the scenegraph. But eventually i want to be able to select objects inside of an boundingbox. Eg. user draws a box with the mouse, and selects all the objects inside it. I found a example of this at: http://www.openscenegraph.org/osgwiki/pmwiki.php/Tasks/OsgIntersect This is pretty much what i want to be done, find nodes/drawables inside a boundingbox. But, from what i can understand this code is nolonger developed or maintained. And i didn't manage to get the examples running. If i understand correctly the Polytope suggestion you gave me would only give me objects that are intersected. Wich means i wouldn't get objects inside it(?). Since there are functions like: /** Return true if this bounding box intersects the specified bounding box. */ bool intersects(const BoundingBox& bb) const /** Returns true if this bounding box contains the specified coordinate. */ inline bool contains(const Vec3& v) const On the boundingbox it shouldn't be to hard to check if any objects boundingbox is inside the "selected" boundingbox. I figured that there was a way to do this in a similar way as the Linesegment & intersectVisitor does. MVH David Johansson On 6/26/06, Robert Osfield <[EMAIL PROTECTED]> wrote: > Hi David, > > Not quite sure what you are after, is that you want to use a polytope > to intersect with a scene, rather than a line segmenet as > IntersectVisitor does? > > There is a spealized code in src/osgSim/SphereSegmenet.cpp does create > a osg::Polytope > and traversing throught the scene picking out what elements intersect > it. Perhaps this would be useful guide for you. > > BTW, a Polytope can be used to represent a bounding box, by building > it from 6 half space planes. > > > Robert. > > On 6/25/06, David Johansson <[EMAIL PROTECTED]> wrote: > > Hi All! > > > > I have been looking for a while now, but have not found, a way to use > > a BoundingBox and a IntersectVisitor. > > > > I'm not sure if it's currently implemeted, but instead of writing my > > own functions i thought i might just ask. > > As shown in some examples you can use a LineSegment and a > > IntersectVisitor to find node's (geodes) that intersect with a given > > line. Since i am using this to Select objects (sometimes very thin > > lines) with a mouse this does pose a problem. As you need to click on > > the exact pixel to select the object. > > So, i was thinking that maybe you could use a BoundingBox instead, and > > check if any object is inside. So, back to the question.. Is there a > > way to do this allready implemeted into OSG? > > > > Thanks in advance! > > > > MVH > > David Johansson > > _______________________________________________ > > osg-users mailing list > > [email protected] > > http://openscenegraph.net/mailman/listinfo/osg-users > > http://www.openscenegraph.org/ > > > _______________________________________________ > osg-users mailing list > [email protected] > http://openscenegraph.net/mailman/listinfo/osg-users > http://www.openscenegraph.org/ > _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
