Volume Cartographer 2.27.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
volcart::shapes::Sphere Class Reference

Icosphere shape. More...

#include <vc/core/shapes/Sphere.hpp>

Inheritance diagram for volcart::shapes::Sphere:
[legend]
Collaboration diagram for volcart::shapes::Sphere:
[legend]

Public Member Functions

 Sphere (float radius=5, int recursion=2)
 
- Public Member Functions inherited from volcart::shapes::ShapePrimitive
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::VertexgetPoints () const
 Return the vertices as a list of SimpleMesh::Vertex. More...
 
std::vector< SimpleMesh::CellgetCells () 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...
 

Private Member Functions

int midpoint_ (int p1, int p2)
 Compute and cache the midpoint between two vertices.
 

Private Attributes

std::unordered_map< std::string, int > indexCache_
 Vertex index cache. More...
 

Additional Inherited Members

- Protected Member Functions inherited from volcart::shapes::ShapePrimitive
 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 inherited from volcart::shapes::ShapePrimitive
std::vector< SimpleMesh::Vertexpoints_
 
std::vector< SimpleMesh::Cellcells_
 
bool ordered_ {false}
 
std::size_t orderedWidth_ {0}
 
std::size_t orderedHeight_ {0}
 

Detailed Description

Icosphere shape.

Author
Melissa Shankle
Date
12/03/15

This class generates an approximation of a sphere as a polyhedron by recursively subdividing the triangles of an icosahedron.

The recursion level defines the "smoothness" of the sphere. An icosphere with recursion = 0 will have 20 triangular faces. Each additional level results in a 4x increase in the number of faces over the previous level. For a recursion level $r$, the number of faces in the sphere will be $ 20 * 4^{r}$.

The radius parameter is not currently used.

The shape will have a number of points equal to the number of faces in the sphere (see above) plus two. The points generated by this class are unordered.

This implementation is an adaptation of an implementation by Andreas Kahler.

Definition at line 40 of file Sphere.hpp.

Member Data Documentation

◆ indexCache_

std::unordered_map<std::string, int> volcart::shapes::Sphere::indexCache_
private

Vertex index cache.

Keeps track of vertices that have already been created by subdividing an existing edge. Used to avoid creating duplicate vertices.

Definition at line 54 of file Sphere.hpp.


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