opensurgsim
Public Types | Public Member Functions | List of all members
SurgSim::Math::CompoundShape Class Reference
Inheritance diagram for SurgSim::Math::CompoundShape:
SurgSim::Math::Shape SurgSim::Framework::Accessible SurgSim::Framework::FactoryBase< Shape >

Public Types

typedef std::pair< std::shared_ptr< Shape >, RigidTransform3dSubShape
 
- Public Types inherited from SurgSim::Math::Shape
typedef ::SurgSim::Math::Vector3d Vector3d
 
typedef ::SurgSim::Math::Matrix33d Matrix33d
 
- Public Types inherited from SurgSim::Framework::Accessible
typedef std::function< boost::any(void)> GetterType
 
typedef std::function< void(boost::any)> SetterType
 
typedef std::function< YAML::Node(void)> EncoderType
 
typedef std::function< void(const YAML::Node *)> DecoderType
 
- Public Types inherited from SurgSim::Framework::FactoryBase< Shape >
typedef ObjectFactory< Shape > FactoryType
 

Public Member Functions

 CompoundShape ()
 Constructor.
 
 ~CompoundShape ()
 Destructor.
 
 SURGSIM_CLASSNAME (SurgSim::Math::CompoundShape)
 
size_t addShape (const std::shared_ptr< Shape > &shape, const RigidTransform3d &pose=RigidTransform3d::Identity())
 Add a shape to this shape, you can optionally supply a local pose for the added shape w.r.t. More...
 
void setShapes (const std::vector< SubShape > &shapes)
 Sets the shapes for this object, the shapes should be a list of shapes together with their respective poses, this will clear all the previously contained shapes. More...
 
const std::vector< SubShape > & getShapes () const
 
const std::shared_ptr< Shape > & getShape (size_t index) const
 
RigidTransform3d getCompoundPose (size_t index) const
 
RigidTransform3d getPose (size_t index) const
 
const std::vector< RigidTransform3d > & getPoses () const
 
void setPoses (const std::vector< RigidTransform3d > &poses)
 Sets the local poses for all subshapes with respect to this CompoundShape. More...
 
void setPose (size_t index, const RigidTransform3d &pose)
 Set the local pose for the specified shape with respect to this CompoundShape. More...
 
size_t getNumShapes () const
 
void clearShapes ()
 clears all the enclosed shapes
 
int getType () const override
 
double getVolume () const override
 
Vector3d getCenter () const override
 Get the volumetric center of the shape. More...
 
Matrix33d getSecondMomentOfVolume () const override
 Get the second central moment of the volume, commonly used to calculate the moment of inertia matrix. More...
 
bool isValid () const override
 Check if the shape is valid. More...
 
const Math::Aabbd & getBoundingBox () const override
 
bool isTransformable () const override
 
std::shared_ptr< ShapegetTransformed (const RigidTransform3d &pose) const override
 Get a copy of this shape with an applied rigid transform. More...
 
void setPose (const RigidTransform3d &pose) override
 Set the pose on a transformable shape. More...
 
void updateShape () override
 Update the internals of a transformable shape.
 
void updateShapePartial () override
 Update some of the internals of a transformable shape. More...
 
- Public Member Functions inherited from SurgSim::Math::Shape
 Shape ()
 Constructor.
 
virtual ~Shape ()
 Destructor.
 
virtual std::string getClassName () const
 Get class name.
 
- Public Member Functions inherited from SurgSim::Framework::Accessible
 Accessible ()
 Default Constructor.
 
 ~Accessible ()
 Destructor.
 
template<class T >
getValue (const std::string &name) const
 Retrieves the value with the name by executing the getter if it is found and tries to convert it to the given type. More...
 
boost::any getValue (const std::string &name) const
 Retrieves the value with the name by executing the getter if it is found. More...
 
template<class T >
bool getValue (const std::string &name, T *value) const
 Retrieves the value with the name by executing the getter if it is found, and converts it to the type of the output parameter. More...
 
void setValue (const std::string &name, const boost::any &value)
 Sets a value of a property that has setter. More...
 
bool isReadable (const std::string &name) const
 Check whether a property is readable. More...
 
bool isWriteable (const std::string &name) const
 Check whether a property is writable. More...
 
void setGetter (const std::string &name, GetterType func)
 Sets a getter for a given property. More...
 
void setSetter (const std::string &name, SetterType func)
 Sets a setter for a given property. More...
 
void setAccessors (const std::string &name, GetterType getter, SetterType setter)
 Sets the accessors getter and setter in one function. More...
 
void removeAccessors (const std::string &name)
 Removes all the accessors (getter and setter) for a given property. More...
 
void forwardProperty (const std::string &name, const Accessible &target, const std::string &targetProperty)
 Adds a property with the given name that uses the targets accessors, in effect forwarding the value to the target. More...
 
void setSerializable (const std::string &name, EncoderType encoder, DecoderType decoder)
 Sets the functions used to convert data from and to a YAML::Node. More...
 
void setDecoder (const std::string &name, DecoderType decoder)
 Sets the functions used to convert data from a YAML::Node. More...
 
YAML::Node encode () const
 Encode this Accessible to a YAML::Node. More...
 
void decode (const YAML::Node &node, const std::vector< std::string > &ignoredProperties=std::vector< std::string >())
 Decode this Accessible from a YAML::Node, will throw an exception if the data type cannot be converted. More...
 
std::vector< std::string > getProperties ()
 
template<>
boost::any getValue (const std::string &name) const
 

Additional Inherited Members

- Static Public Member Functions inherited from SurgSim::Framework::FactoryBase< Shape >
static FactoryTypegetFactory ()
 
- Protected Attributes inherited from SurgSim::Math::Shape
Math::Aabbd m_aabb
 

Member Function Documentation

§ addShape()

size_t SurgSim::Math::CompoundShape::addShape ( const std::shared_ptr< Shape > &  shape,
const RigidTransform3d pose = RigidTransform3d::Identity() 
)

Add a shape to this shape, you can optionally supply a local pose for the added shape w.r.t.

this CompoundShape.

Parameters
shapeto be added
poseThe local pose for the newly added shape
Returns
the index of the newly added shape

§ getBoundingBox()

const Math::Aabbd & SurgSim::Math::CompoundShape::getBoundingBox ( ) const
overridevirtual
Returns
the bounding box for the shape

Reimplemented from SurgSim::Math::Shape.

§ getCenter()

Vector3d SurgSim::Math::CompoundShape::getCenter ( ) const
overridevirtual

Get the volumetric center of the shape.

Returns
The center of the shape

Implements SurgSim::Math::Shape.

§ getCompoundPose()

RigidTransform3d SurgSim::Math::CompoundShape::getCompoundPose ( size_t  index) const
Returns
The compound pose of a specific shape i.e., the local pose of this CompoundShape times the local pose of the subshape in the CompoundShape.
Exceptions
SurgSim::AssertionFailureif the index exceeds the current number of shapes

§ getNumShapes()

size_t SurgSim::Math::CompoundShape::getNumShapes ( ) const
Returns
the number of shapes in this shape

§ getPose()

RigidTransform3d SurgSim::Math::CompoundShape::getPose ( size_t  index) const
Returns
The local pose of a specific shape with respect to this CompoundShape.
Exceptions
SurgSim::AssertionFailureif the index exceeds the current number of shapes

§ getPoses()

const std::vector< RigidTransform3d > & SurgSim::Math::CompoundShape::getPoses ( ) const
Returns
The local poses of the subshapes with respect to this CompoundShape.

§ getSecondMomentOfVolume()

Matrix33d SurgSim::Math::CompoundShape::getSecondMomentOfVolume ( ) const
overridevirtual

Get the second central moment of the volume, commonly used to calculate the moment of inertia matrix.

Returns
The 3x3 symmetric second moment matrix

check whether istransformable subshapes should multiply by pose (their localpose)

check whether istransformable subshapes should multiply by r (the linear part of their localpose)

Implements SurgSim::Math::Shape.

§ getShape()

const std::shared_ptr< Shape > & SurgSim::Math::CompoundShape::getShape ( size_t  index) const
Returns
a specific shape
Exceptions
SurgSim::AssertionFailureif the index exceeds the current number of shapes

§ getShapes()

const std::vector< CompoundShape::SubShape > & SurgSim::Math::CompoundShape::getShapes ( ) const
Returns
all the contained shapes and their respective poses

§ getTransformed()

std::shared_ptr< Shape > SurgSim::Math::CompoundShape::getTransformed ( const RigidTransform3d pose) const
overridevirtual

Get a copy of this shape with an applied rigid transform.

Parameters
poseThe pose to transform the shape by
Returns
the posed shape

Reimplemented from SurgSim::Math::Shape.

§ getType()

int SurgSim::Math::CompoundShape::getType ( ) const
overridevirtual
Returns
the type of shape

Implements SurgSim::Math::Shape.

§ getVolume()

double SurgSim::Math::CompoundShape::getVolume ( ) const
overridevirtual
Returns
the volume of the shape
Note
that currently this is a very simple sum of all the volumes of the enclosed shapes it will disregard any overlapping shapes.

Implements SurgSim::Math::Shape.

§ isTransformable()

bool SurgSim::Math::CompoundShape::isTransformable ( ) const
overridevirtual
Returns
true if the the shape can be transformed

Reimplemented from SurgSim::Math::Shape.

§ isValid()

bool SurgSim::Math::CompoundShape::isValid ( ) const
overridevirtual

Check if the shape is valid.

Returns
True if shape is valid; Otherwise, false.

Implements SurgSim::Math::Shape.

§ setPose() [1/2]

void SurgSim::Math::CompoundShape::setPose ( size_t  index,
const RigidTransform3d pose 
)

Set the local pose for the specified shape with respect to this CompoundShape.

Parameters
indexindex of the target shape
posenew pose for the indicated shape
Exceptions
SurgSim::AssertionFailureif the index exceeds the current number of shapes

§ setPose() [2/2]

void SurgSim::Math::CompoundShape::setPose ( const RigidTransform3d pose)
overridevirtual

Set the pose on a transformable shape.

Parameters
poseThe pose to transform the shape by.

Reimplemented from SurgSim::Math::Shape.

§ setPoses()

void SurgSim::Math::CompoundShape::setPoses ( const std::vector< RigidTransform3d > &  poses)

Sets the local poses for all subshapes with respect to this CompoundShape.

Parameters
posesarray of poses to be copied to each shape
Exceptions
SurgSimm::AssertialFailureif the size of poses.size() != getNumShapes()

§ setShapes()

void SurgSim::Math::CompoundShape::setShapes ( const std::vector< SubShape > &  shapes)

Sets the shapes for this object, the shapes should be a list of shapes together with their respective poses, this will clear all the previously contained shapes.

Parameters
shapeslist of shapes

§ updateShapePartial()

void SurgSim::Math::CompoundShape::updateShapePartial ( )
overridevirtual

Update some of the internals of a transformable shape.

Only called if the AABB has not changed much.

Reimplemented from SurgSim::Math::Shape.


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