iMSTK
Interactive Medical Simulation Toolkit
|
PointwiseMap can compute & apply a mapping between parent and child PointSet geometries. More...
#include <imstkPointwiseMap.h>
Public Member Functions | |
PointwiseMap (std::shared_ptr< Geometry > parent, std::shared_ptr< Geometry > child) | |
void | compute () override |
Compute the tetra-triangle mesh map. | |
void | computeMap (std::unordered_map< int, int > &tetVertToSurfVertMap) |
Compute tet vertex id to surf vertex id map. | |
void | setMap (const std::unordered_map< int, int > &sourceMap) |
Sets the one-to-one correspondence directly. | |
const std::unordered_map< int, int > & | getMap () const |
void | addNewUniquePoint (int sourceId, int targetId) |
Unsafe function for adding new points Can be used in methods that modify the parent mesh when new vertices are added to the child mesh. | |
int | getParentVertexId (const int childVertexId) const |
Get the mapped/corresponding parent index, given a child index. returns -1 if no correspondence found. More... | |
void | setTolerance (const double tolerance) |
Set/Get the tolerance. The distance to consider two points equivalent/corresponding. | |
double | getTolerance () const |
![]() | |
virtual const std::string | getTypeName () const =0 |
Returns the string class name. More... | |
void | setParentGeometry (std::shared_ptr< Geometry > parent) |
Get/Set parent geometry. | |
std::shared_ptr< Geometry > | getParentGeometry () const |
void | setChildGeometry (std::shared_ptr< Geometry > child) |
Get/Set child geometry. | |
std::shared_ptr< Geometry > | getChildGeometry () const |
![]() | |
std::shared_ptr< Geometry > | getInput (size_t port=0) const |
Returns input geometry given port, returns nullptr if doesn't exist. | |
std::shared_ptr< Geometry > | getOutput (size_t port=0) const |
Returns output geometry given port, returns nullptr if doesn't exist. | |
void | setInput (std::shared_ptr< Geometry > inputGeometry, size_t port=0) |
Set the input at the port. | |
void | update () |
Do the actual algorithm. | |
Public Attributes | |
std::unordered_map< int, int > | m_oneToOneMap |
One to one mapping data. | |
std::vector< std::pair< int, int > > | m_oneToOneMapVector |
One to one mapping data. | |
double | m_epsilon = 0.00000001 |
Tolernace for considering two points equivalent/mapped. The tolerance is set a bit higher here since 32bit float PointSets are very commonly mapped to 64 bit double PointSets (because of file formats/IO) | |
Protected Member Functions | |
int | findMatchingVertex (const VecDataArray< double, 3 > &parentMesh, const Vec3d &p) |
Returns the first matching vertex, -1 if not found. | |
void | requestUpdate () override |
Apply (if active) the tetra-triangle mesh map. | |
![]() | |
void | setOutput (std::shared_ptr< Geometry > inputGeometry, const size_t port=0) |
Set the output at the port. | |
template<typename T > | |
void | setRequiredInputType (const size_t port) |
Declares the type for the port with the given number, also defines that the give port is required for the filter to run correctly. | |
template<typename T > | |
void | setOptionalInputType (const size_t port) |
Declares the type for the port with the given number, the data for this port is optional and may be omitted. | |
virtual bool | areInputsValid () |
Check inputs are correct. More... | |
void | setNumInputPorts (const size_t numPorts) |
Get/Set the amount of input ports. | |
imstkGetMacro (NumInputPorts, size_t) | |
void | setNumOutputPorts (const size_t numPorts) |
Get/Set the amount of output ports. | |
imstkGetMacro (NumOutputPorts, size_t) | |
Additional Inherited Members | |
![]() | |
using | GeometryCheck = std::function< bool(Geometry *)> |
using | TypeCheckContainer = std::unordered_map< size_t, GeometryCheck > |
![]() | |
TypeCheckContainer | m_requiredTypeChecks |
TypeCheckContainer | m_optionalTypeChecks |
PointwiseMap can compute & apply a mapping between parent and child PointSet geometries.
Definition at line 24 of file imstkPointwiseMap.h.
int imstk::PointwiseMap::getParentVertexId | ( | const int | childVertexId | ) | const |
Get the mapped/corresponding parent index, given a child index. returns -1 if no correspondence found.
index | on the child geometry |
Definition at line 148 of file imstkPointwiseMap.cpp.