Geometry puzzler

William Park parkw at better.net
Mon Nov 6 19:25:26 EST 2000


On Mon, Nov 06, 2000 at 02:55:35AM +0000, Paul Winkler wrote:
> There are two basic but important things I can't figure out how to do:
> 
> 1) Given any polygon, how can I test whether an arbitrary point lies
>    inside that polygon?

I remember a pretty good handbook with "Handbook" as part of its title
when I was undergraduate.  I think testing whether a point is inside of
a polygon is similar (formula wise) to area of polygon.  I know the
latter, but not the first.


> 2) Given two line segments, how can I find the coordinates of their
>    intersection, if there is one? (easy for right angles, but I will
>    often NOT have right angles.)

Determine equation of the two lines, ie.
    Ax + By + C = 0
    Dx + Ey + F = 0
and solve the resulting linear system.  The answer is coordinate of
intersection.


---William Park, Open Geometry Consulting




More information about the Python-list mailing list