Jump to content
  • Advertisement
Sign in to follow this  
sgdimitris

Collinear 3d Points

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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))

Sorry about that.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!