PCL
pcl::SurfaceSpline< T > Class Template Reference

Two-dimensional interpolating/approximating surface spline (thin plate). More...

#include <SurfaceSpline.h>

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

Classes

struct  NodeData
 Auxiliary structure for data sanitization. More...
 

Public Types

typedef T scalar
 
typedef GenericVector< scalarvector
 
typedef float weight
 

Public Member Functions

 SurfaceSpline ()=default
 
 SurfaceSpline (const SurfaceSpline &)=default
 
 SurfaceSpline (SurfaceSpline &&)=default
 
virtual ~SurfaceSpline ()
 
void Clear ()
 
void Initialize (const scalar *x, const scalar *y, const scalar *z, int n, const weight *w=nullptr)
 
bool IsValid () const
 
int Length () const
 
scalar operator() (double x, double y) const
 
template<typename Tp >
scalar operator() (const GenericPoint< Tp > &p) const
 
SurfaceSplineoperator= (const SurfaceSpline &)=default
 
SurfaceSplineoperator= (SurfaceSpline &&)=default
 
int Order () const
 
void SetOrder (int order)
 
void SetSmoothing (float s)
 
float Smoothing () const
 
vector X () const
 
vector Y () const
 

Detailed Description

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

SurfaceSpline implements interpolating or smoothing surface splines, also known as thin plate splines, for arbitrarily distributed input nodes in two dimensions.

A thin plate spline describes the minimal-energy bending of a thin sheet of metal passing through a set of interpolation points in three-dimensional space. This physical analogy gives thin plate splines accuracy and adaptability properties that we have been applying successfully to many data modeling tasks, including very especially image registration and astrometric applications.

The most distinctive property of surface splines is their high adaptability to local variations, which makes them ideal to model complex two dimensional functions with high accuracy. An important advantage of our implementation is the possibility to control adaptability with approximating (or smoothing) surface splines, as opposed to interpolating splines, and the possibility to control adaptability both as a global property of the modeling device, or on a point-by-point basis. The main drawback of surface splines is that they are computationally expensive, especially for large data sets. See the GridInterpolation and PointGridInterpolation classes for highly efficient discretized implementations. See also the RecursivePointSurfaceSpline class for an efficient implementation based on recursive subsplines.

See also
PointSurfaceSpline, RecursivePointSurfaceSpline, GridInterpolation, PointGridInterpolation, ShepardInterpolation, SurfacePolynomial

Definition at line 188 of file SurfaceSpline.h.

Member Typedef Documentation

◆ scalar

template<typename T>
typedef T pcl::SurfaceSpline< T >::scalar

The numeric type used to represent coordinates, function values and spline coefficients.

Definition at line 196 of file SurfaceSpline.h.

◆ vector

template<typename T>
typedef GenericVector<scalar> pcl::SurfaceSpline< T >::vector

Represents a vector of coordinates, function values or spline coefficients.

Definition at line 202 of file SurfaceSpline.h.

◆ weight

template<typename T>
typedef float pcl::SurfaceSpline< T >::weight

The numeric type used to represent the interpolation strength of a surface interpolation node.

Definition at line 208 of file SurfaceSpline.h.

Constructor & Destructor Documentation

◆ SurfaceSpline() [1/3]

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

Default constructor. Constructs an empty, two-dimensional interpolating surface spline of second order.

◆ SurfaceSpline() [2/3]

template<typename T>
pcl::SurfaceSpline< T >::SurfaceSpline ( const SurfaceSpline< T > &  )
default

Copy constructor.

◆ SurfaceSpline() [3/3]

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

Move constructor.

◆ ~SurfaceSpline()

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

Virtual destructor.

Definition at line 234 of file SurfaceSpline.h.

Member Function Documentation

◆ Clear()

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

Resets this surface spline interpolation, deallocating all internal working structures.

Definition at line 510 of file SurfaceSpline.h.

◆ Initialize()

template<typename T>
void pcl::SurfaceSpline< T >::Initialize ( const scalar x,
const scalar y,
const scalar z,
int  n,
const weight w = nullptr 
)
inline

Generation of a two-dimensional surface spline (thin plate).

Parameters
xX node coordinates.
yY node coordinates.
zNode function values.
nNumber of nodes. Must be ≥ 3 (3 nodes * 2 coordinates = six degrees of freedom).
wWhen the smoothing factor of this spline is > 0, this is a vector of positive weights > 0 corresponding to the specified input nodes. If this parameter is nullptr, unit weights are assumed for all input nodes. When the smoothing factor is zero (interpolating spline), this parameter is ignored.

The input nodes can be arbitrarily distributed, and they don't need to follow any specific order. However, all nodes 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 surface spline, 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.

For an interpolating surface spline (smoothness = 0), all node values will be reproduced exactly at their respective coordinates. In this case the vector w of node weights will be ignored.

For an approximating surface spline (smoothness > 0), if a vector w of node weights is specified, it will be used to assign a different interpolation strength to each interpolation node. In this case the vector w must have at least n values greater than zero. A node weight larger than one will reduce the smoothness of the interpolating surface at the corresponding node coordinates, or in other words, it will give more prominence to the corresponding data point. A node weight of one will apply the current surface smoothness at its node position. A node weight smaller than one will increase the interpolation smoothness.

Definition at line 394 of file SurfaceSpline.h.

◆ IsValid()

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

Returns true iff this surface spline is valid. A valid surface spline has been initialized with three or more nodes.

Definition at line 252 of file SurfaceSpline.h.

◆ Length()

template<typename T>
int pcl::SurfaceSpline< T >::Length ( ) const
inline

Returns the number of nodes used by this surface spline interpolation.

Definition at line 260 of file SurfaceSpline.h.

◆ operator()() [1/2]

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

Two-dimensional surface spline interpolation/approximation. Returns an approximated or interpolated function value at the specified x and y coordinates.

Before calling this function, a valid surface spline must be generated by calling Initialize(). If called fon an uninitialized object, this member function invokes undefined behavior.

Definition at line 527 of file SurfaceSpline.h.

◆ operator()() [2/2]

template<typename T>
template<typename Tp >
scalar pcl::SurfaceSpline< 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 586 of file SurfaceSpline.h.

◆ operator=() [1/2]

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

Copy assignment operator. Returns a reference to this object.

◆ operator=() [2/2]

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

Move assignment operator. Returns a reference to this object.

◆ Order()

template<typename T>
int pcl::SurfaceSpline< T >::Order ( ) const
inline

Returns the derivability order of this surface spline.

Definition at line 296 of file SurfaceSpline.h.

◆ SetOrder()

template<typename T>
void pcl::SurfaceSpline< T >::SetOrder ( int  order)
inline

Sets the derivability order of this surface spline.

Parameters
orderDerivability order. Must be >= 2.

Calling this member function implicitly resets this SurfaceSpline object and destroys all internal working structures.

The surface spline will be continuously differentiable up to the specified order m. If this order is too high, an ill-conditioned linear system may result.

The default order is 2. Recommended values are 2 and 3.

Definition at line 315 of file SurfaceSpline.h.

◆ SetSmoothing()

template<typename T>
void pcl::SurfaceSpline< T >::SetSmoothing ( float  s)
inline

Sets the smoothing factor of this surface spline.

Parameters
sSmoothing factor. Must be >= 0.

For s = 0, an interpolating spline will be generated: all node values will be reproduced exactly at their respective coordinates.

For s > 0, a smoothing (or approximating) spline will be generated: increasing s values will generate splines closer to the reference plane of the input node set.

Definition at line 343 of file SurfaceSpline.h.

◆ Smoothing()

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

Returns the smoothing factor of this surface spline. See SetSmoothing() for more information.

Definition at line 326 of file SurfaceSpline.h.

◆ X()

template<typename T>
vector pcl::SurfaceSpline< T >::X ( ) const
inline

Returns a vector with the X node coordinates used to initialize this surface spline. If this object has not been initialized, this function returns an empty vector.

Definition at line 270 of file SurfaceSpline.h.

◆ Y()

template<typename T>
vector pcl::SurfaceSpline< T >::Y ( ) const
inline

Returns a vector with the Y node coordinates used to initialize this surface spline. If this object has not been initialized, this function returns an empty vector.

Definition at line 284 of file SurfaceSpline.h.


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