# Calculating two end points of a perpendicular line

Discussion in 'General Math' started by Guy, Sep 21, 2005.

1. ### GuyGuest

Hi,

I have been trying to work out the x and y co-ordinates of the two
endpoints of a perpendicular line to a known line.

Specific to my case:

A and B are end points of a line.
A is a stationary point and B a point that can be rotated 360 degrees
around point A at a set distance.
I know the x and y co-ordinates of points A and B and the distance
between these points.
A perpendicular line (with end points C and D) passes through point B
exactly in the middle of point C and D so that CB = BD. The size of
line CD is known.

How do I go about calculating point C and D's co-ordinates.

Thanks very much!

Guy

Guy, Sep 21, 2005

2. ### Jim SpriggsGuest

So let's say B is the point (x_B, y_B).
Perpendicular to what? Since you're working with cartesian
co-ordinates I'll assume that by perpendicular you mean parallel to the
y-axis.
Do you mean B is in the middle of segment CD?
Let's call the length CD, k.
C is (x_B, y_B + k/2) or (x_B, y_B - k/2), you don't have enough data to
say which. D is (x_B, y_B - k/2) or (x_B, y_B + k/2), you don't have
enough data to say which. If you're adding k/2 in C's case you must
subtract it in D's case, and vice versa.

Because you know the x and y co-ordinates of B, A is irrelevant as is
B's motion. Since you have mentioned A, and B's motion, that makes me
think that you don't know B's co-ordinates. If so write back.

Jim Spriggs, Sep 21, 2005

3. ### GuyGuest

Sorry CD is Perpendicular to line AB
Yes B's co-ordinates are known

Guy, Sep 22, 2005
4. ### Sylvain CroussetteGuest

In the following, Ax refers to the x component of A, and Ay refers to
the y component of A. Same thing for B, C, D, AB and pAB.

Compute the vector AB that goes from A to B:
ABx = Bx-Ax
ABy = By-Ay

Compute the vector pAB which is perpendicular to AB:
pABx = -ABy
pABy = ABx

Make this vector pAB a unit vector:
pABx = pABx / sqrt(ABx*ABx + ABy*ABy)
pABy = pABy / sqrt(ABx*ABx + ABy*ABy)

distCD is the known scalar distance between C and D. Compute the
coordinates of points C and D:

Cx = Bx + 1/2 * distCD * pABx
Cy = By + 1/2 * distCD * pABy

Dx = Bx - 1/2 * distCD * pABx
Dy = By - 1/2 * distCD * pABy

I have assumed this is all done in 2d because in 3d a perpendicular
line to AB is not unique so the problem would require more information.

Sylvain Croussette, Sep 22, 2005