codac 2.0.0
Loading...
Searching...
No Matches
codac2::ConvexPolygon Class Reference

Represents a convex polygon defined by vertices enclosed in IntervalVectors. More...

#include <codac2_ConvexPolygon.h>

Inheritance diagram for codac2::ConvexPolygon:
Collaboration diagram for codac2::ConvexPolygon:

Public Member Functions

 ConvexPolygon (std::initializer_list< Vector > vertices)
 Constructs a ConvexPolygon from an initializer list of Vector vertices.
 
 ConvexPolygon (const std::vector< Vector > &vertices, bool compute_convex_hull=true)
 Constructs a ConvexPolygon from a vector of Vector vertices.
 
 ConvexPolygon (const std::vector< IntervalVector > &vertices, bool compute_convex_hull=true)
 Constructs a ConvexPolygon from a vector of IntervalVector vertices.
 
 ConvexPolygon (std::initializer_list< Segment > edges)
 Constructs a ConvexPolygon from an initializer list of Segment edges.
 
 ConvexPolygon (const std::vector< Segment > &edges)
 Constructs a ConvexPolygon from a vector of Segment edges.
 
 ConvexPolygon (const IntervalVector &x)
 Constructs a box as a ConvexPolygon.
 
- Public Member Functions inherited from codac2::Polygon
 Polygon (std::initializer_list< Vector > vertices)
 Constructs a Polygon from an initializer list of Vector vertices.
 
 Polygon (const std::vector< Vector > &vertices)
 Constructs a Polygon from a vector of Vector vertices.
 
 Polygon (const std::vector< IntervalVector > &vertices)
 Constructs a Polygon from a vector of IntervalVector vertices.
 
 Polygon (std::initializer_list< Segment > edges)
 Constructs a Polygon from an initializer list of Segment edges.
 
 Polygon (const std::vector< Segment > &edges)
 Constructs a Polygon from a vector of Segment edges.
 
 Polygon (const IntervalVector &x)
 Constructs a box as a Polygon.
 
const std::vector< Segment > & edges () const
 Returns the list of edges of the polygon.
 
std::list< IntervalVectorunsorted_vertices () const
 Returns the list of unique vertices in no particular order.
 
std::vector< IntervalVectorsorted_vertices () const
 Returns the list of vertices sorted in polygonal order.
 
IntervalVector box () const
 Computes the bounding box of the polygon.
 
bool is_empty () const
 Checks whether the polygon is empty (has no vertex).
 
BoolInterval contains (const IntervalVector &p) const
 Checks whether the polygon contains a given point.
 
bool operator== (const Polygon &p) const
 Comparison operator.
 

Static Public Member Functions

static ConvexPolygon empty ()
 Provides an empty convex polygon.
 
- Static Public Member Functions inherited from codac2::Polygon
static Polygon empty ()
 Provides an empty polygon.
 

Protected Member Functions

 ConvexPolygon ()
 Default protected constructor used internally.
 
- Protected Member Functions inherited from codac2::Polygon
 Polygon ()
 Default protected constructor used internally.
 

Detailed Description

Represents a convex polygon defined by vertices enclosed in IntervalVectors.

A convex polygon is a special case of polygon where all internal angles are less than 180°, and every line segment between any two points in the polygon lies entirely within it. It inherits all functionality from Polygon and ensures convexity of the structure.

Constructor & Destructor Documentation

◆ ConvexPolygon() [1/6]

codac2::ConvexPolygon::ConvexPolygon ( std::initializer_list< Vector > vertices)

Constructs a ConvexPolygon from an initializer list of Vector vertices.

Parameters
verticesA list of vertices defining the convex polygon.

◆ ConvexPolygon() [2/6]

codac2::ConvexPolygon::ConvexPolygon ( const std::vector< Vector > & vertices,
bool compute_convex_hull = true )

Constructs a ConvexPolygon from a vector of Vector vertices.

Parameters
verticesA vector of vertices defining the convex polygon.
compute_convex_hullif true, will create the shape as the convex hull of the provided points. This option may be set to false when one can ensure that the points are already convex and provided in counterclockwise order. This would speed up computations, avoiding a Graham scan procedure.

◆ ConvexPolygon() [3/6]

codac2::ConvexPolygon::ConvexPolygon ( const std::vector< IntervalVector > & vertices,
bool compute_convex_hull = true )
explicit

Constructs a ConvexPolygon from a vector of IntervalVector vertices.

Parameters
verticesA vector of IntervalVectors enclosing the convex polygon vertices.
compute_convex_hullif true, will create the shape as the convex hull of the provided points. This option may be set to false when one can ensure that the points are already convex and provided in counterclockwise order. This would speed up computations, avoiding a Graham scan procedure.

◆ ConvexPolygon() [4/6]

codac2::ConvexPolygon::ConvexPolygon ( std::initializer_list< Segment > edges)

Constructs a ConvexPolygon from an initializer list of Segment edges.

Parameters
edgesA list of Segments forming the convex polygon.

◆ ConvexPolygon() [5/6]

codac2::ConvexPolygon::ConvexPolygon ( const std::vector< Segment > & edges)

Constructs a ConvexPolygon from a vector of Segment edges.

Parameters
edgesA vector of Segments forming the convex polygon.

◆ ConvexPolygon() [6/6]

codac2::ConvexPolygon::ConvexPolygon ( const IntervalVector & x)
explicit

Constructs a box as a ConvexPolygon.

Typically used to create a rectangular convex polygon.

Parameters
xAn IntervalVector representing the bounds of the convex polygon.

Member Function Documentation

◆ empty()

static ConvexPolygon codac2::ConvexPolygon::empty ( )
static

Provides an empty convex polygon.

Returns
An empty convex polygon without vertices.

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