Hello Jean-Sébastien,

it no big deal for me, coding around OpenSceneGraph is my hobby ...
... to keep a bit on track and good for my brain.

A made some other code to select geometry objects within a box.
The scenario is that I place 1.000 cows.osg (transform + scale) in a world cube 
of 200,200,200.
Then I do an intersection for each cow with a given SelectionBoundingBox (max: 
200,200,200).
For each node I do " ... nodeBoundingBox.intersects(selectionBoundingBox); ..."
This is very, very fast, <1sec for 1.000 cows.
But some nodes could be outside the selectionBoundingBox, because the box of 
the node has an intersection with the SelectionBoundingBox and not the node 
itself.

To be more accurate I made another try, using PolytopeIntersector

For each node I do ...
            osg::Polytope polytope;
            polytope.setToBoundingBox(selectionBoundingBox);
            PolytopeIntersectorRef boxContent = new 
osgUtil::PolytopeIntersector(polytope);

            GroupRef group = new osg::Group;
            getWorldGroup(group.get()); // own func. to get the node with the 
transforms to the world position

            IntersectionVisitorRef intersectionVisitor = new 
osgUtil::IntersectionVisitor(boxContent..get());
            group->accept(*intersectionVisitor);
            osgUtil::PolytopeIntersector::Intersections intersection = 
boxContent->getIntersections();
            if (intersections.size())
            {
              ...

This example computes me the exactly the nodes inside the box but it's slower.
I takes about 6-7minutes for the 1000 cows.

- Any idea to speed up this procedure?
- How can I use "setDimensionMask(DimZero)"? Is this faster? How put I then the 
points of the nodes into the intersection algo?

Many thanks for any kind of help.

Karl ...


=================

---------- Forwarded message ----------
From: Jean-Sébastien Guay <[EMAIL PROTECTED]>
Date: 18 Nov., 22:44
Subject: [Newbie]: PolytopeIntersector in WINDOW CoordinateFrame is not working 
as expected
To: OpenSceneGraph Users


Hi Karl,

> hey, you are a hero ... It's working, fine.

Glad I could help. Seems we're doing similar things... :-)

> Do you have any experience in terms of performance when expanding a rect 
> (dragging like a rubberband) over a huge number of models (ex. hundreds or 
> thousands of cow.osg) and computing the intersection in a EventHandler 
> depending on mouse positions?

That's exactly what I'm doing, and it's pretty slow. Even compared to a
single LineSegmentIntersection without kd-trees, a relatively complex
geometric object takes a few seconds to be selected if I make a
box-selection that contains it all. If I make a smaller box it's faster
of course.

I'll be looking into using the kd-tree to do PolytopeIntersections in
the near future, to speed this up. Although, I've been having weird
results profiling this... It seems like STL operations
(additions/removals from STL containers) are taking a sizable amount of
time, even in release mode.

Anyways, that will wait until the basic functionality is in place, which
won't happen until I get this graphics context deadlock fixed...
(another thread)

J-S
--
______________________________________________________
Jean-Sebastien Guay    [EMAIL PROTECTED]
                               http://www.cm-labs.com/
                         http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[EMAIL 
PROTECTED]://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph...



      

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to