How to determine if 3 vertices are in line?


Could anyone please tell me how to calculate if 3 vertices are in a straight line…

So that I can avoid “bad” normal calculations.


Find the slope of the first two points and see if the slope matches for the second two.

Threat the points as vectors. Take the difference of the second two vectors from the first, and then take the cross product of those two (doesn’t matter what order to do it in). The norm of the vector you get is 2 times the area of the triangle those points make. If that area is 0, then the points lie in the same line. This is also good since you can use a very small tolerance constant in case your normals have loss percision because of operations done on them.

Thanks Barry,

If I understand you correctly, I can basically just add a check in my normal caluclation function to determine if the norm is 0 (or very near to it)
then I would know if the normal is “valid”…

I’ll give it a try