1. ## projecting lines

I have a scheme on projecting lines on another line, but I don't know how to calculate the points that are projected on the lines.

I want to calculate them using the coordinates of the rectangle corners.

2. ## Projecting lines

Hello moment
Originally Posted by moment
I have a scheme on projecting lines on another line, but I don't know how to calculate the points that are projected on the lines.

I want to calculate them using the coordinates of the rectangle corners.
As I understand it, you need to find, using coordinate geometry, the positions of the vertices of rectangles when they are projected onto a series of lines. So, to be specific, I think you're saying that, given a point $\displaystyle P$ (representing a typical vertex of a rectangle) you need to find the position of the projection of $\displaystyle P$ onto a line $\displaystyle l$.

If that's so, then the following may be helpful.

Suppose that $\displaystyle P$ has coordinates $\displaystyle (x_1,y_1)$ and that the equation of the line $\displaystyle l$ is $\displaystyle y = mx + c$. Suppose further that $\displaystyle Q$ is the projection of $\displaystyle P$ onto $\displaystyle l$, and that the coordinates of $\displaystyle Q$ are $\displaystyle (x_2, y_2)$.

Then, because $\displaystyle Q$ lies on $\displaystyle l$:

$\displaystyle y_2 = mx_2 + c$ (1)

and because $\displaystyle PQ \bot l$:

$\displaystyle \frac{y_1-y_2}{x_1-x_2} = -\frac{1}{m}$ (2)

Substitute from (1) into (2):

$\displaystyle \frac{y_1-(mx_2+c)}{x_1-x_2}=-\frac{1}{m}$

$\displaystyle \Rightarrow my_1-m^2x_2-mc=x_2-x_1$

$\displaystyle \Rightarrow my_1 - mc +x_1=x_2(1+m^2)$

$\displaystyle \Rightarrow x_2=\frac{x_1+my_1 - mc}{1+m^2}$ (3)

Substitute into (1):

$\displaystyle y_2 = \frac{mx_1 + m^2y_1 - m^2c + c + cm^2}{1+m^2}$

$\displaystyle \Rightarrow y_2 = \frac{mx_1 + m^2y_1 +c}{1+m^2}$ (4)

So equations (3) and (4) give us the coordinates of Q in terms of $\displaystyle x_1, y_1, m$ and $\displaystyle c$.

Of course, you may be able to simplify these results if you are able to choose a particular origin of coordinates. For example, if the origin can be chosen to lie on the line $\displaystyle l$, then $\displaystyle c = 0$, and equations (3) and (4) simplify to:

$\displaystyle \Rightarrow x_2=\frac{x_1+my_1}{1+m^2}$

$\displaystyle \Rightarrow y_2 = \frac{m(x_1 + my_1)}{1+m^2}$

Or, if you could also choose two lines $\displaystyle l$ at $\displaystyle 45^o$ to the axes, then you can make $\displaystyle m = \pm 1$, and the equations would simplify even further to:

$\displaystyle \Rightarrow x_2=\frac{x_1\pm y_1}{2}$

$\displaystyle \Rightarrow y_2 = \frac{y_1 \pm x_1}{2}$

I hope this gives you some ideas.