Ok, I've been wracking my brain over this for 2 weeks. It's time to call in the experts.
See diagram below. Using the coordinate system shown and given Line A with endpoints at coordinates x1, y1 and x2, y2. Can you give me a formula(s) that takes the endpoints of Line A (x1, y1 and x2, y2) and will produce the endpoints of Line B (s1, t1 and s2, t2), where Line B is parallel to Line A and Line B is exactly 5 units away from Line A? An imaginary line from s1, t1 to x1, y1 is 5 units in length and perpendicular to Line A. Line B's length will equal that of Line A. Likewise, I'll need another formula(s) to produce another parallel line, Line C, on the opposite side of Line A.
This is for a railroad computer simulation where a user will draw a line representing a railroad track. I want the computer to be able to draw a parallel track above or below the original exactly 5 units away from the original and the same length as the original. The original track drawn (Line A) can be in any direction.
Thank you for your assistance.
Andrew
See diagram below. Using the coordinate system shown and given Line A with endpoints at coordinates x1, y1 and x2, y2. Can you give me a formula(s) that takes the endpoints of Line A (x1, y1 and x2, y2) and will produce the endpoints of Line B (s1, t1 and s2, t2), where Line B is parallel to Line A and Line B is exactly 5 units away from Line A? An imaginary line from s1, t1 to x1, y1 is 5 units in length and perpendicular to Line A. Line B's length will equal that of Line A. Likewise, I'll need another formula(s) to produce another parallel line, Line C, on the opposite side of Line A.
This is for a railroad computer simulation where a user will draw a line representing a railroad track. I want the computer to be able to draw a parallel track above or below the original exactly 5 units away from the original and the same length as the original. The original track drawn (Line A) can be in any direction.
Thank you for your assistance.
Andrew