# Collinear 3d Points

This topic is 2446 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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?

##### Share on other sites
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.

##### Share on other sites

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)

##### Share on other sites

[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))

##### Share on other sites
Thanks for the replies-They are really useful

1. 1
2. 2
Rutin
19
3. 3
khawk
15
4. 4
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633744
• Total Posts
3013653
×