iMSTK
Interactive Medical Simulation Toolkit
Classes | Public Member Functions | List of all members
imstk::CompoundGeometry Class Reference

#include <imstkCompoundGeometry.h>

Inheritance diagram for imstk::CompoundGeometry:
Inheritance graph
[legend]
Collaboration diagram for imstk::CompoundGeometry:
Collaboration graph
[legend]

Public Member Functions

 IMSTK_TYPE_NAME (CompoundGeometry)
 
void add (std::shared_ptr< AnalyticalGeometry > geometry)
 Adds a geometry to the compound geometry.
 
void setLocalTransform (size_t index, const Mat4d &transform)
 
size_t count () const
 
std::shared_ptr< Geometryget (size_t index) const
 
void print () const override
 Print. More...
 
double getVolume () override
 Returns the volume of the geometry (if valid) More...
 
void computeBoundingBox (Vec3d &lowerCorner, Vec3d &upperCorner, const double paddingPercent=0.0) override
 Compute the bounding box for the geometry. More...
 
Vec3d getCenter () override
 Returns the bounding box center. More...
 
bool isMesh () const override
 Returns true if the geometry is a mesh, else returns false. More...
 
void updatePostTransformData () const override
 
void applyTransform (const Mat4d &) override
 Directly apply transform to data. More...
 
- Public Member Functions inherited from imstk::Geometry
 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)
 
void transform (const Mat4d &T, TransformType type=TransformType::ConcatenateToTransform)
 Applies a rigid transform to the geometry.
 
std::unique_ptr< Geometryclone ()
 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)
 
- Public Member Functions inherited from imstk::EventObject
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.
 

Additional Inherited Members

- Public Types inherited from imstk::Geometry
enum  TransformType { ApplyToData, ConcatenateToTransform }
 Enumeration for the transformation to apply ApplyToTransform to apply the transformation to the data ConcatenateToTransform to apply the transformation to the transform matrix.
 
enum  DataType { PreTransform, PostTransform }
 Enumeration for the data to retrieve PreTransform for data where transform matrix is not applied PostTransform for data where transform matrix is applied.
 
- Public Types inherited from imstk::EventObject
using Observer = std::tuple< bool, std::weak_ptr< EventObject >, std::function< void(Event *)> >
 
- Static Public Member Functions inherited from imstk::Geometry
static size_t getNumGlobalIds ()
 Get number of ids/geometries.
 
- Static Protected Member Functions inherited from imstk::Geometry
static size_t getUniqueId ()
 Get a unique ID for the new generated geometry object.
 
- Protected Attributes inherited from imstk::Geometry
bool m_transformApplied = true
 
bool m_boundsDirty = true
 
Mat4d m_transform = Mat4d::Identity()
 Transformation matrix.
 
size_t m_globalId
 Unique ID assigned to each geometry upon construction.
 
std::string m_name = "unnamed"
 
- Protected Attributes inherited from imstk::EventObject
ParallelUtils::SpinLock eventQueueLock
 
std::deque< CommandeventQueue
 
std::vector< std::pair< std::string, std::vector< Observer > > > queuedObservers
 
std::vector< std::pair< std::string, std::vector< Observer > > > directObservers
 
- Static Protected Attributes inherited from imstk::Geometry
static std::atomic< size_t > s_numGlobalIds = { 0 }
 Total number of geometries that have been created in this program.
 

Detailed Description

Class that enables the composition of multiple geometries into on object, useful for creating rigids from multiple shapes.

Definition at line 21 of file imstkCompoundGeometry.h.

Member Function Documentation

◆ applyTransform()

void imstk::CompoundGeometry::applyTransform ( const Mat4d &  mat)
overridevirtual

Directly apply transform to data.

Reimplemented from imstk::Geometry.

Definition at line 80 of file imstkCompoundGeometry.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ computeBoundingBox()

void imstk::CompoundGeometry::computeBoundingBox ( Vec3d &  lowerCorner,
Vec3d &  upperCorner,
const double  paddingPercent = 0.0 
)
overridevirtual

Compute the bounding box for the geometry.

Todo:
Padding should not be here

Reimplemented from imstk::Geometry.

Definition at line 32 of file imstkCompoundGeometry.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ count()

size_t imstk::CompoundGeometry::count ( ) const
inline
Returns
the number of shapes handled

Definition at line 38 of file imstkCompoundGeometry.h.

Here is the call graph for this function:

◆ get()

std::shared_ptr< imstk::Geometry > imstk::CompoundGeometry::get ( size_t  index) const
Returns
the shape with the given index, nullptr otherwise

Definition at line 103 of file imstkCompoundGeometry.cpp.

◆ getCenter()

Vec3d imstk::CompoundGeometry::getCenter ( )
overridevirtual

Returns the bounding box center.

Reimplemented from imstk::Geometry.

Definition at line 49 of file imstkCompoundGeometry.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getVolume()

double imstk::CompoundGeometry::getVolume ( )
overridevirtual

Returns the volume of the geometry (if valid)

Reimplemented from imstk::Geometry.

Definition at line 24 of file imstkCompoundGeometry.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isMesh()

bool imstk::CompoundGeometry::isMesh ( ) const
overridevirtual

Returns true if the geometry is a mesh, else returns false.

Reimplemented from imstk::Geometry.

Definition at line 57 of file imstkCompoundGeometry.cpp.

Here is the caller graph for this function:

◆ print()

void imstk::CompoundGeometry::print ( ) const
overridevirtual

Print.

Reimplemented from imstk::Geometry.

Definition at line 18 of file imstkCompoundGeometry.cpp.

Here is the caller graph for this function:

◆ setLocalTransform()

void imstk::CompoundGeometry::setLocalTransform ( size_t  index,
const Mat4d &  transform 
)

Sets a local transform for the object at index, this offsets the shape from the origin of the overall compound object

Parameters
indexindex of the subshape
transformtransform to be used for that shape if index doesn't exist the operation does nothing

Definition at line 92 of file imstkCompoundGeometry.cpp.

Here is the call graph for this function:

◆ updatePostTransformData()

void imstk::CompoundGeometry::updatePostTransformData ( ) const
overridevirtual

Reimplemented from imstk::Geometry.

Definition at line 63 of file imstkCompoundGeometry.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

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