Abstract template base class for all meshes that have homogenous cell types. This class allows templated access to cells. A cell in iMSTK could be a line, triangle, quad, tetrahedron, hexahedron, ... It is a group of vertices that form an element of a larger mesh.
More...
|
void | initialize (std::shared_ptr< VecDataArray< double, 3 >> vertices, std::shared_ptr< VecDataArray< int, N >> indices) |
| Initializes the rest of the data structures given vertex positions and connectivity.
|
|
int | getCellVertexCount () const override |
| Number of verticies associated with the cell type.
|
|
void | clear () override |
| Clears all the mesh data.
|
|
void | computeVertexToCellMap () override |
| Computes neighboring cells for all vertices.
|
|
void | computeVertexNeighbors () override |
| Computes neighboring vertices for all vertices.
|
|
virtual Eigen::Vector< double, N > | computeBarycentricWeights (const int imstkNotUsed(cellId), const Vec3d &imstkNotUsed(pos)) const |
| compute the barycentric weights of a given point in 3D space for a given the cell
|
|
Vec3d | computeWorldPosition (const int cellId, const Eigen::Matrix< double, N, 1 > &bary) const |
| compute the world position of a point in 3D given the cellId and a set of barycentric coordinates
|
|
std::shared_ptr< AbstractDataArray > | getAbstractCells () const override |
| Get cells as abstract array. Overridden by derived classes to return cells as point indices.
|
|
int | getNumCells () const override |
| Returns the number of cells.
|
|
std::unique_ptr< CellMesh< N > > | clone () |
| Polymorphic clone, hides the declaration in superclass return own type.
|
|
|
void | setCells (std::shared_ptr< VecDataArray< int, N >> indices) |
| Get/Set cell connectivity.
|
|
std::shared_ptr< VecDataArray< int, N > > | getCells () const |
|
bool | isMesh () const override |
| Returns true if the geometry is a mesh, else returns false.
|
|
void | print () const override |
| Print the surface mesh.
|
|
const std::vector< std::unordered_set< int > > & | getVertexToCellMap () const |
| Returns map of vertices to cells that contain the vertex (reverse linkage)
|
|
const std::vector< int > | getCellsForVertex (const int vertexId) |
| Returns cells that contain the vertex, will calculate vertex cells if necessary. More...
|
|
const std::vector< std::unordered_set< int > > & | getVertexNeighbors () const |
| Returns map of vertices to neighboring vertices.
|
|
const std::unordered_map< std::string, std::shared_ptr< AbstractDataArray > > & | getCellAttributes () const |
| Get the cell attributes map.
|
|
void | setCellAttribute (const std::string &arrayName, std::shared_ptr< AbstractDataArray > arr) |
|
std::shared_ptr< AbstractDataArray > | getCellAttribute (const std::string &name) const |
|
bool | hasCellAttribute (const std::string &arrayName) const |
| Check if a specific data array exists.
|
|
void | setCellAttributes (std::unordered_map< std::string, std::shared_ptr< AbstractDataArray >> attributes) |
| Set the cell attributes map.
|
|
void | setCellScalars (const std::string &arrayName, std::shared_ptr< AbstractDataArray > scalars) |
| Get/Set the active scalars.
|
|
void | setCellScalars (const std::string &arrayName) |
|
std::string | getActiveCellScalars () const |
|
std::shared_ptr< AbstractDataArray > | getCellScalars () const |
|
void | setCellNormals (const std::string &arrayName, std::shared_ptr< VecDataArray< double, 3 >> normals) |
| Get/Set the active normals.
|
|
void | setCellNormals (const std::string &arrayName) |
|
std::string | getActiveCellNormals () const |
|
std::shared_ptr< VecDataArray< double, 3 > > | getCellNormals () const |
|
void | setCellTangents (const std::string &arrayName, std::shared_ptr< VecDataArray< double, 3 >> tangents) |
| Get/Set the active tangents.
|
|
void | setCellTangents (const std::string &arrayName) |
|
std::string | getActiveCellTangents () const |
|
std::shared_ptr< VecDataArray< double, 3 > > | getCellTangents () const |
|
void | initialize (std::shared_ptr< VecDataArray< double, 3 >> positions) |
| Initializes the data structure given vertex positions.
|
|
virtual void | computeBoundingBox (Vec3d &lowerCorner, Vec3d &upperCorner, const double paddingPercent=0.0) override |
| Compute the bounding box for the entire mesh.
|
|
void | setInitialVertexPositions (std::shared_ptr< VecDataArray< double, 3 >> vertices) |
| Sets initial positions from an array.
|
|
std::shared_ptr< VecDataArray< double, 3 > > | getInitialVertexPositions () const |
| Returns the vector of initial positions of the mesh vertices.
|
|
Vec3d & | getInitialVertexPosition (const size_t vertNum) |
| Returns the initial position of a vertex given its index.
|
|
void | setVertexPositions (std::shared_ptr< VecDataArray< double, 3 >> positions) |
| Sets current vertex positions of the mesh.
|
|
std::shared_ptr< VecDataArray< double, 3 > > | getVertexPositions (DataType type=DataType::PostTransform) const |
| Returns the vector of current positions of the mesh vertices.
|
|
void | setVertexPosition (const size_t vertNum, const Vec3d &pos) |
| Set the current position of a vertex given its index to certain position (this is not a thread-safe method)
|
|
int | getNumVertices () const |
| Returns the number of total vertices in the mesh.
|
|
void | setVertexAttribute (const std::string &arrayName, std::shared_ptr< AbstractDataArray > arr) |
| Set a data array holding some per vertex data.
|
|
std::shared_ptr< AbstractDataArray > | getVertexAttribute (const std::string &arrayName) const |
| Get a specific data array. If the array name cannot be found, nullptr is returned.
|
|
bool | hasVertexAttribute (const std::string &arrayName) const |
| Check if a specific data array exists.
|
|
void | setVertexAttributes (std::unordered_map< std::string, std::shared_ptr< AbstractDataArray >> attributes) |
| Set the vertex attributes map.
|
|
const std::unordered_map< std::string, std::shared_ptr< AbstractDataArray > > & | getVertexAttributes () const |
| Get the vertex attributes map.
|
|
void | updatePostTransformData () const override |
| Applies the geometries member transform to produce currPositions.
|
|
std::unique_ptr< PointSet > | clone () |
| Polymorphic clone, hides the declaration in superclass return own type.
|
|
const Vec3d & | getVertexPosition (const size_t vertNum, DataType type=DataType::PostTransform) const |
| Returns the position of a vertex given its index.
|
|
Vec3d & | getVertexPosition (const size_t vertNum, DataType type=DataType::PostTransform) |
|
void | setVertexScalars (const std::string &arrayName, std::shared_ptr< AbstractDataArray > scalars) |
| Get/Set the active scalars.
|
|
void | setVertexScalars (const std::string &arrayName) |
|
std::string | getActiveVertexScalars () const |
|
std::shared_ptr< AbstractDataArray > | getVertexScalars () const |
|
void | setVertexNormals (const std::string &arrayName, std::shared_ptr< VecDataArray< double, 3 >> normals) |
| Get/Set the active normals.
|
|
void | setVertexNormals (const std::string &arrayName) |
|
std::string | getActiveVertexNormals () const |
|
std::shared_ptr< VecDataArray< double, 3 > > | getVertexNormals () const |
|
void | setVertexTangents (const std::string &arrayName, std::shared_ptr< VecDataArray< float, 3 >> tangents) |
| Get/Set the active tangents.
|
|
void | setVertexTangents (const std::string &arrayName) |
|
std::string | getActiveVertexTangents () const |
|
std::shared_ptr< VecDataArray< float, 3 > > | getVertexTangents () const |
|
void | setVertexTCoords (const std::string &arrayName, std::shared_ptr< VecDataArray< float, 2 >> tcoords) |
| Get/Set the active tcoords.
|
|
void | setVertexTCoords (const std::string &arrayName) |
|
std::string | getActiveVertexTCoords () const |
|
std::shared_ptr< VecDataArray< float, 2 > > | getVertexTCoords () const |
|
| Geometry (const Geometry &other) |
|
void | operator= (const Geometry &other) |
|
virtual const std::string | getTypeName () const =0 |
| Returns the string representing the type name of the geometry. More...
|
|
| SIGNAL (Geometry, modified) |
|
virtual double | getVolume () |
| Returns the volume of the geometry (if valid)
|
|
virtual Vec3d | getCenter () |
| Returns the bounding box center.
|
|
void | transform (const Mat4d &T, TransformType type=TransformType::ConcatenateToTransform) |
| Applies a rigid transform to the geometry.
|
|
std::unique_ptr< Geometry > | clone () |
| polymorphic clone function, utilize this to get a copy of the geometry without casting to the expected geometry type
|
|
const std::string & | getName () const |
| Get the name of the geometry.
|
|
void | setName (const std::string &name) |
|
size_t | getGlobalId () const |
| Get the global (unique) index of the geometry.
|
|
void | postModified () |
| Post modified event.
|
|
void | translate (const Vec3d &t, TransformType type=TransformType::ConcatenateToTransform) |
| Translate the geometry in Cartesian space.
|
|
void | translate (double x, double y, double z, TransformType type=TransformType::ConcatenateToTransform) |
|
void | rotate (const Quatd &q, TransformType type=TransformType::ConcatenateToTransform) |
| Rotate the geometry in Cartesian space.
|
|
void | rotate (const Mat3d &m, TransformType type=TransformType::ConcatenateToTransform) |
|
void | rotate (const Vec3d &axis, double radians, TransformType type=TransformType::ConcatenateToTransform) |
|
void | scale (const Vec3d &scaling, TransformType type=TransformType::ConcatenateToTransform) |
| Scale in Cartesian directions.
|
|
void | scale (const double scaling, TransformType type=TransformType::ConcatenateToTransform) |
|
Vec3d | getTranslation () const |
| Get/Set translation.
|
|
void | setTranslation (const Vec3d &t) |
|
void | setTranslation (const double x, const double y, const double z) |
|
Mat3d | getRotation () const |
| Get/Set rotation.
|
|
void | setRotation (const Mat3d &m) |
|
void | setRotation (const Quatd &q) |
|
void | setRotation (const Vec3d &axis, const double angle) |
|
Vec3d | getScaling () const |
| Get/Set scaling.
|
|
void | setScaling (const Vec3d &s) |
|
void | setScaling (const double s) |
|
const Mat4d & | getTransform () const |
| Get/Set the transform.
|
|
void | setTransform (const Mat4d &m) |
|
template<typename T > |
void | postEvent (const T &e) |
| Emits the event Direct observers will be immediately called, in sync Queued observers will receive the Command in their queue for later execution, reciever must implement doEvent.
|
|
template<typename T > |
void | queueEvent (const T &e) |
| Queues event directly to this.
|
|
void | doEvent () |
| Do an event, if none exists return.
|
|
void | doAllEvents () |
| Do all the events in the event queue.
|
|
void | foreachEvent (std::function< void(Command cmd)> func) |
| Thread safe loop over all event commands, one can implement a custom handler.
|
|
void | rforeachEvent (std::function< void(Command cmd)> func) |
| thread safe reverse loop over all event commands, one can implement a custom handler
|
|
void | clearEvents () |
| Removes all events from queue cleans up copies of the event.
|
|
template<int N>
class imstk::CellMesh< N >
Abstract template base class for all meshes that have homogenous cell types. This class allows templated access to cells. A cell in iMSTK could be a line, triangle, quad, tetrahedron, hexahedron, ... It is a group of vertices that form an element of a larger mesh.
- Template Parameters
-
N | number of of vertices in cell |
Definition at line 23 of file imstkCellMesh.h.