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

Represents a polygon with curved edges defined by BezierCurves. More...

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

Public Types

using PointType = Point< T, NDIMS >
 
using VectorType = Vector< T, NDIMS >
 
using NumArrayType = NumericArray< T, NDIMS >
 
using BezierCurveType = BezierCurve< T, NDIMS >
 
using BoundingBoxType = typename BezierCurveType::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...
 
 CurvedPolygon (BezierCurveType *curves, int nEdges)
 Constructor from an array of nEdges curves. More...
 
void clear ()
 Clears the list of edges. More...
 
bool empty () const
 Returns true if the polygon has no edges. More...
 
BezierCurveTypeoperator[] (int idx)
 
const BezierCurveTypeoperator[] (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 BezierCurveType &c1)
 Appends a BezierCurve to the list of edges. More...
 
void splitEdge (int idx, T t)
 Splits an edge "in place". More...
 
axom::Array< BezierCurve< T, NDIMS > > getEdges () const
 

Friends

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

Detailed Description

template<typename T, int NDIMS>
class axom::primal::CurvedPolygon< T, NDIMS >

Represents a polygon with curved edges defined by BezierCurves.

Template Parameters
Tthe coordinate type, e.g., double, float, etc.
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

◆ PointType

template<typename T , int NDIMS>
using axom::primal::CurvedPolygon< T, NDIMS >::PointType = Point<T, NDIMS>

◆ VectorType

template<typename T , int NDIMS>
using axom::primal::CurvedPolygon< T, NDIMS >::VectorType = Vector<T, NDIMS>

◆ NumArrayType

template<typename T , int NDIMS>
using axom::primal::CurvedPolygon< T, NDIMS >::NumArrayType = NumericArray<T, NDIMS>

◆ BezierCurveType

template<typename T , int NDIMS>
using axom::primal::CurvedPolygon< T, NDIMS >::BezierCurveType = BezierCurve<T, NDIMS>

◆ BoundingBoxType

template<typename T , int NDIMS>
using axom::primal::CurvedPolygon< T, NDIMS >::BoundingBoxType = typename BezierCurveType::BoundingBoxType

Constructor & Destructor Documentation

◆ CurvedPolygon() [1/3]

template<typename T , int NDIMS>
axom::primal::CurvedPolygon< T, NDIMS >::CurvedPolygon ( )
default

Default constructor for an empty polygon.

◆ CurvedPolygon() [2/3]

template<typename T , int NDIMS>
axom::primal::CurvedPolygon< T, NDIMS >::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 SLIC_ASSERT.

◆ CurvedPolygon() [3/3]

template<typename T , int NDIMS>
axom::primal::CurvedPolygon< T, NDIMS >::CurvedPolygon ( BezierCurveType curves,
int  nEdges 
)
inline

Constructor from an array of nEdges curves.

References axom::primal::CurvedPolygon< T, NDIMS >::addEdge(), and SLIC_ASSERT.

Member Function Documentation

◆ clear()

template<typename T , int NDIMS>
void axom::primal::CurvedPolygon< T, NDIMS >::clear ( )
inline

Clears the list of edges.

◆ empty()

template<typename T , int NDIMS>
bool axom::primal::CurvedPolygon< T, NDIMS >::empty ( ) const
inline

Returns true if the polygon has no edges.

◆ numEdges()

template<typename T , int NDIMS>
int axom::primal::CurvedPolygon< T, NDIMS >::numEdges ( ) const
inline

Return the number of edges in the polygon.

◆ setNumEdges()

template<typename T , int NDIMS>
void axom::primal::CurvedPolygon< T, NDIMS >::setNumEdges ( int  ngon)
inline

References SLIC_ASSERT.

◆ addEdge()

template<typename T , int NDIMS>
void axom::primal::CurvedPolygon< T, NDIMS >::addEdge ( const BezierCurveType c1)
inline

Appends a BezierCurve to the list of edges.

◆ splitEdge()

template<typename T , int NDIMS>
void axom::primal::CurvedPolygon< T, NDIMS >::splitEdge ( int  idx,
t 
)
inline

Splits an edge "in place".

References SLIC_ASSERT.

◆ getEdges()

template<typename T , int NDIMS>
axom::Array<BezierCurve<T, NDIMS> > axom::primal::CurvedPolygon< T, NDIMS >::getEdges ( ) const
inline

◆ operator[]() [1/2]

template<typename T , int NDIMS>
BezierCurveType& axom::primal::CurvedPolygon< T, NDIMS >::operator[] ( int  idx)
inline

Retrieves the Bezier Curve at index idx

◆ operator[]() [2/2]

template<typename T , int NDIMS>
const BezierCurveType& axom::primal::CurvedPolygon< T, NDIMS >::operator[] ( int  idx) const
inline

Retrieves the vertex at index idx

◆ print()

template<typename T , int NDIMS>
std::ostream& axom::primal::CurvedPolygon< T, NDIMS >::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< T, NDIMS >::numEdges().

◆ isClosed()

template<typename T , int NDIMS>
bool axom::primal::CurvedPolygon< T, NDIMS >::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< T, NDIMS >::numEdges(), and axom::primal::squared_distance().

◆ reverseOrientation()

template<typename T , int NDIMS>
void axom::primal::CurvedPolygon< T, NDIMS >::reverseOrientation ( )
inline

◆ boundingBox()

template<typename T , int NDIMS>
BoundingBoxType axom::primal::CurvedPolygon< T, NDIMS >::boundingBox ( ) const
inline

Returns an axis-aligned bounding box containing the CurvedPolygon.

Friends And Related Function Documentation

◆ operator==

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

Tests equality of two CurvedPolygons.

◆ operator!=

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

Tests inequality of two CurvedPolygons.


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