Advertisement

Is Ray Casting What I'm lookin' for here?

Started by February 09, 2002 08:35 AM
1 comment, last by AbeE 23 years ago
I had a previous post about Quadtrees and stuff and dividing the polygons into nodes. I have starting learning about planes and stuff but I have no idea as to how to detect the coordinates of where the plane intersects the triangle. This is so that I can therefore construct 2 triangles from one with the new vertice if the triangle spans the 2 nodes. Should I be learning ray casting for this or what, I don''t really have a clue. Thanks
No, raycasting is something else. Raycasting is a simplified 2D version of raytracing. It''s used to get per vertex effects, such as reflection, shadows, refraction, etc.

What you need is simple polygon splitting. If you want to split a triangle between 2 nodes, then that is essentially clipping, but you keep both parts, instead of throwing 1 part away (as with clipping). A triangle divided by a plane splits normally into 3 triangle, or into 2 in the special case of the plane going through one of it''s vertices. Just calculate the intersection points between the triangles edge segements and the plane. That will create 2 intersection points, forming a line. Now divide your triangle along this line. You will get one triangle and one quad for the general case. Split the quad into 2 triangles, and you are done.

Your should look into Sutherland-Hodgeman or Cohen-Sutherland clipping algorithms.
Advertisement
>>This is so that I can therefore construct 2 triangles from one with the new vertice if the triangle spans the 2 nodes.<<

why would u want to do this?

http://uk.geocities.com/sloppyturds/gotterdammerung.html

This topic is closed to new replies.

Advertisement