Suppose I have 3 points. A and B and a C. I want the line segment throu C, parallel to the line on which A and B are.
In the image above I want the A'
and B'
points.
I know I can get the slope of the line between A
and B
and get the line passing through C
with the y = mx + b
formula. But I'm not sure how to get the A'
and B'
points.
Edit
Sorry I didn't give any information about the A'
and B'
points. Basically they're the same points on the new line segment if we map every point to the new line. This means that A'
is a point on the new line with the same distance as C
from AB
's line. Sorry if there's a word in geometry for this. English is not my native language.
Best Answer
The equation of a line through $(x_A,y_A)$ and $(x_B,y_B)$ is
$$A \mathbf{x} + B \mathbf{y} + C=0\\(y_B-y_A) \mathbf{x} + (x_A-x_B) \mathbf{y} + x_B y_A - x_A y_B = 0 $$
The equation of parallel passing through $(x_C,y_C)$ is
$$A \mathbf{x} + B \mathbf{y} + C'=0 \\(y_B-y_A) \mathbf{x} + (x_A-x_B) \mathbf{y} + y_C (x_B-x_A) + x_C (y_A-y_B) = 0 $$
The point on the parallel a line $A \mathbf{x} + B \mathbf{y} + C' = 0$ closest to point $(x_A,y_A)$ is
$$ (x_A',y_A') = \left( \frac{B^2 x_A-A (B y_A+C')}{A^2+B^2},\; \frac{A^2 y_A-B (A x_A+C')}{A^2+B^2} \right) $$
and similarly for the other point
$$ (x_B',y_B') = \left( \frac{B^2 x_B-A (B y_B+C')}{A^2+B^2},\; \frac{A^2 y_B-B (A x_B+C')}{A^2+B^2} \right) $$
with
$$\begin{align} A & = y_B-y_A = -13\\ B & = x_A-x_B = -25 \\ C & = x_B y_A - x_A y_B = 630 \\ C' & = y_C (x_B-x_A) + x_C (y_A-y_B) = 406 \end{align} $$
$$ (x_A',y_A') = \left( \frac{2514}{397}, \; \frac{5140}{397} \right) = (6.33, 12.95) $$ $$ (x_B',y_B') = \left( \frac{12439}{397}, \; -\frac{21}{397} \right) = (31.33, -0.05)$$
Confirmation with Geogebra