AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::primal::CurvedPolygon< CurveType > Class Template Reference

Represents a polygon with generic curves for edges. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/develop/src/axom/primal/geometry/CurvedPolygon.hpp>

Public Types

using NumericType = typename CurveType::NumericType
 
using PointType = typename CurveType::PointType
 
using VectorType = typename CurveType::VectorType
 
using BoundingBoxType = typename CurveType::BoundingBoxType
 

Public Member Functions

 CurvedPolygon ()=default
 Default constructor for an empty polygon. More...
 
 CurvedPolygon (int nEdges)
 Constructor for an empty CurvedPolygon that reserves space for the given number of Edges. More...
 
template<typename OtherCurveType >
 CurvedPolygon (const CurvedPolygon< OtherCurveType > &other_poly)
 Copy constructor for another curve type. More...
 
 CurvedPolygon (axom::ArrayView< const CurveType > curves)
 ! More...
 
 CurvedPolygon (const CurveType *curves, int nEdges)
 ! More...
 
 CurvedPolygon (const axom::Array< CurveType > &curves)
 ! More...
 
void clear ()
 Clears the list of edges. More...
 
bool empty () const
 Returns true if the polygon has no edges. More...
 
CurveType & operator[] (int idx)
 
const CurveType & operator[] (int idx) const
 
std::ostream & print (std::ostream &os) const
 Simple formatted print of a CurvedPolygon instance. More...
 
bool isClosed (double tol=1e-5) const
 Check closedness of a CurvedPolygon. More...
 
void reverseOrientation ()
 Reverses orientation of a CurvedPolygon. More...
 
BoundingBoxType boundingBox () const
 Returns an axis-aligned bounding box containing the CurvedPolygon. More...
 
Operations on edges
int numEdges () const
 Return the number of edges in the polygon. More...
 
void setNumEdges (int ngon)
 
void addEdge (const CurveType &c1)
 Appends a curve to the list of edges. More...
 
void addEdge (CurveType &&c1)
 Consumes then appends a curve to the list of edges. More...
 
void splitEdge (int idx, NumericType t)
 Splits an edge "in place". More...
 
axom::Array< CurveType > & getEdges ()
 Returns a reference to the underlying array of curved edges. More...
 
const axom::Array< CurveType > & getEdges () const
 Returns a const reference to the underlying array of curved edges. More...
 

Friends

bool operator== (const CurvedPolygon< CurveType > &lhs, const CurvedPolygon< CurveType > &rhs)
 Tests equality of two CurvedPolygons. More...
 
bool operator!= (const CurvedPolygon< CurveType > &lhs, const CurvedPolygon< CurveType > &rhs)
 Tests inequality of two CurvedPolygons. More...
 

Detailed Description

template<typename CurveType>
class axom::primal::CurvedPolygon< CurveType >

Represents a polygon with generic curves for edges.

Template Parameters
NDIMSthe number of dimensions
Note
The component curves should be ordered in a counter clockwise orientation with respect to the polygon's normal vector

Member Typedef Documentation

◆ NumericType

template<typename CurveType >
using axom::primal::CurvedPolygon< CurveType >::NumericType = typename CurveType::NumericType

◆ PointType

template<typename CurveType >
using axom::primal::CurvedPolygon< CurveType >::PointType = typename CurveType::PointType

◆ VectorType

template<typename CurveType >
using axom::primal::CurvedPolygon< CurveType >::VectorType = typename CurveType::VectorType

◆ BoundingBoxType

template<typename CurveType >
using axom::primal::CurvedPolygon< CurveType >::BoundingBoxType = typename CurveType::BoundingBoxType

Constructor & Destructor Documentation

◆ CurvedPolygon() [1/6]

template<typename CurveType >
axom::primal::CurvedPolygon< CurveType >::CurvedPolygon ( )
default

Default constructor for an empty polygon.

◆ CurvedPolygon() [2/6]

template<typename CurveType >
axom::primal::CurvedPolygon< CurveType >::CurvedPolygon ( int  nEdges)
inlineexplicit

Constructor for an empty CurvedPolygon that reserves space for the given number of Edges.

Parameters
[in]numExpectedEdgesnumber of edges for which to reserve space
Precondition
numExpectedEdges is at least 1

References axom::Array< T, DIM, SPACE, StoragePolicy >::reserve(), axom::Array< T, DIM, SPACE, StoragePolicy >::resize(), and SLIC_ASSERT.

◆ CurvedPolygon() [3/6]

template<typename CurveType >
template<typename OtherCurveType >
axom::primal::CurvedPolygon< CurveType >::CurvedPolygon ( const CurvedPolygon< OtherCurveType > &  other_poly)
inline

◆ CurvedPolygon() [4/6]

template<typename CurveType >
axom::primal::CurvedPolygon< CurveType >::CurvedPolygon ( axom::ArrayView< const CurveType >  curves)
inline

!

Constructor for CurvedPolygon from an ArrayView of curves

◆ CurvedPolygon() [5/6]

template<typename CurveType >
axom::primal::CurvedPolygon< CurveType >::CurvedPolygon ( const CurveType *  curves,
int  nEdges 
)
inline

!

Constructor from a c-style array of nEdges curves

◆ CurvedPolygon() [6/6]

template<typename CurveType >
axom::primal::CurvedPolygon< CurveType >::CurvedPolygon ( const axom::Array< CurveType > &  curves)
inline

!

Constructor from a Axom array of curves

Member Function Documentation

◆ clear()

template<typename CurveType >
void axom::primal::CurvedPolygon< CurveType >::clear ( )
inline

Clears the list of edges.

References axom::Array< T, DIM, SPACE, StoragePolicy >::clear().

◆ empty()

template<typename CurveType >
bool axom::primal::CurvedPolygon< CurveType >::empty ( ) const
inline

Returns true if the polygon has no edges.

References axom::Array< T, DIM, SPACE, StoragePolicy >::empty().

◆ numEdges()

template<typename CurveType >
int axom::primal::CurvedPolygon< CurveType >::numEdges ( ) const
inline

Return the number of edges in the polygon.

References axom::Array< T, DIM, SPACE, StoragePolicy >::size().

◆ setNumEdges()

template<typename CurveType >
void axom::primal::CurvedPolygon< CurveType >::setNumEdges ( int  ngon)
inline

◆ addEdge() [1/2]

template<typename CurveType >
void axom::primal::CurvedPolygon< CurveType >::addEdge ( const CurveType &  c1)
inline

Appends a curve to the list of edges.

References axom::Array< T, DIM, SPACE, StoragePolicy >::push_back().

◆ addEdge() [2/2]

template<typename CurveType >
void axom::primal::CurvedPolygon< CurveType >::addEdge ( CurveType &&  c1)
inline

Consumes then appends a curve to the list of edges.

References axom::Array< T, DIM, SPACE, StoragePolicy >::push_back().

◆ splitEdge()

◆ getEdges() [1/2]

template<typename CurveType >
axom::Array<CurveType>& axom::primal::CurvedPolygon< CurveType >::getEdges ( )
inline

Returns a reference to the underlying array of curved edges.

◆ getEdges() [2/2]

template<typename CurveType >
const axom::Array<CurveType>& axom::primal::CurvedPolygon< CurveType >::getEdges ( ) const
inline

Returns a const reference to the underlying array of curved edges.

◆ operator[]() [1/2]

template<typename CurveType >
CurveType& axom::primal::CurvedPolygon< CurveType >::operator[] ( int  idx)
inline

Retrieves the curve at index idx

◆ operator[]() [2/2]

template<typename CurveType >
const CurveType& axom::primal::CurvedPolygon< CurveType >::operator[] ( int  idx) const
inline

Retrieves the curve at index idx

◆ print()

template<typename CurveType >
std::ostream& axom::primal::CurvedPolygon< CurveType >::print ( std::ostream &  os) const
inline

Simple formatted print of a CurvedPolygon instance.

Parameters
osThe output stream to write to
Returns
A reference to the modified ostream

References axom::primal::CurvedPolygon< CurveType >::numEdges().

◆ isClosed()

template<typename CurveType >
bool axom::primal::CurvedPolygon< CurveType >::isClosed ( double  tol = 1e-5) const
inline

Check closedness of a CurvedPolygon.

A CurvedPolygon is closed when the endpoint of each edge coincides with startpoint of next edge

Returns
true, if the polygon is closed, false otherwise

References axom::utilities::isNearlyEqual(), axom::primal::CurvedPolygon< CurveType >::numEdges(), and axom::primal::squared_distance().

◆ reverseOrientation()

template<typename CurveType >
void axom::primal::CurvedPolygon< CurveType >::reverseOrientation ( )
inline

◆ boundingBox()

template<typename CurveType >
BoundingBoxType axom::primal::CurvedPolygon< CurveType >::boundingBox ( ) const
inline

Returns an axis-aligned bounding box containing the CurvedPolygon.

Friends And Related Function Documentation

◆ operator==

template<typename CurveType >
bool operator== ( const CurvedPolygon< CurveType > &  lhs,
const CurvedPolygon< CurveType > &  rhs 
)
friend

Tests equality of two CurvedPolygons.

◆ operator!=

template<typename CurveType >
bool operator!= ( const CurvedPolygon< CurveType > &  lhs,
const CurvedPolygon< CurveType > &  rhs 
)
friend

Tests inequality of two CurvedPolygons.


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