|
Drag[en]gine Script Module DragonScript 1.35
|
Bezier curve. More...
Public Member Functions | |
Management | |
| int | getPointCount () |
| Number of points. | |
| Vector2 | getPointAt (int position) |
| Point at position. | |
| Vector2 | getHandle1At (int position) |
| First handle at position. | |
| Vector2 | getHandle2At (int position) |
| Second handle at position. | |
| int | findPointPriorTo (float coordinate) |
| Index of point with matching x coordinates or point right before coordinate. | |
| int | addPoint (Vector2 point, Vector2 handle1, Vector2 handle2) |
| Add point returning index where it has been added. | |
| int | addPoint (float pointX, float pointY, float handle1X, float handle1Y, float handle2X, float handle2Y) |
| Add point returning index where it has been added. | |
| int | addPoint (Vector2 point) |
| Add point returning index where it has been added. | |
| int | addPoint (float pointX, float pointY) |
| Add point returning index where it has been added. | |
| void | removePointFrom (int position) |
| Remove point from position. | |
| void | removeAllPoints () |
| Remove all points. | |
| CurveBezierInterpolation | getInterpolationMode () |
| Interpolation mode. | |
| void | setInterpolationMode (CurveBezierInterpolation mode) |
| Set interpolation mode. | |
| void | setDefaultLinear () |
| Set curve to linear mapping from (0,0) to (1,1). | |
| void | setDefaultBezier () |
| Set curve to default bezier curve from (0,0) to (1,1). | |
| float | evaluateAt (float x) |
| Evaluates curve at position. | |
Constructors | |
| CurveBezier | new () |
| Create bezier curve with CurveBezierInterpolation.bezier interpolation. | |
| CurveBezier | new (CurveBezier bezier) |
| Create copy of bezier curve. | |
| static CurveBezier | newDefaultLinear () |
| Create bezier curve set to linear mapping from (0,0) to (1,1). | |
| static CurveBezier | newDefaultBezier () |
| Create bezier curve set to default bezier curve from (0,0) to (1,1). | |
File Handling | |
| void | writeToFile (FileWriter writer) |
| Write curve to file writer. | |
| static CurveBezier | readFromFile (FileReader reader) |
| Read curve from file reader. | |
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.
| int Dragengine.Scenery.CurveBezier.addPoint | ( | float | pointX, |
| float | pointY ) |
Add point returning index where it has been added.
References findPointPriorTo().
| 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.
| int Dragengine.Scenery.CurveBezier.addPoint | ( | Vector2 | point | ) |
Add point returning index where it has been added.
Add point returning index where it has been added.
References getHandle2At().
Referenced by getInterpolationMode(), removePointFrom(), and setInterpolationMode().
| float Dragengine.Scenery.CurveBezier.evaluateAt | ( | float | x | ) |
Evaluates curve at position.
References getInterpolationMode(), and removeAllPoints().
Referenced by writeToFile().
| 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.
Referenced by addPoint().
| Vector2 Dragengine.Scenery.CurveBezier.getHandle1At | ( | int | position | ) |
First handle at position.
| EOutOfBoundary | position is less than 0 or larger than or equal to getPointCount(). |
References getPointAt().
Referenced by getHandle2At().
| Vector2 Dragengine.Scenery.CurveBezier.getHandle2At | ( | int | position | ) |
Second handle at position.
| EOutOfBoundary | position is less than 0 or larger than or equal to getPointCount(). |
References getHandle1At().
Referenced by addPoint().
| CurveBezierInterpolation Dragengine.Scenery.CurveBezier.getInterpolationMode | ( | ) |
| Vector2 Dragengine.Scenery.CurveBezier.getPointAt | ( | int | position | ) |
Point at position.
| EOutOfBoundary | position is less than 0 or larger than or equal to getPointCount(). |
References getPointCount().
Referenced by getHandle1At().
| int Dragengine.Scenery.CurveBezier.getPointCount | ( | ) |
Number of points.
Referenced by getPointAt().
| CurveBezier Dragengine.Scenery.CurveBezier.new | ( | ) |
| CurveBezier Dragengine.Scenery.CurveBezier.new | ( | CurveBezier | bezier | ) |
|
static |
Create bezier curve set to default bezier curve from (0,0) to (1,1).
References newDefaultBezier().
Referenced by newDefaultBezier().
|
static |
Create bezier curve set to linear mapping from (0,0) to (1,1).
References newDefaultLinear().
Referenced by newDefaultLinear().
|
static |
Read curve from file reader.
References setInterpolationMode().
Referenced by writeToFile().
| void Dragengine.Scenery.CurveBezier.removeAllPoints | ( | ) |
Remove all points.
Referenced by evaluateAt().
| void Dragengine.Scenery.CurveBezier.removePointFrom | ( | int | position | ) |
Remove point from position.
| EOutOfBoundary | position is less than 0 or larger than or equal to getPointCount(). |
References addPoint().
Referenced by setDefaultBezier().
| void Dragengine.Scenery.CurveBezier.setDefaultBezier | ( | ) |
Set curve to default bezier curve from (0,0) to (1,1).
References removePointFrom().
Referenced by writeToFile().
| void Dragengine.Scenery.CurveBezier.setDefaultLinear | ( | ) |
Set curve to linear mapping from (0,0) to (1,1).
Referenced by writeToFile().
| void Dragengine.Scenery.CurveBezier.setInterpolationMode | ( | CurveBezierInterpolation | mode | ) |
Set interpolation mode.
| EInvalidParam | mode is not a valid value. |
References addPoint().
Referenced by readFromFile().
| void Dragengine.Scenery.CurveBezier.writeToFile | ( | FileWriter | writer | ) |
Write curve to file writer.
References evaluateAt(), readFromFile(), setDefaultBezier(), setDefaultLinear(), and writeToFile().
Referenced by writeToFile().