Polygon2D

 

Functions for 2D Pointf concave and convex polygons. No specific order is required.

 

Function List


 

enum ContainsPointRes ContainsPoint(const Vector<Pointf>& polygon, const Pointf& pt)

Checks if point pt is inside or in the boundaries of polygon polygon.

Returned ContainsPointRes is:

>0 if pt is inside

== 0 if pt is in the boundary.

 


 

bool PointInPoly(const Vector<Pointf>& xy, const Pointf& pxy)

Checks if point pxy is inside the polygon xy.

 


 

bool IsClockwise(const Vector<Pointf>& p)

Returns if polygon p is clockwise.

 


 

double Area(const Vector<Pointf>& p)

Returns the area of polygon p.

 


 

Pointf Centroid(const Vector<Pointf>& p)

Returns the centroid of polygon p.