0

Hi I need to find the distance between two non-parallel line at some point on the plane. Below image will show what I really need to achieve.

enter image description here

Where I know the points P1,P2,P3,P4 and C.

How can I find the distance between the line from point C.

Haris
  • 137
  • May you make the question clearer? Which distance do you want exactly? the distance between the point and a line or the distance between the lines? In the latter case, what is the role of the point? – Sumit Kumar Kar May 26 '17 at 07:12
  • Are you looking for the shortest line joining the two given lines passing through $C$? – lesath82 May 26 '17 at 07:21
  • See https://math.stackexchange.com/questions/2287848/distance-between-two-parametric-lines/2288212#2288212 – Michael Hoppe May 26 '17 at 08:05
  • I mean the length of the line(green) passing through the point C – Haris May 26 '17 at 08:17
  • A segment is not a distance. A distance is a non-negative number, and if two lines meet at some point their distance is simply zero. – Jack D'Aurizio May 26 '17 at 09:05
  • The distance of the point $P(x_0,y_0)$ from the line with equation $ax+by+c=0$ is given by $\frac{\left|a x_0+b y_0+c\right|}{\sqrt{a^2+b^2}}$. – Jack D'Aurizio May 26 '17 at 09:07

1 Answers1

2

Let us use algebra and name $(x_i,y_i)$ the coordinates of point $P_i$.

The equation for the line going trough points $P_1,P_4$ is $$y=\alpha + \beta x\qquad \beta=\frac{y_1-y_4}{x_1-x_4}\qquad \alpha=y_1-\beta x_1$$ The line going trough points $P_2,P_3$ is $$y=\gamma + \delta x\qquad \delta=\frac{y_2-y_3}{x_2-x_3}\qquad \gamma=y_2-\delta x_2$$ The equation of the line going though point $C$ is $$y=y_C+m(x-x_C)$$ So, the points of intersection are given by $$X_1=\frac{\alpha +m x_C-y_C}{m-\beta }\qquad Y_1=\frac{\alpha m+\beta m x_C-\beta y_C}{m-\beta }$$ $$X_2=\frac{\gamma +m x_C-y_C}{m-\delta }\qquad Y_2=\frac{\gamma m+\delta m x_C-\delta y_C}{m-\delta }$$ and the square of distance between the points is $$D^2=(X_1-X_2)^2+(Y_1-Y_2)^2$$ which is a function of $m$.

Now, if you want the shortest distance, you need to solve for $m$ equation $$\frac d {dm}D^2=0$$ This is ugly if we do not use numbers but very easy otherwise.

  • I want to find the shortest distance, but line should pass through the point C(C can be any where between the two lines) and intersect the two lines – Haris May 26 '17 at 08:24
  • @Haris.What else did I write ? – Claude Leibovici May 26 '17 at 08:32
  • I have one more doubt, how can I calculate m to use in above equation. Also the points Xc and Yc are x,y co-ordinates of point C right? – Haris May 26 '17 at 10:04
  • 1
    As I wrote, $m$ will be obtained minimizing $D^2$ with respect to $m$. Using numbers, it is very easy as I showed in the example I deleted since it was apparently of no interest to you. Just try with any example of your choice. – Claude Leibovici May 26 '17 at 10:12
  • Can you give me some references please. – Haris May 26 '17 at 10:14
  • Search for minimization of a function. – Claude Leibovici May 26 '17 at 10:16
  • Thanks for the feedback, if I took both Y1 and Y2 same as Cy(y coordinates of C ), then is there any way to solve the problem easily. – Haris May 26 '17 at 10:21