Re: Python Line Intersection

Discussion in 'Python' started by Emile van Sebille, Apr 9, 2010.

  1. On 4/9/2010 8:04 AM Peyman Askari said...
    > Hello
    >
    > This is partly Python related, although it might end up being more math related.
    >
    > I am using PyGTK (GUI builder for Python) and I need to find the intersection point for two lines. It is easy to do, even if you only have the four points describing line segments (http://www.maths.abdn.ac.uk/~igc/tch/eg1006/notes/node23.html). However, it requires that you solve for two equations. How can I do this in Python, either solve equations, or calculating intersection points some other way?


    I needed this a couple years back and used parts of pycad without much
    difficulty.

    Emile
    Emile van Sebille, Apr 9, 2010
    #1
    1. Advertising

  2. Emile van Sebille

    Josh English Guest

    On Apr 9, 8:36 am, Emile van Sebille <> wrote:
    > On 4/9/2010 8:04 AM Peyman Askari said...
    >
    > > Hello

    >
    > > This is partly Python related, although it might end up being more math related.

    >
    > > I am using PyGTK (GUI builder for Python) and I need to find the intersection point for two lines. It is easy to do, even if you only have the four points describing line segments (http://www.maths.abdn.ac.uk/~igc/tch/eg1006/notes/node23.html). However, it requires that you solve for two equations. How can I do this in Python, either solve equations, or calculating intersection points some other way?

    >
    > I needed this a couple years back and used parts of pycad without much
    > difficulty.
    >
    > Emile


    You can also do this by creating a Python representation of a line. I
    did it by creating a vector class (using named tuple) and a line class
    that stored a point and a direction vector. From there, you can find
    the intersection of two lines (or a line with a circle, triangle, etc.
    through some mathematical jiggery pokery using dot products.

    If anyone want to see it I can post the code when I get home
    Josh English, Apr 9, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SPG
    Replies:
    15
    Views:
    12,670
    ACE01
    Nov 7, 2006
  2. Replies:
    1
    Views:
    3,390
    Betty
    Apr 11, 2005
  3. Replies:
    6
    Views:
    1,063
  4. Alain Frisch
    Replies:
    3
    Views:
    425
    Richard Tobin
    May 3, 2005
  5. Chris Rebert

    Re: Python Line Intersection

    Chris Rebert, Apr 9, 2010, in forum: Python
    Replies:
    5
    Views:
    2,272
    Lie Ryan
    Apr 10, 2010
Loading...

Share This Page