Drag[en]gine Script Module DragonScript  1.21
Dragengine.Scenery.CurveBezier Class Reference

Bezier curve. More...

Inheritance diagram for Dragengine.Scenery.CurveBezier:

Public Member Functions

Management
int getPointCount ()
 Number of points. More...
 
Vector2 getPointAt (int position)
 Point at position. More...
 
Vector2 getHandle1At (int position)
 First handle at position. More...
 
Vector2 getHandle2At (int position)
 Second handle at position. More...
 
int findPointPriorTo (float coordinate)
 Index of point with matching x coordinates or point right before coordinate. More...
 
int addPoint (Vector2 point, Vector2 handle1, Vector2 handle2)
 Add point returning index where it has been added. More...
 
int addPoint (float pointX, float pointY, float handle1X, float handle1Y, float handle2X, float handle2Y)
 Add point returning index where it has been added. More...
 
int addPoint (Vector2 point)
 Add point returning index where it has been added. More...
 
int addPoint (float pointX, float pointY)
 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...
 
CurveBezierInterpolation getInterpolationMode ()
 Interpolation mode. More...
 
void setInterpolationMode (CurveBezierInterpolation mode)
 Set interpolation mode. More...
 
void setDefaultLinear ()
 Set curve to linear mapping from (0,0) to (1,1). More...
 
void setDefaultBezier ()
 Set curve to default bezier curve from (0,0) to (1,1). More...
 
float evaluateAt (float x)
 Evaluates curve at position. More...
 

Constructors

CurveBezier new ()
 Create bezier curve with CurveBezierInterpolation.bezier interpolation. More...
 
CurveBezier new (CurveBezier bezier)
 Create copy of bezier curve. More...
 
static CurveBezier newDefaultLinear ()
 Create bezier curve set to linear mapping from (0,0) to (1,1). More...
 
static CurveBezier newDefaultBezier ()
 Create bezier curve set to default bezier curve from (0,0) to (1,1). More...
 

Detailed Description

Bezier curve.

Control points composes of a position and two handles. The handles are only used if CurveBezierInterpolation.bezier interpolation is used. With CurveBezierInterpolation.constant the same value is used from the starting coordinates up to but excluding the coordinates of the next point.

Bezier curves are two dimensional.

This is a native class.

Member Function Documentation

◆ addPoint() [1/4]

int Dragengine.Scenery.CurveBezier.addPoint ( float  pointX,
float  pointY 
)

Add point returning index where it has been added.

◆ addPoint() [2/4]

int Dragengine.Scenery.CurveBezier.addPoint ( float  pointX,
float  pointY,
float  handle1X,
float  handle1Y,
float  handle2X,
float  handle2Y 
)

Add point returning index where it has been added.

◆ addPoint() [3/4]

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

Add point returning index where it has been added.

◆ addPoint() [4/4]

int Dragengine.Scenery.CurveBezier.addPoint ( Vector2  point,
Vector2  handle1,
Vector2  handle2 
)

Add point returning index where it has been added.

◆ evaluateAt()

float Dragengine.Scenery.CurveBezier.evaluateAt ( float  x)

Evaluates curve at position.

◆ findPointPriorTo()

int Dragengine.Scenery.CurveBezier.findPointPriorTo ( float  coordinate)

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

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.

◆ getHandle1At()

Vector2 Dragengine.Scenery.CurveBezier.getHandle1At ( int  position)

First handle at position.

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

◆ getHandle2At()

Vector2 Dragengine.Scenery.CurveBezier.getHandle2At ( int  position)

Second handle at position.

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

◆ getInterpolationMode()

CurveBezierInterpolation Dragengine.Scenery.CurveBezier.getInterpolationMode ( )

Interpolation mode.

◆ getPointAt()

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

Point at position.

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

◆ getPointCount()

int Dragengine.Scenery.CurveBezier.getPointCount ( )

Number of points.

◆ new() [1/2]

CurveBezier Dragengine.Scenery.CurveBezier.new ( )

Create bezier curve with CurveBezierInterpolation.bezier interpolation.

◆ new() [2/2]

CurveBezier Dragengine.Scenery.CurveBezier.new ( CurveBezier  bezier)

Create copy of bezier curve.

Version
1.9

◆ newDefaultBezier()

static CurveBezier Dragengine.Scenery.CurveBezier.newDefaultBezier ( )
static

Create bezier curve set to default bezier curve from (0,0) to (1,1).

◆ newDefaultLinear()

static CurveBezier Dragengine.Scenery.CurveBezier.newDefaultLinear ( )
static

Create bezier curve set to linear mapping from (0,0) to (1,1).

◆ removeAllPoints()

void Dragengine.Scenery.CurveBezier.removeAllPoints ( )

Remove all points.

◆ removePointFrom()

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

Remove point from position.

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

◆ setDefaultBezier()

void Dragengine.Scenery.CurveBezier.setDefaultBezier ( )

Set curve to default bezier curve from (0,0) to (1,1).

◆ setDefaultLinear()

void Dragengine.Scenery.CurveBezier.setDefaultLinear ( )

Set curve to linear mapping from (0,0) to (1,1).

◆ setInterpolationMode()

void Dragengine.Scenery.CurveBezier.setInterpolationMode ( CurveBezierInterpolation  mode)

Set interpolation mode.

Exceptions
EInvalidParammode is not a valid value.

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