scenegraph for triangle-data

Started by
5 comments, last by mmakrzem 13 years ago
hey ppl! :)

i'm looking for a tutorial/book/library, which shows/allows me to do the math for picking vertices, edges and faces.

already in use: "minimalistic" opengl-window with camera-movement, triangle-importer and -viewer

i'm glad to read your replies. :)
Advertisement
Moving to Graphics Programming and Theory.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

As far as I know, picking triangles is best solved using ray-cast to scene and testing it against triangles. One ray-tri test is here (Moller test, one of the most famous today) - http://www.cs.virginia.edu/~gfx/Courses/2003/ImageSynthesis/papers/Acceleration/Fast%20MinimumStorage%20RayTriangle%20Intersection.pdf and also theory behind barycentric coordinates: http://mathworld.wolfram.com/BarycentricCoordinates.html (read first this - it might also help you with picking edges).

For point picking I would use replacing them with virtual spheres (not seen) and perform ray-cast against them. Sphere radius would grow with depth from camera (doesn't count for orthogonal projections, just for perspective), so your picking area would be same by distant and close sphere. Writing ray-sphere intersection is just a minute (or thinking it out of the head) with simple quadratic equation ... a little help for ray-sphere: Quite uneffective, but working, although very good explanation and easy to understand (e.g. read first this) http://wiki.cgsociety.org/index.php/Ray_Sphere_Intersection much better here http://www.dreamincode.net/forums/topic/124203-ray-sphere-intersection/ (read after, to see, how it can be computed effectively).

I'm not expert for writing mesh editors (I actually had never written any), but picking can be done this way quite minimalisticaly, in easy way and is quite effective (and if you pack your meshes under Bounding Volume Hierarchies, then bloody effective).

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com

Thank you so much Vilem Otte! :)

I've fitted the triangle-ray-intersection-code into my math-lib. It workes so far, but just from ONE side. Is there an easy way to make it "bothsided"? :)
Well, you could change the sign of the distance back to positive (flipping it if it was negative). Anyway, when I wrote my animator, I use gluUn/gluProject to do the trick, and it worked quite well for me...
I've fitted the triangle-ray-intersection-code into my math-lib. It workes so far, but just from ONE side. Is there an easy way to make it "bothsided"?[/quote]

Just use the code without defining TEST_CULL, e.g. use the path after #else in the code. That will perform double-sided test.

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com


I've fitted the triangle-ray-intersection-code into my math-lib. It workes so far, but just from ONE side. Is there an easy way to make it "bothsided"? :)


If you flip your normal direction then you'll be able to find the solution on the other side.

This topic is closed to new replies.

Advertisement