[Tutor] Fw: point and polygon

Glen Wheeler gew75 at hotmail.com
Sun Nov 6 13:16:42 CET 2005


  Missed the rest of the list with this.
  Still sent to Shi however.

From: "Shi Mu" <samrobertsmith at gmail.com>
> why the following code report error?
>
> [..]
>        assert pointInPoly(pointA, poly)
>        assert not pointInPoly(pointB, poly)

  Assuming your function is correct, the asserts are failing, and python is
 telling you about it.  Asserts exist for many reasons but not for output.
 What you most likely want is:

 if pointInPoly(pointA, poly):
    print "pointA in poly"
 else:
    print "pointA not in poly"

  With a similar conditional for pointB.

  HTH,
  Glen

 L:Pyt E+++ T-- R+ P+++ D+ G+ F:*band !RL RLA-
W:AF Q+++ AI++ GFX++ SFX-- RN++++ PO--- !Hp Re-- S+ 


More information about the Tutor mailing list