Distance along the perpendicular line

1 view (last 30 days)
Devinya Herath
Devinya Herath on 27 Sep 2011
I have two line segments seg1 and seg2. The starting and ending points of each line segment is known. For example seg1=(x1,y1),(x2,y2) and seg2=(x3,y3),(x4,y4). I want to draw a perpendicular line through the mid point of seg1 (let's assume the mid point is (x0,y0)). Then I want to check whether this perpendicular line touches(crosses) seg2. If it crosses, then I want to calculate the distance along the perpendicular line to this crossing point(not the perpendicular distance from (x0,y0) to the crossing point/seg2)
Furthermore, I want to find the sign (+ or -) of the distance. i.e: If the seg2 is on the right side, the sign should be positive(+) and if it is on left, the sign should be negative (-).
Please help.
  5 Comments
Jan
Jan on 27 Sep 2011
@Devinya: The problem is clear. What have you done so far?
Devinya Herath
Devinya Herath on 27 Sep 2011
I have calculated M, the perpendicular line and C

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!