First you have to find this slope of the first line. Get y2-y1, and put it over x2-x1. Say it is 5/3. Next you find the slope of the perpindicular line by getting the negative reciprical. For this is would be -3/5. I'm not sure what you mean next, but once you have the slope it shouldn't be hard to find the endpoint of a segment, as long as you have a starting point for this segment. Anyway, I probably didn't answer that right because I don't totally understand what you're asking. . .
2d math question
If (x1,y1) to (x2,y2) is the first line you need to find a point (x3,y3) so that the line (x1,y1) to (x3,y3) is of length L and perpendicular to (x1,y1) to (x2,y2), right?
Something like this should do the trick:
a= L / L1
x3=x1 + a * -(y2-y1)
y3=y1 + a * (x2-x1)
L1 is the length of the first line. Just off the top of my head so I might've screwed it up !!
/Niels
<b>/NJ</b>
Just general help, if all else fails--turn to a math book or website. The other responces are correct, they just might be a little difficult to understand.
November 25, 1999 04:01 AM
Say you have an arbitrary line in 2d space with endpoints x1,y1 and x2,y2. Is there a computationally efficient way that I can calculate the endpoint of a line
of length (L) perpendicular to the line defined by endpoints x1,y1 and x2,y2.
of length (L) perpendicular to the line defined by endpoints x1,y1 and x2,y2.
Your help is greatly appreciated. If at all possible, can someone give me a detailed answer with example.
November 25, 1999 04:01 AM
Just to try to finish the other reply, take the x_slope and y_slope L is the length of the line. k
,
x_slope = ylen/xlen
y_slope = xlen/ylen
x3 = L*x_slope
y3 = L*y_slope

x_slope = ylen/xlen
y_slope = xlen/ylen
x3 = L*x_slope
y3 = L*y_slope
Try somtin like dat, hope it works, not exactly sure about the length of the line, but yo probaly figure it out ,
jus tryin ta help,
later
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement