Loading...
Searching...
No Matches
meshkit::plan::Polygon Class Reference

Point sequence in XY units used for polygon rings and polylines. More...

#include <meshkit/detail/planmodel.hpp>

Inheritance diagram for meshkit::plan::Polygon:
Collaboration diagram for meshkit::plan::Polygon:

Public Member Functions

 Polygon ()=default
 
 Polygon (const Vector< Point2 > &v)
 Copy a point vector.
 
 Polygon (const std::vector< Point2 > &v)
 Copy a std::vector of points.
 
Box2 boundingRect () const
 Axis-aligned bounding box of all points.
 
- Public Member Functions inherited from meshkit::detail::Vector< T >
 Vector ()=default
 Empty vector.
 
 Vector (const std::vector< T > &v)
 Copy the elements of a std::vector.
 
 Vector (std::vector< T > &&v)
 Take over the buffer of a std::vector without copying elements.
 
decltype(auto) first ()
 Reference to the first element (front()); the vector must not be empty.
 
decltype(auto) first () const
 Read-only reference to the first element; the vector must not be empty.
 
decltype(auto) last ()
 Reference to the last element (back()); the vector must not be empty.
 
decltype(auto) last () const
 Read-only reference to the last element; the vector must not be empty.
 
const T * constData () const
 Read-only pointer to the contiguous elements (data()).
 
Vector mid (std::ptrdiff_t at, std::ptrdiff_t count=-1) const
 Copy of a contiguous run of elements.
 
void prepend (const T &v)
 Insert a copy of v before the first element; linear in size().
 
void append (const Vector &v)
 Append copies of all elements of v.
 
Vector & operator+= (const Vector &v)
 Append copies of all elements of v; same as append(const Vector &).
 
Vector & operator<< (const T &v)
 Append one element.
 
std::ptrdiff_t size () const noexcept
 Number of elements as a signed std::ptrdiff_t.
 
bool isEmpty () const
 True when the vector holds no elements.
 
void append (const T &v)
 Append a copy of v (push_back).
 
void append (T &&v)
 Append v by move (push_back).
 
T takeLast ()
 Remove the last element and return it by move; the vector must not be empty.
 
T takeFirst ()
 Remove the first element and return it by move; linear in size().
 
void removeLast ()
 Remove the last element (pop_back); the vector must not be empty.
 
void removeAt (int at)
 Erase one element; the elements after it shift down by one.
 
void fill (const T &v)
 Assign v to every existing element; the size is unchanged.
 
void fill (const T &v, std::size_t size)
 Replace the contents with size copies of v (assign()).
 
bool contains (const T &v) const
 Linear search with operator==.
 

Detailed Description

Point sequence in XY units used for polygon rings and polylines.

The type imposes no closure, orientation, simplicity or finiteness rule; each function that takes a Polygon states its own requirements.

Constructor & Destructor Documentation

◆ Polygon() [1/3]

meshkit::plan::Polygon::Polygon ( )
default

◆ Polygon() [2/3]

meshkit::plan::Polygon::Polygon ( const Vector< Point2 > & v)
inline

Copy a point vector.

Parameters
[in]vPoints to copy, in order.
Here is the call graph for this function:

◆ Polygon() [3/3]

meshkit::plan::Polygon::Polygon ( const std::vector< Point2 > & v)
inline

Copy a std::vector of points.

Parameters
[in]vPoints to copy, in order.
Here is the call graph for this function:

Member Function Documentation

◆ boundingRect()

Box2 meshkit::plan::Polygon::boundingRect ( ) const
inline

Axis-aligned bounding box of all points.

Returns
Box from the minimum to the maximum x and y, in XY units; a default (all-zero) Box2 when the polygon is empty. Coordinates are not checked for finiteness.
Here is the caller graph for this function:

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