When does two line segments intercept?

Creating a new topic here requires registration. All other forums are without registration.

When does two line segments intercept?

Postby Math Tutor » Wed Apr 02, 2014 3:46 am

Suppose you have two line segments.
Every segment is defined by start and end point coordinates.

What is the formula that shows whether the two line segments intercept.
Math Tutor
Site Admin
 
Posts: 429
Joined: Sun Oct 09, 2005 11:37 am
Reputation: 42

Re: When does two line segments intercept?

Postby Guest » Wed Apr 02, 2014 2:33 pm

If they are not parallel then they will intesect somewhere.
I assume you mean intersect rather than intercept.
If they are parallel then both have the same slope and they will not intersect
Guest
 

Re: When does two line segments intercept?

Postby Guest » Wed Apr 02, 2014 6:35 pm

For line 1....x1,y1 is start and x2,y2 is end
For line2.....x3,y3 is start and x4,y4 is end

For line 1....slope is m1= (y2-y1)/(x2-x1)
For line 2....slope is m2= (y4-y3)/(x4-x3)
The lines will intersect when m1 is different from m2.....when (m2 - m1) <> 0 or ( m1/m2) <> 1
The lines are parallel when m1=m2 or [(m2 - m1) = 0] or when m1/m2 = 1 and they won't intersect.
If m1 = -(1/m2) the lines intersect at right angles (90 degrees) so in this case they are perpendicular.
Guest
 

Re: When does two line segments intercept?

Postby Math Tutor » Thu Apr 03, 2014 7:50 am

Here we do not talk about lines and segments.

Suppose you have to write a program.
How will you define that 2 segments intercepts?

Math Tutor
Site Admin
 
Posts: 429
Joined: Sun Oct 09, 2005 11:37 am
Reputation: 42

Re: When does two line segments intercept?

Postby Guest » Thu Apr 03, 2014 9:46 am

Give an example of your syntax for defining lines.
How do you define a line in your syntax.......Doesnt matter whether it intercepts or not
All lines will intercept, only parallel ones will not intercept.

Is it with start and end points....x1,y1 is start and x2,y2 is end
Guest
 

Re: When does two line segments intercept?

Postby Math Tutor » Thu Apr 03, 2014 3:16 pm

It is true for lines and not for segments.

Segments are defined by start and end points.
x1,y1 is start and x2,y2 is the end for the first segment.
Math Tutor
Site Admin
 
Posts: 429
Joined: Sun Oct 09, 2005 11:37 am
Reputation: 42

Re: When does two line segments intercept?

Postby Guest » Thu Apr 03, 2014 4:26 pm

Well then.....What is the question.??
Guest
 

Re: When does two line segments intercept?

Postby Math Tutor » Fri Apr 04, 2014 7:23 am

When does two line segments(by given coordinates) intercept?

Math Tutor
Site Admin
 
Posts: 429
Joined: Sun Oct 09, 2005 11:37 am
Reputation: 42

Re: When does two line segments intercept?

Postby Guest » Sat Apr 05, 2014 5:10 am

You can use the separating axis theorem, see
http://en.wikipedia.org/wiki/Hyperplane ... on_theorem
There are three "separating axis" (not to be confused with the "separating line") you have to check in 2D space:
the axis perpendicular to segment 1
the axis perpendicular to segment 2
the axis parallel to segment 1 (or 2)

R. Baber.
Guest
 

Re: When does two line segments intercept?

Postby leesajohnson » Wed Jun 15, 2016 5:57 am

If the lines are not parallel to each other they will intercept somewhere.

leesajohnson
 

Re: When does two line segments intercept?

Postby Guest » Wed Jun 15, 2016 12:57 pm

Good thinking , leesa

and...... no one mentioned straight lines yet..... just start and end point......segments of lines ......are the long enough to intersect ?? ..... If they were longer they may intersect.....????

..... or are they crooked and intersect several times......??????
Guest
 


Return to Math Problem of the Week



Who is online

Users browsing this forum: No registered users and 6 guests

cron