Gazebo Math

API Reference

7.5.1
VolumetricGridLookupField< T, I > Class Template Reference

Lookup table for a volumetric dataset. This class is used to lookup indices for a large dataset that's organized in a grid. This class is not meant to be used with non-grid like data sets. The grid may be sparse or non uniform and missing data points. More...

#include <VolumetricGridLookupField.hh>

Public Member Functions

 VolumetricGridLookupField (const std::vector< Vector3< T >> &_cloud)
 Constructor. More...
 
 VolumetricGridLookupField (const std::vector< Vector3< T >> &_cloud, const std::vector< I > &_indices)
 Constructor. More...
 
std::pair< Vector3< T >, Vector3< T > > Bounds () const
 Get the bounds of this grid field. More...
 
template<typename V >
std::optional< V > EstimateValueUsingTrilinear (const std::vector< InterpolationPoint3D< T >> _interpolators, const Vector3< T > &_pt, const std::vector< V > &_values, const V &_default=V(0)) const
 Estimates the values for a grid given a list of values to interpolate. This method uses Trilinear interpolation. More...
 
template<typename V >
std::optional< V > EstimateValueUsingTrilinear (const Vector3< T > &_pt, const std::vector< V > &_values, const V &_default=V(0)) const
 Estimates the values for a grid given a list of values to interpolate. This method uses Trilinear interpolation. More...
 
std::vector< InterpolationPoint3D< T > > GetInterpolators (const Vector3< T > &_pt, const double _xTol=1e-6, const double _yTol=1e-6, const double _zTol=1e-6) const
 Retrieves the indices of the points that are to be used for interpolation. Separate tolerance values are used for each axis as data may have different magnitudes on each axis. More...
 

Detailed Description

template<typename T, typename I = std::size_t>
class gz::math::VolumetricGridLookupField< T, I >

Lookup table for a volumetric dataset. This class is used to lookup indices for a large dataset that's organized in a grid. This class is not meant to be used with non-grid like data sets. The grid may be sparse or non uniform and missing data points.

Constructor & Destructor Documentation

◆ VolumetricGridLookupField() [1/2]

VolumetricGridLookupField ( const std::vector< Vector3< T >> &  _cloud)
inline

Constructor.

Parameters
[in]_cloudThe cloud of points to use to construct the grid.

◆ VolumetricGridLookupField() [2/2]

VolumetricGridLookupField ( const std::vector< Vector3< T >> &  _cloud,
const std::vector< I > &  _indices 
)
inline

Constructor.

Parameters
[in]_cloudThe cloud of points to use to construct the grid.
[in]_indicesA series of indices these points correspond to.

References vector< T >::size().

Member Function Documentation

◆ Bounds()

std::pair<Vector3<T>, Vector3<T> > Bounds ( ) const
inline

Get the bounds of this grid field.

Returns
A pair of vectors.

◆ EstimateValueUsingTrilinear() [1/2]

std::optional<V> EstimateValueUsingTrilinear ( const std::vector< InterpolationPoint3D< T >>  _interpolators,
const Vector3< T > &  _pt,
const std::vector< V > &  _values,
const V &  _default = V(0) 
) const
inline

Estimates the values for a grid given a list of values to interpolate. This method uses Trilinear interpolation.

Parameters
[in]_interpolatorsThe list of interpolators to use. Retrieved by calling GetInterpolators().
[in]_ptThe point to estimate for.
[in]_valuesThe values to interpolate.
[in]_defaultIf a value is not found at a specific point then this value will be used.
Returns
The estimated value for the point. Nullopt if we are outside the field. Default value if in the field but no value is in the index.

◆ EstimateValueUsingTrilinear() [2/2]

std::optional<V> EstimateValueUsingTrilinear ( const Vector3< T > &  _pt,
const std::vector< V > &  _values,
const V &  _default = V(0) 
) const
inline

Estimates the values for a grid given a list of values to interpolate. This method uses Trilinear interpolation.

Parameters
[in]_ptThe point to estimate for.
[in]_valuesThe values to interpolate.
[in]_defaultIf a value is not found at a specific point then this value will be used.
Returns
The estimated value for the point.

References VolumetricGridLookupField< T, I >::GetInterpolators().

◆ GetInterpolators()

std::vector<InterpolationPoint3D<T> > GetInterpolators ( const Vector3< T > &  _pt,
const double  _xTol = 1e-6,
const double  _yTol = 1e-6,
const double  _zTol = 1e-6 
) const
inline

Retrieves the indices of the points that are to be used for interpolation. Separate tolerance values are used for each axis as data may have different magnitudes on each axis.

Parameters
[in]_ptThe point to get the interpolators for.
[in]_xTolThe tolerance for the x axis.
[in]_yTolThe tolerance for the y axis.
[in]_zTolThe tolerance for the z axis.
Returns
A list of points which are to be used for interpolation. If the point is in the middle of a grid cell then it returns the four corners of the grid cell. If its along a plane then it returns the four corners, if along an edge two points and if coincident with a corner one point. If the data is sparse and missing indices then a nullopt will be returned.

References vector< T >::push_back(), Vector3< T >::X(), Vector3< T >::Y(), and Vector3< T >::Z().

Referenced by VolumetricGridLookupField< T, I >::EstimateValueUsingTrilinear().


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