bodies::Body Class Referenceabstract

A body is a shape + its pose. Point inclusion, ray intersection can be tested, volumes and bounding spheres can be computed. More...

`#include <bodies.h>`

Inheritance diagram for bodies::Body:
[legend]

Public Member Functions

Body ()

BodyPtr cloneAt (const Eigen::Isometry3d &pose) const
Get a clone of this body, but one that is located at the pose pose. More...

virtual BodyPtr cloneAt (const Eigen::Isometry3d &pose, double padding, double scaling) const =0
Get a clone of this body, but one that is located at the pose pose and has possibly different passing and scaling: padding and scaling. This function is useful to implement thread safety, when bodies need to be moved around. More...

virtual void computeBoundingBox (AABB &bbox) const =0
Compute the axis-aligned bounding box for the body, in its current pose. Scaling and padding are accounted for. More...

virtual void computeBoundingCylinder (BoundingCylinder &cylinder) const =0
Compute the bounding cylinder for the body, in its current pose. Scaling and padding are accounted for. More...

virtual void computeBoundingSphere (BoundingSphere &sphere) const =0
Compute the bounding radius for the body, in its current pose. Scaling and padding are accounted for. More...

virtual double computeVolume () const =0
Compute the volume of the body. This method includes changes induced by scaling and padding. More...

bool containsPoint (double x, double y, double z, bool verbose=false) const
Check if a point is inside the body. More...

virtual bool containsPoint (const Eigen::Vector3d &p, bool verbose=false) const =0
Check if a point is inside the body. Surface points are included. More...

virtual std::vector< double > getDimensions () const =0
Get the dimensions associated to this body (as read from corresponding shape) More...

const Eigen::Isometry3d & getPose () const
Retrieve the pose of the body. More...

double getScale () const
Retrieve the current scale. More...

shapes::ShapeType getType () const
Get the type of shape this body represents. More...

virtual bool intersectsRay (const Eigen::Vector3d &origin, const Eigen::Vector3d &dir, EigenSTL::vector_Vector3d *intersections=nullptr, unsigned int count=0) const =0
Check if a ray intersects the body, and find the set of intersections, in order, along the ray. A maximum number of intersections can be specified as well. If that number is 0, all intersections are returned. Passing dir as a unit vector will result in faster computation. More...

virtual bool samplePointInside (random_numbers::RandomNumberGenerator &rng, unsigned int max_attempts, Eigen::Vector3d &result) const
Sample a point that is included in the body using a given random number generator. More...

void setDimensions (const shapes::Shape *shape)
Set the dimensions of the body (from corresponding shape) More...

void setDimensionsDirty (const shapes::Shape *shape)
Set the dimensions of the body (from corresponding shape). More...

If constant padding should be added to the body, this method sets the padding. Default is 0.0. More...

If the dimension of the body should be padded, this method sets the pading. More...

void setPose (const Eigen::Isometry3d &pose)
Set the pose of the body. Default is identity. More...

void setPoseDirty (const Eigen::Isometry3d &pose)
Set the pose of the body. More...

void setScale (double scale)
If the dimension of the body should be scaled, this method sets the scale. Default is 1.0. More...

void setScaleDirty (double scale)
If the dimension of the body should be scaled, this method sets the scale. More...

virtual void updateInternalData ()=0
This function is called every time a change to the body is made, so that intermediate values stored for efficiency reasons are kept up to date. More...

virtual ~Body ()

Protected Member Functions

virtual void useDimensions (const shapes::Shape *shape)=0
Depending on the shape, this function copies the relevant data to the body. More...

Protected Attributes

The scale that was set for this body. More...

Eigen::Isometry3d pose_
The location of the body (position and orientation) More...

double scale_
The scale that was set for this body. More...

shapes::ShapeType type_
The type of shape this body was constructed from. More...

Detailed Description

A body is a shape + its pose. Point inclusion, ray intersection can be tested, volumes and bounding spheres can be computed.

Definition at line 88 of file bodies.h.

◆ Body()

 bodies::Body::Body ( )
inline

Definition at line 91 of file bodies.h.

◆ ~Body()

 virtual bodies::Body::~Body ( )
inlinevirtual

Definition at line 96 of file bodies.h.

◆ cloneAt() [1/2]

 BodyPtr bodies::Body::cloneAt ( const Eigen::Isometry3d & pose ) const
inline

Get a clone of this body, but one that is located at the pose pose.

Definition at line 248 of file bodies.h.

◆ cloneAt() [2/2]

 virtual BodyPtr bodies::Body::cloneAt ( const Eigen::Isometry3d & pose, double padding, double scaling ) const
pure virtual

Get a clone of this body, but one that is located at the pose pose and has possibly different passing and scaling: padding and scaling. This function is useful to implement thread safety, when bodies need to be moved around.

Implemented in bodies::ConvexMesh, bodies::Box, bodies::Cylinder, and bodies::Sphere.

◆ computeBoundingBox()

 virtual void bodies::Body::computeBoundingBox ( AABB & bbox ) const
pure virtual

Compute the axis-aligned bounding box for the body, in its current pose. Scaling and padding are accounted for.

Implemented in bodies::ConvexMesh, bodies::Box, bodies::Cylinder, and bodies::Sphere.

◆ computeBoundingCylinder()

 virtual void bodies::Body::computeBoundingCylinder ( BoundingCylinder & cylinder ) const
pure virtual

Compute the bounding cylinder for the body, in its current pose. Scaling and padding are accounted for.

Implemented in bodies::ConvexMesh, bodies::Box, bodies::Cylinder, and bodies::Sphere.

◆ computeBoundingSphere()

 virtual void bodies::Body::computeBoundingSphere ( BoundingSphere & sphere ) const
pure virtual

Compute the bounding radius for the body, in its current pose. Scaling and padding are accounted for.

Implemented in bodies::ConvexMesh, bodies::Box, bodies::Cylinder, and bodies::Sphere.

◆ computeVolume()

 virtual double bodies::Body::computeVolume ( ) const
pure virtual

Compute the volume of the body. This method includes changes induced by scaling and padding.

Implemented in bodies::ConvexMesh, bodies::Box, bodies::Cylinder, and bodies::Sphere.

◆ containsPoint() [1/2]

 bool bodies::Body::containsPoint ( double x, double y, double z, bool verbose = `false` ) const
inline

Check if a point is inside the body.

Definition at line 206 of file bodies.h.

◆ containsPoint() [2/2]

 virtual bool bodies::Body::containsPoint ( const Eigen::Vector3d & p, bool verbose = `false` ) const
pure virtual

Check if a point is inside the body. Surface points are included.

Implemented in bodies::ConvexMesh, bodies::Box, bodies::Cylinder, and bodies::Sphere.

◆ getDimensions()

 virtual std::vector bodies::Body::getDimensions ( ) const
pure virtual

Get the dimensions associated to this body (as read from corresponding shape)

Implemented in bodies::ConvexMesh, bodies::Box, bodies::Cylinder, and bodies::Sphere.

inline

Definition at line 155 of file bodies.h.

◆ getPose()

 const Eigen::Isometry3d& bodies::Body::getPose ( ) const
inline

Retrieve the pose of the body.

Definition at line 181 of file bodies.h.

◆ getScale()

 double bodies::Body::getScale ( ) const
inline

Retrieve the current scale.

Definition at line 128 of file bodies.h.

◆ getType()

 shapes::ShapeType bodies::Body::getType ( ) const
inline

Get the type of shape this body represents.

Definition at line 101 of file bodies.h.

◆ intersectsRay()

 virtual bool bodies::Body::intersectsRay ( const Eigen::Vector3d & origin, const Eigen::Vector3d & dir, EigenSTL::vector_Vector3d * intersections = `nullptr`, unsigned int count = `0` ) const
pure virtual

Check if a ray intersects the body, and find the set of intersections, in order, along the ray. A maximum number of intersections can be specified as well. If that number is 0, all intersections are returned. Passing dir as a unit vector will result in faster computation.

Implemented in bodies::ConvexMesh, bodies::Box, bodies::Cylinder, and bodies::Sphere.

◆ samplePointInside()

 bool bodies::Body::samplePointInside ( random_numbers::RandomNumberGenerator & rng, unsigned int max_attempts, Eigen::Vector3d & result ) const
virtual

Sample a point that is included in the body using a given random number generator.

Sometimes multiple attempts need to be generated. The function terminates with failure (returns false) after max_attempts attempts. If the call is successful (returns true) the point is written to result

Reimplemented in bodies::Box, bodies::Cylinder, and bodies::Sphere.

Definition at line 168 of file bodies.cpp.

◆ setDimensions()

 void bodies::Body::setDimensions ( const shapes::Shape * shape )

Set the dimensions of the body (from corresponding shape)

Definition at line 162 of file bodies.cpp.

◆ setDimensionsDirty()

 void bodies::Body::setDimensionsDirty ( const shapes::Shape * shape )
inline

Set the dimensions of the body (from corresponding shape).

Note
This is the dirty version of the function which does not update internal data that depend on the dimensions. In the general case, you should call setDimensions() instead. Only call this function if you have a series of calls like setScale/setPadding/setPose/setDimensions and you want to avoid the overhead of updating the internal structures after each call. When you are finished with the batch, call updateInternalData().
Parameters
 shape The shape whose dimensions should be assumed. After the function finishes, the pointer can be deleted.

Definition at line 194 of file bodies.h.

inline

If constant padding should be added to the body, this method sets the padding. Default is 0.0.

Definition at line 148 of file bodies.h.

inline

If the dimension of the body should be padded, this method sets the pading.

Note
This is the dirty version of the function which does not update internal data that depend on the scale. In the general case, you should call setPadding() instead. Only call this function if you have a series of calls like setScale/setPadding/setPose/setDimensions and you want to avoid the overhead of updating the internal structures after each call. When you are finished with the batch, call updateInternalData().
Parameters

Definition at line 141 of file bodies.h.

◆ setPose()

 void bodies::Body::setPose ( const Eigen::Isometry3d & pose )
inline

Set the pose of the body. Default is identity.

Definition at line 174 of file bodies.h.

◆ setPoseDirty()

 void bodies::Body::setPoseDirty ( const Eigen::Isometry3d & pose )
inline

Set the pose of the body.

Note
This is the dirty version of the function which does not update internal data that depend on the pose. In the general case, you should call setPose() instead. Only call this function if you have a series of calls like setScale/setPadding/setPose/setDimensions and you want to avoid the overhead of updating the internal structures after each call. When you are finished with the batch, call updateInternalData().
Parameters
 pose The pose to set. Default is identity.

Definition at line 168 of file bodies.h.

◆ setScale()

 void bodies::Body::setScale ( double scale )
inline

If the dimension of the body should be scaled, this method sets the scale. Default is 1.0.

Definition at line 121 of file bodies.h.

◆ setScaleDirty()

 void bodies::Body::setScaleDirty ( double scale )
inline

If the dimension of the body should be scaled, this method sets the scale.

Note
This is the dirty version of the function which does not update internal data that depend on the scale. In the general case, you should call setScale() instead. Only call this function if you have a series of calls like setScale/setPadding/setPose/setDimensions and you want to avoid the overhead of updating the internal structures after each call. When you are finished with the batch, call updateInternalData().
Parameters
 scale The scale to set. 1.0 means no scaling.

Definition at line 114 of file bodies.h.

◆ updateInternalData()

 virtual void bodies::Body::updateInternalData ( )
pure virtual

This function is called every time a change to the body is made, so that intermediate values stored for efficiency reasons are kept up to date.

Implemented in bodies::ConvexMesh, bodies::Box, bodies::Cylinder, and bodies::Sphere.

◆ useDimensions()

 virtual void bodies::Body::useDimensions ( const shapes::Shape * shape )
protectedpure virtual

Depending on the shape, this function copies the relevant data to the body.

Implemented in bodies::ConvexMesh, bodies::Box, bodies::Cylinder, and bodies::Sphere.

Member Data Documentation

protected

The scale that was set for this body.

Definition at line 272 of file bodies.h.

◆ pose_

 Eigen::Isometry3d bodies::Body::pose_
protected

The location of the body (position and orientation)

Definition at line 278 of file bodies.h.

◆ scale_

 double bodies::Body::scale_
protected

The scale that was set for this body.

Definition at line 269 of file bodies.h.

◆ type_

 shapes::ShapeType bodies::Body::type_
protected

The type of shape this body was constructed from.

Definition at line 275 of file bodies.h.

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

geometric_shapes
Author(s): Ioan Sucan , Gil Jones
autogenerated on Tue Jun 22 2021 06:26:29