Drag[en]gine Script Module DragonScript 1.35
Loading...
Searching...
No Matches
Dragengine.Scenery.Curve2D Class Reference

2D Curve. More...

Inheritance diagram for Dragengine.Scenery.Curve2D:

Public Member Functions

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

Detailed Description

2D Curve.

This is a native class.

Member Function Documentation

◆ addPoint() [1/2]

int Dragengine.Scenery.Curve2D.addPoint ( float x,
float y )

Add point returning index where it has been added.

References indexOfPointBefore().

◆ addPoint() [2/2]

int Dragengine.Scenery.Curve2D.addPoint ( Vector2 point)

Add point returning index where it has been added.

Referenced by removeAllPoints(), and removePointFrom().

◆ evaluateConstant()

float Dragengine.Scenery.Curve2D.evaluateConstant ( float coordinate)

Evaluate curve at coordinate using constant interpolation.

Referenced by evaluateLinear().

◆ evaluateLinear()

float Dragengine.Scenery.Curve2D.evaluateLinear ( float coordinate)

Evaluate curve at coordinate using linear interpolation.

References evaluateConstant(), evaluateLinear(), offsetPointsBy(), scalePointsBy(), and setDefaultCurve().

Referenced by evaluateLinear().

◆ getPointAt()

Vector2 Dragengine.Scenery.Curve2D.getPointAt ( int position)

Point at positon.

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

References getPointAt().

Referenced by getPointAt().

◆ getPointCount()

int Dragengine.Scenery.Curve2D.getPointCount ( )

Nnumber of points.

References getPointCount().

Referenced by getPointCount().

◆ indexOfPointBefore()

int Dragengine.Scenery.Curve2D.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.

Referenced by addPoint().

◆ indexOfPointClosestTo()

int Dragengine.Scenery.Curve2D.indexOfPointClosestTo ( float coordinate)

Index of the point closest to an x coordinate.

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

References indexOfPointClosestTo().

Referenced by indexOfPointClosestTo().

◆ new()

Curve2D Dragengine.Scenery.Curve2D.new ( )

Create 2d curve.

References new().

Referenced by new().

◆ offsetPointsBy()

void Dragengine.Scenery.Curve2D.offsetPointsBy ( float offset)

Offset Y coordinate of all curve points.

References removePointFrom().

Referenced by evaluateLinear().

◆ removeAllPoints()

void Dragengine.Scenery.Curve2D.removeAllPoints ( )

Remove all points.

References addPoint().

Referenced by scalePointsBy().

◆ removePointFrom()

void Dragengine.Scenery.Curve2D.removePointFrom ( int position)

Remove point from position.

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

References addPoint().

Referenced by offsetPointsBy().

◆ scalePointsBy()

void Dragengine.Scenery.Curve2D.scalePointsBy ( float scale)

Scale Y coordinate of all curve points.

References removeAllPoints().

Referenced by evaluateLinear().

◆ setDefaultCurve()

void Dragengine.Scenery.Curve2D.setDefaultCurve ( )

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

Referenced by evaluateLinear().


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