Ocular Engine
Ocular::Math::Polygon2D Class Reference

#include <Polygon2D.hpp>

Public Member Functions

 Polygon2D (std::vector< Point2f > const &points)
 
 Polygon2D (Point2f const *, uint32_t numPoints)
 
Point2f getCenter ()
 
float getSignedArea ()
 

Detailed Description

Helper class that can perform common actions on a polygon.

The points are expected to be ordered as the occur along the polygon's perimeter and form a regular polygon.

Member Function Documentation

Point2f Ocular::Math::Polygon2D::getCenter ( )

Calculates the center (centroid) of the polygon.

float Ocular::Math::Polygon2D::getSignedArea ( )

Calculates and returns the signed area of the polygon.

Note
If the points are ordered in a clockwise manner, then the area will have a negative sign.

Calculates and returns the signed area of the polygon.


The documentation for this class was generated from the following files: