Where two line segments intersect?

algiuxas

New member
Joined
Jul 20, 2016
Messages
2
Hello,

I know two points positions, they make up a continuous line.
There is another line too, and they collide, I need to know where do they collide.

Here I have two examples,
I know two blue points coordinates, and two green points coordinates, I need to find red point position.
I think you understand what I want to do :)

attachment.php
attachment.php

(I'm new in these forums, sorry for my bad English, sorry if I made some mistake here)
 

Attachments

  • Examplgif.gif
    Examplgif.gif
    1.8 KB · Views: 47
  • Example2.jpg
    Example2.jpg
    5.8 KB · Views: 25
Hello,

I know two points positions, they make up a continuous line.
There is another line too, and they collide, I need to know where do they collide.

Here I have two examples,
I know two blue points coordinates, and two green points coordinates, I need to find red point position.
I think you understand what I want to do :)

attachment.php
attachment.php

(I'm new in these forums, sorry for my bad English, sorry if I made some mistake here)

If a line passes through points (x1, y1) and (x2, y2) - what is the equation of the line (as a function of the coordinates of those points)?
 
I know two points' positions; they make up a continuous [straight] line.
There is another line too, and [the two lines intersect]. I need to know where do they [intersect].
So you have two lines, each of which is defined by two points on each line, such as:

Code:
lines:

\             /        \        *d
A*           /         a*    ,-'
  \         *D           \  /
  B*       /              *z
    \     /            ,-' \
     \   *C           /     \
      \ /          ,-'       \
     Z *          *c          *b
      / \
     /   \
Either way, you'd take the points' coordinates, and plug them into various algebraic formulas to get their line equations.

To start, pick a line. Take that line's pair of points, and plug them into the formula for the slope of that straight line. (here) Then pick either one of these points (it doesn't matter which), and plug this point and the slope you just found into the point-slope formula. (here) Solve the resulting equation for "y=". (here)

Do the same for the other line's points.

Now that you have two line equations, you can solve the system for the value of x and y where the two equations are simultaneously true; that is, for the values of x and y where the lines intersect. It would probably be simplest to set the two equations right-hand sides (the parts with the x's in them) equal. Solve for x. (here) Then plug this x-value back into either line's equation, and simplify for the corresponding y-value.

If you get stuck, please reply with a clear listing of your efforts, starting with the coordinates you have and how you plugged those into the slope formula. Thank you! ;)
 
Line defined by two points has an equation:

\(\displaystyle y-y_1=\dfrac{y_2-y_1}{x_2-x_1}(x-x_1) \).

If you have four points \(\displaystyle A(x_a,y_a),B(x_b,y_b),C(x_c,y_c) \qquad and \qquad D(x_d,y_d) \) and lines AB and CD, you have to find the equations of AB and CD using the formula given above as follows:

\(\displaystyle y-y_a=\dfrac{y_b-y_a}{x_b-x_a}(x-x_a) \) . After you have found the equation for AB, you can move on to find the equation of CD. And to find the intersection point, you just plug in 'y' of equation of AB into the equation of CD: \(\displaystyle y_{AB}=y_{CD} \). At that point you will have some expression like: \(\displaystyle ax+b=cx+d \). From that equation you will be able to get 'x' of the intersection point. And if you want to get 'y', you can plug in that 'x' that you got into any of two equations(the one for AB or the one for CD).
 
Last edited:
Top