Jump to content
  • Advertisement
Sign in to follow this  
skjinedmjeet

Best way to split a triangle

This topic is 3872 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What is the best algorithm for splitting a triangle, keeping in mind that the triangle has UV coords that must be kept perspective correct when split. Will simply interpolating the UV coordinates to the point of intersection along the edge of the polygon yield correct results? The goal, obviously, is that when one triangle is split into to, the two should render and appear as one continuous triangle. The triangle will always be split along one of the primary axis (X,Y, or Z)

Share this post


Link to post
Share on other sites
Advertisement
I suppose it would be silly to ask why you're doing this - the two resulting triangles will be coplanar, and if the appearance of the result (the 2 rendered triangles) should be identical to that of the original (the un-split triangle), then you lose efficiency.
If you're trying to decompose or tesselate an object (such as a theoretical or mathematical shape), try this explanation to start.

I think you are correct in your approach to the UV coordinates - interpolation is exactly what OpenGL uses when rasterizing the texture to the screen.

Share this post


Link to post
Share on other sites
The "best" method that I can think of, for triangle ABC is to take point D, in the middle of line AC, and then form triangles ABD and BCD.

klaymore142 is correct, however, your two triangles will be coplanar. If you intend to render a scene with a lot of lighting, consider using lightmaps instead. The new point, point D, would be halfway between points A and C on the UV map.

Share this post


Link to post
Share on other sites
Try searching for "triangle longest edge bisection". I think this is what speciesUnknown talks about too.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!