User Manual, Developers Guide and API Documentation

wns::NLinear< T, N, M > Class Template Reference

N-linear interpolation (linear, bilinear, trilinear...). More...

#include <NLinear.hpp>

Inheritance diagram for wns::NLinear< T, N, M >:

Inheritance graph
[legend]
Collaboration diagram for wns::NLinear< T, N, M >:

Collaboration graph
[legend]

List of all members.

Public Types

typedef const HyperplaneTypeConstReference
 Constant reference to hyperplanes.
typedef std::list< CoordTypeCoordList
 List of coordinates.
typedef SuperType::CoordType CoordType
 Type of coordinates used in this class.
typedef
SuperType::DiscreteContainer 
DiscreteContainer
 Type of the container that contains the discrete (uninterpolated) values.
typedef const NLinear< T, N-1, M > HyperplaneType
 Type of the hyperplanes.
typedef SuperType::InitType InitType
 Type to be used in constructor.

Public Member Functions

 NLinear (const DiscreteContainer &discreteValues, const void *const universe=0, CoordList *const coords=0)
 Construct a NLinear interpolation object that interpolates over discreteValues.
virtual ConstReference operator[] (const CoordType &coord) const
 Specify a coordinate to be interpolated.
virtual ~NLinear ()
 Destructor.

Private Types

typedef Interpolation< T, N > SuperType
 We inherit from this class.

Private Attributes

CoordList *const coords
 List of the coordinates we need to interpolate with.
const bool deleteCoords
 Does our constructor need to destroy coords.
HyperplaneType hyperplane
 the hyperplanes.


Detailed Description

template<typename T, InterpolationDefs::SizeType N, InterpolationDefs::SizeType M = N>
class wns::NLinear< T, N, M >

Parameters:
T Type of the values to interpolate over.
N Number of dimensions.
This class implements a generic n-linear interpolation, so NLinear<T, 1> is a linear, NLinear<T, 2> is a bilinear and NLinear<T, 3> is a trilinear interpolation.

Linear interpolation can easily be extended to multiple dimensions, which will be demonstrated by explaining how bilinear interpolation works:

Bilinear interpolation interpolates over two dimensions. So you get two coordinates, e.g. x=3.4 and y=2.5. Then you have to interpolate between the points Q11=(3,2), Q12=(4,2), Q21=(3,3) and Q22=(4,3) somehow. You can do this by first doing a linear interpolation between Q11 and Q12 and then Q21 and Q22, which gives you the values for two new points. Then you can do a linear interpolation between these points and here you are.

So - generally - n-linear interpolation can be done by successive linear interpolation in all dimension.

See also http://en.wikipedia.org/wiki/Bilinear_interpolation for more details.

For internal use only.

Parameters:
M Original number of dimensions.

Definition at line 71 of file NLinear.hpp.


Member Typedef Documentation

template<typename T, InterpolationDefs::SizeType N, InterpolationDefs::SizeType M = N>
typedef const HyperplaneType& wns::NLinear< T, N, M >::ConstReference

Reimplemented from wns::container::MultiReadAccessible< T, N, R, I >.

Definition at line 101 of file NLinear.hpp.

template<typename T, InterpolationDefs::SizeType N, InterpolationDefs::SizeType M = N>
typedef std::list<CoordType> wns::NLinear< T, N, M >::CoordList

Definition at line 106 of file NLinear.hpp.

template<typename T, InterpolationDefs::SizeType N, InterpolationDefs::SizeType M = N>
typedef SuperType::CoordType wns::NLinear< T, N, M >::CoordType

Reimplemented from wns::Interpolation< T, N >.

Definition at line 81 of file NLinear.hpp.

template<typename T, InterpolationDefs::SizeType N, InterpolationDefs::SizeType M = N>
typedef SuperType::DiscreteContainer wns::NLinear< T, N, M >::DiscreteContainer

Reimplemented from wns::Interpolation< T, N >.

Definition at line 86 of file NLinear.hpp.

template<typename T, InterpolationDefs::SizeType N, InterpolationDefs::SizeType M = N>
typedef const NLinear<T, N-1, M> wns::NLinear< T, N, M >::HyperplaneType

Definition at line 96 of file NLinear.hpp.

template<typename T, InterpolationDefs::SizeType N, InterpolationDefs::SizeType M = N>
typedef SuperType::InitType wns::NLinear< T, N, M >::InitType

Reimplemented from wns::Interpolation< T, N >.

Definition at line 91 of file NLinear.hpp.

template<typename T, InterpolationDefs::SizeType N, InterpolationDefs::SizeType M = N>
typedef Interpolation<T, N> wns::NLinear< T, N, M >::SuperType [private]

Reimplemented from wns::Interpolation< T, N >.

Definition at line 76 of file NLinear.hpp.


Constructor & Destructor Documentation

template<typename T, InterpolationDefs::SizeType N, InterpolationDefs::SizeType M = N>
wns::NLinear< T, N, M >::NLinear ( const DiscreteContainer discreteValues,
const void *const   universe = 0,
CoordList *const   coords = 0 
) [inline]

Parameters:
discreteValues (in) Container that contains the values which we interpolate over.
You should call this constructor only with its default values!

For internal use only.

Parameters:
universe Pointer to the discrete container specified at template recursion level M.
coords Pointer to the shared CoordList that gets constructed by operator[].
This constructor serves two purposes, it is the external user interface constructor (when used with the default values) and the internal "recursive template" constructor.

discreteValues is used only in the top template recursion level (M) to set universe. If universe is set to non-zero its value is passed down up to the N == 1 template.

Definition at line 133 of file NLinear.hpp.

template<typename T, InterpolationDefs::SizeType N, InterpolationDefs::SizeType M = N>
virtual wns::NLinear< T, N, M >::~NLinear (  )  [inline, virtual]

Definition at line 148 of file NLinear.hpp.


Member Function Documentation

template<typename T, InterpolationDefs::SizeType N, InterpolationDefs::SizeType M = N>
virtual ConstReference wns::NLinear< T, N, M >::operator[] ( const CoordType coord  )  const [inline, virtual]

Interpolate with the coordinate specified by coord.

For internal use only.

We only want to create a CoordList. The real calculation and DiscreteContainer access happens at N == 1 with the help of the CoordList. This is also why we pass the original value of N (M) down to the N == 1 template, because it needs to know what type the DiscreteContainer is.

Definition at line 164 of file NLinear.hpp.


Member Data Documentation

template<typename T, InterpolationDefs::SizeType N, InterpolationDefs::SizeType M = N>
CoordList* const wns::NLinear< T, N, M >::coords [private]

For internal use only.

This list is shared with all hyperplanes.

Definition at line 177 of file NLinear.hpp.

template<typename T, InterpolationDefs::SizeType N, InterpolationDefs::SizeType M = N>
const bool wns::NLinear< T, N, M >::deleteCoords [private]

For internal use only.

Definition at line 183 of file NLinear.hpp.

template<typename T, InterpolationDefs::SizeType N, InterpolationDefs::SizeType M = N>
HyperplaneType wns::NLinear< T, N, M >::hyperplane [private]

For internal use only.

Definition at line 189 of file NLinear.hpp.


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

Generated on Sat May 26 03:32:51 2012 for openWNS by  doxygen 1.5.5