Solving for a coordinate along an axis given a triangle (3 coordinates)

37 Views Asked by At

Not sure what the best, or most descriptive title is but here is my problem:

I have added a picture to help clarify it. I am trying to solve for the diamond position, more specificly I really only need the x (assuming x is red) distance to the line P1->P2. In the picture P2 is just Y translated relative to 0/0 but it may not always be the case.

How can I solve for this distance/position with respect to P1/P2 (they are not always fixed) but relative to 0/0.

enter image description here

1

There are 1 best solutions below

0
On

enter image description here

Since $\triangle OXP_2\sim\triangle AP_1P_2$,

\begin{align} \frac{|XO|}{|P_2O|} &= \frac{|P_1A|}{|P_2A|} ,\\ X_x&= \frac{|P_{2y}|\cdot|P_{1x}|}{|P_{1y}-P_{2y}|} . \end{align}