Drag[en]gine Script Module DragonScript Script API  1.0
Curve2D Class Reference

2D Curve. More...

Inheritance diagram for Curve2D:

Public Member Functions

Constructors
Curve2D new ()
 Create 2d curve. More...
 
Management
int getPointCount ()
 Nnumber of points. More...
 
Vector2 getPointAt (int position)
 Point at positon. More...
 
int indexOfPointClosestTo (float coordinate)
 Index of the point closest to an x coordinate. More...
 
int indexOfPointBefore (float coordinate)
 Index of the point with matching x coordinates or point right before. More...
 
int addPoint (Vector2 point)
 Add point returning index where it has been added. More...
 
int addPoint (float x, float y)
 Add point returning index where it has been added. More...
 
void removePointFrom (int position)
 Remove point from position. More...
 
void removeAllPoints ()
 Remove all points. More...
 
void setDefaultCurve ()
 Clear curve to a straight line from (0,0) to (1,1). More...
 
void offsetPointsBy (float offset)
 Offset Y coordinate of all curve points. More...
 
void scalePointsBy (float scale)
 Scale Y coordinate of all curve points. More...
 
float evaluateConstant (float coordinate)
 Evaluate curve at coordinate using constant interpolation. More...
 
float evaluateLinear (float coordinate)
 Evaluate curve at coordinate using linear interpolation. More...
 

Detailed Description

2D Curve.

This is a native class.

Author
Roland Pl├╝ss
Version
1.0
Date
2015

Member Function Documentation

§ addPoint() [1/2]

int addPoint ( Vector2  point)

Add point returning index where it has been added.

§ addPoint() [2/2]

int addPoint ( float  x,
float  y 
)

Add point returning index where it has been added.

§ evaluateConstant()

float evaluateConstant ( float  coordinate)

Evaluate curve at coordinate using constant interpolation.

§ evaluateLinear()

float evaluateLinear ( float  coordinate)

Evaluate curve at coordinate using linear interpolation.

§ getPointAt()

Vector2 getPointAt ( int  position)

Point at positon.

Exceptions
EOutOfBoundaryposition is less than 0 or larger than or equal to getPointCount().

§ getPointCount()

int getPointCount ( )

Nnumber of points.

§ indexOfPointBefore()

int indexOfPointBefore ( float  coordinate)

Index of the point with matching x coordinates or point right before.

This method can be used to find the interval a point is located in by returning the most prior point. Returns -1 if there are no points satisfying this criteria.

§ indexOfPointClosestTo()

int indexOfPointClosestTo ( float  coordinate)

Index of the point closest to an x coordinate.

If no such point can be found -1 is returned.

§ new()

Curve2D new ( )

Create 2d curve.

§ offsetPointsBy()

void offsetPointsBy ( float  offset)

Offset Y coordinate of all curve points.

§ removeAllPoints()

void removeAllPoints ( )

Remove all points.

§ removePointFrom()

void removePointFrom ( int  position)

Remove point from position.

Exceptions
EOutOfBoundaryposition is less than 0 or larger than or equal to getPointCount().

§ scalePointsBy()

void scalePointsBy ( float  scale)

Scale Y coordinate of all curve points.

§ setDefaultCurve()

void setDefaultCurve ( )

Clear curve to a straight line from (0,0) to (1,1).


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