Thunderbots Project
Loading...
Searching...
No Matches
ConvexPolygon Class Reference

#include <convex_polygon.h>

Inheritance diagram for ConvexPolygon:
Collaboration diagram for ConvexPolygon:

Public Member Functions

double area () const override
 
 ConvexPolygon (const std::vector< Point > &points)
 
 ConvexPolygon (const std::initializer_list< Point > &points)
 
- Public Member Functions inherited from Polygon
 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
 

Additional Inherited Members

- Static Public Member Functions inherited from Polygon
static Polygon fromSegment (const Segment &segment, double length_radius, double width_radius)
 
static Polygon fromSegment (const Segment &segment, double radius)
 
- Protected Member Functions inherited from Polygon
void initSegments ()
 
- Protected Attributes inherited from Polygon
std::vector< Pointpoints_
 
std::vector< Segmentsegments_
 

Detailed Description

A polygon that is convex (curved outwards).

Constructor & Destructor Documentation

◆ ConvexPolygon() [1/2]

ConvexPolygon ( const std::vector< Point > &  points)
explicit

Construct a convex polygon by drawing line segments between consecutive Points, and then from the last Point to the first Point.

Parameters
pointsPoints that form a convex polygon
Exceptions
std::invalid_argumentif the given points do not form a convex polygon

◆ ConvexPolygon() [2/2]

ConvexPolygon ( const std::initializer_list< Point > &  points)
explicit

Construct a convex polygon by drawing line segments between consecutive Points, and then from the last Point to the first Point.

Parameters
pointsPoints that form a convex polygon
Exceptions
std::invalid_argumentif the given points do not form a convex polygon

Member Function Documentation

◆ area()

double area ( ) const
overridevirtual

Returns the area of this convex polygon

Returns
The area of this convex polygon

Implements ConvexShape.


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