Wonton::Polytope< D > Class Template Reference

#include <Polytope.h>

Public Member Functions

 Polytope (const std::vector< Point< 2 > > &vertex_points)
 Constructor for a 2D polygon. More...
 
 Polytope (const std::vector< Point< 3 > > &vertex_points, const std::vector< std::vector< int > > &face_vertices)
 Constructor for a 3D polyhedron. More...
 
 ~Polytope ()=default
 
const std::vector< Point< D > > & points () const
 Points for all the vertices of the polytope. More...
 
const std::vector< int > & face_vertices (int const face_id) const
 Indices of vertices of the polytope's face in counter-clockwise order (i.e. so that the normal to the face is pointing outside of the polytope) More...
 
std::vector< Point< D > > face_points (int const face_id) const
 Coordinates of vertices of the polytope's face in counter-clockwise order (i.e. so that the normal to the face is pointing outside of the polytope) More...
 
const std::vector< std::vector< int > > & face_vertices () const
 Indices of vertices for all the faces of the polytope. More...
 
Point< D > vertex_point (int const vertex_id) const
 Coordinates of a polytope's vertex. More...
 
int num_vertices () const
 Number of material poly's vertices. More...
 
int num_faces () const
 Number of material poly's faces. More...
 
std::vector< double > face_moments (int face_id) const
 Moments for a face of the polytope. More...
 
Vector< D > face_normal (int face_id) const
 Effective normal to a face of the polytope. More...
 
std::vector< double > moments () const
 Moments for the polytope. More...
 
template<>
std::vector< double > face_moments (int const face_id) const
 Moments for a face of the polygon. More...
 
template<>
std::vector< double > face_moments (int const face_id) const
 Moments for a face of the polyhedron. Non-triangular faces are assumed to be non-flat and are split into triangles using their geometric center. More...
 
template<>
Vector< 2 > face_normal (int face_id) const
 Normal to a face of the polygon. More...
 
template<>
Vector< 3 > face_normal (int face_id) const
 Effective normal to a face of the polyhedron. Non-triangular faces are assumed to be non-flat and effective normal is computed using face centroid for triangulation. More...
 
template<>
std::vector< double > moments () const
 Moments for the polygon. More...
 
template<>
std::vector< double > moments () const
 Moments for the polyhedron. Non-triangular faces are assumed to be non-flat and are split into triangles using their centroid. More...
 

Constructor & Destructor Documentation

◆ Polytope() [1/2]

template<int D>
Wonton::Polytope< D >::Polytope ( const std::vector< Point< 2 > > &  vertex_points)
inlineexplicit

Constructor for a 2D polygon.

Parameters
vertex_pointsVector of coordinates of the polygon's vertices listed counter-clockwise

◆ Polytope() [2/2]

template<int D>
Wonton::Polytope< D >::Polytope ( const std::vector< Point< 3 > > &  vertex_points,
const std::vector< std::vector< int > > &  face_vertices 
)
inline

Constructor for a 3D polyhedron.

Parameters
vertex_pointsVector of coordinates of the polyhedron's vertices
face_verticesFaces of the polyhedron, every face is given by IDs of its vertices in counter-clockwise order (i.e. so that the normal to the face is pointing outside of the polyhedron)

◆ ~Polytope()

template<int D>
Wonton::Polytope< D >::~Polytope ( )
default

Destructor

Member Function Documentation

◆ face_moments() [1/3]

template<int D>
std::vector<double> Wonton::Polytope< D >::face_moments ( int  face_id) const

Moments for a face of the polytope.

Parameters
face_idID of the face of the polytope
Returns
Vector of moments; moments[0] is the size, moments[i+1]/moments[0] is i-th coordinate of the centroid

◆ face_moments() [2/3]

template<>
std::vector< double > Wonton::Polytope< 2 >::face_moments ( int const  face_id) const
inline

Moments for a face of the polygon.

Parameters
face_idID of the face of the polygon
Returns
Vector of moments; moments[0] is the size, moments[i+1]/moments[0] is i-th coordinate of the centroid

◆ face_moments() [3/3]

template<>
std::vector< double > Wonton::Polytope< 3 >::face_moments ( int const  face_id) const
inline

Moments for a face of the polyhedron. Non-triangular faces are assumed to be non-flat and are split into triangles using their geometric center.

Parameters
face_idID of the face of the polyhedron
Returns
Vector of moments; moments[0] is the size, moments[i+1]/moments[0] is i-th coordinate of the centroid

◆ face_normal() [1/3]

template<int D>
Vector<D> Wonton::Polytope< D >::face_normal ( int  face_id) const

Effective normal to a face of the polytope.

Parameters
face_idID of the face of the polytope
Returns
Normal vector

◆ face_normal() [2/3]

template<>
Vector< 2 > Wonton::Polytope< 2 >::face_normal ( int  face_id) const
inline

Normal to a face of the polygon.

Parameters
face_idID of the face of the polygon
Returns
Unit normal vector

◆ face_normal() [3/3]

template<>
Vector< 3 > Wonton::Polytope< 3 >::face_normal ( int  face_id) const
inline

Effective normal to a face of the polyhedron. Non-triangular faces are assumed to be non-flat and effective normal is computed using face centroid for triangulation.

Parameters
face_idID of the face of the polyhedron
Returns
Normal vector, might be non-unitary

◆ face_points()

template<int D>
std::vector< Point<D> > Wonton::Polytope< D >::face_points ( int const  face_id) const
inline

Coordinates of vertices of the polytope's face in counter-clockwise order (i.e. so that the normal to the face is pointing outside of the polytope)

Parameters
face_idID of the face of the polytope
Returns
Vector of coordinates of face's vertices

◆ face_vertices() [1/2]

template<int D>
const std::vector<int>& Wonton::Polytope< D >::face_vertices ( int const  face_id) const
inline

Indices of vertices of the polytope's face in counter-clockwise order (i.e. so that the normal to the face is pointing outside of the polytope)

Parameters
face_idID of the face of the polytope
Returns
Vector of indices of the face's vertices

◆ face_vertices() [2/2]

template<int D>
const std::vector< std::vector<int> >& Wonton::Polytope< D >::face_vertices ( ) const
inline

Indices of vertices for all the faces of the polytope.

Returns
Vector of vectors of indices of faces' vertices

◆ moments() [1/3]

template<int D>
std::vector<double> Wonton::Polytope< D >::moments ( ) const

Moments for the polytope.

Returns
Vector of moments; moments[0] is the size, moments[i+1]/moments[0] is i-th coordinate of the centroid

◆ moments() [2/3]

template<>
std::vector< double > Wonton::Polytope< 2 >::moments ( ) const
inline

Moments for the polygon.

Parameters
momentsComputed moments: moments[0] is area, moments[i+1]/moments[0] is i-th coordinate of the centroid, i=1,2

◆ moments() [3/3]

template<>
std::vector< double > Wonton::Polytope< 3 >::moments ( ) const
inline

Moments for the polyhedron. Non-triangular faces are assumed to be non-flat and are split into triangles using their centroid.

Parameters
momentsComputed moments, moments[0] is volume, moments[i+1]/moments[0] is i-th coordinate of the centroid, i=1,2,3

◆ num_faces()

template<int D>
int Wonton::Polytope< D >::num_faces ( ) const
inline

Number of material poly's faces.

Returns
Number of faces

◆ num_vertices()

template<int D>
int Wonton::Polytope< D >::num_vertices ( ) const
inline

Number of material poly's vertices.

Returns
Number of vertices

◆ points()

template<int D>
const std::vector< Point<D> >& Wonton::Polytope< D >::points ( ) const
inline

Points for all the vertices of the polytope.

Returns
Vector of vertex points

◆ vertex_point()

template<int D>
Point<D> Wonton::Polytope< D >::vertex_point ( int const  vertex_id) const
inline

Coordinates of a polytope's vertex.

Parameters
vertex_idID of a vertex of the polytope
Returns
Coordinates of that vertex

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