I need to get the second point in a line segment knowing its first point, distance and perpendicular line segment. The line segments need to intersect , thus the direction of the incomplete line segment could differ based on the location of its first point. The problem I have now is that I don't know how to obtain the direction of the incomplete line segment.
This is what is known:
a1 = (30, 30)
a2 = (10, 30)
b1 = (30, 35)
d = 30 (distance of line segment b)
I tried the following:
Get perpendicular slope a.
m = (b2.x - b1.x) / (b2.y - b1.y);
Get horizontal direction.
hd = ? // either 1 or -1
a2.x = a1.x + d * cos(atan(m)) * hd; a2.y = a1.y + d * sin(atan(m));
I am missing the step to get the horizontal direction of the slope of
b, I was unable to recognize the pattern. Or perhaps there is a better and shorter algorithm to figure out point