Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Parametric Line intersections

  1. Mar 20, 2009 #1
    Hello!

    I'm having a pretty big problem intersecting parametric lines. I'm using the equations:
    x = x1 + t(x2 - x1)
    y = y1 + t(y2 - y1)

    Given the 2 lines:
    x = x1 + t(x2 - x1)
    y = y1 + t(y2 - y1)

    x = x3 + t(x4 - x3)
    y = y3 + t(y4 - y3)

    I calculate the intersection, using this:
    t = ( x3 - x1 ) / ( (x2 - x1) - (x4 - x3) )

    And then I would plug it into the first line...

    For some odd reason...it doesn't work! And the funny thing is, that it used to work in my program. I'm not sure if I made any changes, but it's really screwing things up...

    Please help!

    P.
     
  2. jcsd
  3. Mar 21, 2009 #2

    HallsofIvy

    User Avatar
    Staff Emeritus
    Science Advisor

    Why would you think that would work? There is no reason to thing that the same value of the parameter in each line gives the point of intersection. Think of "t" as representing the time some object is at each point on the line. The same t giving the point of interesection would be equivalent to the two objects being at that point at the same time which is not necessary for a point of intersection. To make it clear that the parameters in the two different lines are not necessarily the same, use different letters, say t and s:
    x = x1 + t(x2 - x1)
    y = y1 + t(y2 - y1)
    and
    x = x3 + s(x4 - x3)
    y = y3 + s(y4 - y3)

    set x and y equal:
    x1+ t(x2-x1)= x3+ s(x4- x3) and y1+ t(y2-y1)= y3+ s(y4-y3)
    and you have two equations to solve for the two parameters s and t.
     
  4. Mar 21, 2009 #3
    ARRRG!!!

    I was wondering why it worked before! In my first tests I had used lines of equal length and intersecting in the middle!
    I now understand. I knew that you of course couldn't plug "t" into any of the two...I thought it depended to which equation you plugged it into.
    Anywho, I found a complete equation finding the "t" variable for the first line:
    http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/

    Thanks for your help and explaining anyhow! The more math stuff I start getting through my head, the more I'll be able to learn on my own!

    P.
     
    Last edited by a moderator: Apr 24, 2017
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Parametric Line intersections
Loading...