|
Thunderbots Project
|
#include <polygon.h>


Public Member Functions | |
| Polygon (const std::vector< Point > &points) | |
| Polygon (const std::initializer_list< Point > &points) | |
| Point | centroid () const |
| Polygon | expand (double expansion_amount) const |
| double | perimeter () const |
| const std::vector< Segment > & | getSegments () const |
| const std::vector< Point > & | getPoints () const |
Static Public Member Functions | |
| static Polygon | fromSegment (const Segment &segment, double length_radius, double width_radius) |
| static Polygon | fromSegment (const Segment &segment, double radius) |
Protected Member Functions | |
| void | initSegments () |
Protected Attributes | |
| std::vector< Point > | points_ |
| std::vector< Segment > | segments_ |
A shape composed of line segments.
| Point centroid | ( | ) | const |
Returns the centroid of this polygon
| Polygon expand | ( | double | expansion_amount | ) | const |
Creates a rectangular polygon that is oriented along the segment. The radius defines the closest distance to a edge of the rectangle parallel to the segment i.e. the radius is half the width of the rectangle. The polygon contains both points as "focal" points similar to an ellipse. see definition for details and diagram
| segment | segment along which to construct the rectangular polygon |
| length_radius | How much each end of the segment should be elongated by |
| width_radius | How wide should the polygon be, measured from the segment |
| const std::vector< Point > & getPoints | ( | ) | const |
Returns the points that form the polygon.
| const std::vector< Segment > & getSegments | ( | ) | const |
Returns the line segments that form this polygon.
|
protected |
Initializes the segments_ vector
| double perimeter | ( | ) | const |
Returns perimeter length of the polygon