coal  3.0.1
Coal, The Collision Detection Library. Previously known as HPP-FCL, fork of FCL -- The Flexible Collision Library
coal::HeightField< BV > Class Template Reference

Data structure depicting a height field given by the base grid dimensions and the elevation along the grid. More...

#include <coal/hfield.h>

Inheritance diagram for coal::HeightField< BV >:
Collaboration diagram for coal::HeightField< BV >:

Public Types

typedef HFNode< BV > Node
 
typedef std::vector< Node, Eigen::aligned_allocator< Node > > BVS
 

Public Member Functions

 HeightField ()
 Constructing an empty HeightField. More...
 
 HeightField (const Scalar x_dim, const Scalar y_dim, const MatrixXs &heights, const Scalar min_height=(Scalar) 0)
 Constructing an HeightField from its base dimensions and the set of heights points. The granularity of the height field along X and Y direction is extraded from the Z grid. More...
 
 HeightField (const HeightField &other)
 Copy contructor from another HeightField. More...
 
const VecXsgetXGrid () const
 Returns a const reference of the grid along the X direction. More...
 
const VecXsgetYGrid () const
 Returns a const reference of the grid along the Y direction. More...
 
const MatrixXsgetHeights () const
 Returns a const reference of the heights. More...
 
Scalar getXDim () const
 Returns the dimension of the Height Field along the X direction. More...
 
Scalar getYDim () const
 Returns the dimension of the Height Field along the Y direction. More...
 
Scalar getMinHeight () const
 Returns the minimal height value of the Height Field. More...
 
Scalar getMaxHeight () const
 Returns the maximal height value of the Height Field. More...
 
virtual HeightField< BV > * clone () const
 Clone *this into a new CollisionGeometry. More...
 
const BVSgetNodes () const
 
virtual ~HeightField ()
 deconstruction, delete mesh data related. More...
 
void computeLocalAABB ()
 Compute the AABB for the HeightField, used for broad-phase collision. More...
 
void updateHeights (const MatrixXs &new_heights)
 Update Height Field height. More...
 
const HFNode< BV > & getBV (unsigned int i) const
 Access the bv giving the its index. More...
 
HFNode< BV > & getBV (unsigned int i)
 Access the bv giving the its index. More...
 
NODE_TYPE getNodeType () const
 Get the BV type: default is unknown. More...
 
NODE_TYPE getNodeType () const
 Specialization of getNodeType() for HeightField with different BV types. More...
 
NODE_TYPE getNodeType () const
 get the node type More...
 
NODE_TYPE getNodeType () const
 get the node type More...
 
NODE_TYPE getNodeType () const
 get the node type More...
 
NODE_TYPE getNodeType () const
 get the node type More...
 
NODE_TYPE getNodeType () const
 get the node type More...
 
NODE_TYPE getNodeType () const
 get the node type More...
 
NODE_TYPE getNodeType () const
 get the node type More...
 
- Public Member Functions inherited from coal::CollisionGeometry
 CollisionGeometry ()
 
 CollisionGeometry (const CollisionGeometry &other)=default
 Copy constructor. More...
 
virtual ~CollisionGeometry ()
 
bool operator== (const CollisionGeometry &other) const
 Equality operator. More...
 
bool operator!= (const CollisionGeometry &other) const
 Difference operator. More...
 
void * getUserData () const
 get user data in geometry More...
 
void setUserData (void *data)
 set user data in geometry More...
 
bool isOccupied () const
 whether the object is completely occupied More...
 
bool isFree () const
 whether the object is completely free More...
 
bool isUncertain () const
 whether the object has some uncertainty More...
 
virtual Matrix3s computeMomentofInertiaRelatedToCOM () const
 compute the inertia matrix, related to the com More...
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef CollisionGeometry Base
 
- Public Attributes inherited from coal::CollisionGeometry
Vec3s aabb_center
 AABB center in local coordinate. More...
 
Scalar aabb_radius
 AABB radius. More...
 
AABB aabb_local
 AABB in local coordinate, used for tight AABB when only translation transform. More...
 
void * user_data
 pointer to user defined data specific to this object More...
 
Scalar cost_density
 collision cost for unit volume More...
 
Scalar threshold_occupied
 threshold for occupied ( >= is occupied) More...
 
Scalar threshold_free
 threshold for free (<= is free) More...
 

Protected Member Functions

void init (const Scalar x_dim, const Scalar y_dim, const MatrixXs &heights, const Scalar min_height)
 
OBJECT_TYPE getObjectType () const
 Get the object type: it is a HFIELD. More...
 
Vec3s computeCOM () const
 compute center of mass More...
 
Scalar computeVolume () const
 compute the volume More...
 
Matrix3s computeMomentofInertia () const
 compute the inertia matrix, related to the origin More...
 
int buildTree ()
 Build the bounding volume hierarchy. More...
 
Scalar recursiveUpdateHeight (const size_t bv_id)
 
Scalar recursiveBuildTree (const size_t bv_id, const Eigen::DenseIndex x_id, const Eigen::DenseIndex x_size, const Eigen::DenseIndex y_id, const Eigen::DenseIndex y_size)
 

Protected Attributes

Scalar x_dim
 Dimensions in meters along X and Y directions. More...
 
Scalar y_dim
 
MatrixXs heights
 Elevation values in meters of the Height Field. More...
 
Scalar min_height
 Minimal height of the Height Field: all values bellow min_height will be discarded. More...
 
Scalar max_height
 
VecXs x_grid
 Grids along the X and Y directions. Useful for plotting or other related things. More...
 
VecXs y_grid
 
BVS bvs
 Bounding volume hierarchy. More...
 
unsigned int num_bvs
 

Detailed Description

template<typename BV>
class coal::HeightField< BV >

Data structure depicting a height field given by the base grid dimensions and the elevation along the grid.

Template Parameters
BVone of the bounding volume class in Bounding volumes.

An height field is defined by its base dimensions along the X and Y axes and a set ofpoints defined by their altitude, regularly dispatched on the grid. The height field is centered at the origin and the corners of the geometry correspond to the following coordinates [± x_dim/2; ± y_dim/2].

Member Typedef Documentation

◆ BVS

template<typename BV >
typedef std::vector<Node, Eigen::aligned_allocator<Node> > coal::HeightField< BV >::BVS

◆ Node

template<typename BV >
typedef HFNode<BV> coal::HeightField< BV >::Node

Constructor & Destructor Documentation

◆ HeightField() [1/3]

template<typename BV >
coal::HeightField< BV >::HeightField ( )
inline

Constructing an empty HeightField.

◆ HeightField() [2/3]

template<typename BV >
coal::HeightField< BV >::HeightField ( const Scalar  x_dim,
const Scalar  y_dim,
const MatrixXs heights,
const Scalar  min_height = (Scalar)0 
)
inline

Constructing an HeightField from its base dimensions and the set of heights points. The granularity of the height field along X and Y direction is extraded from the Z grid.

Parameters
[in]x_dimDimension along the X axis
[in]y_dimDimension along the Y axis
[in]heightsMatrix containing the altitude of each point compositng the height field
[in]min_heightMinimal height of the height field

◆ HeightField() [3/3]

template<typename BV >
coal::HeightField< BV >::HeightField ( const HeightField< BV > &  other)
inline

Copy contructor from another HeightField.

Parameters
[in]otherto copy.

◆ ~HeightField()

template<typename BV >
virtual coal::HeightField< BV >::~HeightField ( )
inlinevirtual

deconstruction, delete mesh data related.

Member Function Documentation

◆ buildTree()

template<typename BV >
int coal::HeightField< BV >::buildTree ( )
inlineprotected

Build the bounding volume hierarchy.

◆ clone()

template<typename BV >
virtual HeightField<BV>* coal::HeightField< BV >::clone ( ) const
inlinevirtual

Clone *this into a new CollisionGeometry.

Implements coal::CollisionGeometry.

◆ computeCOM()

template<typename BV >
Vec3s coal::HeightField< BV >::computeCOM ( ) const
inlineprotectedvirtual

compute center of mass

Reimplemented from coal::CollisionGeometry.

◆ computeLocalAABB()

template<typename BV >
void coal::HeightField< BV >::computeLocalAABB ( )
inlinevirtual

Compute the AABB for the HeightField, used for broad-phase collision.

Implements coal::CollisionGeometry.

◆ computeMomentofInertia()

template<typename BV >
Matrix3s coal::HeightField< BV >::computeMomentofInertia ( ) const
inlineprotectedvirtual

compute the inertia matrix, related to the origin

Reimplemented from coal::CollisionGeometry.

◆ computeVolume()

template<typename BV >
Scalar coal::HeightField< BV >::computeVolume ( ) const
inlineprotectedvirtual

compute the volume

Reimplemented from coal::CollisionGeometry.

◆ getBV() [1/2]

template<typename BV >
HFNode<BV>& coal::HeightField< BV >::getBV ( unsigned int  i)
inline

Access the bv giving the its index.

◆ getBV() [2/2]

template<typename BV >
const HFNode<BV>& coal::HeightField< BV >::getBV ( unsigned int  i) const
inline

Access the bv giving the its index.

◆ getHeights()

template<typename BV >
const MatrixXs& coal::HeightField< BV >::getHeights ( ) const
inline

Returns a const reference of the heights.

◆ getMaxHeight()

template<typename BV >
Scalar coal::HeightField< BV >::getMaxHeight ( ) const
inline

Returns the maximal height value of the Height Field.

◆ getMinHeight()

template<typename BV >
Scalar coal::HeightField< BV >::getMinHeight ( ) const
inline

Returns the minimal height value of the Height Field.

◆ getNodes()

template<typename BV >
const BVS& coal::HeightField< BV >::getNodes ( ) const
inline

◆ getNodeType() [1/9]

template<typename BV >
NODE_TYPE coal::HeightField< BV >::getNodeType ( ) const
inlinevirtual

Get the BV type: default is unknown.

Reimplemented from coal::CollisionGeometry.

◆ getNodeType() [2/9]

NODE_TYPE coal::HeightField< AABB >::getNodeType ( ) const
virtual

Specialization of getNodeType() for HeightField with different BV types.

Reimplemented from coal::CollisionGeometry.

◆ getNodeType() [3/9]

NODE_TYPE coal::HeightField< OBB >::getNodeType ( ) const
virtual

get the node type

Reimplemented from coal::CollisionGeometry.

◆ getNodeType() [4/9]

NODE_TYPE coal::HeightField< RSS >::getNodeType ( ) const
virtual

get the node type

Reimplemented from coal::CollisionGeometry.

◆ getNodeType() [5/9]

NODE_TYPE coal::HeightField< kIOS >::getNodeType ( ) const
virtual

get the node type

Reimplemented from coal::CollisionGeometry.

◆ getNodeType() [6/9]

NODE_TYPE coal::HeightField< OBBRSS >::getNodeType ( ) const
virtual

get the node type

Reimplemented from coal::CollisionGeometry.

◆ getNodeType() [7/9]

NODE_TYPE coal::HeightField< KDOP< 16 > >::getNodeType ( ) const
virtual

get the node type

Reimplemented from coal::CollisionGeometry.

◆ getNodeType() [8/9]

NODE_TYPE coal::HeightField< KDOP< 18 > >::getNodeType ( ) const
virtual

get the node type

Reimplemented from coal::CollisionGeometry.

◆ getNodeType() [9/9]

NODE_TYPE coal::HeightField< KDOP< 24 > >::getNodeType ( ) const
virtual

get the node type

Reimplemented from coal::CollisionGeometry.

◆ getObjectType()

template<typename BV >
OBJECT_TYPE coal::HeightField< BV >::getObjectType ( ) const
inlineprotectedvirtual

Get the object type: it is a HFIELD.

Reimplemented from coal::CollisionGeometry.

◆ getXDim()

template<typename BV >
Scalar coal::HeightField< BV >::getXDim ( ) const
inline

Returns the dimension of the Height Field along the X direction.

◆ getXGrid()

template<typename BV >
const VecXs& coal::HeightField< BV >::getXGrid ( ) const
inline

Returns a const reference of the grid along the X direction.

◆ getYDim()

template<typename BV >
Scalar coal::HeightField< BV >::getYDim ( ) const
inline

Returns the dimension of the Height Field along the Y direction.

◆ getYGrid()

template<typename BV >
const VecXs& coal::HeightField< BV >::getYGrid ( ) const
inline

Returns a const reference of the grid along the Y direction.

◆ init()

template<typename BV >
void coal::HeightField< BV >::init ( const Scalar  x_dim,
const Scalar  y_dim,
const MatrixXs heights,
const Scalar  min_height 
)
inlineprotected

◆ recursiveBuildTree()

template<typename BV >
Scalar coal::HeightField< BV >::recursiveBuildTree ( const size_t  bv_id,
const Eigen::DenseIndex  x_id,
const Eigen::DenseIndex  x_size,
const Eigen::DenseIndex  y_id,
const Eigen::DenseIndex  y_size 
)
inlineprotected

◆ recursiveUpdateHeight()

template<typename BV >
Scalar coal::HeightField< BV >::recursiveUpdateHeight ( const size_t  bv_id)
inlineprotected

◆ updateHeights()

template<typename BV >
void coal::HeightField< BV >::updateHeights ( const MatrixXs new_heights)
inline

Update Height Field height.

Member Data Documentation

◆ Base

template<typename BV >
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef CollisionGeometry coal::HeightField< BV >::Base

◆ bvs

template<typename BV >
BVS coal::HeightField< BV >::bvs
protected

Bounding volume hierarchy.

◆ heights

template<typename BV >
MatrixXs coal::HeightField< BV >::heights
protected

Elevation values in meters of the Height Field.

◆ max_height

template<typename BV >
Scalar coal::HeightField< BV >::max_height
protected

◆ min_height

template<typename BV >
Scalar coal::HeightField< BV >::min_height
protected

Minimal height of the Height Field: all values bellow min_height will be discarded.

◆ num_bvs

template<typename BV >
unsigned int coal::HeightField< BV >::num_bvs
protected

◆ x_dim

template<typename BV >
Scalar coal::HeightField< BV >::x_dim
protected

Dimensions in meters along X and Y directions.

◆ x_grid

template<typename BV >
VecXs coal::HeightField< BV >::x_grid
protected

Grids along the X and Y directions. Useful for plotting or other related things.

◆ y_dim

template<typename BV >
Scalar coal::HeightField< BV >::y_dim
protected

◆ y_grid

template<typename BV >
VecXs coal::HeightField< BV >::y_grid
protected

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