[osg-users] Shape Intersection
Andreas Goebel
a-goebel at gmx.de
Sat Feb 2 14:56:50 PST 2008
Renan Mendes schrieb:
> Hi everyone,
>
> I need to detect when two shapes intersect and I need to know
> the point (or set of points) where it happens. I'm using shape
> drawables and I've been told that OSG doesn't have any support in that
Hi Renan,
why don´t you do it the "mathematical" way? What I mean by this is: If
you have simple shapes like spheres, planes, triangles, boxes, then you
can compute their intersection by using math alone, without the need of
OpenGL or the scene graph.
Like this: You have two spheres. The intersection is a circle. You can
easily compute the midpoint, radius and normal vector of this circle. A
book that covers most of those methods is "Geometric Tools for Graphics".
If you do it the "graphic" way, a sphere consists of triangles. If you
intersect two spheres graphically, you intersect two sets of triangles
and get a set of segments as a result. The plane-intersector in the OSG
does it like this. This is very useful if you do not know what the
objects you intersect with look like. But in your case (only simple
shapes), I would compute it mathematically.
But (no offence meant, just a hint) if you have problems computing the
intersection of a line and a plane (which you said in another thread)
then this will be quite difficult for you.
Regards,
Andreas
More information about the osg-users
mailing list