DART
6.10.1
|
Attach this to a Viewer in order to visualize the support polygon of a Skeleton. More...
#include <SupportPolygonVisual.hpp>
Public Member Functions | |
SupportPolygonVisual (const dart::dynamics::SkeletonPtr &skeleton=nullptr, double elevation=0.02) | |
Visualize the support polygon of an entire Skeleton. More... | |
SupportPolygonVisual (const dart::dynamics::SkeletonPtr &skeleton, std::size_t treeIndex, double elevation=0.02) | |
Visualize the support polygon of a specific tree in a Skeleton. More... | |
void | setSkeleton (const dart::dynamics::SkeletonPtr &skeleton) |
Change the Skeleton that is being visualized. More... | |
dart::dynamics::SkeletonPtr | getSkeleton () const |
Get the Skeleton associated with this visual. More... | |
void | visualizeWholeSkeleton () |
Visualize the entire Skeleton. More... | |
void | visualizeTree (std::size_t treeIndex) |
Visualize a specific tree in the Skeleton. More... | |
void | setDisplayElevation (double elevation) |
Change the elevation height at which the polygon is displayed. More... | |
double | getDisplayElevation () const |
Get the elevation of display for the support polygon. More... | |
void | displayPolygon (bool display) |
Display the support polygon. More... | |
bool | isPolygonDisplayed () const |
Returns true if the support polygon is being displayed. More... | |
void | setPolygonColor (const Eigen::Vector4d &color) |
Set the color of the support polygon. More... | |
Eigen::Vector4d | getPolygonColor () const |
Get the color of the support polygon. More... | |
void | displayCentroid (bool display) |
Display the centroid. More... | |
bool | isCentroidDisplayed () const |
Returns true if the centroid is being displayed. More... | |
void | setCentroidRadius (double radius) |
Set the radius of the centroid visualization. More... | |
double | getCentroidRadius () const |
Get the radius of the centroid visualization. More... | |
void | displayCenterOfMass (bool display) |
Display the center of mass. More... | |
bool | isCenterOfMassDisplayed () const |
Returns true if the center of mass is being displayed. More... | |
void | setCenterOfMassRadius (double radius) |
Set the radius of the center of mass visualization. More... | |
double | getCenterOfMassRadius () const |
Get the radius of the center of mass visualization. More... | |
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. More... | |
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. More... | |
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 polygon. More... | |
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 polygon. More... | |
void | refresh () override final |
Update the support polygon visual. More... | |
Viewer * | getViewer () |
const Viewer * | getViewer () const |
Protected Member Functions | |
void | initialize () |
Initialize the memory used by this visual. More... | |
virtual void | customAttach (Viewer *newViewer) |
This function will be called by attach(Viewer*) so you can do customized setup when the Viewer changes. More... | |
virtual void | attach (Viewer *newViewer) |
This function will get called when the visual is attached to a new Viewer. More... | |
Protected Attributes | |
dart::dynamics::WeakSkeletonPtr | mSkeleton |
Skeleton for this visual. More... | |
std::size_t | mTreeIndex |
Tree index for this visual. More... | |
double | mElevation |
Elevation that this visual should use. More... | |
bool | mDisplayPolygon |
Whether to display the polygon. More... | |
bool | mDisplayCentroid |
Whether to display the centroid. More... | |
dart::dynamics::SimpleFramePtr | mCentroid |
SimpleFrame for the centroid. More... | |
double | mCentroidRadius |
Radius to be used by the centroid. More... | |
bool | mDisplayCOM |
Whether to display the center of mass. More... | |
dart::dynamics::SimpleFramePtr | mCom |
SimpleFrame for the center of mass. More... | |
double | mComRadius |
Radius to be used by the center of mass. More... | |
Eigen::Vector4d | mValidColor |
Color to be used when COM is valid. More... | |
Eigen::Vector4d | mInvalidColor |
Color to be used when COM is invalid. More... | |
::osg::ref_ptr<::osg::Vec4Array > | mPolygonColor |
Color for the polygon. More... | |
::osg::ref_ptr<::osg::Geode > | mPolygonGeode |
Geode to hold the polygon. More... | |
::osg::ref_ptr<::osg::Geometry > | mPolygonGeom |
Geometry to describe the polygon. More... | |
::osg::ref_ptr<::osg::Vec3Array > | mVertices |
Vertices of the polygon. More... | |
::osg::ref_ptr<::osg::DrawElementsUShort > | mFaces |
Faces of the polygon. More... | |
::osg::ref_ptr< ShapeFrameNode > | mCentroidNode |
Node to render the centroid. More... | |
::osg::ref_ptr< ShapeFrameNode > | mComNode |
Node to render the COM. More... | |
Private Attributes | |
Viewer * | mViewer |
Attach this to a Viewer in order to visualize the support polygon of a Skeleton.
dart::gui::osg::SupportPolygonVisual::SupportPolygonVisual | ( | const dart::dynamics::SkeletonPtr & | skeleton = nullptr , |
double | elevation = 0.02 |
||
) |
Visualize the support polygon of an entire Skeleton.
dart::gui::osg::SupportPolygonVisual::SupportPolygonVisual | ( | const dart::dynamics::SkeletonPtr & | skeleton, |
std::size_t | treeIndex, | ||
double | elevation = 0.02 |
||
) |
Visualize the support polygon of a specific tree in a Skeleton.
|
protectedvirtualinherited |
This function will get called when the visual is attached to a new Viewer.
It adds this node as a child to the root node of the Viewer so the refresh() function will be called at each update cycle. It will also call customAttach(Viewer*) so you can do customized setup.
|
protectedvirtualinherited |
This function will be called by attach(Viewer*) so you can do customized setup when the Viewer changes.
By default this function does nothing, so overriding it is completely safe.
void dart::gui::osg::SupportPolygonVisual::displayCenterOfMass | ( | bool | display | ) |
Display the center of mass.
void dart::gui::osg::SupportPolygonVisual::displayCentroid | ( | bool | display | ) |
Display the centroid.
void dart::gui::osg::SupportPolygonVisual::displayPolygon | ( | bool | display | ) |
Display the support polygon.
double dart::gui::osg::SupportPolygonVisual::getCenterOfMassRadius | ( | ) | const |
Get the radius of the center of mass visualization.
double dart::gui::osg::SupportPolygonVisual::getCentroidRadius | ( | ) | const |
Get the radius of the centroid visualization.
double dart::gui::osg::SupportPolygonVisual::getDisplayElevation | ( | ) | const |
Get the elevation of display for the support polygon.
const Eigen::Vector4d & dart::gui::osg::SupportPolygonVisual::getInvalidCOMColor | ( | ) | const |
Get the color that will be used for the center of mass if its projection is NOT on the support polygon.
Eigen::Vector4d dart::gui::osg::SupportPolygonVisual::getPolygonColor | ( | ) | const |
Get the color of the support polygon.
dart::dynamics::SkeletonPtr dart::gui::osg::SupportPolygonVisual::getSkeleton | ( | ) | const |
Get the Skeleton associated with this visual.
const Eigen::Vector4d & dart::gui::osg::SupportPolygonVisual::getValidCOMColor | ( | ) | const |
Get the color that will be used for the center of mass if its projection is on the support polygon.
|
inherited |
|
inherited |
|
protected |
Initialize the memory used by this visual.
bool dart::gui::osg::SupportPolygonVisual::isCenterOfMassDisplayed | ( | ) | const |
Returns true if the center of mass is being displayed.
bool dart::gui::osg::SupportPolygonVisual::isCentroidDisplayed | ( | ) | const |
Returns true if the centroid is being displayed.
bool dart::gui::osg::SupportPolygonVisual::isPolygonDisplayed | ( | ) | const |
Returns true if the support polygon is being displayed.
|
finaloverridevirtual |
Update the support polygon visual.
Implements dart::gui::osg::ViewerAttachment.
void dart::gui::osg::SupportPolygonVisual::setCenterOfMassRadius | ( | double | radius | ) |
Set the radius of the center of mass visualization.
void dart::gui::osg::SupportPolygonVisual::setCentroidRadius | ( | double | radius | ) |
Set the radius of the centroid visualization.
void dart::gui::osg::SupportPolygonVisual::setDisplayElevation | ( | double | elevation | ) |
Change the elevation height at which the polygon is displayed.
void dart::gui::osg::SupportPolygonVisual::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 polygon.
void dart::gui::osg::SupportPolygonVisual::setPolygonColor | ( | const Eigen::Vector4d & | color | ) |
Set the color of the support polygon.
void dart::gui::osg::SupportPolygonVisual::setSkeleton | ( | const dart::dynamics::SkeletonPtr & | skeleton | ) |
Change the Skeleton that is being visualized.
void dart::gui::osg::SupportPolygonVisual::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.
void dart::gui::osg::SupportPolygonVisual::visualizeTree | ( | std::size_t | treeIndex | ) |
Visualize a specific tree in the Skeleton.
void dart::gui::osg::SupportPolygonVisual::visualizeWholeSkeleton | ( | ) |
Visualize the entire Skeleton.
|
protected |
SimpleFrame for the centroid.
|
protected |
Node to render the centroid.
|
protected |
Radius to be used by the centroid.
|
protected |
SimpleFrame for the center of mass.
|
protected |
Node to render the COM.
|
protected |
Radius to be used by the center of mass.
|
protected |
Whether to display the centroid.
|
protected |
Whether to display the center of mass.
|
protected |
Whether to display the polygon.
|
protected |
Elevation that this visual should use.
|
protected |
Faces of the polygon.
|
protected |
Color to be used when COM is invalid.
|
protected |
Color for the polygon.
|
protected |
Geode to hold the polygon.
|
protected |
Geometry to describe the polygon.
|
protected |
Skeleton for this visual.
|
protected |
Tree index for this visual.
|
protected |
Color to be used when COM is valid.
|
protected |
Vertices of the polygon.
|
privateinherited |