PCL
pcl::ShepardInterpolation< T > Class Template Reference

Two-dimensional surface interpolation with the local Shepard method. More...

#include <ShepardInterpolation.h>

+ Inheritance diagram for pcl::ShepardInterpolation< T >:

Public Types

typedef vector_type::scalar scalar
 
typedef search_tree::rectangle search_rect
 
typedef QuadTree< vector_typesearch_tree
 
typedef GenericVector< T > vector_type
 

Public Member Functions

 ShepardInterpolation ()=default
 
 ShepardInterpolation (const ShepardInterpolation &)=delete
 
 ShepardInterpolation (ShepardInterpolation &&)=default
 
virtual ~ShepardInterpolation ()
 
void Clear ()
 
void Initialize (const T *x, const T *y, const T *z, int n)
 
void Initialize (const search_rect &rect, const T *x, const T *y, const T *z, int n)
 
bool IsValid () const
 
operator() (double x, double y) const
 
template<typename Tp >
operator() (const GenericPoint< Tp > &p) const
 
ShepardInterpolationoperator= (const ShepardInterpolation &)=delete
 
ShepardInterpolationoperator= (ShepardInterpolation &&)=default
 
int Power () const
 
double Radius () const
 
void SetPower (int m)
 
void SetRadius (double R)
 
void SetSmoothing (float r)
 
float Smoothing () const
 

Static Public Attributes

static constexpr int BucketCapacity = 16
 

Protected Member Functions

void DoInitialize (const search_rect *rect, const T *x, const T *y, const T *z, int n)
 

Detailed Description

template<typename T>
class pcl::ShepardInterpolation< T >

ShepardInterpolation implements the Shepard method of function interpolation/approximation for arbitrarily distributed input nodes in two dimensions.

This class implements local Shepard interpolation with Franke-Little weights, quadtree structures for fast rectangular search of input nodes, optional regularization, and an adaptive local interpolation search routine.

References

Shepard, Donald (1968). A two-dimensional interpolation function for irregularly-spaced data. Proceedings of the 1968 ACM National Conference, pp. 517-524.

Franke, Richard (1982). Scattered data interpolation: tests of some methods. Mathematics of Computation 38 (1982), pp. 181-200.

Hanan Samet, Foundations of Multidimensional and Metric Data Structures, Morgan Kaufmann, 2006, Section 1.4.

Mark de Berg et al, Computational Geometry: Algorithms and Applications Third Edition, Springer, 2010, Chapter 14.

See also
SurfaceSpline, SurfacePolynomial, QuadTree

Definition at line 125 of file ShepardInterpolation.h.

Member Typedef Documentation

◆ scalar

template<typename T>
typedef vector_type::scalar pcl::ShepardInterpolation< T >::scalar

The numeric type used to represent coordinates and function values.

Definition at line 137 of file ShepardInterpolation.h.

◆ search_rect

template<typename T>
typedef search_tree::rectangle pcl::ShepardInterpolation< T >::search_rect

The class used to specify interpolation regions.

Definition at line 147 of file ShepardInterpolation.h.

◆ search_tree

template<typename T>
typedef QuadTree<vector_type> pcl::ShepardInterpolation< T >::search_tree

The class used to implement fast coordinate search operations.

Definition at line 142 of file ShepardInterpolation.h.

◆ vector_type

template<typename T>
typedef GenericVector<T> pcl::ShepardInterpolation< T >::vector_type

Represents a vector of coordinates or function values.

Definition at line 132 of file ShepardInterpolation.h.

Constructor & Destructor Documentation

◆ ShepardInterpolation() [1/3]

template<typename T>
pcl::ShepardInterpolation< T >::ShepardInterpolation ( )
default

Default constructor. Constructs an empty ShepardInterpolation object.

◆ ShepardInterpolation() [2/3]

template<typename T>
pcl::ShepardInterpolation< T >::ShepardInterpolation ( const ShepardInterpolation< T > &  )
delete

Copy constructor. Copy construction is disabled because this class uses internal data structures that cannot be copy-constructed. However, ShepardInterpolation implements move construction and move assignment.

◆ ShepardInterpolation() [3/3]

template<typename T>
pcl::ShepardInterpolation< T >::ShepardInterpolation ( ShepardInterpolation< T > &&  )
default

Move constructor.

◆ ~ShepardInterpolation()

template<typename T>
virtual pcl::ShepardInterpolation< T >::~ShepardInterpolation ( )
inlinevirtual

Virtual destructor.

Definition at line 174 of file ShepardInterpolation.h.

Member Function Documentation

◆ Clear()

template<typename T>
void pcl::ShepardInterpolation< T >::Clear ( )
inline

Resets this ShepardInterpolation object, deallocating all internal working structures.

Definition at line 478 of file ShepardInterpolation.h.

◆ DoInitialize()

template<typename T>
void pcl::ShepardInterpolation< T >::DoInitialize ( const search_rect rect,
const T *  x,
const T *  y,
const T *  z,
int  n 
)
inlineprotected

Performs input data normalization and sanitization. Builds the point search quadtree with normalized node coordinates.

Definition at line 498 of file ShepardInterpolation.h.

◆ Initialize() [1/2]

template<typename T>
void pcl::ShepardInterpolation< T >::Initialize ( const T *  x,
const T *  y,
const T *  z,
int  n 
)
inline

Generation of a two-dimensional surface approximation.

Parameters
xX node coordinates.
yY node coordinates.
zNode values.
nNumber of nodes. There must be at least three distinct input nodes.

The input nodes can be arbitrarily distributed and don't need to follow any specific order. However, all node points should be distinct with respect to the machine epsilon for the floating point type T.

This initialization function includes a sanitization routine. If there are duplicate points in the specified set of input nodes, only the first occurrence of each duplicate will be kept to build the interpolation surface, and the rest of duplicate points will be ignored. Two points are considered equal if their coordinates don't differ more than the machine epsilon for the floating point type T.

Definition at line 332 of file ShepardInterpolation.h.

◆ Initialize() [2/2]

template<typename T>
void pcl::ShepardInterpolation< T >::Initialize ( const search_rect rect,
const T *  x,
const T *  y,
const T *  z,
int  n 
)
inline

Generation of a two-dimensional surface approximation with a prescribed rectangular interpolation region.

Parameters
rectThe rectangular region for interpolation.
xX node coordinates.
yY node coordinates.
zNode values.
nNumber of nodes. There must be at least three distinct input nodes within the specified interpolation region.

The input nodes can be arbitrarily distributed and don't need to follow any specific order. However, all node points should be distinct with respect to the machine epsilon for the floating point type T.

This initialization function includes a sanitization routine. If there are duplicate points in the specified set of input nodes, only the first occurrence of each duplicate will be kept to build the interpolation surface, and the rest of duplicate points will be ignored. Two points are considered equal if their coordinates don't differ more than the machine epsilon for the floating point type T.

This function will only take into account input nodes located within the specified region rect; all points outside this region will be ignored. A prescribed interpolation region is useful to ensure that the approximation surface can be evaluated on the entire region, for example to represent images or other data sets, not necessarily bounded by the extreme coordinates in the set of input nodes. Specifying a region also allows to use a reduced subset of the available data, to accelerate calculations.

Definition at line 372 of file ShepardInterpolation.h.

◆ IsValid()

template<typename T>
bool pcl::ShepardInterpolation< T >::IsValid ( ) const
inline

Returns true iff this object is valid. A valid ShepardInterpolation object has been initialized with a sufficient number of input nodes.

Definition at line 194 of file ShepardInterpolation.h.

◆ operator()() [1/2]

template<typename T>
T pcl::ShepardInterpolation< T >::operator() ( double  x,
double  y 
) const
inline

Two-dimensional surface interpolation/approximation with the local Shepard method. Returns an approximated function value at the specified x and y coordinates.

The interpolation function uses an adaptive point search routine. The current search radius is used as an initial parameter. If less than three input nodes are found within the search radius distance from the desired interpolation point, the radius is increased and a new search is performed. This is repeated until at least three nodes are found around the specified interpolation point.

In degenerate cases where no valid solution can be found, zero is returned conventionally. These cases are rare and may only happen if the input nodes are very close together with respect to the machine epsilon for the numeric type T.

Definition at line 394 of file ShepardInterpolation.h.

◆ operator()() [2/2]

template<typename T>
template<typename Tp >
T pcl::ShepardInterpolation< T >::operator() ( const GenericPoint< Tp > &  p) const
inline

Returns an interpolated/approximated function value at the specified p.x and p.y point coordinates. See operator()( double, double ) for more information.

Definition at line 469 of file ShepardInterpolation.h.

◆ operator=() [1/2]

template<typename T>
ShepardInterpolation& pcl::ShepardInterpolation< T >::operator= ( const ShepardInterpolation< T > &  )
delete

Copy assignment operator. Copy assignment is disabled because this class uses internal data structures that cannot be copy-assigned. However, ShepardInterpolation implements move assignment and move construction.

◆ operator=() [2/2]

template<typename T>
ShepardInterpolation& pcl::ShepardInterpolation< T >::operator= ( ShepardInterpolation< T > &&  )
default

Move assignment operator. Returns a reference to this object.

◆ Power()

template<typename T>
int pcl::ShepardInterpolation< T >::Power ( ) const
inline

Returns the current power parameter of this local Shepard interpolation.

See SetPower() for more information.

Definition at line 231 of file ShepardInterpolation.h.

◆ Radius()

template<typename T>
double pcl::ShepardInterpolation< T >::Radius ( ) const
inline

Returns the current normalized search radius of this local Shepard interpolation. See SetRadius() for more information.

Definition at line 272 of file ShepardInterpolation.h.

◆ SetPower()

template<typename T>
void pcl::ShepardInterpolation< T >::SetPower ( int  m)
inline

Sets the power parameter of the local Shepard interpolation.

Parameters
mPower parameter. Must be > 0.

The power parameter is a positive real > 0 that defines the behavior of the interpolation/approximation function. For large values of m, the interpolating surface tends to be uniform within boundaries defined around input nodes, and hence is more local. For values of m ≤ 2, the surface is more global, that is, interpolated values are more influenced by nodes far away from the interpolation coordinates. The default power parameter value is 4.

If an invalid value m ≤ 0 is specified, the default m = 4 power parameter value will be set.

Calling this member function does not reset this ShepardInterpolation object, since no internal structures built upon initialization depend on the power parameter. This facilitates the use of this class to compare the results of different power parameter values applied to the same data.

Definition at line 220 of file ShepardInterpolation.h.

◆ SetRadius()

template<typename T>
void pcl::ShepardInterpolation< T >::SetRadius ( double  R)
inline

Sets the normalized search radius of the local Shepard interpolation.

Parameters
RSearch radius in the range (0,1].

The search radius defines a distance from the interpolation point where existing input nodes will be used to compute an interpolated function value. Larger values of R will construct more global interpolation surfaces, while smaller values will tend to yield more local interpolations. Smaller search radii will also lead to faster interpolation devices, since the computational complexity is reduced as the number of input nodes used for each interpolation point decreases.

The search radius parameter is normalized to the (0,1] range in this implementation, where 1 represents the largest distance between two distinct input nodes, or equivalently, the size of the interpolation region. The default search radius is 0.1.

If an invalid value R ≤ 0 is specified, the default R = 0.1 search radius parameter value will be set.

Calling this member function does not reset this ShepardInterpolation object, since no internal structures built upon initialization depend on the search radius. This facilitates the use of this class to compare the results of different search radius values applied to the same data.

Definition at line 262 of file ShepardInterpolation.h.

◆ SetSmoothing()

template<typename T>
void pcl::ShepardInterpolation< T >::SetSmoothing ( float  r)
inline

Sets the smoothing factor of the local Shepard interpolation.

Parameters
rSmoothing factor in the range [0,1).

For r > 0, a regularized local interpolation will be applied. The r argument represents a fraction of the count of nearby function samples that will be Winsorized, that is, replaced with their r-th nearest value at the top and the tail of the interpolation sample.

For r = 0, a normal (unsmoothed) local Shepard interpolation scheme is used. This is the default state for newly created instances of ShepardInterpolation.

If an invalid value r < 0 or r ≥ 1 is specified, the default r = 0 smoothing factor will be set.

Definition at line 294 of file ShepardInterpolation.h.

◆ Smoothing()

template<typename T>
float pcl::ShepardInterpolation< T >::Smoothing ( ) const
inline

Returns the smoothing factor of this local Shepard interpolation. See SetSmoothing() for more information.

Definition at line 304 of file ShepardInterpolation.h.

Member Data Documentation

◆ BucketCapacity

template<typename T>
constexpr int pcl::ShepardInterpolation< T >::BucketCapacity = 16
static

The maximum number of interpolation points in a leaf quadtree node.

Definition at line 152 of file ShepardInterpolation.h.


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