I built a program that loads triangle mesh from file. I use Winged Edge data structure to represent triangle mesh. One triangle is represented with three edges which must be in counterclockwise direction. (One edge know it’s previous and next edge)

The problem is how to check the (3d) points orientation in a triangle. One solution was this:

but here the problem is that it is assumed that the normal vector of the face (triangle) is calculated the right way, but that normal can be pointing in two directions and I don’t know if it is the right one.

The other solution was to check the normal vector direction and if it is pointing towards the face (triangle) then the orientation is ok. I can do this if I check the distance from the point at the and of normal vector and the plane represented with three points that forms triangle. And then I invert the normal vector direction, and if the same distance is greater then the first one then the normal is pointing the right direction. But I am having trouble with math, and finding this distance, so if anyone can help I would appreciate it.

Those were my guesses if somebody knows the easier way to find the orientation of edges it would be of great help.

Regards.