Re: Python Line Intersection
- From: Lie Ryan <lie.1296@xxxxxxxxx>
- Date: Sat, 10 Apr 2010 17:44:30 +1000
On 04/10/10 16:24, Mark Tolonen wrote:
"Chris Rebert" <clp2@xxxxxxxxxxxx> wrote in message
On Fri, Apr 9, 2010 at 11:43 AM, John Nagle <nagle@xxxxxxxxxxx> wrote:
Chris Rebert wrote:<snip>
On Fri, Apr 9, 2010 at 8:04 AM, Peyman Askari
This is partly Python related, although it might end up being more
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
the four points describing line segments
requires that you solve for two equations. How can I do this in
either solve equations, or calculating intersection points some
Just solve the equations ahead of time by using generic ones.
x = (c - b) / (m-n)
Actually, you don't want to do it that way, because it fails for
lines, when m and n go to infinity.
As the programmer said upon seeing a stripe-less zebra:
"Oh no, a special case!"
Excellent catch my good sir; although I will point out that strictly
speaking, you can't put vertical lines into slope-intercept form (but
I should not have forgotten that precondition).
And parallel lines, where m and n are equal (divide-by-zero)...
This is actually one place where non-stop arithmetic can be a good thing.
With non-stop arithmetic, when you divide by zero, you get infinity and
everything turns out quite well.
- Prev by Date: Re: Python Line Intersection
- Next by Date: Re: Striving for PEP-8 compliance
- Previous by thread: Re: Python Line Intersection
- Next by thread: Python question