Go to the documentation of this file.
16 #ifndef SURGSIM_MATH_COMPOUNDSHAPE_H
17 #define SURGSIM_MATH_COMPOUNDSHAPE_H
22 #include <boost/thread.hpp>
34 SURGSIM_STATIC_REGISTRATION(CompoundShape);
58 void setShapes(
const std::vector<SubShape>& shapes);
61 const std::vector<SubShape>&
getShapes()
const;
65 const std::shared_ptr<Shape>&
getShape(
size_t index)
const;
74 void setPoses(
const std::vector<RigidTransform3d>& poses);
115 typedef boost::shared_lock<boost::shared_mutex>
ReadLock;
116 typedef boost::unique_lock<boost::shared_mutex>
WriteLock;
std::pair< std::shared_ptr< Shape >, RigidTransform3d > SubShape
Definition: CompoundShape.h:47
bool isValid() const override
Check if the shape is valid.
Definition: CompoundShape.cpp:146
Vector3d getCenter() const override
Get the volumetric center of the shape.
Definition: CompoundShape.cpp:71
DataStructures::OptionalValue< Matrix33d > m_secondMoment
Definition: CompoundShape.h:126
void clearShapes()
clears all the enclosed shapes
Definition: CompoundShape.cpp:246
DataStructures::OptionalValue< Vector3d > m_center
Definition: CompoundShape.h:124
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
RigidTransform3d getPose(size_t index) const
Definition: CompoundShape.cpp:212
void setPose(size_t index, const RigidTransform3d &pose)
Set the pose for the specified shape.
Definition: CompoundShape.cpp:232
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
boost::shared_mutex m_mutex
Definition: CompoundShape.h:118
std::shared_ptr< Shape > getTransformed(const RigidTransform3d &pose) const override
Get a copy of this shape with an applied rigid transform.
Definition: CompoundShape.cpp:258
int getType() const override
Definition: CompoundShape.cpp:39
Definition: CompoundShapeToGraphics.cpp:29
std::vector< SubShape > m_shapes
Definition: CompoundShape.h:113
const std::vector< SubShape > & getShapes() const
Definition: CompoundShape.cpp:199
boost::shared_lock< boost::shared_mutex > ReadLock
Definition: CompoundShape.h:115
~CompoundShape()
Destructor.
Definition: CompoundShape.cpp:35
Eigen::Matrix< double, 3, 3, Eigen::RowMajor > Matrix33d
A 3x3 matrix of doubles.
Definition: Matrix.h:51
Eigen::AlignedBox< double, 3 > Aabbd
Wrapper around the Eigen type.
Definition: Aabb.h:30
Definition: CompoundShape.h:36
void setPoses(const std::vector< RigidTransform3d > &poses)
Sets the poses for all shapes.
Definition: CompoundShape.cpp:219
Matrix33d getSecondMomentOfVolume() const override
Get the second central moment of the volume, commonly used to calculate the moment of inertia matrix.
Definition: CompoundShape.cpp:106
size_t getNumShapes() const
Definition: CompoundShape.cpp:240
CompoundShape()
Constructor.
Definition: CompoundShape.cpp:27
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...
Definition: CompoundShape.cpp:192
SURGSIM_CLASSNAME(SurgSim::Math::CompoundShape)
Generic rigid shape class defining a shape.
Definition: Shape.h:65
DataStructures::OptionalValue< double > m_volume
Definition: CompoundShape.h:125
boost::unique_lock< boost::shared_mutex > WriteLock
Definition: CompoundShape.h:116
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.
Definition: CompoundShape.cpp:184
DataStructures::OptionalValue< Math::Aabbd > m_localAabb
Definition: CompoundShape.h:127
const std::shared_ptr< Shape > & getShape(size_t index) const
Definition: CompoundShape.cpp:205
const Math::Aabbd & getBoundingBox() const override
Definition: CompoundShape.cpp:151
double getVolume() const override
Definition: CompoundShape.cpp:44
void invalidateData()
Clears the data for the volume, center and secondMoment and aabb so it can be recalculated when neede...
Definition: CompoundShape.cpp:176
bool isTransformable() const override
Definition: CompoundShape.cpp:253