I want to get the points of a triangle mesh and connect them with a polyline, but still keep the winding so that when I draw the polyline and the mesh they look the same.
To explain I am using ofxDelaunay and need the triangle structure as a polyline not a mesh. The get polyline method in ofxDelauney returns a polyline made of all the points used to create the triangle mesh but not in the correct order so when I draw the polyline it looks quite different.
I tried with this code:
vector trianglesFromMesh;
trianglesFromMesh = triangulation.triangleMesh.getUniqueFaces();
ofPolyline myPolyline;
for (int m = 0; m<trianglesFromMesh.size(); m++) {
for (int n = 0; n<2;n++ ) {
myPolyline.addVertex((float)trianglesFromMesh[m].getVertex(n).x/vidWidth,(float)trianglesFromMesh[m].getVertex(n).y/vidHeight);
}
}
But it is not quite right, when I join the verticies together there is still something up with the interpretation of the winding.
Is there a way to get the vertices out of a triangle mesh in the order that they are connected together.
Making each of the faces a closed polyline is way too slow.
Sorry for the unformatted code, I dont get format options in android and with 2g internet I can only load the mobile version.