![]() |
#include <SurgSim/Math/CompoundShape.h>
Public Types | |
typedef std::pair< std::shared_ptr< Shape >, RigidTransform3d > | SubShape |
![]() | |
typedef ::SurgSim::Math::Vector3d | Vector3d |
typedef ::SurgSim::Math::Matrix33d | Matrix33d |
![]() | |
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 |
![]() | |
typedef ObjectFactory< Shape > | FactoryType |
Public Member Functions | |
CompoundShape () | |
Constructor. More... | |
~CompoundShape () | |
Destructor. More... | |
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 pose for the added shape. 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 | getPose (size_t index) const |
void | setPoses (const std::vector< RigidTransform3d > &poses) |
Sets the poses for all shapes. More... | |
void | setPose (size_t index, const RigidTransform3d &pose) |
Set the pose for the specified shape. More... | |
size_t | getNumShapes () const |
void | clearShapes () |
clears all the enclosed shapes More... | |
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< Shape > | getTransformed (const RigidTransform3d &pose) const override |
Get a copy of this shape with an applied rigid transform. More... | |
![]() | |
Shape () | |
Constructor. More... | |
virtual | ~Shape () |
Destructor. More... | |
virtual std::string | getClassName () const |
Get class name. More... | |
![]() | |
Accessible () | |
Default Constructor. More... | |
~Accessible () | |
Destructor. More... | |
template<class T > | |
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... | |
template<> | |
boost::any | getValue (const std::string &name) const |
Private Types | |
typedef boost::shared_lock< boost::shared_mutex > | ReadLock |
typedef boost::unique_lock< boost::shared_mutex > | WriteLock |
Private Member Functions | |
void | invalidateData () |
Clears the data for the volume, center and secondMoment and aabb so it can be recalculated when needed again. More... | |
Private Attributes | |
std::vector< SubShape > | m_shapes |
boost::shared_mutex | m_mutex |
DataStructures::OptionalValue< Vector3d > | m_center |
DataStructures::OptionalValue< double > | m_volume |
DataStructures::OptionalValue< Matrix33d > | m_secondMoment |
DataStructures::OptionalValue< Math::Aabbd > | m_localAabb |
Additional Inherited Members | |
![]() | |
static FactoryType & | getFactory () |
![]() | |
Math::Aabbd | m_aabb |
|
private |
typedef std::pair<std::shared_ptr<Shape>, RigidTransform3d> SurgSim::Math::CompoundShape::SubShape |
|
private |
SurgSim::Math::CompoundShape::CompoundShape | ( | ) |
Constructor.
SurgSim::Math::CompoundShape::~CompoundShape | ( | ) |
Destructor.
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 pose for the added shape.
shape | to be added |
pose | for the newly added shape |
void SurgSim::Math::CompoundShape::clearShapes | ( | ) |
clears all the enclosed shapes
|
overridevirtual |
Reimplemented from SurgSim::Math::Shape.
|
overridevirtual |
Get the volumetric center of the shape.
Implements SurgSim::Math::Shape.
size_t SurgSim::Math::CompoundShape::getNumShapes | ( | ) | const |
RigidTransform3d SurgSim::Math::CompoundShape::getPose | ( | size_t | index | ) | const |
SurgSim::AssertionFailure | if the index exceeds the current number of shapes |
|
overridevirtual |
Get the second central moment of the volume, commonly used to calculate the moment of inertia matrix.
Implements SurgSim::Math::Shape.
const std::shared_ptr< Shape > & SurgSim::Math::CompoundShape::getShape | ( | size_t | index | ) | const |
SurgSim::AssertionFailure | if the index exceeds the current number of shapes |
const std::vector< CompoundShape::SubShape > & SurgSim::Math::CompoundShape::getShapes | ( | ) | const |
|
overridevirtual |
Get a copy of this shape with an applied rigid transform.
pose | The pose to transform the shape by |
Reimplemented from SurgSim::Math::Shape.
|
overridevirtual |
Implements SurgSim::Math::Shape.
|
overridevirtual |
Implements SurgSim::Math::Shape.
|
private |
Clears the data for the volume, center and secondMoment and aabb so it can be recalculated when needed again.
|
overridevirtual |
Reimplemented from SurgSim::Math::Shape.
|
overridevirtual |
Check if the shape is valid.
Implements SurgSim::Math::Shape.
void SurgSim::Math::CompoundShape::setPose | ( | size_t | index, |
const RigidTransform3d & | pose | ||
) |
Set the pose for the specified shape.
index | index of the target shape |
pose | new pose for the indicated shape |
SurgSim::AssertionFailure | if the index exceeds the current number of shapes |
void SurgSim::Math::CompoundShape::setPoses | ( | const std::vector< RigidTransform3d > & | poses | ) |
Sets the poses for all shapes.
poses | array of poses to be copied to each shape |
SurgSimm::AssertialFailure | if the size of poses.size() != getNumShapes() |
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.
shapes | list of shapes |
SurgSim::Math::CompoundShape::SURGSIM_CLASSNAME | ( | SurgSim::Math::CompoundShape | ) |
|
mutableprivate |
Storage for the physical properties of this shape mutable so they can be recalculated inside the const functions getVolume(), getCenter(), getSecondMommentOfVolume()
|
mutableprivate |
Storage for the physical properties of this shape mutable so they can be recalculated inside the const functions getVolume(), getCenter(), getSecondMommentOfVolume()
|
mutableprivate |
|
mutableprivate |
Storage for the physical properties of this shape mutable so they can be recalculated inside the const functions getVolume(), getCenter(), getSecondMommentOfVolume()
|
private |
|
mutableprivate |
Storage for the physical properties of this shape mutable so they can be recalculated inside the const functions getVolume(), getCenter(), getSecondMommentOfVolume()