DART
6.10.1
|
The PointCloudShape represents point cloud data. More...
#include <PointCloudShape.hpp>
Public Types | |
enum | ColorMode { USE_SHAPE_COLOR = 0 , BIND_OVERALL , BIND_PER_POINT } |
enum | PointShapeType { BOX = 0 , BILLBOARD_SQUARE , BILLBOARD_CIRCLE , POINT } |
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. More... | |
const std::string & | getType () const override |
Returns a string representing the shape type. More... | |
Eigen::Matrix3d | computeInertia (double mass) const override |
Computes the inertia. More... | |
void | reserve (std::size_t size) |
Reserves the point list by size . More... | |
void | addPoint (const Eigen::Vector3d &point) |
Adds a point to this point cloud. More... | |
void | addPoint (const std::vector< Eigen::Vector3d > &points) |
Adds points to this point cloud. More... | |
void | setPoint (const std::vector< Eigen::Vector3d > &points) |
Replaces points with points . More... | |
const std::vector< Eigen::Vector3d > & | getPoints () const |
Returns the list of points. More... | |
std::size_t | getNumPoints () const |
Returns the number of points. More... | |
void | removeAllPoints () |
Removes all the points. More... | |
void | setPointShapeType (PointShapeType type) |
Sets the point shape type. More... | |
PointShapeType | getPointShapeType () const |
Returns the point shape type. More... | |
void | setColorMode (ColorMode mode) |
Sets the color mode. More... | |
ColorMode | getColorMode () const |
Returns the color mode. More... | |
void | setOverallColor (const Eigen::Vector4d &color) |
Sets the overall color. More... | |
Eigen::Vector4d | getOverallColor () const |
Returns the overall color. More... | |
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. More... | |
void | setVisualSize (double size) |
Sets size of visual object that represents each point. More... | |
double | getVisualSize () const |
Returns size of visual object that represents each point. More... | |
void | notifyColorUpdated (const Eigen::Vector4d &color) override |
Notify that the color (rgba) of this shape has updated. More... | |
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::BoundingBox & | getBoundingBox () 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. More... | |
bool | checkDataVariance (DataVariance type) const |
True iff this Shape has the specified type of DataVariance. More... | |
virtual void | refreshData () |
Instruct this shape to update its data. More... | |
virtual void | notifyAlphaUpdate (double alpha) |
Notify that the alpha of this shape has updated. More... | |
virtual void | notifyAlphaUpdated (double alpha) |
Notify that the alpha of this shape has updated. More... | |
virtual void | notifyColorUpdate (const Eigen::Vector4d &color) |
Notify that the color (rgba) of this shape has updated. More... | |
std::size_t | incrementVersion () override final |
Increment the version of this Shape and notify its subscribers. More... | |
virtual std::size_t | getVersion () const |
Get the version number of this object. More... | |
Static Public Member Functions | |
static const std::string & | getStaticType () |
Returns shape type for this class. More... | |
Public Attributes | |
common::SlotRegister< VersionChangedSignal > | onVersionChanged |
Use this to subscribe to version change signals. More... | |
Protected Member Functions | |
void | updateVolume () const override |
Updates volume. More... | |
void | updateBoundingBox () const override |
Updates bounding box. More... | |
void | sendDestructionNotification () const |
Send a destruction notification to all Observers. More... | |
void | addObserver (Observer *_observer) const |
Add an Observer to the list of Observers. More... | |
void | removeObserver (Observer *_observer) const |
Remove an Observer from the list of Observers. More... | |
void | setVersionDependentObject (VersionCounter *dependent) |
Protected Attributes | |
std::vector< Eigen::Vector3d > | mPoints |
List of points. More... | |
PointShapeType | mPointShapeType |
The point shape type. More... | |
ColorMode | mColorMode |
The color mode. More... | |
std::vector< Eigen::Vector4d, Eigen::aligned_allocator< Eigen::Vector4d > > | mColors |
List of colors. More... | |
double | mVisualSize |
The size of visual object that represents each point. More... | |
math::BoundingBox | mBoundingBox |
The bounding box (in the local coordinate frame) of the shape. More... | |
bool | mIsBoundingBoxDirty |
Whether bounding box needs update. More... | |
double | mVolume |
Volume enclosed by the geometry. More... | |
bool | mIsVolumeDirty |
Whether volume needs update. More... | |
const std::size_t | mID |
Unique id. More... | |
unsigned int | mVariance |
The DataVariance of this Shape. More... | |
ShapeType | mType |
std::set< Observer * > | mObservers |
List of current Observers. More... | |
std::size_t | mVersion |
Static Protected Attributes | |
static std::atomic_int | mCounter { 1000 } |
Private Attributes | |
VersionChangedSignal | mVersionChangedSignal |
Triggered by incrementVersion() More... | |
VersionCounter * | mDependent |
The PointCloudShape represents point cloud data.
|
inherited |
|
inherited |
DataVariance can be used by renderers to determine whether it should expect data for this shape to change during each update.
Enumerator | |
---|---|
STATIC | |
DYNAMIC_TRANSFORM | No data will ever change. |
DYNAMIC_PRIMITIVE | The relative transform of the Shape might change. |
DYNAMIC_COLOR | The primitive properties (such as x/y/z scaling) of the shape might change. |
DYNAMIC_VERTICES | The coloring or textures of the shape might change. |
DYNAMIC_ELEMENTS | Vertex positions of a mesh might change (this does not include adding or removing vertices) (this enum is not relevant for primitive shapes) |
DYNAMIC | The number of elements and/or arrangement of elements might change (this includes adding and removing vertices) (this enum is not relevant for primitive shapes) |
|
inherited |
Enumerator | |
---|---|
SPHERE | |
BOX | |
ELLIPSOID | |
CYLINDER | |
CAPSULE | |
CONE | |
PYRAMID | |
RECTANGULAR_PYRAMID | |
PLANE | |
MULTISPHERE | |
MESH | |
SOFT_MESH | |
LINE_SEGMENT | |
HEIGHTMAP | |
UNSUPPORTED |
|
explicit |
Constructor.
[in] | visualSize | The size of cube that represents each point. |
|
overridedefault |
Destructor.
|
inherited |
Add a type of variance to this shape.
All other variance types will remain the same.
|
protectedinherited |
Add an Observer to the list of Observers.
void dart::dynamics::PointCloudShape::addPoint | ( | const Eigen::Vector3d & | point | ) |
Adds a point to this point cloud.
void dart::dynamics::PointCloudShape::addPoint | ( | const std::vector< Eigen::Vector3d > & | points | ) |
Adds points to this point cloud.
|
inherited |
True iff this Shape has the specified type of DataVariance.
|
overridevirtual |
Computes the inertia.
Implements dart::dynamics::Shape.
|
inherited |
|
inherited |
|
inherited |
Get the bounding box of the shape in its local coordinate frame.
The dimension will be automatically determined by the sub-classes such as BoxShape, EllipsoidShape, CylinderShape, and MeshShape.
PointCloudShape::ColorMode dart::dynamics::PointCloudShape::getColorMode | ( | ) | const |
Returns the color mode.
const std::vector< Eigen::Vector4d, Eigen::aligned_allocator< Eigen::Vector4d > > & dart::dynamics::PointCloudShape::getColors | ( | ) | const |
Returns the point cloud colors.
|
inherited |
Get the data variance of this shape.
|
inherited |
std::size_t dart::dynamics::PointCloudShape::getNumPoints | ( | ) | const |
Returns the number of points.
Eigen::Vector4d dart::dynamics::PointCloudShape::getOverallColor | ( | ) | const |
Returns the overall color.
const std::vector< Eigen::Vector3d > & dart::dynamics::PointCloudShape::getPoints | ( | ) | const |
Returns the list of points.
PointCloudShape::PointShapeType dart::dynamics::PointCloudShape::getPointShapeType | ( | ) | const |
Returns the point shape type.
|
inherited |
|
static |
Returns shape type for this class.
|
overridevirtual |
|
virtualinherited |
Get the version number of this object.
double dart::dynamics::PointCloudShape::getVisualSize | ( | ) | const |
Returns size of visual object that represents each point.
|
inherited |
Returns volume of this shape.
The volume will be automatically calculated by the sub-classes such as BoxShape, EllipsoidShape, CylinderShape, and MeshShape.
|
finaloverridevirtualinherited |
Increment the version of this Shape and notify its subscribers.
Reimplemented from dart::common::VersionCounter.
|
inherited |
Get true if the types of this Shape and the template parameter (a shape class) are identical.
This function is a syntactic sugar, which is identical to: (getType() == ShapeType::getStaticType()).
Example code:
|
virtualinherited |
Notify that the alpha of this shape has updated.
|
virtualinherited |
Notify that the alpha of this shape has updated.
|
virtualinherited |
Notify that the color (rgba) of this shape has updated.
|
overridevirtual |
Notify that the color (rgba) of this shape has updated.
Reimplemented from dart::dynamics::Shape.
|
virtualinherited |
Instruct this shape to update its data.
void dart::dynamics::PointCloudShape::removeAllPoints | ( | ) |
Removes all the points.
|
inherited |
Remove a type of variance from this shape.
All other variance types will remain the same.
|
protectedinherited |
Remove an Observer from the list of Observers.
void dart::dynamics::PointCloudShape::reserve | ( | std::size_t | size | ) |
Reserves the point list by size
.
|
protectedinherited |
Send a destruction notification to all Observers.
This will cause all Observers to behave as if this Subject has been permanently deleted, so it should only be called when that behavior is desired.
void dart::dynamics::PointCloudShape::setColorMode | ( | PointCloudShape::ColorMode | mode | ) |
Sets the color mode.
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.
|
inherited |
Set the data variance of this shape.
Use the DataVariance to indicate what kind of shape information might change during run time so that renderers can optimize reliably.
void dart::dynamics::PointCloudShape::setOverallColor | ( | const Eigen::Vector4d & | color | ) |
Sets the overall color.
This function resizes the colors to one.
void dart::dynamics::PointCloudShape::setPoint | ( | const std::vector< Eigen::Vector3d > & | points | ) |
Replaces points with points
.
void dart::dynamics::PointCloudShape::setPointShapeType | ( | PointCloudShape::PointShapeType | type | ) |
Sets the point shape type.
|
protectedinherited |
void dart::dynamics::PointCloudShape::setVisualSize | ( | double | size | ) |
Sets size of visual object that represents each point.
|
overrideprotectedvirtual |
Updates bounding box.
Implements dart::dynamics::Shape.
|
overrideprotectedvirtual |
Updates volume.
Implements dart::dynamics::Shape.
|
mutableprotectedinherited |
The bounding box (in the local coordinate frame) of the shape.
|
protected |
The color mode.
|
protected |
List of colors.
|
staticprotectedinherited |
|
privateinherited |
|
protectedinherited |
Unique id.
|
mutableprotectedinherited |
Whether bounding box needs update.
|
mutableprotectedinherited |
Whether volume needs update.
|
mutableprotectedinherited |
List of current Observers.
|
protected |
List of points.
|
protected |
The point shape type.
|
protectedinherited |
Please use getType() instead. Type of primitive shpae.
|
protectedinherited |
The DataVariance of this Shape.
|
protectedinherited |
|
privateinherited |
Triggered by incrementVersion()
|
protected |
The size of visual object that represents each point.
|
mutableprotectedinherited |
Volume enclosed by the geometry.
|
inherited |
Use this to subscribe to version change signals.