iMSTK
Interactive Medical Simulation Toolkit
|
OrientedBox geometry, specified with extents (half lengths) More...
#include <imstkOrientedBox.h>
Public Member Functions | |
OrientedBox (const Vec3d &pos=Vec3d::Zero(), const Vec3d extents=Vec3d(0.5, 0.5, 0.5), const Quatd &orientation=Quatd::Identity()) | |
void | print () const override |
Print the cube info. | |
double | getVolume () override |
Returns the volume of the cube. | |
Vec3d | getExtents (DataType type=DataType::PostTransform) |
Returns the extents of the cube. | |
void | setExtents (const Vec3d extents) |
Sets the extents of the cube (half dimensions) | |
void | setExtents (const double x, const double y, const double z) |
Sets the width of the cube (half dimensions) | |
double | getFunctionValue (const Vec3d &pos) const override |
Returns signed distance to surface at pos. | |
void | computeBoundingBox (Vec3d &min, Vec3d &max, const double paddingPercent=0.0) override |
Get the min, max of the AABB around the cube. | |
void | updatePostTransformData () const override |
Update the Cube parameters applying the latest transform. | |
std::unique_ptr< OrientedBox > | clone () |
Polymorphic clone, hides the declaration in superclass return own type. | |
![]() | |
Vec3d | getPosition (DataType type=DataType::PostTransform) |
Get the local or global position (post transformed) | |
Quatd | getOrientation (DataType type=DataType::PostTransform) |
Get the local or global orientation (post transformed) | |
void | setOrientation (const Quatd r) |
Set the local orientation. | |
double | getFunctionValue (const Vec3d &imstkNotUsed(pos)) const override |
Returns the implicit function value, this could signed, unsigned distance, or some other scalar. More... | |
void | setPosition (const Vec3d p) |
Set the local position. | |
void | setPosition (const double x, const double y, const double z) |
![]() | |
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 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. | |
virtual bool | isMesh () const |
Returns true if the geometry is a mesh, else returns false. | |
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. | |
Protected Member Functions | |
void | applyTransform (const Mat4d &m) override |
Apply a user transform directly to (pre-transformed) parameters producing new parameters. | |
Protected Attributes | |
Vec3d | m_extents = Vec3d(0.5, 0.5, 0.5) |
Vec3d | m_extentsPostTransform = Vec3d(0.5, 0.5, 0.5) |
Half dimensions of the oriented box once transform applied. | |
![]() | |
Vec3d | m_position |
position | |
Vec3d | m_positionPostTransform |
position once transform applied | |
Quatd | m_orientation |
orientation | |
Quatd | m_orientationPostTransform |
orientation once transform is applied | |
![]() | |
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" |
![]() | |
ParallelUtils::SpinLock | eventQueueLock |
std::deque< Command > | eventQueue |
std::vector< std::pair< std::string, std::vector< Observer > > > | queuedObservers |
std::vector< std::pair< std::string, std::vector< Observer > > > | directObservers |
Additional Inherited Members | |
![]() | |
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. | |
![]() | |
using | Observer = std::tuple< bool, std::weak_ptr< EventObject >, std::function< void(Event *)> > |
![]() | |
static size_t | getNumGlobalIds () |
Get number of ids/geometries. | |
![]() | |
static size_t | getUniqueId () |
Get a unique ID for the new generated geometry object. | |
![]() | |
static std::atomic< size_t > | s_numGlobalIds = { 0 } |
Total number of geometries that have been created in this program. | |
OrientedBox geometry, specified with extents (half lengths)
Definition at line 19 of file imstkOrientedBox.h.