CARMA C++
sza::util::QuadPath Class Reference

A class to handle quadrature interpolation of ephemerides received from the control program. More...

#include <carma/szautil/QuadPath.h>

Classes

struct  QuadData
 The following object type is used to query or replace the current contents of a QuadPath object. More...
 

Public Types

enum  QuadType { QP_NORMAL, QP_SIGNED_ANGLE, QP_POSITIVE_ANGLE }
 Enumerate the various types of ephemeris types we might handle. More...
 

Public Member Functions

void empty ()
 Empty the coordinate table of a QuadPath object. More...
 
double eval (double x)
 Return the value of the quadratic equation at x. More...
 
void extend (double x, double y)
 Append or prepend an x,y coordinate pair to the three-entry circular table of a quadratic interpolation object. More...
 
void get (QuadData *data)
 Query the contents of a QuadPath object. More...
 
double grad (double x)
 Return the gradient of the quadratic equation at x. More...
 
 QuadPath (double empty_value, QuadType type)
 Constructor function. More...
 
void set (QuadData *data)
 Set the contents of a QuadPath object. More...
 
 ~QuadPath ()
 Destructor. More...
 

Detailed Description

A class to handle quadrature interpolation of ephemerides received from the control program.

This class is a wrapper around the C-style struct QuadData which is required by certain sza::array functions.

Definition at line 27 of file QuadPath.h.

Member Enumeration Documentation

Enumerate the various types of ephemeris types we might handle.

Enumerator
QP_NORMAL 

A continuous function.

QP_SIGNED_ANGLE 

Angles defined modulo 2.pi between -pi <= v < pi.

QP_POSITIVE_ANGLE 

Angles defined modulo 2.pi between 0 <= v < 2.pi.

Definition at line 34 of file QuadPath.h.

Constructor & Destructor Documentation

sza::util::QuadPath::QuadPath ( double  empty_value,
QuadType  type 
)

Constructor function.

Parameters
empty_valuedouble The value to return until at least one coordinate pair has been added.
typeQuadType The type of ordinate being interpolated.
@throwsException
sza::util::QuadPath::~QuadPath ( )

Destructor.

Member Function Documentation

void sza::util::QuadPath::empty ( )

Empty the coordinate table of a QuadPath object.

After this call the value of the empty_value argument that was presented to QuadPath::QuadPath() will be returned until extend() is next called.

Exceptions
Exception
double sza::util::QuadPath::eval ( double  x)

Return the value of the quadratic equation at x.

void sza::util::QuadPath::extend ( double  x,
double  y 
)

Append or prepend an x,y coordinate pair to the three-entry circular table of a quadratic interpolation object.

Entries are kept in ascending order of x, so if the new x value is larger than any currently in the table, it will be appended, and if it is smaller it will be prepended. If there are already three entries in the table the one at the other end of the table will be discarded and the table rotated over it to make room for the new sample.

If the new x value is within the range of x values already covered by the table, the interpolator will be left unchanged.

Each time a new entry is added, the three quadratic polynomial coefficients a,b,c (ie. a.x^2+b.x+c) are recomputed for use by eval().

The coefficients are initialized according to the number of entries in the interpolation table. After just one coordinate pair has been entered via this function, eval() returns its y-value irrespective of the target x-value. After a second point has been * added, the coefficients implement linear interpolation of the two * coordinate pairs. After 3 or more points have been added, the three * coefficients implement a quadratic interpolation of the last three * points entered.

Note that calls to this function and set_QuadPath() can be interleaved. In fact this function itself calls set_QuadPath().

Parameters
xdouble The X coordinate of the point to add.
ydouble The Y coordinate of the point to add.
void sza::util::QuadPath::get ( QuadData data)

Query the contents of a QuadPath object.

Exceptions
Exception
double sza::util::QuadPath::grad ( double  x)

Return the gradient of the quadratic equation at x.

void sza::util::QuadPath::set ( QuadData data)

Set the contents of a QuadPath object.

Each time a new set of samples is received by this function, the three quadratic polynomial coefficients a,b,c (ie. a.x^2+b.x+c) are * recomputed for use by eval().

The coefficients are initialized according to the number of entries in the interpolation table. If just one coordinate pair has been entered via this function, eval() returns its y-value irrespective of the target x-value. If two samples have been entered, the coefficients implement linear interpolation of the two coordinate pairs. If all 3 points are entered, the three coefficients implement a quadratic interpolation.

Exceptions
Exception

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