Wiki

Clone wiki

BWTA2 / Polygon

Polygon

Class header file: BWTA/Polygon.h

A BWTA::Polygon is a std::vector of BWAPI::Position objects, so to iterate over the vertices of a BWTA::Polygon you just need to iterate over the vector.

Methods:

getArea

double getArea() const;

Returns the area of the polygon.

getPerimeter

double getPerimeter() const;

Returns the perimeter of the polygon.

getCenter

BWAPI::Position getCenter() const;

Returns the centroid of the polygon.

getNearestPoint

BWAPI::Position getNearestPoint(BWAPI::Position p) const;

Returns the point on the boundary of the polygon that is nearest to the given point.

isInside

bool isInside(BWAPI::Position p) const;

Returns true if the given point is inside the polygon.

Updated