SimGear - Simulator Construction Tools
SGInterpTable Class Reference

#include <interpolater.hxx>

Inheritance diagram for SGInterpTable:
SGReferenced

Public Member Functions

 SGInterpTable ()
 
 SGInterpTable (const SGPropertyNode *interpolation)
 
 SGInterpTable (const std::string &file)
 
 SGInterpTable (const SGPath &path)
 
 ~SGInterpTable ()
 
void addEntry (double ind, double dep)
 
double interpolate (double x) const
 

Static Public Member Functions

static unsigned count (const SGReferenced *ref)
 
static unsigned get (const SGReferenced *ref)
 
static unsigned put (const SGReferenced *ref)
 
static bool shared (const SGReferenced *ref)
 

Private Types

typedef std::map< double, double > Table
 

Private Attributes

Table _table
 

Detailed Description

A class that provids a simple linear 2d interpolation lookup table. The actual table is expected to be loaded from a file. The independant variable must be strictly ascending. The dependent variable can be anything.

Definition at line 52 of file interpolater.hxx.

Member Typedef Documentation

typedef std::map<double, double> SGInterpTable::Table
private

Definition at line 99 of file interpolater.hxx.

Constructor & Destructor Documentation

SGInterpTable::SGInterpTable ( )

Constructor. Creates a new, empty table.

Definition at line 41 of file interpolater.cxx.

SGInterpTable::SGInterpTable ( const SGPropertyNode interpolation)

Constructor. Loads the interpolation table from an interpolation property node.

Parameters
interpolationproperty node having entry children

Definition at line 45 of file interpolater.cxx.

SGInterpTable::SGInterpTable ( const std::string &  file)

Constructor. Loads the interpolation table from the specified file.

Parameters
filename of interpolation file

Definition at line 57 of file interpolater.cxx.

SGInterpTable::SGInterpTable ( const SGPath path)

Constructor. Loads the interpolation table from the specified file.

Parameters
filename of interpolation file

Definition at line 79 of file interpolater.cxx.

SGInterpTable::~SGInterpTable ( )

Destructor

Definition at line 142 of file interpolater.cxx.

Member Function Documentation

void SGInterpTable::addEntry ( double  ind,
double  dep 
)

Add an entry to the table, extending the table's length.

Parameters
indThe independent variable.
depThe dependent variable.

Definition at line 100 of file interpolater.cxx.

Referenced by SGInterpTable().

static unsigned SGReferenced::count ( const SGReferenced ref)
inlinestaticinherited
double SGInterpTable::interpolate ( double  x) const

Given an x value, linearly interpolate the y value from the table.

Parameters
xindependent variable
Returns
interpolated dependent variable

Definition at line 106 of file interpolater.cxx.

Referenced by SGDistScaleAnimation::Transform::computeScaleFactor(), and SGInterpTableExpression< T >::eval().

static unsigned SGReferenced::put ( const SGReferenced ref)
inlinestaticinherited

Definition at line 46 of file SGReferenced.hxx.

static bool SGReferenced::shared ( const SGReferenced ref)
inlinestaticinherited

Definition at line 50 of file SGReferenced.hxx.

Member Data Documentation

Table SGInterpTable::_table
private

Definition at line 100 of file interpolater.hxx.

Referenced by addEntry(), interpolate(), and SGInterpTable().


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