On 4/18/07, Abu Ismail <[EMAIL PROTECTED]> wrote: > Hi, > > I am working on an implementation of an L-system in Python. I hate > using turtle module since it uses Tk and as my IDE also uses Tk I have > to close my editor before I can test the program. So I am implementing > the graphics using PIL. > > Now to the problem. > > Say you have a line AB with co-ords (x1,y1) and (x2,y2). Say you also > have a point C with co-ords (x3,y3). > > Question: how to determine whether point C is to the left or to the > right of the line AB? > 1. Write an equation for the line AB in the form x = Wy + Z (as opposed to y = mx + b, which is the usual form). 2. Substitute the value for y3 in that equation - it will give you the value of x on that line (call it X3). 3. Compare x3 with X3.
A quick derivation gave me (please verify) x = [(x2-x1) y + x1 y2 - x2 y1]/(y2-y1) where the multiplication signs are implicit. Good luck! André > Any suggestions would be welcome. > > Ta, > AH > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor