3#include "../FoundationBase.h"
18 using List = std::vector<Polygon>;
19 using PointList = std::vector<glm::vec3>;
22 Polygon(
const PointList& initialPoints);
25 void setPoints(
const PointList& pointList);
26 void addPoint(
const glm::vec3& point);
30 const PointList& getPoints()
const {
return points; }
31 const glm::vec3& getPoint(
size_t idx)
const {
return points[idx]; }
32 size_t getNoOfPoints()
const {
return points.size(); }
33 float calcArea()
const {
return std::fabs(calcSignedArea(points.begin(), points.end())); }
34 bool isPointInside(
const glm::vec3& p)
const {
return isPointInside(p, points); }
36 List add(
const Polygon& polygon)
const;
37 List subtract(
const Polygon& polygon)
const;
42 static bool isClockwise(
const PointList& pointList);
43 static bool isPointInside(
const glm::vec3& p,
const PointList& pointList);
44 static float calcSignedArea(
const PointList::const_iterator& start,
const PointList::const_iterator& end);
Generic 2D concave or convex polygon.
@ Geometry
Store entity vector fields (vector<vec3>, vector<vec2>, vector<int>, vector<float>).
Contains all Cogs related functionality.