[Maya C++ API]Flip Triangle edges

Hi guys,

i’m currently writing a verlet cloth solver plugin for Maya, for learning purposes.
(if you’re interested you can find a quick introduction here: http://vimeo.com/71160448).

For solving the cloth i simply use the edges of the input geometry as structural constraints (green).
I now want to implement the shear constraint as seen here (yellow):

I can make that work by iterating over the triangles of the mesh (MFnMesh.getTriangles()),
but that only gives me the current triangulation.
This means i end up with only one yellow line, excpet two forming an X.
Does anybody have a nice idea how i could get the two triangle edges (one representing the current triangulation and the other its flipped equivalent)?

Thanks a lot :wink:

Here is a link to the whole cloth solver article:
http://cg.alexandra.dk/2009/06/02/mosegaards-cloth-simulation-coding-tutorial/

Just a thought, couldn’t you shear constrain the two verts that are:
-not a part of the first constraint
-make up the two triangles that are connected by the edge between the verts involved in the first constraint

I may be way off or totally misunderstanding the question, but let us know how it goes.

I only support quads, but here is how i got it to work (just in case anybody ever has the same problem):
I iterate each face. For each face i get the four edges. For each edge i get the vertexIDs.
I remove all the duplicates from the vertexID list and then i connect them in the order described here.
Never heard of the concept of face vertices before though, but it works ;D

Image