Glam Prestige Journal

Bright entertainment trends with youth appeal.

$\begingroup$

How to find a point where $L_1$ and $L_2$ intersect, given that $L_1$ goes through $(x_1,y_1)$ and it's slope is $\alpha_1$ and $L_2$ goes through $(x_2,y_2)$ and it's slope is $\alpha_2$? I tried applying sine theorem but I get two answers instead of one. Doing to Cartesian coordinates complicates things (vertical and horizontal lines should be differently to avoid division by zero in $\dfrac{1}{\sin(\alpha)}$ and $\dfrac{1}{\cos(\alpha)}$ cases.

$\endgroup$ 6

2 Answers

$\begingroup$

Initially, we have $L_1: y – y_1 = m_1(x – x_1)$ and $ L_2: y – y_2 = m_2(x – x_2)$.

If they intersect at (h, k), then just combine the two equations to get $ m_1(h – x_1) + y_1 = m_2(h – x_2) + y_2$

Finally, $h = \dfrac {(m_2x_2 – m_1x_1) – (y_2 – y_1)}{m_2 – m_1}$

$k$ can be found by substituting the value of $h$ back in $L_1$.

Edit:-

The following cases should be checked before applying the formula.

1) If $m_1 = 0$, then from $L_1$, $k = y_1$ and h can be found using $L_2$.

2) If $m_2 = 0$, then ....

3) If $m_1 = 0$ and $m_2 = 0$, then either they never meet or meet at infinitely many points.

4) If $m_1 = \infty$ (i.e. $L_1: x = x_1$), then simply $h = x_1$, and k can be found accordingly.

5) If $m_2 = \infty$, then .....

6) If $m_1 = \infty$ and $m_2 = \infty$, then ......

7) If $m_1 – m_2 = 0$, this means the two lines are either parallel or actually the same line. In the first occasion, the point of intersection can never be found. In the second occasion, there are infinitely many points of intersection.

$\endgroup$ 0 $\begingroup$

Years later I am writing this to answer the precise question that was asked (because I needed it). The solution given by Mick is correct, so I won't repeat his calculations.

The original question asked about lines given by angles, not by slopes. Also when programming, we have to be careful because the mod function is usually not the mathematical mod function.

At the end, I give a function in javascript (where % is the mod or remainder function). The logic does not need seven cases.

CASE 1: if the two angles are equal (mod 180 degrees), then the lines are parallel, and either you have infinite solutions or none at all. Either case is a problem, so we simply throw an error and stop.

CASE 2: Line 1 is vertical (angle1 mod 180 degrees is 90)

CASE 3: Line 2 is vertical

CASE 4: Normal case

The details can be seen from the program below (angles are input in degrees, but calculations are done in radians).

function xsect(x0, y0, a0, x1, y1, a1) { toRad = Math.PI / 180 if ((((a0-a1) % 180) + 180) % 180 === 0) throw parallelError if (((a0 % 180) + 180) % 180 === 90) { // vertical line at x = x0 return [x0, Math.tan(a1*toRad) * (x0-x1) + y1] } else if (((a1 % 180) + 180) % 180 === 90) { // vertical line at x = x0 return [x1, Math.tan(a0*toRad) * (x1-x0) + y0] } let m0 = Math.tan(a0*toRad) // Line 0: y = m0 (x - x0) + y0 let m1 = Math.tan(a1*toRad) // Line 1: y = m1 (x - x1) + y1 let x = ((m0 * x0 - m1 * x1) - (y0 - y1)) / (m0 - m1) return [x, m0 * (x - x0) + y0]
}
$\endgroup$

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy