PCL
|
Two-dimensional surface interpolation with the local Shepard method. More...
#include <ShepardInterpolation.h>
Public Types | |
using | scalar = typename vector_type::scalar |
using | search_rect = typename search_tree::rectangle |
using | search_tree = QuadTree< vector_type > |
using | vector_type = GenericVector< T > |
Public Member Functions | |
ShepardInterpolation ()=default | |
ShepardInterpolation (const ShepardInterpolation &)=delete | |
ShepardInterpolation (ShepardInterpolation &&)=default | |
virtual | ~ShepardInterpolation () |
void | Clear () |
void | Initialize (const search_rect &rect, const T *x, const T *y, const T *z, int n) |
void | Initialize (const T *x, const T *y, const T *z, int n) |
bool | IsValid () const |
template<typename Tp > | |
T | operator() (const GenericPoint< Tp > &p) const |
T | operator() (double x, double y) const |
ShepardInterpolation & | operator= (const ShepardInterpolation &)=delete |
ShepardInterpolation & | operator= (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 | |
constexpr static int | BucketCapacity = 16 |
Protected Member Functions | |
void | DoInitialize (const search_rect *rect, const T *x, const T *y, const T *z, int n) |
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.
Definition at line 125 of file ShepardInterpolation.h.
using pcl::ShepardInterpolation< T >::scalar = typename vector_type::scalar |
The numeric type used to represent coordinates and function values.
Definition at line 137 of file ShepardInterpolation.h.
using pcl::ShepardInterpolation< T >::search_rect = typename search_tree::rectangle |
The class used to specify interpolation regions.
Definition at line 147 of file ShepardInterpolation.h.
using pcl::ShepardInterpolation< T >::search_tree = QuadTree<vector_type> |
The class used to implement fast coordinate search operations.
Definition at line 142 of file ShepardInterpolation.h.
using pcl::ShepardInterpolation< T >::vector_type = GenericVector<T> |
Represents a vector of coordinates or function values.
Definition at line 132 of file ShepardInterpolation.h.
|
default |
Default constructor. Constructs an empty ShepardInterpolation object.
|
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.
|
default |
Move constructor.
|
inlinevirtual |
Virtual destructor.
Definition at line 174 of file ShepardInterpolation.h.
|
inline |
Resets this ShepardInterpolation object, deallocating all internal working structures.
Definition at line 478 of file ShepardInterpolation.h.
|
inlineprotected |
Performs input data normalization and sanitization. Builds the point search quadtree with normalized node coordinates.
Definition at line 498 of file ShepardInterpolation.h.
|
inline |
Generation of a two-dimensional surface approximation with a prescribed rectangular interpolation region.
rect | The rectangular region for interpolation. |
x | X node coordinates. |
y | Y node coordinates. |
z | Node values. |
n | Number 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.
|
inline |
Generation of a two-dimensional surface approximation.
x | X node coordinates. |
y | Y node coordinates. |
z | Node values. |
n | Number 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.
|
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.
|
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.
|
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.
|
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.
|
default |
Move assignment operator. Returns a reference to this object.
|
inline |
Returns the current power parameter of this local Shepard interpolation.
See SetPower() for more information.
Definition at line 231 of file ShepardInterpolation.h.
|
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.
|
inline |
Sets the power parameter of the local Shepard interpolation.
m | Power 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.
|
inline |
Sets the normalized search radius of the local Shepard interpolation.
R | Search 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.
|
inline |
Sets the smoothing factor of the local Shepard interpolation.
r | Smoothing 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.
|
inline |
Returns the smoothing factor of this local Shepard interpolation. See SetSmoothing() for more information.
Definition at line 304 of file ShepardInterpolation.h.
|
staticconstexpr |
The maximum number of interpolation points in a leaf quadtree node.
Definition at line 152 of file ShepardInterpolation.h.