checking all points on a line rather than just one against another line

Started by
4 comments, last by grhodes_at_work 19 years, 2 months ago
if i have two lines, and both of their end points and equations, is there a way i can do a check of one line against the other, rather than testing every point of one line against the other?
I currently only use c# and directX9, in case its relivant and i didnt mention it in the post
Advertisement
yes.

would you like to know it?

google is your friend.

seriously, half the topics on this board are by you, and this wouldnt be the first one that could be answered by a ten second google search.
i have done a google search on this and can only find the intersection of a point on a line, but no formula to check all points of one line against another. anyway, are forums not where people come to ask questions? my questions might seem basic to you, but they are quite difficult to me, so just because you understand, dont think anyone else does. if the admin has a prob with all my posts he'l deal with it. you are not the forum admin
I currently only use c# and directX9, in case its relivant and i didnt mention it in the post
Quote:Original post by fguihen
i have done a google search on this and can only find the intersection of a point on a line, but no formula to check all points of one line against another.

no surprise, since that doesnt even make the slightest bit of sense. there are infinitly many points on a line, so checking them all doesnt seem like a good idea to me.

google for 'line intersection' (not that hard to come up with, is it?)

first and third links give equal but respectively precise and short answers to your question.

Quote:
anyway, are forums not where people come to ask questions? my questions might seem basic to you, but they are quite difficult to me, so just because you understand, dont think anyone else does. if the admin has a prob with all my posts he'l deal with it. you are not the forum admin

im not. nonetheless i feel its my right aswell as my duty to try and make you a little less dependant.
I agree with eelco

I typed this in google:

"line intersection 2d"

Wasn't very hard to find the info! As usual google came up with the goods. By the way this guy's website has loads of geometrical goodies!
______________________________________________________The problem with designing something completely foolproof is tounderestimate the ingenuity of a complete fool. - Douglas AdamsEmail: thefatgecko@yahoo.co.ukhttp://www.geocities.com/thefatgecko
Folks,

I don't find anything wrong with fguihen's question. Yes, it is a bit naive, but that's okay. As long as posts remain approximately on topic (game development and specifically not requests for solutions to school problems + the usual general forum rules), then they can remain open. The wording on this one sounds on-topic-ish, so I have no problem with the post. Please do not be so quick to attack!

That said, I agree with Eelco and TheFatGecko. The answer isn't checking all the points on the line individually (impossible to do), but to solve the line/line intersection problem.

TheFatGecko's link does contain the answer, in 2D and 3D, but I don't like the organization of the site. So, here are some directly links:

Intersection Point of Two Lines (2 dimensions)

Shortest line between two lines in 3D

Those two pages compute the intersection or nearest point of two lines quite smartly.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

This topic is closed to new replies.

Advertisement