Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Orientation of three points in 3D space

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2018
    Posts
    9

    Orientation of three points in 3D space

    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:
    https://math.stackexchange.com/quest...ts-in-3d-space
    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.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,962
    Calculate the face normal from the vertices. Then calculate the dot product between the calculated face normal and the stored face normal. If it's positive, the two normals are on the same side of the plane; if it's negative, they're on opposite sides (meaning that the vertex order is reversed).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •