Volume Cartographer 2.27.0
|
Base class for shape generators. More...
#include <vc/core/shapes/ShapePrimitive.hpp>
Public Member Functions | |
ITKMesh::Pointer | itkMesh () |
Return the shape as an ITKMesh. | |
vtkSmartPointer< vtkPolyData > | vtkMesh () |
Return the shape as a vtkPolyData. | |
PointSet< cv::Vec3d > | unorderedPoints () |
Return the vertices as a PointSet. More... | |
PointSet< cv::Vec6d > | unorderedPointNormal () |
Return the vertices and vertex normals as a PointSet. More... | |
std::vector< SimpleMesh::Vertex > | getPoints () const |
Return the vertices as a list of SimpleMesh::Vertex. More... | |
std::vector< SimpleMesh::Cell > | getCells () const |
Return the faces as a list of volcart::Cell. More... | |
OrderedPointSet< cv::Vec3d > | orderedPoints () |
Return the vertices as an OrderedPointSet. More... | |
OrderedPointSet< cv::Vec6d > | orderedPointNormal () |
Return the vertices and vertex normals as an OrderedPointSet. More... | |
bool | isOrdered () const |
Return if the shape generator created ordered vertices. More... | |
std::size_t | orderedWidth () const |
Return the width of the ordered vertex set. More... | |
std::size_t | orderedHeight () const |
Return the height of the ordered vertex set. More... | |
Protected Member Functions | |
ShapePrimitive () | |
void | addVertex_ (double x, double y, double z) |
Add a new vertex to the shape. | |
void | addCell_ (int v1, int v2, int v3) |
Add a new triangular face to the mesh from vertex IDs. More... | |
void | updateNormal_ (int vertID, double nx, double ny, double nz) |
Update the normal of a vertex with a new normal component. More... | |
Protected Attributes | |
std::vector< SimpleMesh::Vertex > | points_ |
std::vector< SimpleMesh::Cell > | cells_ |
bool | ordered_ {false} |
std::size_t | orderedWidth_ {0} |
std::size_t | orderedHeight_ {0} |
Base class for shape generators.
This class provides a common interface for interacting with the various shape generators (Cube, Plane, etc.) provided by the Core library. Shape generators are meant to be used for unit and regression testing.
This class internally keeps a simple list of vertices and triangular faces and provides adaptor functions to convert these lists into higher level data structures (ITK/VTK meshes, PointSets, etc.). A new ShapePrimitive object will have no vertices or faces.
Definition at line 41 of file ShapePrimitive.hpp.
|
protected |
Default constructor
|
protected |
Add a new triangular face to the mesh from vertex IDs.
Automatically calls updateNormal_ as needed
|
inline |
Return the faces as a list of volcart::Cell.
Definition at line 71 of file ShapePrimitive.hpp.
|
inline |
Return the vertices as a list of SimpleMesh::Vertex.
Definition at line 68 of file ShapePrimitive.hpp.
|
inline |
Return if the shape generator created ordered vertices.
Definition at line 92 of file ShapePrimitive.hpp.
|
inline |
Return the height of the ordered vertex set.
Definition at line 98 of file ShapePrimitive.hpp.
OrderedPointSet< cv::Vec6d > volcart::shapes::ShapePrimitive::orderedPointNormal | ( | ) |
Return the vertices and vertex normals as an OrderedPointSet.
Throws a std::runtime_error if shape does not generate ordered vertices
Element order is: {x, y, z, nx, ny, nz}
OrderedPointSet< cv::Vec3d > volcart::shapes::ShapePrimitive::orderedPoints | ( | ) |
Return the vertices as an OrderedPointSet.
Throws a std::runtime_error if shape does not generate ordered points
Element order is: {x, y, z}
|
inline |
Return the width of the ordered vertex set.
Definition at line 95 of file ShapePrimitive.hpp.
PointSet< cv::Vec6d > volcart::shapes::ShapePrimitive::unorderedPointNormal | ( | ) |
Return the vertices and vertex normals as a PointSet.
Element order is: {x, y, z, nx, ny, nz}
PointSet< cv::Vec3d > volcart::shapes::ShapePrimitive::unorderedPoints | ( | ) |
Return the vertices as a PointSet.
Element order is: {x, y, z}
|
protected |
Update the normal of a vertex with a new normal component.
The stored vertex normal is an average of the normals of a vertex's adjacent faces. This function reaverages the normal with the vector defined by {nx, ny, nz}.
|
protected |
Face storage
Definition at line 108 of file ShapePrimitive.hpp.
|
protected |
Is the generated vertex set ordered?
Definition at line 129 of file ShapePrimitive.hpp.
|
protected |
Height of the ordered vertex set
Definition at line 133 of file ShapePrimitive.hpp.
|
protected |
Width of the ordered vertex set
Definition at line 131 of file ShapePrimitive.hpp.
|
protected |
Vertex storage
Definition at line 106 of file ShapePrimitive.hpp.