I know that for 3 Vector2 points (say points a, b, c) the determinant of the following matrix M is zero if they are one one line:
| ax ay 1 |
M = | bx by 1 |
| cx cy 1 |
But how can I check this for 3 Vector3 points. I wrongly assumed it would be like this:
| ax ay az |
M = | bx by bz |
| cx cy cz |
Is there a similar way to determine that 3 points (Vector3) are on one line in 3D using a matrix and the determinant?
3 Points A B and C are in one line (collinear) in 3D if:
collinear is
truefor points in one line,falseif not in one line.To keep into account any rounding errors or inaccuracies in the vectors it can be necessary to set a precision and use the absolute values:
Different syntax:
Another way is to calculate the surface area of a triangle using those three points A, B and C. They are collinear when the surface is equal to zero:
Or