View Full Version : How to determine if 3 vertices are in line?
06-13-2005, 08:42 AM
Could anyone please tell me how to calculate if 3 vertices are in a straight line..
So that I can avoid "bad" normal calculations.
06-13-2005, 09:46 AM
Find the slope of the first two points and see if the slope matches for the second two.
06-13-2005, 05:12 PM
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.
06-14-2005, 08:38 AM
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
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.