The constructor.
CubicBezierCurve
Readonly
END_Readonly
END_Readonly
START_Readonly
START_CubicBezierCurve
CubicBezierCurve
CubicBezierCurve
CubicBezierCurve
isDestroyed
CubicBezierCurve
CubicBezierCurve
CubicBezierCurve
CubicBezierCurve
CubicBezierCurve
Readonly
uidThe UID of this drawable object.
CubicBezierCurve
Static
Readonly
END_Static
Readonly
END_Static
Readonly
START_Static
Readonly
START_Static
Private
utilsHelper utils.
Get the points of a sub curve at the given start end end offsets (values between 0.0 and 1.0).
tStart >= tEnd is allowed, you will get a reversed sub curve then.
getSubCurvePointsAt
CubicBezierCurve
The sub curve as a new curve.
– The curve to get the sub curve points from.
– The start offset of the desired sub curve (must be in [0..1]).
– The end offset if the desired cub curve (must be in [0..1]).
Clone this Bézier curve (deep clone).
clone
CubicBezierCurve
Check if this and the specified curve are equal.
All four points need to be equal for this, the Vertex.equals function is used.
Please note that this function is not type safe (comparison with any object will fail).
The curve to compare with.
clone
CubicBezierCurve
Get a 't' (relative position on curve) with the closest distance to point 'p'.
The returned number is 0.0 <= t <= 1.0. Use the getPointAt(t) function to retrieve the actual curve point.
This function uses a recursive approach by cutting the curve into several linear segments.
The point to find the closest position ('t' on the curve).
Get the total curve length.
As not all Bézier curved have a closed formula to calculate their lengths, this
implementation uses a segment buffer (with a length of 30 segments). So the
returned length is taken from the arc segment buffer.
Note that if the curve points were changed and the segment buffer was not
updated this function might return wrong (old) values.
= 0
getLength
CubicBezierCurve
Get the curve perpendicular at a given relative position u in [0,arcLength] as a vector.
Note that the returned vector (end point) is not normalized.
The relative position on the curve in [0,arcLength].
getPerpendicular
CubicBezierCurve
Get the curve point at a given position u, where u is in [0,arcLength].
The position on the curve in [0,arcLength] (0 means at start point, arcLength means at end point, other values address points in bertween).
CubicBezierCurve.getPointAt
getPoint
CubicBezierCurve
Get the curve point at a given position t, where t is in [0,1].
The position on the curve in [0,1] (0 means at start point, 1 means at end point, other values address points in bertween).
Line.pointAt
getPointAt
CubicBezierCurve
Get a sub curve at the given start end end positions (values on the curve's length, between 0 and curve.arcLength).
tStart >= tEnd is allowed, you will get a reversed sub curve then.
The sub curve as a new curve.
getSubCurve
CubicBezierCurve
Get a sub curve at the given start end end offsets (values between 0.0 and 1.0).
tStart >= tEnd is allowed, you will get a reversed sub curve then.
– The start offset of the desired sub curve (must be in [0..1]).
– The end offset if the desired cub curve (must be in [0..1]).
The sub curve as a new curve.
getSubCurveAt
CubicBezierCurve
Get the curve tangent vector at a given absolute curve position t in [0,1].
Note that the returned tangent vector (end point) is not normalized and relative to (0,0).
The position on the curve in [0,1].
getTangent
CubicBezierCurve
Private
locateThis helper function locates the 't' on a fixed step interval with the minimal distance between the curve (at 't') and the given point.
Furthermore you must specify a sub curve (start 't' and end 't') you want to search on. Using tStart=0.0 and tEnd=1.0 will search on the full curve.
The point to find the closest curve point for.
The start position (start 't' of the sub curve). Should be >= 0.0.
The end position (end 't' of the sub curve). Should be <= 1.0.
The number of steps to check within the interval.
Move the given curve point (the start point, end point or one of the two control points).
The numeric identicator of the point to move. Use one of the four eBezierPoint constants.
The amount to move the specified point by.
Move the control points along with their path point (if specified point is a path point).
Specifiy if the internal arc segment buffer should be updated.
moveCurvePoint
CubicBezierCurve
Reverse this curve, means swapping start- and end-point and swapping start-control- and end-control-point.
this (for chaining).
reverse
CubicBezierCurve
Translate the whole curve by the given {x,y} amount: moves all four points.
The amount to translate this curve by.
this (for chaining).
translate
CubicBezierCurve
Trim off the end of this curve. The position parameter uValue
is the absolute position on the
curve in [0...arcLength]
.
The remaining curve will be the one in the bounds [0,uValue]
(so [1.0-uValue,1.0]
is cut off).
Note this function just converts the absolute parameter to a relative one and call trimEndAt
.
The absolute position parameter where to cut off the tail curve.
this
for chanining.
trimEnd
CubicBezierCurve
Trim off the end of this curve. The position parameter t
is the relative position in [0..1].
The remaining curve will be the one in the bounds [0,t]
(so [1.0-t,1.0]
is cut off).
The relative position parameter where to cut off the tail curve.
this
for chanining.
trimEndAt
CubicBezierCurve
Trim off a start section of this curve. The position parameter uValue
is the absolute position on the
curve in [0...arcLength]
.
The remaining curve will be the one in the bounds [uValue,1]
(so [0.0,uValue]
is cut off).
Note this function just converts the absolute parameter to a relative one and call trimStartAt
.
The absolute position parameter where to cut off the head curve.
this
for chanining.
trimStart
CubicBezierCurve
Trim off a start section of this curve. The position parameter t
is the relative position in [0..1].
The remaining curve will be the one in the bounds [uValue,1]
(so [0.0,uValue]
is cut off).
The relative position parameter where to cut off the head curve.
this
for chanining.
trimStartAt
CubicBezierCurve
Uptate the internal arc segment buffer and their lengths.
All class functions update the buffer automatically; if any
curve point is changed by other reasons you should call this
function to keep actual values in the buffer.
updateArcLengths
CubicBezierCurve
Static
fromConvert a 4-element array of vertices to a cubic bézier curve.
[ startVertex, endVertex, startControlVertex, endControlVertex ]
fromArray
CubicBezierCurve
An exception if the passed array is malformed.
Static
fromJSONParse a Bézier curve from the given JSON string.
The JSON data to parse.
fromJSON
CubicBezierCurve
An exception if the JSON string is malformed.
Static
fromTry to convert the passed object to a CubicBezierCurve.
The object to convert.
fromObject
CubicBezierCurve
An exception if the passed object is malformed.
Static
is
Classdesc
A refactored cubic bezier curve class.
Requires
Bounds
Requires
Vertex
Requires
Vector
Requires
XYCoords
Requires
UID
Requires
UIDGenerator