First of all let me clear .. I am not asking about 2D mesh, to determine the winding order of 2D mesh its very easy with normal-z direction.
Second is, I am not ask
Does your mesh include edge adjacency information? i.e. each triangle T contains three vertices A,B,C and three edges AB, BC and CA, where AB is a link to the triangle T1 which shares common vertices A,B and includes a new vertex D. Something like
struct Vertex
{
double x,y,z;
};
struct Triangle
{
int vertices[3],edges[3];
};
struct TriangleMesh
{
Vertex Vertices[];
Triangle Triangles[];
};
If this is the case, for any triangle T = {{VA,VB,VC},{TAB,TBC,TCA}} with neighbour TE = &TAB at edge AB, A and B must appear in the reverse order for T and TE to have the same winding. e.g. TAB = {{VB,VA,VD},{TBA,TAD,TDA}} where TBA = &T. This can be used to give all the triangles the same winding.