DART  6.10.1
dart::gui::osg::SupportPolygonVisual Class Reference

Attach this to a Viewer in order to visualize the support polygon of a Skeleton. More...

#include <SupportPolygonVisual.hpp>

Inheritance diagram for dart::gui::osg::SupportPolygonVisual:
dart::gui::osg::ViewerAttachment

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...
 
ViewergetViewer ()
 
const ViewergetViewer () 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< ShapeFrameNodemCentroidNode
 Node to render the centroid. More...
 
::osg::ref_ptr< ShapeFrameNodemComNode
 Node to render the COM. More...
 

Private Attributes

ViewermViewer
 

Detailed Description

Attach this to a Viewer in order to visualize the support polygon of a Skeleton.

Constructor & Destructor Documentation

◆ SupportPolygonVisual() [1/2]

dart::gui::osg::SupportPolygonVisual::SupportPolygonVisual ( const dart::dynamics::SkeletonPtr skeleton = nullptr,
double  elevation = 0.02 
)

Visualize the support polygon of an entire Skeleton.

◆ SupportPolygonVisual() [2/2]

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.

Member Function Documentation

◆ attach()

void dart::gui::osg::ViewerAttachment::attach ( Viewer newViewer)
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.

◆ customAttach()

void dart::gui::osg::ViewerAttachment::customAttach ( Viewer newViewer)
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.

◆ displayCenterOfMass()

void dart::gui::osg::SupportPolygonVisual::displayCenterOfMass ( bool  display)

Display the center of mass.

◆ displayCentroid()

void dart::gui::osg::SupportPolygonVisual::displayCentroid ( bool  display)

Display the centroid.

◆ displayPolygon()

void dart::gui::osg::SupportPolygonVisual::displayPolygon ( bool  display)

Display the support polygon.

◆ getCenterOfMassRadius()

double dart::gui::osg::SupportPolygonVisual::getCenterOfMassRadius ( ) const

Get the radius of the center of mass visualization.

◆ getCentroidRadius()

double dart::gui::osg::SupportPolygonVisual::getCentroidRadius ( ) const

Get the radius of the centroid visualization.

◆ getDisplayElevation()

double dart::gui::osg::SupportPolygonVisual::getDisplayElevation ( ) const

Get the elevation of display for the support polygon.

◆ getInvalidCOMColor()

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.

◆ getPolygonColor()

Eigen::Vector4d dart::gui::osg::SupportPolygonVisual::getPolygonColor ( ) const

Get the color of the support polygon.

◆ getSkeleton()

dart::dynamics::SkeletonPtr dart::gui::osg::SupportPolygonVisual::getSkeleton ( ) const

Get the Skeleton associated with this visual.

◆ getValidCOMColor()

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.

◆ getViewer() [1/2]

Viewer * dart::gui::osg::ViewerAttachment::getViewer ( )
inherited

◆ getViewer() [2/2]

const Viewer * dart::gui::osg::ViewerAttachment::getViewer ( ) const
inherited

◆ initialize()

void dart::gui::osg::SupportPolygonVisual::initialize ( )
protected

Initialize the memory used by this visual.

◆ isCenterOfMassDisplayed()

bool dart::gui::osg::SupportPolygonVisual::isCenterOfMassDisplayed ( ) const

Returns true if the center of mass is being displayed.

◆ isCentroidDisplayed()

bool dart::gui::osg::SupportPolygonVisual::isCentroidDisplayed ( ) const

Returns true if the centroid is being displayed.

◆ isPolygonDisplayed()

bool dart::gui::osg::SupportPolygonVisual::isPolygonDisplayed ( ) const

Returns true if the support polygon is being displayed.

◆ refresh()

void dart::gui::osg::SupportPolygonVisual::refresh ( )
finaloverridevirtual

Update the support polygon visual.

Implements dart::gui::osg::ViewerAttachment.

◆ setCenterOfMassRadius()

void dart::gui::osg::SupportPolygonVisual::setCenterOfMassRadius ( double  radius)

Set the radius of the center of mass visualization.

◆ setCentroidRadius()

void dart::gui::osg::SupportPolygonVisual::setCentroidRadius ( double  radius)

Set the radius of the centroid visualization.

◆ setDisplayElevation()

void dart::gui::osg::SupportPolygonVisual::setDisplayElevation ( double  elevation)

Change the elevation height at which the polygon is displayed.

◆ setInvalidCOMColor()

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.

◆ setPolygonColor()

void dart::gui::osg::SupportPolygonVisual::setPolygonColor ( const Eigen::Vector4d &  color)

Set the color of the support polygon.

◆ setSkeleton()

void dart::gui::osg::SupportPolygonVisual::setSkeleton ( const dart::dynamics::SkeletonPtr skeleton)

Change the Skeleton that is being visualized.

◆ setValidCOMColor()

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.

◆ visualizeTree()

void dart::gui::osg::SupportPolygonVisual::visualizeTree ( std::size_t  treeIndex)

Visualize a specific tree in the Skeleton.

◆ visualizeWholeSkeleton()

void dart::gui::osg::SupportPolygonVisual::visualizeWholeSkeleton ( )

Visualize the entire Skeleton.

Member Data Documentation

◆ mCentroid

dart::dynamics::SimpleFramePtr dart::gui::osg::SupportPolygonVisual::mCentroid
protected

SimpleFrame for the centroid.

◆ mCentroidNode

::osg::ref_ptr<ShapeFrameNode> dart::gui::osg::SupportPolygonVisual::mCentroidNode
protected

Node to render the centroid.

◆ mCentroidRadius

double dart::gui::osg::SupportPolygonVisual::mCentroidRadius
protected

Radius to be used by the centroid.

◆ mCom

dart::dynamics::SimpleFramePtr dart::gui::osg::SupportPolygonVisual::mCom
protected

SimpleFrame for the center of mass.

◆ mComNode

::osg::ref_ptr<ShapeFrameNode> dart::gui::osg::SupportPolygonVisual::mComNode
protected

Node to render the COM.

◆ mComRadius

double dart::gui::osg::SupportPolygonVisual::mComRadius
protected

Radius to be used by the center of mass.

◆ mDisplayCentroid

bool dart::gui::osg::SupportPolygonVisual::mDisplayCentroid
protected

Whether to display the centroid.

◆ mDisplayCOM

bool dart::gui::osg::SupportPolygonVisual::mDisplayCOM
protected

Whether to display the center of mass.

◆ mDisplayPolygon

bool dart::gui::osg::SupportPolygonVisual::mDisplayPolygon
protected

Whether to display the polygon.

◆ mElevation

double dart::gui::osg::SupportPolygonVisual::mElevation
protected

Elevation that this visual should use.

◆ mFaces

::osg::ref_ptr<::osg::DrawElementsUShort> dart::gui::osg::SupportPolygonVisual::mFaces
protected

Faces of the polygon.

◆ mInvalidColor

Eigen::Vector4d dart::gui::osg::SupportPolygonVisual::mInvalidColor
protected

Color to be used when COM is invalid.

◆ mPolygonColor

::osg::ref_ptr<::osg::Vec4Array> dart::gui::osg::SupportPolygonVisual::mPolygonColor
protected

Color for the polygon.

◆ mPolygonGeode

::osg::ref_ptr<::osg::Geode> dart::gui::osg::SupportPolygonVisual::mPolygonGeode
protected

Geode to hold the polygon.

◆ mPolygonGeom

::osg::ref_ptr<::osg::Geometry> dart::gui::osg::SupportPolygonVisual::mPolygonGeom
protected

Geometry to describe the polygon.

◆ mSkeleton

dart::dynamics::WeakSkeletonPtr dart::gui::osg::SupportPolygonVisual::mSkeleton
protected

Skeleton for this visual.

◆ mTreeIndex

std::size_t dart::gui::osg::SupportPolygonVisual::mTreeIndex
protected

Tree index for this visual.

◆ mValidColor

Eigen::Vector4d dart::gui::osg::SupportPolygonVisual::mValidColor
protected

Color to be used when COM is valid.

◆ mVertices

::osg::ref_ptr<::osg::Vec3Array> dart::gui::osg::SupportPolygonVisual::mVertices
protected

Vertices of the polygon.

◆ mViewer

Viewer* dart::gui::osg::ViewerAttachment::mViewer
privateinherited