All Classes Namespaces Functions Variables Enumerations Enumerator Properties
plyCommon.plyCurve Class Reference

A curve or 2D graph represented by an array of values. The array index represents the horizontal (X) and the value of each represents the vertical (Y) of the graph. More...

Public Member Functions

 plyCurve (int valuesCount, int yMin, int yMax)
 Constructor. More...
 
 plyCurve (plyCurve c)
 Copy constructor. More...
 
void Create (int valuesCount, int yMin, int yMax)
 Creates a new curve and destroys old values. More...
 
void Reset ()
 Resets the curve, removing any manual changes made to values. More...
 
int GetYValue (int xValue)
 Same as calling values[xValue], returning the vertical value from graph. More...
 
int GetXValue (float yValue)
 Returns the horizontal value from graph that is close to the given vertical value. More...
 

Public Attributes

int yMin = 0
 The minimum for a vertical value.
 
int yMax = 100
 The maximum a vertical value can reach.
 
int[] values = new int[100]
 the Y (Vertical) value for each position of X (horizontal). (X always starts at 0)
 
plyUtil.EasingType easingType = plyUtil.EasingType.Linear
 
float acceleration = 1f
 

Detailed Description

A curve or 2D graph represented by an array of values. The array index represents the horizontal (X) and the value of each represents the vertical (Y) of the graph.

Constructor & Destructor Documentation

plyCommon.plyCurve.plyCurve ( int  valuesCount,
int  yMin,
int  yMax 
)

Constructor.

Parameters
valuesCountNumber of values to init curve to.
yMinThe minimum.
yMaxThe maximum.
plyCommon.plyCurve.plyCurve ( plyCurve  c)

Copy constructor.

Parameters
cThe plyCurve to process.

Member Function Documentation

void plyCommon.plyCurve.Create ( int  valuesCount,
int  yMin,
int  yMax 
)

Creates a new curve and destroys old values.

Parameters
valuesCountNumber of values to init curve to.
yMinThe minimum.
yMaxThe maximum.
int plyCommon.plyCurve.GetXValue ( float  yValue)

Returns the horizontal value from graph that is close to the given vertical value.

Parameters
yValueThe value to lookup
Returns
The x coordinate/ index/ horizontal value.
int plyCommon.plyCurve.GetYValue ( int  xValue)

Same as calling values[xValue], returning the vertical value from graph.

Parameters
xValueThe value.
Returns
The y coordinate/ horizontal value.
void plyCommon.plyCurve.Reset ( )

Resets the curve, removing any manual changes made to values.