PCL
pcl::GridInterpolation Class Reference

Discretized scalar surface interpolation/approximation in two dimensions. More...

#include <GridInterpolation.h>

+ Inheritance diagram for pcl::GridInterpolation:

Public Member Functions

 GridInterpolation ()=default
 
 GridInterpolation (const GridInterpolation &)=default
 
 GridInterpolation (GridInterpolation &&)=default
 
void Clear ()
 
double Delta () const
 
template<class R >
void Initialize (const R &rect, double delta, const DMatrix &G)
 
template<class R , class SI >
void Initialize (const R &rect, int delta, const SI &S, bool verbose=true)
 
const DMatrixInterpolationMatrix () const
 
bool IsValid () const
 
template<typename T >
double operator() (const GenericPoint< T > &p) const
 
template<typename T >
double operator() (T x, T y) const
 
GridInterpolationoperator= (const GridInterpolation &)=default
 
GridInterpolationoperator= (GridInterpolation &&)=default
 
const DRectReferenceRect () const
 
- Public Member Functions inherited from pcl::ParallelProcess
 ParallelProcess ()=default
 
 ParallelProcess (const ParallelProcess &)=default
 
virtual ~ParallelProcess ()
 
void DisableParallelProcessing (bool disable=true) noexcept
 
void EnableParallelProcessing (bool enable=true, int maxProcessors=0) noexcept
 
bool IsParallelProcessingEnabled () const noexcept
 
int MaxProcessors () const noexcept
 
ParallelProcessoperator= (const ParallelProcess &)=default
 
void SetMaxProcessors (int maxProcessors) noexcept
 
void Swap (ParallelProcess &process) noexcept
 

Detailed Description

This class performs the same tasks as a surface interpolation device, such as SurfaceSpline or ShepardInterpolation, but allows for much faster interpolation with negligible accuracy loss in most applications.

Interpolation from discrete grids can be orders of magnitude faster than direct evaluation of surface interpolation/approximation devices, depending on the number of input data points.

Definition at line 97 of file GridInterpolation.h.

Constructor & Destructor Documentation

◆ GridInterpolation() [1/3]

pcl::GridInterpolation::GridInterpolation ( )
default

Default constructor. Yields an empty instance that cannot be used without initialization.

◆ GridInterpolation() [2/3]

pcl::GridInterpolation::GridInterpolation ( const GridInterpolation )
default

Copy constructor.

◆ GridInterpolation() [3/3]

pcl::GridInterpolation::GridInterpolation ( GridInterpolation &&  )
default

Move constructor.

Member Function Documentation

◆ Clear()

void pcl::GridInterpolation::Clear ( )
inline

Deallocates internal structures, yielding an empty object that cannot be used before a new call to Initialize().

Definition at line 299 of file GridInterpolation.h.

◆ Delta()

double pcl::GridInterpolation::Delta ( ) const
inline

Returns the current grid distance for calculation of discrete function values. See Initialize() for more information.

Definition at line 318 of file GridInterpolation.h.

◆ Initialize() [1/2]

template<class R >
void pcl::GridInterpolation::Initialize ( const R &  rect,
double  delta,
const DMatrix G 
)
inline

Initializes this GridInterpolation object with a prescribed discrete interpolation matrix.

Parameters
rectReference rectangle. Interpolation will be initialized within the boundaries of this rectangle at discrete delta coordinate intervals.
deltaGrid distance for calculation of discrete function values. Must be > 0.
Ginterpolation matrix.

The specified G matrix must have n rows and m columns, which are given by:

n = 1 + Ceil( rect.Height()/delta )
m = 1 + Ceil( rect.Width()/delta )

If the dimensions of the specified matrix are different from the values defined above, this function will throw an Error exception.

Matrix elements must be function values computed at discrete delta intervals within rect boundaries. For a given matrix row r and matrix column c, the corresponding matrix element must be a function value computed at coordinates {x,y} given by:

x = rect.x0 + c*delta
y = rect.y0 + r*delta

Definition at line 262 of file GridInterpolation.h.

◆ Initialize() [2/2]

template<class R , class SI >
void pcl::GridInterpolation::Initialize ( const R &  rect,
int  delta,
const SI &  S,
bool  verbose = true 
)
inline

Initializes this GridInterpolation object for the specified input data and interpolation parameters.

Parameters
rectReference rectangle. Interpolation will be initialized within the boundaries of this rectangle at discrete delta coordinate intervals.
deltaGrid distance for calculation of discrete function values. Must be > 0.
SReference to a surface interpolation/approximation object that will be used to evaluate function values at discrete coordinate intervals. This object must have been previously initialized and must be valid.
verboseIf true, this function will write information to the standard PixInsight console to provide some feedback to the user during the (potentially long) initialization process. If false, no feedback will be provided.

The template parameter SI must implement the following member functions:

  1. Function evaluation operator:

double SI::operator ()( double x, double y ) const

or an equivalent operator member function whose return value can be statically casted to double, with two by-value parameters that can be statically casted from the double type. This function will be called multiple times for the S object to evaluate the approximated surface at discrete grid coordinate pairs {x,y}, respectively on the X and Y plane directions. The implementation of this member function must be thread-safe if parallel processing has been enabled and is allowed for this object.

  1. Vector evaluation function:

void SI::Evaluate( double* Z,
const double* X, const double* Y, size_type n ) const

This function will be called multiple times for the S object for fast multithreaded surface evaluation at a set of points in 2-D space specified as the X and Y contiguous sequences of n coordinates. The function must store the corresponding function values in the Z array. The implementation of this member function must be thread-safe if parallel processing has been enabled and is allowed for this object.

  1. Information function:

bool SI::HasFastVectorEvaluation() const

This member function must return true if the S object provides fast surface evaluation for vectors of points with the Evaluate() function. If this function returns false for S, the operator ()() described above will be called exclusively from grid generation threads.

If parallel processing is allowed, this function executes the initialization process using multiple concurrent threads. See EnableParallelProcessing() for additional information.

Definition at line 189 of file GridInterpolation.h.

◆ InterpolationMatrix()

const DMatrix& pcl::GridInterpolation::InterpolationMatrix ( ) const
inline

Returns a reference to the discrete matrix used for interpolation of function values.

If this object has not been initialized, this member function returns a reference to an empty matrix.

Definition at line 330 of file GridInterpolation.h.

◆ IsValid()

bool pcl::GridInterpolation::IsValid ( ) const
inline

Returns true iff this is a valid, initialized object ready for interpolation.

Definition at line 290 of file GridInterpolation.h.

◆ operator()() [1/2]

template<typename T >
double pcl::GridInterpolation::operator() ( const GenericPoint< T > &  p) const
inline

Returns an interpolated function value at p.x and p.y coordinates.

Definition at line 350 of file GridInterpolation.h.

References pcl::GenericPoint< T >::x, and pcl::GenericPoint< T >::y.

◆ operator()() [2/2]

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

Returns an interpolated function value at the specified coordinates.

Definition at line 339 of file GridInterpolation.h.

◆ operator=() [1/2]

GridInterpolation& pcl::GridInterpolation::operator= ( const GridInterpolation )
default

Copy assignment operator. Returns a reference to this object.

◆ operator=() [2/2]

GridInterpolation& pcl::GridInterpolation::operator= ( GridInterpolation &&  )
default

Move assignment operator. Returns a reference to this object.

◆ ReferenceRect()

const DRect& pcl::GridInterpolation::ReferenceRect ( ) const
inline

Returns the current interpolation reference rectangle. See Initialize() for more information.

Definition at line 309 of file GridInterpolation.h.


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