DzNaturalSpline Class Reference
[Basic Objects]

Natural Spline class used for the DForm Zone falloff curve. More...

Inheritance diagram for DzNaturalSpline:

DzBase QObject Object List of all members.

Methods

void clear ()
void deletePoint (Number index)
Number getMax ()
Number getMin ()
Number getNumPoints ()
Number getValue (Number x)
Number getX (Number index)
Number getY (Number index)
void insertPoint (Number x, Number y)
void setX (Number index, Number x)
void setY (Number index, Number y)

Constructors



 DzNaturalSpline ()

Signals

void splineChanged ()
 Signature: "splineChanged()"

Detailed Description

Natural Spline class used for the DForm Zone falloff curve.

This class encapsulates the behavior of a standard natural spline. A natural spline is a special case of a cubic spline that has zero second derivative at its two end boundaries. A standard reference for natural splines are the Numerical Recipes books that can be found online.

The spline can be initially constructed either by setting a default curve or by inserting two or more points.

The spline value y at a point x is found with the function getValue(). The y extrema of the curve can be found via getMinMax().

The spline point x,y coordinates should be limited to the range 0<=x<= 1 and 0<=y<=1 for proper functioning and this is explicitly enforced by the set functions.

The resulting spline curve may extend above or below those ranges.


Constructor & Destructor Documentation

DzNaturalSpline::DzNaturalSpline (  ) 

Default Constructor.


Member Function Documentation

void DzNaturalSpline::clear (  ) 

Removes all spline data. Number of points is set to zero.

void DzNaturalSpline::deletePoint ( Number  index  ) 

Deletes the spline point at the designated index.

Parameters:
index The zero based index of the point to be deleted.

double DzNaturalSpline::getMax (  ) 

Returns:
The maximum y value for the curve.

double DzNaturalSpline::getMin (  ) 

Returns:
The minimum y value for the curve.

int DzNaturalSpline::getNumPoints (  ) 

Gets the number of points the spline has. Used with getX(i) and getX(i) to loop over the spline points.

Returns:
The number of points.

Number DzNaturalSpline::getValue ( Number  x  ) 

Computes the y value on the spline for the given x. If the passed x is out of the range, then the y value for the closest endpoint is returned.

Parameters:
x The x coordinate.
Returns:
The y value.

Number DzNaturalSpline::getX ( Number  index  ) 

Gets the x value of the point at position index in the point array.

Parameters:
index The zero based index of the point.
Returns:
The x value.

Number DzNaturalSpline::getY ( Number  index  ) 

Gets the y value of the point at position index in the point array.

Parameters:
index The zero based index of the point.
Returns:
The y value.

void DzNaturalSpline::insertPoint ( Number  x,
Number  y 
)

Inserts a new point in the spline at position x, y. If there is allready a point in the spline with the same x value, then its y coordinate is replaced with new value.

Parameters:
x The x value of the point.
y The y value of the point.

void DzNaturalSpline::setX ( Number  index,
Number  x 
)

Sets the x value of the point at position index in the point array.

Parameters:
index The zero based index of the point.
x The x value of the point.

void DzNaturalSpline::setY ( Number  index,
Number  y 
)

Sets the y value of the point at position index in the point array.

Parameters:
index The zero based index of the point.
y The y value of the point.

void DzNaturalSpline::splineChanged (  )  [signal]

Signature: "splineChanged()"

Emitted when the values of the spline have changed.


Generated on Thu Sep 24 12:21:13 2009

Copyright © 2002 - 2009 DAZ 3D, Inc.