Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
bodies::ConvexMesh Class Reference

Definition of a convex mesh. Convex hull is computed for a given shape::Mesh. More...

#include <bodies.h>

Inheritance diagram for bodies::ConvexMesh:
Inheritance graph
[legend]

Classes

struct  MeshData
 

Public Member Functions

virtual BodyPtr cloneAt (const Eigen::Affine3d &pose, double padding, double scale) const
 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 computeBoundingCylinder (BoundingCylinder &cylinder) const
 Compute the bounding cylinder for the body, in its current pose. Scaling and padding are accounted for. More...
 
virtual void computeBoundingSphere (BoundingSphere &sphere) const
 Compute the bounding radius for the body, in its current pose. Scaling and padding are accounted for. More...
 
void computeScaledVerticesFromPlaneProjections ()
 Project the original vertex to the scaled and padded planes and average. More...
 
virtual double computeVolume () const
 Compute the volume of the body. This method includes changes induced by scaling and padding. More...
 
virtual bool containsPoint (const Eigen::Vector3d &p, bool verbose=false) const
 Check if a point is inside the body. More...
 
 ConvexMesh ()
 
 ConvexMesh (const shapes::Shape *shape)
 
void correctVertexOrderFromPlanes ()
 
virtual std::vector< double > getDimensions () const
 Returns an empty vector. More...
 
const EigenSTL::vector_Vector3dgetScaledVertices () const
 
const std::vector< unsigned int > & getTriangles () const
 
const EigenSTL::vector_Vector3dgetVertices () const
 
virtual bool intersectsRay (const Eigen::Vector3d &origin, const Eigen::Vector3d &dir, EigenSTL::vector_Vector3d *intersections=NULL, unsigned int count=0) const
 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. More...
 
virtual ~ConvexMesh ()
 
- Public Member Functions inherited from bodies::Body
 Body ()
 
BodyPtr cloneAt (const Eigen::Affine3d &pose) const
 Get a clone of this body, but one that is located at the pose pose. More...
 
bool containsPoint (double x, double y, double z, bool verbose=false) const
 Check if a point is inside the body. More...
 
double getPadding () const
 Retrieve the current padding. More...
 
const Eigen::Affine3d & 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 samplePointInside (random_numbers::RandomNumberGenerator &rng, unsigned int max_attempts, Eigen::Vector3d &result)
 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 setPadding (double padd)
 If constant padding should be added to the body, this method sets the padding. Default is 0.0. More...
 
void setPose (const Eigen::Affine3d &pose)
 Set the pose of the body. Default is identity. More...
 
void setScale (double scale)
 If the dimension of the body should be scaled, this method sets the scale. Default is 1.0. More...
 
virtual ~Body ()
 

Protected Member Functions

unsigned int countVerticesBehindPlane (const Eigen::Vector4f &planeNormal) const
 (Used mainly for debugging) Count the number of vertices behind a plane More...
 
bool isPointInsidePlanes (const Eigen::Vector3d &point) const
 Check if a point is inside a set of planes that make up a convex mesh. More...
 
virtual void updateInternalData ()
 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 void useDimensions (const shapes::Shape *shape)
 Depending on the shape, this function copies the relevant data to the body. More...
 

Protected Attributes

Box bounding_box_
 
Eigen::Vector3d center_
 
Eigen::Affine3d i_pose_
 
std::shared_ptr< MeshDatamesh_data_
 
double radiusB_
 
double radiusBSqr_
 
EigenSTL::vector_Vector3dscaled_vertices_
 
- Protected Attributes inherited from bodies::Body
double padding_
 The scale that was set for this body. More...
 
Eigen::Affine3d 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...
 

Private Attributes

std::unique_ptr< EigenSTL::vector_Vector3dscaled_vertices_storage_
 

Detailed Description

Definition of a convex mesh. Convex hull is computed for a given shape::Mesh.

Definition at line 397 of file bodies.h.

Constructor & Destructor Documentation

bodies::ConvexMesh::ConvexMesh ( )
inline

Definition at line 400 of file bodies.h.

bodies::ConvexMesh::ConvexMesh ( const shapes::Shape shape)
inline

Definition at line 406 of file bodies.h.

virtual bodies::ConvexMesh::~ConvexMesh ( )
inlinevirtual

Definition at line 413 of file bodies.h.

Member Function Documentation

std::shared_ptr< bodies::Body > bodies::ConvexMesh::cloneAt ( const Eigen::Affine3d &  pose,
double  padding,
double  scaling 
) const
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.

Implements bodies::Body.

Definition at line 999 of file bodies.cpp.

void bodies::ConvexMesh::computeBoundingCylinder ( BoundingCylinder cylinder) const
virtual

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

Implements bodies::Body.

Definition at line 1017 of file bodies.cpp.

void bodies::ConvexMesh::computeBoundingSphere ( BoundingSphere sphere) const
virtual

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

Implements bodies::Body.

Definition at line 1011 of file bodies.cpp.

void bodies::ConvexMesh::computeScaledVerticesFromPlaneProjections ( )

Project the original vertex to the scaled and padded planes and average.

Definition at line 881 of file bodies.cpp.

double bodies::ConvexMesh::computeVolume ( ) const
virtual

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

Implements bodies::Body.

Definition at line 1055 of file bodies.cpp.

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

Check if a point is inside the body.

Implements bodies::Body.

Definition at line 664 of file bodies.cpp.

void bodies::ConvexMesh::correctVertexOrderFromPlanes ( )

Definition at line 678 of file bodies.cpp.

unsigned int bodies::ConvexMesh::countVerticesBehindPlane ( const Eigen::Vector4f &  planeNormal) const
protected

(Used mainly for debugging) Count the number of vertices behind a plane

Definition at line 1041 of file bodies.cpp.

std::vector< double > bodies::ConvexMesh::getDimensions ( ) const
virtual

Returns an empty vector.

Implements bodies::Body.

Definition at line 876 of file bodies.cpp.

const EigenSTL::vector_Vector3d & bodies::ConvexMesh::getScaledVertices ( ) const

Definition at line 994 of file bodies.cpp.

const std::vector< unsigned int > & bodies::ConvexMesh::getTriangles ( ) const

Definition at line 982 of file bodies.cpp.

const EigenSTL::vector_Vector3d & bodies::ConvexMesh::getVertices ( ) const

Definition at line 988 of file bodies.cpp.

bool bodies::ConvexMesh::intersectsRay ( const Eigen::Vector3d &  origin,
const Eigen::Vector3d &  dir,
EigenSTL::vector_Vector3d intersections = NULL,
unsigned int  count = 0 
) const
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.

Implements bodies::Body.

Definition at line 1070 of file bodies.cpp.

bool bodies::ConvexMesh::isPointInsidePlanes ( const Eigen::Vector3d &  point) const
protected

Check if a point is inside a set of planes that make up a convex mesh.

Definition at line 1027 of file bodies.cpp.

void bodies::ConvexMesh::updateInternalData ( )
protectedvirtual

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.

Implements bodies::Body.

Definition at line 945 of file bodies.cpp.

void bodies::ConvexMesh::useDimensions ( const shapes::Shape shape)
protectedvirtual

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

Implements bodies::Body.

Definition at line 701 of file bodies.cpp.

Member Data Documentation

Box bodies::ConvexMesh::bounding_box_
protected

Definition at line 472 of file bodies.h.

Eigen::Vector3d bodies::ConvexMesh::center_
protected

Definition at line 469 of file bodies.h.

Eigen::Affine3d bodies::ConvexMesh::i_pose_
protected

Definition at line 468 of file bodies.h.

std::shared_ptr<MeshData> bodies::ConvexMesh::mesh_data_
protected

Definition at line 465 of file bodies.h.

double bodies::ConvexMesh::radiusB_
protected

Definition at line 470 of file bodies.h.

double bodies::ConvexMesh::radiusBSqr_
protected

Definition at line 471 of file bodies.h.

EigenSTL::vector_Vector3d* bodies::ConvexMesh::scaled_vertices_
protected

Definition at line 478 of file bodies.h.

std::unique_ptr<EigenSTL::vector_Vector3d> bodies::ConvexMesh::scaled_vertices_storage_
private

Definition at line 481 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 Mon Jun 10 2019 13:22:04