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>
Public Member Functions | |
Body (void) | |
virtual void | computeBoundingCylinder (BoundingCylinder &cylinder) const =0 |
Compute the bounding cylinder for the body, in its current pose. Scaling and padding are accounted for. | |
virtual void | computeBoundingSphere (BoundingSphere &sphere) const =0 |
Compute the bounding radius for the body, in its current pose. Scaling and padding are accounted for. | |
virtual double | computeVolume (void) const =0 |
Compute the volume of the body. This method includes changes induced by scaling and padding. | |
bool | containsPoint (double x, double y, double z) const |
Check is a point is inside the body. | |
virtual bool | containsPoint (const tf::Vector3 &p, bool verbose=false) const =0 |
Check is a point is inside the body. | |
double | getPadding (void) const |
Retrieve the current padding. | |
const tf::Transform & | getPose (void) const |
Retrieve the pose of the body. | |
double | getScale (void) const |
Retrieve the current scale. | |
shapes::ShapeType | getType (void) const |
Get the type of shape this body represents. | |
virtual bool | intersectsRay (const tf::Vector3 &origin, const tf::Vector3 &dir, std::vector< tf::Vector3 > *intersections=NULL, unsigned int count=0) const =0 |
Check is 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. | |
void | setDimensions (const shapes::Shape *shape) |
Set the dimensions of the body (from corresponding shape) | |
void | setPadding (double padd) |
If constant padding should be added to the body, this method sets the padding. Default is 0.0. | |
void | setPose (const tf::Transform &pose) |
Set the pose of the body. Default is identity. | |
void | setScale (double scale) |
If the dimension of the body should be scaled, this method sets the scale. Default is 1.0. | |
virtual | ~Body (void) |
Protected Member Functions | |
virtual void | updateInternalData (void)=0 |
virtual void | useDimensions (const shapes::Shape *shape)=0 |
Protected Attributes | |
double | m_padding |
tf::Transform | m_pose |
double | m_scale |
shapes::ShapeType | m_type |
A body is a shape + its pose. Point inclusion, ray intersection can be tested, volumes and bounding spheres can be computed.
bodies::Body::Body | ( | void | ) | [inline] |
virtual bodies::Body::~Body | ( | void | ) | [inline, virtual] |
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.
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.
virtual double bodies::Body::computeVolume | ( | void | ) | 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.
bool bodies::Body::containsPoint | ( | double | x, |
double | y, | ||
double | z | ||
) | const [inline] |
virtual bool bodies::Body::containsPoint | ( | const tf::Vector3 & | p, |
bool | verbose = false |
||
) | const [pure virtual] |
Check is a point is inside the body.
Implemented in bodies::ConvexMesh, bodies::Box, bodies::Cylinder, and bodies::Sphere.
double bodies::Body::getPadding | ( | void | ) | const [inline] |
const tf::Transform& bodies::Body::getPose | ( | void | ) | const [inline] |
double bodies::Body::getScale | ( | void | ) | const [inline] |
shapes::ShapeType bodies::Body::getType | ( | void | ) | const [inline] |
virtual bool bodies::Body::intersectsRay | ( | const tf::Vector3 & | origin, |
const tf::Vector3 & | dir, | ||
std::vector< tf::Vector3 > * | intersections = NULL , |
||
unsigned int | count = 0 |
||
) | const [pure virtual] |
Check is 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.
Implemented in bodies::ConvexMesh, bodies::Box, bodies::Cylinder, and bodies::Sphere.
void bodies::Body::setDimensions | ( | const shapes::Shape * | shape | ) | [inline] |
void bodies::Body::setPadding | ( | double | padd | ) | [inline] |
void bodies::Body::setPose | ( | const tf::Transform & | pose | ) | [inline] |
void bodies::Body::setScale | ( | double | scale | ) | [inline] |
virtual void bodies::Body::updateInternalData | ( | void | ) | [protected, pure virtual] |
Implemented in bodies::ConvexMesh, bodies::Box, bodies::Cylinder, and bodies::Sphere.
virtual void bodies::Body::useDimensions | ( | const shapes::Shape * | shape | ) | [protected, pure virtual] |
Implemented in bodies::ConvexMesh, bodies::Box, bodies::Cylinder, and bodies::Sphere.
double bodies::Body::m_padding [protected] |
tf::Transform bodies::Body::m_pose [protected] |
double bodies::Body::m_scale [protected] |
shapes::ShapeType bodies::Body::m_type [protected] |