33 #ifndef DART_DYNAMICS_SHAPE_HPP_ 34 #define DART_DYNAMICS_SHAPE_HPP_ 38 #include <Eigen/Dense> 40 #include "dart/common/ClassWithVirtualBase.hpp" 41 #include "dart/common/Deprecated.hpp" 42 #include "dart/common/Signal.hpp" 43 #include "dart/common/Subject.hpp" 44 #include "dart/common/VersionCounter.hpp" 45 #include "dart/dynamics/SmartPointer.hpp" 46 #include "dart/math/Geometry.hpp" 51 DART_DECLARE_CLASS_WITH_VIRTUAL_BASE_BEGIN
113 virtual const std::string&
getType()
const = 0;
127 template <
typename ShapeT>
138 Eigen::Matrix3d computeInertiaFromDensity(
double density)
const;
140 Eigen::Matrix3d computeInertiaFromMass(
double mass)
const;
149 std::size_t getID()
const;
220 static
std::atomic_int mCounter;
234 DART_DECLARE_CLASS_WITH_VIRTUAL_BASE_END
239 #include "dart/dynamics/detail/Shape.hpp" 241 #endif // DART_DYNAMICS_SHAPE_HPP_ virtual void notifyColorUpdated(const Eigen::Vector4d &color)
Notify that the color (rgba) of this shape has updated.
Definition: Shape.cpp:174
void setDataVariance(unsigned int _variance)
Set the data variance of this shape.
Definition: Shape.cpp:117
virtual void notifyAlphaUpdate(double alpha)
Notify that the alpha of this shape has updated.
Definition: Shape.cpp:156
The Subject class is a base class for any object that wants to report when it gets destroyed...
Definition: Subject.hpp:57
Vertex positions of a mesh might change (this does not include adding or removing vertices) (this enu...
Definition: Shape.hpp:94
unsigned int getDataVariance() const
Get the data variance of this shape.
Definition: Shape.cpp:135
Definition: MathTypes.hpp:47
virtual void refreshData()
Instruct this shape to update its data.
Definition: Shape.cpp:150
Definition: SharedLibraryManager.hpp:46
double getVolume() const
Returns volume of this shape.
Definition: Shape.cpp:96
VersionCounter is an interface for objects that count their versions.
Definition: VersionCounter.hpp:42
virtual void notifyColorUpdate(const Eigen::Vector4d &color)
Notify that the color (rgba) of this shape has updated.
Definition: Shape.cpp:168
virtual void updateBoundingBox() const =0
Updates bounding box.
void removeDataVariance(unsigned int _variance)
Remove a type of variance from this shape.
Definition: Shape.cpp:129
bool is() const
Get true if the types of this Shape and the template parameter (a shape class) are identical...
Definition: Shape.hpp:42
The relative transform of the Shape might change.
Definition: Shape.hpp:86
Definition: Aspect.cpp:40
common::SlotRegister< VersionChangedSignal > onVersionChanged
Use this to subscribe to version change signals.
Definition: Shape.hpp:232
unsigned int mVariance
The DataVariance of this Shape.
Definition: Shape.hpp:217
Shape()
Constructor.
Definition: Shape.cpp:57
std::size_t incrementVersion() override final
Increment the version of this Shape and notify its subscribers.
Definition: Shape.cpp:180
The primitive properties (such as x/y/z scaling) of the shape might change.
Definition: Shape.hpp:88
void addDataVariance(unsigned int _variance)
Add a type of variance to this shape.
Definition: Shape.cpp:123
math::BoundingBox mBoundingBox
The bounding box (in the local coordinate frame) of the shape.
Definition: Shape.hpp:202
virtual Eigen::Matrix3d computeInertia(double mass) const =0
Computes the inertia.
bool mIsBoundingBoxDirty
Whether bounding box needs update.
Definition: Shape.hpp:205
virtual void notifyAlphaUpdated(double alpha)
Notify that the alpha of this shape has updated.
Definition: Shape.cpp:162
virtual const std::string & getType() const =0
Returns a string representing the shape type.
No data will ever change.
Definition: Shape.hpp:84
The number of elements and/or arrangement of elements might change (this includes adding and removing...
Definition: Shape.hpp:98
The coloring or textures of the shape might change.
Definition: Shape.hpp:90
double mVolume
Volume enclosed by the geometry.
Definition: Shape.hpp:208
bool checkDataVariance(DataVariance type) const
True iff this Shape has the specified type of DataVariance.
Definition: Shape.cpp:141
ShapeType
Definition: Shape.hpp:60
ShapeType mType
Definition: Shape.hpp:224
ShapeType getShapeType() const
Definition: Shape.cpp:111
const std::size_t mID
Unique id.
Definition: Shape.hpp:214
bool mIsVolumeDirty
Whether volume needs update.
Definition: Shape.hpp:211
virtual void updateVolume() const =0
Updates volume.
DataVariance
DataVariance can be used by renderers to determine whether it should expect data for this shape to ch...
Definition: Shape.hpp:81
Definition: Geometry.hpp:589
const math::BoundingBox & getBoundingBox() const
Get the bounding box of the shape in its local coordinate frame.
Definition: Shape.cpp:75
virtual ~Shape()
Destructor.
Definition: Shape.cpp:69