Hello to all members,
I would like to ask something very simple.
Given three Points
(x1,y1,z1)
(x2,y2,z2)
(x3,y3,z3)
When these points are collinear?
Collinear 3d Points
You can check if the determinants
|x1 y1 1|
|x2 y2 1|
|x3 y3 1|
and
|x1 z1 1|
|x2 z2 1|
|x3 z3 1|
are both zero.
EDIT: Another method is checking if the length of the cross product of (P2-P1) and (P3-P1) is zero.
EDIT: Another method is checking if the dot product of (P2-P1) and (P3-P1) is either -1 or 1.
|x1 y1 1|
|x2 y2 1|
|x3 y3 1|
and
|x1 z1 1|
|x2 z2 1|
|x3 z3 1|
are both zero.
EDIT: Another method is checking if the length of the cross product of (P2-P1) and (P3-P1) is zero.
EDIT: Another method is checking if the dot product of (P2-P1) and (P3-P1) is either -1 or 1.
EDIT: Another method is checking if the dot product of (P2-P1) and (P3-P1) is either -1 or 1.
You probably meant normalize(P2 - P1) . normalize(P3 - P1)
[quote name='alvaro' timestamp='1333652206' post='4928565']
EDIT: Another method is checking if the dot product of (P2-P1) and (P3-P1) is either -1 or 1.
You probably meant normalize(P2 - P1) . normalize(P3 - P1)
[/quote]
Oh,right. I meant to compute the cosine between the vectors P2-P1 and P3-P1, which is
dot_product(P2-P1, P3-P1)/(length(P2-P1)*length(P3-P1))
Sorry about that.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement