33 #ifndef DART_GUI_OSG_SUPPORTPOLYGONVISUAL_HPP_ 34 #define DART_GUI_OSG_SUPPORTPOLYGONVISUAL_HPP_ 38 #include "dart/dynamics/SmartPointer.hpp" 40 #include "dart/gui/osg/ShapeFrameNode.hpp" 41 #include "dart/gui/osg/Viewer.hpp" 54 const dart::dynamics::SkeletonPtr& skeleton =
nullptr,
55 double elevation = 0.02);
59 const dart::dynamics::SkeletonPtr& skeleton,
60 std::size_t treeIndex,
61 double elevation = 0.02);
64 void setSkeleton(
const dart::dynamics::SkeletonPtr& skeleton);
165 dart::dynamics::SimpleFramePtr
mCom;
189 ::osg::ref_ptr<::osg::DrawElementsUShort>
mFaces;
202 #endif // DART_GUI_OSG_SUPPORTPOLYGONVISUAL_HPP_ dart::dynamics::SimpleFramePtr mCentroid
SimpleFrame for the centroid.
Definition: SupportPolygonVisual.hpp:156
std::size_t mTreeIndex
Tree index for this visual.
Definition: SupportPolygonVisual.hpp:144
void visualizeWholeSkeleton()
Visualize the entire Skeleton.
Definition: SupportPolygonVisual.cpp:79
bool mDisplayCOM
Whether to display the center of mass.
Definition: SupportPolygonVisual.hpp:162
void setInvalidCOMColor(const Eigen::Vector4d &color)
Set the color that will be used for the center of mass if its projection is NOT on the support polygo...
Definition: SupportPolygonVisual.cpp:221
Definition: Viewer.hpp:76
bool isCenterOfMassDisplayed() const
Returns true if the center of mass is being displayed.
Definition: SupportPolygonVisual.cpp:184
const Eigen::Vector4d & getValidCOMColor() const
Get the color that will be used for the center of mass if its projection is on the support polygon...
Definition: SupportPolygonVisual.cpp:215
dart::dynamics::SkeletonPtr getSkeleton() const
Get the Skeleton associated with this visual.
Definition: SupportPolygonVisual.cpp:73
void visualizeTree(std::size_t treeIndex)
Visualize a specific tree in the Skeleton.
Definition: SupportPolygonVisual.cpp:85
const Eigen::Vector4d & getInvalidCOMColor() const
Get the color that will be used for the center of mass if its projection is NOT on the support polygo...
Definition: SupportPolygonVisual.cpp:227
::osg::ref_ptr< ShapeFrameNode > mCentroidNode
Node to render the centroid.
Definition: SupportPolygonVisual.hpp:192
Eigen::Vector4d getPolygonColor() const
Get the color of the support polygon.
Definition: SupportPolygonVisual.cpp:124
Eigen::Vector4d mInvalidColor
Color to be used when COM is invalid.
Definition: SupportPolygonVisual.hpp:174
void initialize()
Initialize the memory used by this visual.
Definition: SupportPolygonVisual.cpp:346
bool mDisplayPolygon
Whether to display the polygon.
Definition: SupportPolygonVisual.hpp:150
::osg::ref_ptr<::osg::Geometry > mPolygonGeom
Geometry to describe the polygon.
Definition: SupportPolygonVisual.hpp:183
bool mDisplayCentroid
Whether to display the centroid.
Definition: SupportPolygonVisual.hpp:153
double mElevation
Elevation that this visual should use.
Definition: SupportPolygonVisual.hpp:147
void setPolygonColor(const Eigen::Vector4d &color)
Set the color of the support polygon.
Definition: SupportPolygonVisual.cpp:117
double getDisplayElevation() const
Get the elevation of display for the support polygon.
Definition: SupportPolygonVisual.cpp:97
::osg::ref_ptr<::osg::Vec3Array > mVertices
Vertices of the polygon.
Definition: SupportPolygonVisual.hpp:186
Definition: Aspect.cpp:40
void displayCenterOfMass(bool display)
Display the center of mass.
Definition: SupportPolygonVisual.cpp:170
double mComRadius
Radius to be used by the center of mass.
Definition: SupportPolygonVisual.hpp:168
void displayPolygon(bool display)
Display the support polygon.
Definition: SupportPolygonVisual.cpp:103
::osg::ref_ptr< ShapeFrameNode > mComNode
Node to render the COM.
Definition: SupportPolygonVisual.hpp:195
void setCentroidRadius(double radius)
Set the radius of the centroid visualization.
Definition: SupportPolygonVisual.cpp:151
dart::dynamics::SimpleFramePtr mCom
SimpleFrame for the center of mass.
Definition: SupportPolygonVisual.hpp:165
double getCentroidRadius() const
Get the radius of the centroid visualization.
Definition: SupportPolygonVisual.cpp:164
SupportPolygonVisual(const dart::dynamics::SkeletonPtr &skeleton=nullptr, double elevation=0.02)
Visualize the support polygon of an entire Skeleton.
Definition: SupportPolygonVisual.cpp:46
void setDisplayElevation(double elevation)
Change the elevation height at which the polygon is displayed.
Definition: SupportPolygonVisual.cpp:91
void setSkeleton(const dart::dynamics::SkeletonPtr &skeleton)
Change the Skeleton that is being visualized.
Definition: SupportPolygonVisual.cpp:66
::osg::ref_ptr<::osg::DrawElementsUShort > mFaces
Faces of the polygon.
Definition: SupportPolygonVisual.hpp:189
dart::dynamics::WeakSkeletonPtr mSkeleton
Skeleton for this visual.
Definition: SupportPolygonVisual.hpp:141
void setCenterOfMassRadius(double radius)
Set the radius of the center of mass visualization.
Definition: SupportPolygonVisual.cpp:190
bool isCentroidDisplayed() const
Returns true if the centroid is being displayed.
Definition: SupportPolygonVisual.cpp:145
Eigen::Vector4d mValidColor
Color to be used when COM is valid.
Definition: SupportPolygonVisual.hpp:171
void refresh() override final
Update the support polygon visual.
Definition: SupportPolygonVisual.cpp:233
bool isPolygonDisplayed() const
Returns true if the support polygon is being displayed.
double getCenterOfMassRadius() const
Get the radius of the center of mass visualization.
Definition: SupportPolygonVisual.cpp:203
void setValidCOMColor(const Eigen::Vector4d &color)
Set the color that will be used for the center of mass if its projection is on the support polygon...
Definition: SupportPolygonVisual.cpp:209
double mCentroidRadius
Radius to be used by the centroid.
Definition: SupportPolygonVisual.hpp:159
::osg::ref_ptr<::osg::Vec4Array > mPolygonColor
Color for the polygon.
Definition: SupportPolygonVisual.hpp:177
Attach this to a Viewer in order to visualize the support polygon of a Skeleton.
Definition: SupportPolygonVisual.hpp:49
::osg::ref_ptr<::osg::Geode > mPolygonGeode
Geode to hold the polygon.
Definition: SupportPolygonVisual.hpp:180
void displayCentroid(bool display)
Display the centroid.
Definition: SupportPolygonVisual.cpp:131