polygon triangulation

Started by
20 comments, last by FugueInCPP 19 years, 9 months ago
Quote:Original post by taurean
Well, I understood the above concept of shifting each 3D vertices to 2D vertices. How does this differ from finding the normal of the polygon by taking cross - product of 2 vectors of adjacent sides of polygon; and then with the absolute coefficients of N.x, N.y, N.z; strip the one coefficient from 3d vertices that is greater than the other two to make the 2d set of vertices. (This doesn't involve any rotation or matrix either !! )
~ Matt


What you describe is exactly the same thing. And, actually, you ARE effectively using a rotation matrix, :). You are just doing the steps without formally putting the numbers into a data structure that you call a matrix. But the math is the same and the matrix is hidden in there.

Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Advertisement
Hi Taurean -

I just briefly skimmed the replies, so I apologize if this is already been covered, but holes or "islands" as they're usually referred to are very easy to implement in a 2D ear clipping routine. I do not have any experience with true 3D triangulation, but have had a lot of luck using 2D ear clipping.

To carve islands into your shape is really quite straightforward:

1) Determine what order your polygon verts are in (clockwise, anti-clockwise).

2) Reverse the order of your island verts such that they the opposite order of your polygon verts.

3) Find the closest vert on your polygon to the left-most vert on your island shape.

4) Now insert the island verts into your polygon verts "after" the point you found in step 3. Now add the point from step 3 after the island verts (so this point now occurs both before and after the island verts in your polygon shape).

You're done! The ear clipping routine will correctly triangulate around this island shape. You can also chain islands together in this same manner.

Also, for my 2D ear clipper, the only real math I needed was the following two functions:

- Get_Side_Of_Line (): given a point and a line.
- Are_Any_Verts_Inside_Tri (): implemented with barycentric coordinates to decrease numerical roundoff error.

Good luck!

This topic is closed to new replies.

Advertisement