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