Search Grid
AUVSI Search Path Algorithm 2019-2021
Public Member Functions | Public Attributes | List of all members
Polygon Struct Reference

Represents a polygon as a list of vertices in CCW order. More...

Public Member Functions

void addVert (Coord vert)
 Add a vertex to the polygon. More...
 
unsigned int size () const
 Get the number of vertices in the polygon. More...
 
Edge edge (unsigned int i) const
 Construct an edge of the polygon given the index of the first vertex. More...
 
bool adjacent (Polygon &p, int *edgeIndex1=NULL, int *edgeIndex2=NULL) const
 Determine if the polygon is adjacent. More...
 
Coord center () const
 Get the center of the polygon. More...
 
std::string str () const
 Get the string representation of the polygon. More...
 
Polygonoperator= (const Polygon &op)
 Overloaded assignment operator.
 

Public Attributes

std::vector< Coordv
 The vertices of the polygon in CCW order. More...
 

Detailed Description

Represents a polygon as a list of vertices in CCW order.

Member Function Documentation

◆ addVert()

void Polygon::addVert ( Coord  vert)
inline

Add a vertex to the polygon.

Parameters
vertthe vertex to add
See also
Coord

◆ adjacent()

bool Polygon::adjacent ( Polygon p,
int *  edgeIndex1 = NULL,
int *  edgeIndex2 = NULL 
) const
inline

Determine if the polygon is adjacent.

Parameters
pthe polygon
edgeIndex1if not null, stores the index of the shared edge for this polygon
edgeIndex2if not null, stores the index of the shared edge for p
Returns
true if adjacent and stores indeces in edgeIndex1 and edgeIndex2 if not null, else false and stores -1 in edgeIndex1 and edgeIndex2 if not null

◆ center()

Coord Polygon::center ( ) const
inline

Get the center of the polygon.

Returns
the approximate center of the polygon as a Coord
See also
Coord

◆ edge()

Edge Polygon::edge ( unsigned int  i) const
inline

Construct an edge of the polygon given the index of the first vertex.

Parameters
iindex of the first vertex
Returns
the corresponding edge
See also
Edge

◆ size()

unsigned int Polygon::size ( ) const
inline

Get the number of vertices in the polygon.

Returns
the number of vertices

◆ str()

std::string Polygon::str ( ) const
inline

Get the string representation of the polygon.

Returns
the string representation of the polygon

Member Data Documentation

◆ v

std::vector<Coord> Polygon::v

The vertices of the polygon in CCW order.

See also
Coord

The documentation for this struct was generated from the following file: