Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

AyaKoshigaya

Line-Line Intersection in 3D

This topic is 5461 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

Advertisement
Bad idea to do line-line intersection, as it''s subject to floating point error. Your options:

1. cylinder-line intersection, which''ll tell you whether the lines are "close enough" to each other.

2. line-line distance, which''ll tell you how close they are.

3. Plucker coordinates, which''ll tell you which "side" of one line the other line is on. If it''s different than before, the lines intersected at some point.

Which you choose depends heavily on what you''re actually trying to do. So: What are you actually trying to do?


How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
quote:
Original post by AyaKoshigaya
Hi,

ok... line-line distance is the best I think..

Did you know how to calculate this??

Au''revoir,
Aya~

Yeah..... but I posted it recently, so you should be able to search for it. The basic idea is to find the projection of the intersection onto the plane that both lines are parallel to, then back-track that projection to the points on each line, then compute the distance between them.


How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
if one line contains A and B, while the other C and D:
(pseudocode)
dist=normalize(AB x CD) . AC
You can use any points instead of A and C which are on each line respectively.

Share this post


Link to post
Share on other sites
The only problem is if he meant line segments, in which case you can''t do just a line-line distance check. Any two coplanar line segments will give you a zero distance, but they might not always intersect.

Share this post


Link to post
Share on other sites

  • 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!