[Date Index] [Thread Index] [Author Index]
Re: Point inside a plygon?
David Park wrote: > > Adriano, > > Here is a different solution for the point inside a polygon question. > > PointInPolygon::usage = > "PointInPolygon[point, polygonvertices] will determine if a point is \ > within a polygon defined by its vertices. Its method is to calculate the \ > cross product of each leg of the polygon with the vector from the base of > the \ > leg to the point. If there is a change in sign of the z component going \ > around the polygon, the point is outside the polygon."; > > > -----Original Message----- > > > > I need a routine to check if a point is inside or outside a polygon > > (simple polygon non self-intersecting). > > Any help appreciated. > > > > Adriano Moreira > > David Park's solution is correct if the polynomial in question is convex. If it is not, then the problem is more difficult. Chris Henrich