please help me find intersection between two line segments

Let's talk about algorithms!

Moderator: Board moderators

Post Reply
ahmadfarid
New poster
Posts: 6
Joined: Sun Apr 23, 2006 5:47 pm
Location: Cairo
Contact:

please help me find intersection between two line segments

Post by ahmadfarid »

I know that's a trivial problem but I can't find an easy simple general equation for it.

Given two line segments AB & CD how to determine if they intersect or not and get the point of intersection. If I have the X, Y coordinates. Ax, Ay, Bx, By, Cx, Cy, Dx, Dy.

Something else, If it was between a straight line and a line segment. AB: Ax, Ay, Bx, By and the straight line equation: y = Cx + D

andmej
Experienced poster
Posts: 158
Joined: Sun Feb 04, 2007 7:45 pm
Location: Medellin, Colombia

Re: please help me find intersection between two line segments

Post by andmej »

Runtime errors in Pascal are reported as Wrong Answers by the online judge. Be careful.

Are you dreaming right now?
http://www.dreamviews.com

Post Reply

Return to “Algorithms”