Functions for 2D Pointf concave and convex polygons. No specific order is required.
enum ContainsPointRes ContainsPoint(const Vector<Pointf>& polygon, const Pointf& pt)
Checks if point pt is inside or in the boundaries of counterclockwise polygon polygon.
Returned ContainsPointRes is:
>0 if pt is inside
== 0 if pt is in the boundary.
template <typename T> bool ContainsPoint(const Point_<T>& a, const Point_<T>& b, const Point_<T>& c, const Point_<T>& p)
Checks if the point p is inside or in the boundaries of the counterclockwise triangle a, b, c.
template <typename T> bool ContainsPoint(const Point_<T>& a, const Point_<T>& b, const Point_<T>& c, const Point_<T>& d, const Point_<T>& p)
Checks if the point p is inside or in the boundaries of the counterclockwise quadrangle a, b, c, d.
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.
double Angle(const Pointf& a, const Pointf& b)
Returns the angle between two segments a and b.
double AngleNormal(const Pointf& a, const Pointf& b)
Returns the angle between two normalized segments a and b.
|