dart
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dart::dynamics::PointCloudShape Class Reference

The PointCloudShape represents point cloud data. More...

#include <PointCloudShape.hpp>

Inheritance diagram for dart::dynamics::PointCloudShape:
Inheritance graph
[legend]
Collaboration diagram for dart::dynamics::PointCloudShape:
Collaboration graph
[legend]

Public Types

enum  ColorMode { USE_SHAPE_COLOR = 0, BIND_OVERALL, BIND_PER_POINT }
 
enum  PointShapeType { BOX = 0, BILLBOARD_SQUARE, BILLBOARD_CIRCLE, POINT }
 
- Public Types inherited from dart::dynamics::Shape
enum  ShapeType {
  SPHERE, BOX, ELLIPSOID, CYLINDER,
  CAPSULE, CONE, PYRAMID, RECTANGULAR_PYRAMID,
  PLANE, MULTISPHERE, MESH, SOFT_MESH,
  LINE_SEGMENT, HEIGHTMAP, UNSUPPORTED
}
 
enum  DataVariance {
  STATIC = 0, DYNAMIC_TRANSFORM = 1 << 1, DYNAMIC_PRIMITIVE = 1 << 2, DYNAMIC_COLOR = 1 << 3,
  DYNAMIC_VERTICES = 1 << 4, DYNAMIC_ELEMENTS = 1 << 5, DYNAMIC = 0xFF
}
 DataVariance can be used by renderers to determine whether it should expect data for this shape to change during each update. More...
 
using VersionChangedSignal = common::Signal< void(Shape *shape, std::size_t version)>
 

Public Member Functions

 PointCloudShape (double visualSize=0.01)
 Constructor. More...
 
 ~PointCloudShape () override=default
 Destructor.
 
const std::string & getType () const override
 Returns a string representing the shape type. More...
 
Eigen::Matrix3d computeInertia (double mass) const override
 Computes the inertia.
 
void reserve (std::size_t size)
 Reserves the point list by size.
 
void addPoint (const Eigen::Vector3d &point)
 Adds a point to this point cloud.
 
void addPoint (const std::vector< Eigen::Vector3d > &points)
 Adds points to this point cloud.
 
void setPoint (const std::vector< Eigen::Vector3d > &points)
 Replaces points with points.
 
const std::vector< Eigen::Vector3d > & getPoints () const
 Returns the list of points.
 
std::size_t getNumPoints () const
 Returns the number of points.
 
void removeAllPoints ()
 Removes all the points.
 
void setPointShapeType (PointShapeType type)
 Sets the point shape type.
 
PointShapeType getPointShapeType () const
 Returns the point shape type.
 
void setColorMode (ColorMode mode)
 Sets the color mode.
 
ColorMode getColorMode () const
 Returns the color mode.
 
void setOverallColor (const Eigen::Vector4d &color)
 Sets the overall color. More...
 
Eigen::Vector4d getOverallColor () const
 Returns the overall color.
 
void setColors (const std::vector< Eigen::Vector4d, Eigen::aligned_allocator< Eigen::Vector4d >> &colors)
 Sets the point cloud colors. More...
 
const std::vector< Eigen::Vector4d, Eigen::aligned_allocator< Eigen::Vector4d > > & getColors () const
 Returns the point cloud colors.
 
void setVisualSize (double size)
 Sets size of visual object that represents each point.
 
double getVisualSize () const
 Returns size of visual object that represents each point.
 
void notifyColorUpdated (const Eigen::Vector4d &color) override
 Notify that the color (rgba) of this shape has updated.
 
- Public Member Functions inherited from dart::dynamics::Shape
 Shape (ShapeType _type)
 Constructor. More...
 
 Shape ()
 Constructor.
 
virtual ~Shape ()
 Destructor.
 
template<typename ShapeT >
bool is () const
 Get true if the types of this Shape and the template parameter (a shape class) are identical. More...
 
const math::BoundingBoxgetBoundingBox () const
 Get the bounding box of the shape in its local coordinate frame. More...
 
Eigen::Matrix3d computeInertiaFromDensity (double density) const
 
Eigen::Matrix3d computeInertiaFromMass (double mass) const
 
double getVolume () const
 Returns volume of this shape. More...
 
std::size_t getID () const
 
ShapeType getShapeType () const
 
void setDataVariance (unsigned int _variance)
 Set the data variance of this shape. More...
 
void addDataVariance (unsigned int _variance)
 Add a type of variance to this shape. More...
 
void removeDataVariance (unsigned int _variance)
 Remove a type of variance from this shape. More...
 
unsigned int getDataVariance () const
 Get the data variance of this shape.
 
bool checkDataVariance (DataVariance type) const
 True iff this Shape has the specified type of DataVariance.
 
virtual void refreshData ()
 Instruct this shape to update its data.
 
virtual void notifyAlphaUpdate (double alpha)
 Notify that the alpha of this shape has updated.
 
virtual void notifyAlphaUpdated (double alpha)
 Notify that the alpha of this shape has updated.
 
virtual void notifyColorUpdate (const Eigen::Vector4d &color)
 Notify that the color (rgba) of this shape has updated.
 
std::size_t incrementVersion () override final
 Increment the version of this Shape and notify its subscribers.
 
- Public Member Functions inherited from dart::common::Subject
virtual ~Subject ()
 Destructor will notify all Observers that it is destructing.
 
- Public Member Functions inherited from dart::common::VersionCounter
 VersionCounter ()
 Default constructor.
 
virtual std::size_t getVersion () const
 Get the version number of this object.
 

Static Public Member Functions

static const std::string & getStaticType ()
 Returns shape type for this class.
 

Protected Member Functions

void updateVolume () const override
 Updates volume.
 
void updateBoundingBox () const override
 Updates bounding box.
 
- Protected Member Functions inherited from dart::common::Subject
void sendDestructionNotification () const
 Send a destruction notification to all Observers. More...
 
void addObserver (Observer *_observer) const
 Add an Observer to the list of Observers.
 
void removeObserver (Observer *_observer) const
 Remove an Observer from the list of Observers.
 
- Protected Member Functions inherited from dart::common::VersionCounter
void setVersionDependentObject (VersionCounter *dependent)
 

Protected Attributes

std::vector< Eigen::Vector3d > mPoints
 List of points.
 
PointShapeType mPointShapeType
 The point shape type.
 
ColorMode mColorMode
 The color mode.
 
std::vector< Eigen::Vector4d, Eigen::aligned_allocator< Eigen::Vector4d > > mColors
 List of colors.
 
double mVisualSize
 The size of visual object that represents each point.
 
- Protected Attributes inherited from dart::dynamics::Shape
math::BoundingBox mBoundingBox
 The bounding box (in the local coordinate frame) of the shape.
 
bool mIsBoundingBoxDirty
 Whether bounding box needs update.
 
double mVolume
 Volume enclosed by the geometry.
 
bool mIsVolumeDirty
 Whether volume needs update.
 
const std::size_t mID
 Unique id.
 
unsigned int mVariance
 The DataVariance of this Shape.
 
ShapeType mType
 
- Protected Attributes inherited from dart::common::Subject
std::set< Observer * > mObservers
 List of current Observers.
 
- Protected Attributes inherited from dart::common::VersionCounter
std::size_t mVersion
 

Additional Inherited Members

- Public Attributes inherited from dart::dynamics::Shape
common::SlotRegister< VersionChangedSignalonVersionChanged
 Use this to subscribe to version change signals.
 
- Static Protected Attributes inherited from dart::dynamics::Shape
static std::atomic_int mCounter {PRIMITIVE_MAGIC_NUMBER}
 

Detailed Description

The PointCloudShape represents point cloud data.

Member Enumeration Documentation

◆ ColorMode

Enumerator
USE_SHAPE_COLOR 

Use the color specified by the ShapeAspect. This is the default.

BIND_OVERALL 

Use one color for all the points.

BIND_PER_POINT 

Use one color per point.

◆ PointShapeType

Enumerator
BOX 

3D volumetric box

BILLBOARD_SQUARE 

2D square always facing the screen

BILLBOARD_CIRCLE 

2D circle always facing the screen

POINT 

Vertex.

Constructor & Destructor Documentation

◆ PointCloudShape()

dart::dynamics::PointCloudShape::PointCloudShape ( double  visualSize = 0.01)
explicit

Constructor.

Parameters
[in]visualSizeThe size of cube that represents each point.

Member Function Documentation

◆ getType()

const std::string & dart::dynamics::PointCloudShape::getType ( ) const
overridevirtual

Returns a string representing the shape type.

See also
is()

Implements dart::dynamics::Shape.

◆ setColors()

void dart::dynamics::PointCloudShape::setColors ( const std::vector< Eigen::Vector4d, Eigen::aligned_allocator< Eigen::Vector4d >> &  colors)

Sets the point cloud colors.

The count of colors should be the same with points. It's undefined behavior, otherwise.

◆ setOverallColor()

void dart::dynamics::PointCloudShape::setOverallColor ( const Eigen::Vector4d &  color)

Sets the overall color.

This function resizes the colors to one.


The documentation for this class was generated from the following files: