wrote and typechecked pointInPolygon.  Have not tested yet.