Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Python Line Intersection

Reply
Thread Tools

Re: Python Line Intersection

 
 
Emile van Sebille
Guest
Posts: n/a
 
      04-09-2010
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...s/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

 
Reply With Quote
 
 
 
 
Josh English
Guest
Posts: n/a
 
      04-09-2010
On Apr 9, 8:36*am, Emile van Sebille <(E-Mail Removed)> 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...s/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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Python Line Intersection Chris Rebert Python 5 04-10-2010 07:44 AM
Line intersection detection.... SPG Java 15 11-07-2006 10:02 AM
intersection simulation zaebos@gmail.com Java 6 09-14-2005 06:12 PM
XML Schema spec: Attribute Wildcard Intersection Alain Frisch XML 3 05-03-2005 11:57 AM
ray/triangle intersection in java bob@coolgroups.com Java 1 04-11-2005 01:08 AM



Advertisments