AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
Represents a polygon defined by an array of points. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.4.0/src/axom/primal/geometry/Polygon.hpp>
Public Types | |
typedef Point< T, NDIMS > | PointType |
typedef Vector< T, NDIMS > | VectorType |
typedef NumericArray< T, NDIMS > | NumArrayType |
Public Member Functions | |
Polygon () | |
Polygon (int numExpectedVerts) | |
Constructor for an empty polygon that reserves space for the given number of vertices. More... | |
int | numVertices () const |
void | addVertex (const PointType &pt) |
void | clear () |
PointType & | operator[] (int idx) |
const PointType & | operator[] (int idx) const |
PointType | centroid () const |
Computes the centroid as the average of the polygon's vertex positions. More... | |
std::ostream & | print (std::ostream &os) const |
Simple formatted print of a polygon instance. More... | |
bool | isValid () const |
Simple check for validity of a polygon. More... | |
Represents a polygon defined by an array of points.
T | the coordinate type, e.g., double, float, etc. |
NDIMS | the number of dimensions |
typedef Point<T, NDIMS> axom::primal::Polygon< T, NDIMS >::PointType |
typedef Vector<T, NDIMS> axom::primal::Polygon< T, NDIMS >::VectorType |
typedef NumericArray<T, NDIMS> axom::primal::Polygon< T, NDIMS >::NumArrayType |
|
inline |
Default constructor for an empty polygon
|
inline |
Constructor for an empty polygon that reserves space for the given number of vertices.
[in] | numExpectedVerts | number of vertices for which to reserve space |
References SLIC_ASSERT.
|
inline |
Return the number of vertices in the polygon
Referenced by axom::primal::Polygon< T, NDIMS >::centroid(), axom::quest::InOutOctree< DIM >::generateIndex(), and axom::primal::Polygon< T, NDIMS >::print().
|
inline |
Appends a vertex to the list of vertices
Referenced by axom::primal::clip().
|
inline |
Clears the list of vertices
|
inline |
Retrieves the vertex at index idx
|
inline |
Retrieves the vertex at index idx
|
inline |
Computes the centroid as the average of the polygon's vertex positions.
References axom::primal::Polygon< T, NDIMS >::isValid(), axom::primal::Polygon< T, NDIMS >::numVertices(), and SLIC_ASSERT.
Referenced by axom::quest::InOutOctree< DIM >::generateIndex().
|
inline |
Simple formatted print of a polygon instance.
os | The output stream to write to |
References axom::primal::Polygon< T, NDIMS >::numVertices().
|
inline |
Simple check for validity of a polygon.
Initial check is that the polygon has three or more vertices
Referenced by axom::primal::Polygon< T, NDIMS >::centroid().