Hi, not sure if it'll be any help, but just to point out that
osg::LineSegment
has intersect methods which take a boundingbox and return intersection
distances along the segment with the boundingbox.
-charlie
David Johansson 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/
--
============================
Charles Cossé, Ph.D.
Physics & Software R&D
Physical Science Laboratory
New Mexico State University
[EMAIL PROTECTED]
505.522.9291 (voice)
505.522.9428 (fax)
============================
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/