SurgSim::Math::ParticlesShape Class Reference

Particles Shape: A shape consisting of a group of particles of equal radius. More...

`#include <SurgSim/Math/ParticlesShape.h>`

Inheritance diagram for SurgSim::Math::ParticlesShape:

## Public Member Functions

| ParticlesShape (double radius=0.0)
| Constructor. More...
| ParticlesShape (const ParticlesShape &other)
| Copy constructor. More...
template<class V >
| ParticlesShape (const SurgSim::DataStructures::Vertices< V > &other)
| Copy constructor from another Vertices type. More...
template<class V >
ParticlesShape & | operator= (const Vertices< V > &other)
| Assignment when the template data is a different type. More...
| SURGSIM_CLASSNAME (SurgSim::Math::ParticlesShape)
const std::shared_ptr< const SurgSim::DataStructures::AabbTree > | getAabbTree () const
| Get the AabbTree. More...
void | setRadius (double radius)
| Set the particles' radius. More...
double | getRadius () const
| Get the radius of the particles. More...
int | getType () const override
double | getVolume () const override
| Get the volume of the shape. More...
Vector3d | getCenter () const override
| Get the volumetric center of the shape. More...
Matrix33d | getSecondMomentOfVolume () const override
| Get the second central moment of the volume, commonly used to calculate the moment of inertia matrix. More...
std::shared_ptr< Shape > | getTransformed (const RigidTransform3d &pose) const override
| Get a copy of this shape with an applied rigid transform. More...
bool | isValid () const override
| Check if the shape is valid. More...
bool | isTransformable () const override
const Math::Aabbd & | getBoundingBox () const override
template<class V >
ParticlesShape & | operator= (const SurgSim::DataStructures::Vertices< V > &other)
Public Member Functions inherited from SurgSim::Math::Shape
| Shape ()
| Constructor. More...
virtual | ~Shape ()
| Destructor. More...
virtual std::string | getClassName () const
| Get class name. More...
Public Member Functions inherited from SurgSim::Framework::Accessible
| Accessible ()
| Default Constructor. More...
| ~Accessible ()
| Destructor. More...
template<class T >
T | getValue (const std::string &name) const
| Retrieves the value with the name by executing the getter if it is found and tries to convert it to the given type. More...
boost::any | getValue (const std::string &name) const
| Retrieves the value with the name by executing the getter if it is found. More...
template<class T >
bool | getValue (const std::string &name, T *value) const
| Retrieves the value with the name by executing the getter if it is found, and converts it to the type of the output parameter. More...
void | setValue (const std::string &name, const boost::any &value)
| Sets a value of a property that has setter. More...
bool | isReadable (const std::string &name) const
| Check whether a property is readable. More...
bool | isWriteable (const std::string &name) const
| Check whether a property is writable. More...
void | setGetter (const std::string &name, GetterType func)
| Sets a getter for a given property. More...
void | setSetter (const std::string &name, SetterType func)
| Sets a setter for a given property. More...
void | setAccessors (const std::string &name, GetterType getter, SetterType setter)
| Sets the accessors getter and setter in one function. More...
void | removeAccessors (const std::string &name)
| Removes all the accessors (getter and setter) for a given property. More...
void | forwardProperty (const std::string &name, const Accessible &target, const std::string &targetProperty)
| Adds a property with the given name that uses the targets accessors, in effect forwarding the value to the target. More...
void | setSerializable (const std::string &name, EncoderType encoder, DecoderType decoder)
| Sets the functions used to convert data from and to a YAML::Node. More...
void | setDecoder (const std::string &name, DecoderType decoder)
| Sets the functions used to convert data from a YAML::Node. More...
YAML::Node | encode () const
| Encode this Accessible to a YAML::Node. More...
void | decode (const YAML::Node &node, const std::vector< std::string > &ignoredProperties=std::vector< std::string >())
| Decode this Accessible from a YAML::Node, will throw an exception if the data type cannot be converted. More...
template<>
boost::any | getValue (const std::string &name) const
Public Member Functions inherited from SurgSim::DataStructures::Vertices< DataStructures::EmptyData >
| Vertices ()
| Constructor. More...
| Vertices (const Vertices< V > &other)
| Copy constructor when the template data is a different type In this case, no data will be copied. More...
Vertices< DataStructures::EmptyData > & | operator= (const Vertices< V > &other)
| Assignment when the template data is a different type In this case, no data will be copied. More...
virtual | ~Vertices ()
| Destructor. More...
void | clear ()
| Clear mesh to return to an empty state (no vertices). More...
bool | update ()
| Performs any updates that are required when the vertices are modified. More...
size_t | addVertex (const VertexType &vertex)
| Adds a vertex to the mesh. More...
size_t | getNumVertices () const
| Returns the number of vertices in this mesh. More...
const VertexType & | getVertex (size_t id) const
| Returns the specified vertex. More...
VertexType & | getVertex (size_t id)
| Returns the specified vertex (non const version). More...
const std::vector< VertexType > & | getVertices () const
| Returns a vector containing the position of each vertex. More...
std::vector< VertexType > & | getVertices ()
| Returns a vector containing the position of each vertex (non const version). More...
void | setVertexPosition (size_t id, const SurgSim::Math::Vector3d &position)
| Sets the position of a vertex. More...
const SurgSim::Math::Vector3d & | getVertexPosition (size_t id) const
| Returns the position of a vertex. More...
void | setVertexPositions (const std::vector< SurgSim::Math::Vector3d > &positions, bool doUpdate=true)
| Sets the position of each vertex. More...
void | transform (const Math::RigidTransform3d &pose)
| Apply a rigid transform to each vertex. More...
bool | operator== (const Vertices &mesh) const
| Compares the mesh with another one (equality) More...
bool | operator!= (const Vertices &mesh) const
| Compares the mesh with another one (inequality) More...

## Private Member Functions

bool | doUpdate () override
| Performs any updates that are required when the vertices are modified. More...

## Private Attributes

std::shared_ptr< SurgSim::DataStructures::AabbTree > | m_aabbTree
| The aabb tree of the ParticlesShape. More...
double | m_radius
| Particles' radius. More...
Vector3d | m_center
| Volumetric center of particles. More...
double | m_volume
| Total volume of particles. More...
Matrix33d | m_secondMomentOfVolume
| Second moment of volume. More...

## Additional Inherited Members

Public Types inherited from SurgSim::Math::Shape
typedef ::SurgSim::Math::Vector3d | Vector3d
typedef ::SurgSim::Math::Matrix33d | Matrix33d
Public Types inherited from SurgSim::Framework::Accessible
typedef std::function< boost::any(void)> | GetterType
typedef std::function< void(boost::any)> | SetterType
typedef std::function< YAML::Node(void)> | EncoderType
typedef std::function< void(const YAML::Node *)> | DecoderType
Public Types inherited from SurgSim::Framework::FactoryBase< Shape >
typedef ObjectFactory< Shape > | FactoryType
Public Types inherited from SurgSim::DataStructures::Vertices< DataStructures::EmptyData >
typedef Vertex< DataStructures::EmptyData > | VertexType
| Vertex type for convenience. More...
Static Public Member Functions inherited from SurgSim::Framework::FactoryBase< Shape >
static FactoryType & | getFactory ()
Protected Member Functions inherited from SurgSim::DataStructures::Vertices< DataStructures::EmptyData >
virtual void | doClearVertices ()
| Remove all vertices from the mesh. More...
virtual bool | isEqual (const Vertices &mesh) const
| Internal comparison of meshes of the same type: returns true if equal, false if not equal. More...
Protected Attributes inherited from SurgSim::Math::Shape
Math::Aabbd | m_aabb

## Detailed Description

Particles Shape: A shape consisting of a group of particles of equal radius.

## Constructor & Destructor Documentation

## ParticlesShape() [1/3]

SurgSim::Math::ParticlesShape::ParticlesShape | ( | double | radius = `0.0` | ) |

explicit

Constructor.

Parameters

  radius | The particles' radius (in m)

## ParticlesShape() [2/3]

SurgSim::Math::ParticlesShape::ParticlesShape | ( | const ParticlesShape & | other | ) |

explicit

Copy constructor.

Parameters

  other | The ParticleShape to be copied from

## ParticlesShape() [3/3]

template<class V >

SurgSim::Math::ParticlesShape::ParticlesShape | ( | const SurgSim::DataStructures::Vertices< V > & | other | ) |

explicit

Copy constructor from another Vertices type.

Template Parameters

  V | type of data stored in the other vertices

Parameters

  other | The vertices to be copied from. Vertex data will not be copied

## Member Function Documentation

## doUpdate()

bool SurgSim::Math::ParticlesShape::doUpdate | ( |  | ) |

override private virtual

Performs any updates that are required when the vertices are modified.

Override this method to implement update functionality. For example, this could be overridden to calculate normals for each Vertex.

Returns
  true on success.

Reimplemented from SurgSim::DataStructures::Vertices< DataStructures::EmptyData >.

## getAabbTree()

const std::shared_ptr< const SurgSim::DataStructures::AabbTree > SurgSim::Math::ParticlesShape::getAabbTree | ( |  | ) | const

Get the AabbTree.

Returns
  The object's associated AabbTree

## getBoundingBox()

const Math::Aabbd & SurgSim::Math::ParticlesShape::getBoundingBox | ( |  | ) | const

override virtual

Returns
  the bounding box for the shape

Reimplemented from SurgSim::Math::Shape.

## getCenter()

Vector3d SurgSim::Math::ParticlesShape::getCenter | ( |  | ) | const

override virtual

Get the volumetric center of the shape.

Returns
  The center of the shape

Implements SurgSim::Math::Shape.

## getRadius()

double SurgSim::Math::ParticlesShape::getRadius | ( |  | ) | const

Get the radius of the particles.

Returns
  The particles' radius

## getSecondMomentOfVolume()

Matrix33d SurgSim::Math::ParticlesShape::getSecondMomentOfVolume | ( |  | ) | const

override virtual

Get the second central moment of the volume, commonly used to calculate the moment of inertia matrix.

Returns
  The 3x3 symmetric second moment matrix

Implements SurgSim::Math::Shape.

## getTransformed()

std::shared_ptr< Shape > SurgSim::Math::ParticlesShape::getTransformed | ( | const RigidTransform3d & | pose | ) | const

override virtual

Get a copy of this shape with an applied rigid transform.

Parameters

  pose | The pose to transform the shape by

Returns
  the posed shape

Reimplemented from SurgSim::Math::Shape.

## getType()

int SurgSim::Math::ParticlesShape::getType | ( |  | ) | const

override virtual

Returns
  the type of shape

Implements SurgSim::Math::Shape.

## getVolume()

double SurgSim::Math::ParticlesShape::getVolume | ( |  | ) | const

override virtual

Get the volume of the shape.

Returns
  The volume of the shape (in m-3)

Implements SurgSim::Math::Shape.

## isTransformable()

bool SurgSim::Math::ParticlesShape::isTransformable | ( |  | ) | const

override virtual

Returns
  true if the the shape can be transformed

Reimplemented from SurgSim::Math::Shape.

## isValid()

bool SurgSim::Math::ParticlesShape::isValid | ( |  | ) | const

override virtual

Check if the shape is valid.

Returns
  True if shape is valid; Otherwise, false.

Implements SurgSim::Math::Shape.

## operator=() [1/2]

template<class V >

ParticlesShape& SurgSim::Math::ParticlesShape::operator= | ( | const SurgSim::DataStructures::Vertices< V > & | other | ) |

## operator=() [2/2]

template<class V >

ParticlesShape& SurgSim::Math::ParticlesShape::operator= | ( | const Vertices< V > & | other | ) |

Assignment when the template data is a different type.

Template Parameters

  V | type of data stored in the other Vertices

Parameters

  other | the Vertices to copy from

## setRadius()

void SurgSim::Math::ParticlesShape::setRadius | ( | double | radius | ) |

Set the particles' radius.

Parameters

  radius | the radius being set to all particles

## SURGSIM_CLASSNAME()

SurgSim::Math::ParticlesShape::SURGSIM_CLASSNAME | ( | SurgSim::Math::ParticlesShape |  | ) |

## Member Data Documentation

## m_aabbTree

std::shared_ptr<SurgSim::DataStructures::AabbTree> SurgSim::Math::ParticlesShape::m_aabbTree

private

The aabb tree of the ParticlesShape.

## m_center

Vector3d SurgSim::Math::ParticlesShape::m_center

private

Volumetric center of particles.

## m_radius

double SurgSim::Math::ParticlesShape::m_radius

private

Particles' radius.

## m_secondMomentOfVolume

Matrix33d SurgSim::Math::ParticlesShape::m_secondMomentOfVolume

private

Second moment of volume.

## m_volume

double SurgSim::Math::ParticlesShape::m_volume

private

Total volume of particles.

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

- SurgSim/Math/ParticlesShape.h
- SurgSim/Math/ParticlesShape-inl.h
- SurgSim/Math/ParticlesShape.cpp