How to find position of point that is x unit distant from AB line segment and y unit distant from BC line segment?

1k Views Asked by At

Representation image

I am trying to calculate coordinates of point P, which is x units distant from AB line segment and y units distant from BC line segment.

Edit: I am trying to write code for general solution. As parameters, I have three points (coordinates) A, B and C and also two values for distance x and y.

3

There are 3 best solutions below

1
On BEST ANSWER

Hint:

Without loss of generality we can assume that $B$ is the origin and $C$ is a point on the $x$ axis. Changing a bit your notation, let $P=(x_P,\pm b)$ where $|b|$ is the distance from $BC$ (your $y$). If we have $A=(x_A,y_A)$ than the line $BA=r$ has equation $ y_Ax-x_Ay=0$.

The distance $a$ of $P$ from this line $r$ is: $$ \overline{Pr}=\frac{|y_Ax_P\mp x_Ab|}{\sqrt{x_A^2+y_A^2}}=a $$ Solving this equations you can find all points $x_P$.


If all the points $A,B,C$ are given in some coordinate system, then you have to perform a change of coordinates, that, in general, is given by a translation and a rotation. Or you can find the equations of the two lines: $$ a_1x+b_1y+c_1=0 \qquad a_2x+b_2y+c_2=0 $$

and solve the system of the two equation for the distances of the point $P$ from these two lines.

2
On

We can, without loss of generality, assume a coordinate system with origin at B and x-axis along line BC. Then line AB can be written as y= mx.

Since I am using an xy-coordinate system, I am going to call the distance to the given point, from line AB, "p" rather than "x" and the distance to line BC "q" rather than "y".

Let the given point have coordinates, in this coordinate system, $(x_0, y_0)$. Then we must have $y_0= q$. The distance from (x0, y0) to line AB is $\frac{|mx0- y0|}{\sqrt{m^2+ 1}}= p$.

Solve those two equations for $x_0$ and $y_0$.

4
On

There are various ways to do this.

You could set up an equation for the distance from an arbitrary point $(u,v)$ to the extended line $AB$, and another equation for the distance from an arbitrary point $(u,v)$ to the extended line $BC$. (I can't write the coordinates of the point as $(x,y)$ since you already used those symbols to mean something else.) Solve these simultaneous equations for $u$ and $v$. You will get four solutions, but three of them are either on the wrong side of $AB$ or the wrong side of $BC$ so you reject them.

Another way, find the equation of a line parallel to $AB$ but at distance $x$ from $AB$, on the same side of $AB$ as $C$ is, and the equation of another line parallel to $BC$ but at distance $y$ from $BC$, on the same side of $BC$ as $A$ is. Find the intersection point of those two lines by solving these equations simultaneously.

Either of these methods requires some work. You might do just as well to use Emilio Novati's method, including the change of coordinates.