How to find co-ordinates of a line(of specific length) that touches two lines of different slope?

103 Views Asked by At

I am trying to find (m1,n1) and (m2,n2) co-ordinates from the following figure. The line D has a specific length(i.e. 9.5).

I am trying to find the co-ordinates respective to (x3 and y3) co-ordinate. For example, Let's say co-ordinates are as follow: (x1,y1)=(0,0), (x2,y2)=(100, 800), (x3,y3)=(1000, 400), (x4,y4)=(500,0)

Can anyone help please?

Thanks in Advance.

enter image description here

1

There are 1 best solutions below

2
On

Let’s call the vertex with coordinates $(x_i,y_i)$ $P_i$. Let $\mathbf u = {P_4-P_3 \over \|P_4-P_3\|}$ and $\mathbf v = {P_2-P_3 \over \|P_2-P_3\|}$ be the two unit vectors in the directions of the adjacent vertices to $P_3$. Then $(m_1,n_1) = P_3+\lambda\mathbf u$ and $(m_2,n_2)=P_3+\mu\mathbf v$ for some nonnegative values of $\lambda$ and $\mu$. The distance between these two points is fixed at $d$. Subtracting one endpoint from the other and squaring the norm of the resulting vectors produces the constraint $$\left(\lambda\mathbf u-\mu\mathbf v\right)\cdot\left(\lambda\mathbf u-\mu\mathbf v\right) = \lambda^2-2(\mathbf u\cdot\mathbf v)\lambda\mu+\mu^2 = d^2.$$ The coefficients of the squared terms are $1$ because both vectors have unit length, and $\mathbf u\cdot\mathbf v$ is equal to the cosine of the angle $\theta$ between the two edges that meet at $P_3$.

This is the equation of an ellipse rotated 45 degrees from standard position. We’re interested in the arc that lies in the first quadrant. When $0\lt\theta\lt\pi/2$, the ellipse’s major axis lies in this quadrant, and both $\lambda$ and $\mu$ range from zero to $d \csc\theta$. On the other hand, when $\pi/2\lt\theta\lt\pi$, the ellipse’s minor axis is in this quadrant and $\lambda,\mu\in[0,d]$. When $\theta=\pi/2$, this ellipse is a circle and so also $\lambda,\mu\in[0,d]$. If you fix $\lambda$ you get a quadratic equation in $\mu$. When $0\lt\theta\lt\pi/2$ and $\lambda\ge d$, there will be two nonnegative solutions, otherwise, there will only be a single $\mu\ge0$ that satisfies the equation for a given $\lambda\ge0$.

Using the values from your question, we have (approximately) $\mathbf u = (-0.7809,-0.6247)$, $\mathbf v = (-0.9138,0.4061)$ and $\mathbf u\cdot\mathbf v = 0.4599$, with resulting equation $$\lambda^2-0.9197\lambda\mu+\mu=90.25.$$ The dot product of the two unit vectors is positive, which means that the interior angle at $P_3$ is acute and both $\lambda$ and $\mu$ range from zero to a maximum of $$d \csc\theta = {d\over\sqrt{1-\cos\theta}} = {d\over\sqrt{1-(\mathbf u\cdot\mathbf v)^2}} = 10.70.$$ Setting $\lambda$ to, say, $10.0$ fixes $(m_1,n_1)$ at $(992.2,393.8)$ and gives you the quadratic equation $\mu^2-9.197\mu+9.750=0$ with roots $1.223$ and $7.974$, so there are two segments from this point that have length $9.5$: their other endpoints $(m_2,n_2)$ are $(998.9,400.5)$ and $(992.7,403.2)$. On the other hand, for $\lambda=1$, $(m_1,n_1)=(999.2,399.4)$. The resulting quadratic equation in $\mu$ also has two roots, but one of them is negative, so we discard it leaving only $(m_2,n_2)=(990.9,404.0)$. You should work through the details of this and a few more examples for yourself.