Sign in to follow this  

tris to quads?

This topic is 3461 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

Okay so let's say I have a triangle (in 3d), and I'd like to find all 3 possible triangles that could branch off of it. By branch I mean share two vertices with it, and be on the same plane. Basically a triforce-like shape, starting with just the center triangle. It sounds like I'm getting into some advanced linear algebra here, so I'm hoping there's some math routines somewhere to take care of it. =P And before you ask, yes this is for a good reason. The map editor I'm working with stores planes as three points, and in some cases I'd like to procedurally convert them to quads. Thanks in advance.

Share this post


Link to post
Share on other sites
If there is no adjacency information for the triangles, you have to iterate through the list of triangles to find those sharing a tuple of vertices. Maps are often regular, and hence you may have implicit adjacency information available, speeding up the searching significantly.

You can use the normals of the both triangles then to check whether they are (non-overlapping) co-planar. The normals are then to be computed as the normalized cross-product of the difference vectors of 2 pairs of the 3 vertices.

You can also interpret the one triangle as a co-ordinate basis, and then try to solve the unshared vertex of the 2nd triangle by using the basis. The both triangles are co-planar if solving is possible at all.

But I think implementing the former method (i.e. using normals) is easier, especially when some tolerance due to numerical inaccuracy is considered (and IMHO it should be considered).

Share this post


Link to post
Share on other sites
A really simple way:

pick two vertices v0 and v1 that form an edge of your triangle. v2 is the third vertex.

midpoint = (v0 + v1) / 2
d = v2 - midpoint
new vertex = midpoint - d

This will form a parallelogram.

You can repeat for the other 2 edges to get the other possible third vertices.

Seriously crazy hard linear algebra. Lucky for you I'm a genius that can do it though.

Share this post


Link to post
Share on other sites

This topic is 3461 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this