|
Ocean
|
This class implements an advanced 2D lookup object with values at the bins' center positions defining the individual lookup values. More...
#include <Lookup2.h>
Public Member Functions | |
| AdvancedLookupCenter2 ()=default | |
| Creates a new empty lookup object. | |
| AdvancedLookupCenter2 (const AdvancedLookupCenter2< T, TScalar > &lookup) | |
| Copy constructor. | |
| AdvancedLookupCenter2 (AdvancedLookupCenter2< T, TScalar > &&lookup) noexcept | |
| Move constructor. | |
| AdvancedLookupCenter2 (const size_t sizeX, const size_t sizeY, const size_t binsX, const size_t binsY) | |
| Creates a new lookup object by definition of the dimensions and bin numbers. | |
| AdvancedLookupCenter2 (const size_t sizeX, const size_t sizeY, const size_t binsX, const size_t binsY, const bool binsValid) | |
| Creates a new lookup object by definition of the dimensions and bin numbers. | |
| AdvancedLookupCenter2 (const size_t sizeX, const size_t sizeY, const size_t binsX, const size_t binsY, const T *binValues, const unsigned char *validBins) | |
| Creates a new lookup object by definition of the dimensions and bin numbers. | |
| AdvancedLookupCenter2 (const size_t sizeX, const size_t sizeY, const AdvancedLookupCenter2< T, TScalar > &lookup) | |
| Creates a new lookup object by definition of the dimensions and a given lookup object. | |
| bool | binCenterValid (const size_t binX, const size_t binY) const |
| Returns whether a specific bin of this lookup object is valid. | |
| bool | nearestValue (const TScalar x, const TScalar y, T &value) const |
| Applies a lookup for a specific position in this lookup object. | |
| bool | bilinearValue (const TScalar x, const TScalar y, T &value) const |
| Applies a lookup for a specific position in this lookup object. | |
| bool | bilinearValue (const TScalar x, const TScalar y, const unsigned int minimalValidBins, T &value) const |
| Applies a lookup for a specific position in this lookup object. | |
| bool | clampedNearestValue (const TScalar x, const TScalar y, T &value) const |
| Applies a lookup for a specific position in this lookup object while the position is clamped to match into the domain of the lookup table. | |
| bool | clampedBilinearValue (const TScalar x, const TScalar y, T &value) const |
| Applies a lookup for a specific position in this lookup object while the position is clamped to match into the domain of the lookup table. | |
| void | setBinCenterValue (const size_t binX, const size_t binY, const T &value, const bool isValid) |
| Sets the value of one specific lookup bin's center and defines whether this bin is valid. | |
| void | setBinCenterValid (const size_t binX, const size_t binY, const bool isValid) |
| Sets whether a specific lookup bin is valid. | |
| AdvancedLookupCenter2< T, TScalar > & | operator= (AdvancedLookupCenter2< T, TScalar > &&lookup) noexcept |
| Move operator. | |
| bool | operator== (const AdvancedLookupCenter2< T, TScalar > &lookup) const |
| Returns whether two lookup objects are identical. | |
| bool | operator!= (const AdvancedLookupCenter2< T, TScalar > &lookup) const |
| Returns whether two lookup objects are not identical. | |
| Public Member Functions inherited from Ocean::LookupCenter2< T, Scalar > | |
| LookupCenter2 ()=default | |
| Creates a new empty lookup object. | |
| bool | isInside (const Scalar x, const Scalar y) const |
| Returns whether a given position lies inside this lookup object and therefore whether this position can be applied for the interpolation functions. | |
| size_t | binX (const Scalar x) const |
| Returns the horizontal bin that corresponds to a precise horizontal lookup position. | |
| size_t | binY (const Scalar y) const |
| Returns the vertical bin that corresponds to a precise vertical lookup position. | |
| size_t | binTopLeftX (const size_t binX) const |
| Returns the horizontal top left position of a specified bin with pixel accuracy. | |
| size_t | binTopLeftY (const size_t binY) const |
| Returns the vertical top left position of a specified bin with pixel accuracy. | |
| size_t | binBottomRightX (const size_t binX) const |
| Returns the horizontal bottom right position (including) of a specified bin with pixel accuracy. | |
| size_t | binBottomRightY (const size_t binY) const |
| Returns the vertical bottom right position of a specified bin with pixel accuracy. | |
| Scalar | binCenterPositionX (const size_t binX) const |
| Returns the horizontal center position of a specific bin in relation to the dimension of this lookup object. | |
| Scalar | binCenterPositionY (const size_t binY) const |
| Returns the vertical center position of a specific bin in relation to the dimension of this lookup object. | |
| Vector2 | binCenterPosition (const size_t binX, const size_t binY) const |
| Returns the center position of a specific bin in relation to the dimension of this lookup object. | |
| const T & | binCenterValue (const size_t binX, const size_t binY) const |
| Returns the lookup value of a specific bin's center of this lookup object. | |
| T | nearestValue (const Scalar x, const Scalar y) const |
| Applies a lookup for a specific position in this lookup object. | |
| T | bilinearValue (const Scalar x, const Scalar y) const |
| Applies a lookup for a specific position in this lookup object. | |
| T | bicubicValue (const Scalar x, const Scalar y) const |
| Applies a lookup for a specific position in this lookup object. | |
| T | clampedNearestValue (const Scalar x, const Scalar y) const |
| Applies a lookup for a specific position in this lookup object while the position is clamped to match into the domain of the lookup table. | |
| T | clampedBilinearValue (const Scalar x, const Scalar y) const |
| Applies a lookup for a specific position in this lookup object while the position is clamped to match into the domain of the lookup table. | |
| T | clampedBicubicValue (const Scalar x, const Scalar y) const |
| Applies a lookup for a specific position in this lookup object while the position is clamped to match into the domain of the lookup table. | |
| void | setBinCenterValue (const size_t binX, const size_t binY, const T &value) |
| Sets the value of one specific lookup bin's center. | |
| LookupCenter2< T, Scalar > & | operator= (LookupCenter2< T, Scalar > &&lookup) noexcept |
| Move operator. | |
| Public Member Functions inherited from Ocean::Lookup2< T, Scalar > | |
| const T * | data () const |
| Returns a pointer to the constant bin data (row aligned). | |
| size_t | sizeX () const |
| Returns the horizontal dimension of this lookup object. | |
| size_t | sizeY () const |
| Returns the vertical dimension of this lookup object. | |
| size_t | binsX () const |
| Returns the number of horizontal bins of this lookup object. | |
| size_t | binsY () const |
| Returns the number of vertical bins of this lookup object. | |
| bool | isEmpty () const |
| Returns whether this lookup object does not hold any lookup bin. | |
| operator bool () const | |
| Returns whether this lookup object holds at least one lookup bin. | |
| bool | operator== (const Lookup2< T, Scalar > &lookup) const |
| Returns whether two lookup objects are identical. | |
| bool | operator!= (const Lookup2< T, Scalar > &lookup) const |
| Returns whether two lookup objects are not identical. | |
Protected Types | |
| using | ValidBins = std::vector<unsigned char> |
| Definition of a vector holding 1 byte values. | |
| Protected Types inherited from Ocean::Lookup2< T, Scalar > | |
| using | Values |
| Definition of a vector holding lookup values. | |
Protected Attributes | |
| ValidBins | validBins_ |
| The vector individually storing whether a bin is valid or not. | |
| Protected Attributes inherited from Ocean::Lookup2< T, Scalar > | |
| size_t | sizeX_ |
| Horizontal dimension of this lookup object. | |
| size_t | sizeY_ |
| Vertical dimension of this lookup object. | |
| size_t | binsX_ |
| Number of horizontal bins. | |
| size_t | binsY_ |
| Number of vertical bins. | |
| Scalar | invSizeX_ |
| Inverse horizontal dimension of this lookup object. | |
| Scalar | invSizeY_ |
| Inverse vertical dimension of this lookup object. | |
| Scalar | invBinsX_ |
| Inverse number of horizontal bins. | |
| Scalar | invBinsY_ |
| Inverse number of vertical bins. | |
| Values | values_ |
| The values of the lookup bins. | |
Additional Inherited Members | |
| Public Types inherited from Ocean::Lookup2< T, Scalar > | |
| using | Type |
| Definition of the lookup data type. | |
| Protected Member Functions inherited from Ocean::Lookup2< T, Scalar > | |
| Lookup2 ()=default | |
| Creates a new empty lookup object. | |
| Lookup2< T, Scalar > & | operator= (const Lookup2< T, Scalar > &lookup) |
| Assign operator. | |
This class implements an advanced 2D lookup object with values at the bins' center positions defining the individual lookup values.
Further, this lookup object allows to define valid and invalid bins.
Invalid bins are not used for value interpolation.
The lookup table with e.g., 4x2 bins may have the following layout:
--- --- --- --- | x | ? | x | x | --- --- --- --- | ? | x | ? | x | --- --- --- ---
With 'x' showing valid center values and '?' showing invalid/undefined center values.
Thus, the lookup table has 4 horizontal bins and 4 horizontal lookup values.
All lookup values are located inside the specified size of the lookup object.
The vertical positions are accordingly.
| T | The data type of the stored lookup values |
| TScalar | The data type of the scalar values, either 'float' or 'double' |
|
protected |
Definition of a vector holding 1 byte values.
|
default |
Creates a new empty lookup object.
|
inline |
Copy constructor.
| lookup | The lookup object to be copied |
|
inlinenoexcept |
Move constructor.
| lookup | The lookup object to be moved |
| Ocean::AdvancedLookupCenter2< T, TScalar >::AdvancedLookupCenter2 | ( | const size_t | sizeX, |
| const size_t | sizeY, | ||
| const size_t | binsX, | ||
| const size_t | binsY ) |
Creates a new lookup object by definition of the dimensions and bin numbers.
All bins will be set as valid.
Beware: The bin values will be initialized with the default constructor of the template class.
| sizeX | Horizontal dimension of the lookup table, with range [1, infinity) |
| sizeY | Vertical dimension of the lookup table, with range [1, infinity) |
| binsX | Number of horizontal bins, with range [1, sizeX] |
| binsY | Number of vertical bins, with range [1, sizeY] |
| Ocean::AdvancedLookupCenter2< T, TScalar >::AdvancedLookupCenter2 | ( | const size_t | sizeX, |
| const size_t | sizeY, | ||
| const size_t | binsX, | ||
| const size_t | binsY, | ||
| const bool | binsValid ) |
Creates a new lookup object by definition of the dimensions and bin numbers.
| sizeX | Horizontal dimension of the lookup table, with range [1, infinity) |
| sizeY | Vertical dimension of the lookup table, with range [1, infinity) |
| binsX | Number of horizontal bins, with range [1, sizeX] |
| binsY | Number of vertical bins, with range [1, sizeY] |
| binsValid | True, if all bins are valid; False, if all bins are invalid |
| Ocean::AdvancedLookupCenter2< T, TScalar >::AdvancedLookupCenter2 | ( | const size_t | sizeX, |
| const size_t | sizeY, | ||
| const size_t | binsX, | ||
| const size_t | binsY, | ||
| const T * | binValues, | ||
| const unsigned char * | validBins ) |
Creates a new lookup object by definition of the dimensions and bin numbers.
| sizeX | Horizontal dimension of the lookup table, with range [1, infinity) |
| sizeY | Vertical dimension of the lookup table, with range [1, infinity) |
| binsX | Number of horizontal bins, with range [1, sizeX] |
| binsY | Number of vertical bins, with range [1, sizeY] |
| binValues | The bin values of the lookup object (row aligned), binsX * binsY values must be provided |
| validBins | The specification whether a bin is valid or not, a zero value specifies an invalid bin, a non-zero value specifies a valid bin |
| Ocean::AdvancedLookupCenter2< T, TScalar >::AdvancedLookupCenter2 | ( | const size_t | sizeX, |
| const size_t | sizeY, | ||
| const AdvancedLookupCenter2< T, TScalar > & | lookup ) |
Creates a new lookup object by definition of the dimensions and a given lookup object.
| sizeX | Horizontal dimension of the lookup table, with range [1, infinity) |
| sizeY | Vertical dimension of the lookup table, with range [1, infinity) |
| lookup | The lookup object specifying the lookup values and the number of lookup bins |
| bool Ocean::AdvancedLookupCenter2< T, TScalar >::bilinearValue | ( | const TScalar | x, |
| const TScalar | y, | ||
| const unsigned int | minimalValidBins, | ||
| T & | value ) const |
Applies a lookup for a specific position in this lookup object.
The resulting value is bilinear interpolated within the 4-neighborhood of valid lookup bins.
The interpolation result is based on valid bins only.
| x | Precise horizontal position for the resulting lookup value, with range [0, sizeX() - 1] |
| y | Precise vertical position for the resulting lookup value, with range [0, sizeY() - 1] |
| minimalValidBins | The number of minimal valid neighboring/corresponding bins the specified position must have so that interpolation is done, with range [1, 4] |
| value | The resulting interpolated value, if at least one corresponding bin is valid |
| bool Ocean::AdvancedLookupCenter2< T, TScalar >::bilinearValue | ( | const TScalar | x, |
| const TScalar | y, | ||
| T & | value ) const |
Applies a lookup for a specific position in this lookup object.
The resulting value is bilinear interpolated within the 4-neighborhood of valid lookup bins.
The interpolation result is based on valid bins only.
| x | Precise horizontal position for the resulting lookup value, with range [0, sizeX() - 1] |
| y | Precise vertical position for the resulting lookup value, with range [0, sizeY() - 1] |
| value | The resulting interpolated value, if at least one corresponding bin is valid |
|
inline |
| bool Ocean::AdvancedLookupCenter2< T, TScalar >::clampedBilinearValue | ( | const TScalar | x, |
| const TScalar | y, | ||
| T & | value ) const |
Applies a lookup for a specific position in this lookup object while the position is clamped to match into the domain of the lookup table.
The resulting value is bilinear interpolated within the 4-neighborhood of the lookup bins.
| x | Precise horizontal position for the resulting lookup value, with range -(infinity, infinity) |
| y | Precise vertical position for the resulting lookup value, with range -(infinity, infinity) |
| value | The resulting interpolated value, if at least one corresponding bin is valid |
| bool Ocean::AdvancedLookupCenter2< T, TScalar >::clampedNearestValue | ( | const TScalar | x, |
| const TScalar | y, | ||
| T & | value ) const |
Applies a lookup for a specific position in this lookup object while the position is clamped to match into the domain of the lookup table.
The resulting value is specified by the nearest bin (determined by the bin's corner positions).
| x | Precise horizontal position for the resulting lookup value, with range -(infinity, infinity) |
| y | Precise vertical position for the resulting lookup value, with range -(infinity, infinity) |
| value | The resulting value, if the corresponding bin is valid |
| bool Ocean::AdvancedLookupCenter2< T, TScalar >::nearestValue | ( | const TScalar | x, |
| const TScalar | y, | ||
| T & | value ) const |
Applies a lookup for a specific position in this lookup object.
The resulting value is specified by the nearest bin (determined by the bin's center position).
| x | Precise horizontal position for the resulting lookup value, with range [0, sizeX() - 1] |
| y | Precise vertical position for the resulting lookup value, with range [0, sizeY() - 1] |
| value | The resulting value, if the corresponding bin is valid |
|
inline |
Returns whether two lookup objects are not identical.
| lookup | Second lookup object |
|
noexcept |
Move operator.
| lookup | The lookup object that will be moved |
| bool Ocean::AdvancedLookupCenter2< T, TScalar >::operator== | ( | const AdvancedLookupCenter2< T, TScalar > & | lookup | ) | const |
Returns whether two lookup objects are identical.
| lookup | Second lookup object |
|
inline |
|
inline |
|
protected |
The vector individually storing whether a bin is valid or not.