Hi Maxime,

Maxime BOUCHER schrieb:
Hi,

 I have a lot of questions for you!
But, there is one really more critical than the others.
 Let me just introduce the problem :).
 (I am sorry if I bother, but I searched on the net, in the doc and examples 
and didn't find answers. I apologize if this is because I badly searched.)

 I want to cut my primitives along the frustum of a camera.

1) To do this I first have to get my planes equations. I have found a page dealing about this problem in OpenGL:
http://www2.ravensoft.com/users/ggribb/plane%20extraction.pdf
 I think I'll use it, replacing in OSG conventions.

I also found this:
http://markmail.org/message/eeolcuruqpsbgrgu#query:osg%20frustum+page:1+mid:eeolcuruqpsbgrgu+state:results
From famous Paul ;).
 Well, it draws the frustum, but it can be used to get the planes equations.

(for whom it may interest)
2)
 Then I have my equations.
Thus I can declare many osg::Plane.
Question
 If the plane is a Vec4d (a,b,c,d) does it well represent the equation
ax+by+cz+d = 0 ?

The plane uses the above plane equation.
(If you are familiar with projective spaces, the Vec4 can be seen
as the projective normal in homogenous coordinates:
(a,b,c,d) dot (x,y,z,w) = 0, where w=1 for affine points )

Note the the representation is only unique up to a
factor (you can always multiply the equation with a
factor != 0.0)

 I would like to use a PolytopeIntersector. In the doc it's written planes 
normals have to point the inside of the polytope.
Question
 How are the normals set when the plane is initialized?

The normal is given implicitly by the representation. Given the above equation, the normal is (a,b,c). You can easily change the direction
of the plane normal unsing its flip()-method.

Question
 Is there any problem declaring a non-closed (also called opened) polytope? I 
don't mind about the far plane.

No problem at all. PolytopeIntersector uses open polytopes internally when the geometry lies to one side of a plane.

3) Once I have a polytope, I would like to intersect the polytope with the 
scene.
 Thus I declare a PolytopeIntersector I associate to an IntersectionVisitor.
The BIG Question
How do I associate the IntersectionVisitor to a model? I saw for a LineIntersector it is possible to associate it to a view via computeIntersections(), but it doesn't seem possible to do the same with polytope.

You call the method accept(osg::NodeVisitor&) of your model (which is a osg::Node).
See the example osgkeyboardmouse.

4)
Question
 Having the intersected points, is it possible to "easily" get the primitive or 
do I have to use this (it is in french, sorry):
http://www.enseignement.polytechnique.fr/profs/informatique/Philippe.Chassignet/03-04/INF_431/td_16.html
(exercise 4)

This exercise is about polygons not polytopes!

As for the PolytopeIntersector: It will give you all points,
lines, triangles and quads which truly intersect the polytope volume,
given by the primitive index.



Thank you a lot!

Cheers,
Maxime

Cheers,

Peter
--
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196

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

Reply via email to