![]() |
GemaCoreLib
The GeMA Core library
|
Implements the Nearest Neighbor interpolation method. More...
#include <gmNnInterpolatorObject.h>
Public Member Functions | |
virtual GmInterpolatorType | type () const |
Returns the interpolator object type. | |
virtual bool | typeParamIsValid (const QVariant &v) const |
Accepts as valid parameter an integer number > 0 or an empty parameter. | |
virtual QString | typeParamToStr (const QVariant &v) const |
Converts an interpolator type parameter to a string. | |
virtual bool | supportsInterpolatorKind (GmInterpolatorKind kind) const |
Returns whether this interpolator object supports the given interpolator kind or not. | |
virtual bool | distanceBasedWeights (GmInterpolatorCoordinateSetBinding *pointSet, const GmVector &coord, const GmVector &squaredDistances, const QVariant &typeParam, GmVector &weights) const |
Implements the GmInterpolatorObject::distanceBasedWeights() virtual function to calculate interpolation weights by the k-NN method. More... | |
![]() | |
virtual bool | requiresElement () const |
Does this interpolator object requires that the coordinate set provided to interpolationWeights() contains points from a single element, whose identity can be queried by a call to GmCoordinateSet::cell()? Default = false. | |
virtual bool | requiresMesh () const |
Does this interpolator object requires that the coordinate set provided to interpolationWeights() contains information about the underlying mesh, whose identity can be queried by a call to GmCoordinateSet::mesh()? Default = false. | |
virtual bool | requiresNaturalCoordinates () const |
Does this interpolator object requires that the coordinate passed as parameter to interpolationWeights() be expressed in natural coordinates? By default this is false and the provided coordinate should be cartesian coordinates. | |
virtual bool | interpolationWeights (GmInterpolatorCoordinateSetBinding *pointSet, const GmVector &coord, const QVariant &typeParam, GmVector &weights) const |
Basic function for calculating the interpolation weights that should be associated with each point (coordinate) in the given point set. More... | |
virtual const GmMatrix & | gaussToNodesExtrapolationMatrix (GmInterpolatorGaussCoordinateSetBinding *pointSet, const QVariant &typeParam, GmMatrix &weights) const |
Basic function for returning the extrapolation matrix used by the GM_GAUSS_TO_NODE_INTERPOLATOR interpolator kind. More... | |
Additional Inherited Members | |
![]() | |
GmInterpolatorObject () | |
Protected default constructor to make sure that Interpolator objects are created only by the GmInterpolator friend class. | |
Implements the Nearest Neighbor interpolation method.
For the interpolation, this class finds the Kth points closest to the interpolation point and takes the average of their values. The value of K is given by the interpolator parameter. If missing, a value of 1 will be used reducing it to a nearest neighbor interpolation
Following the GmInterpolatorObject interface, this class is responsible for calculating the weights wi associated to each of the known points used in the iterpolation. The K nearest points will have a weight equal to 1/K while the others will have a weight equal to 0.
|
virtual |
Implements the GmInterpolatorObject::distanceBasedWeights() virtual function to calculate interpolation weights by the k-NN method.
The typeParam parameter should be an integer value with the value of k for the k-NN formulation (see class description). If absent or zero, the default 1 will be used. See the documentation for GmInterpolatorObject::distanceBasedWeights() and GmInterpolatorObject::interpolationWeights() for aditional information on the function parameters.
Reimplemented from GmInterpolatorObject.