The constructor.
The Bézier curve's start point.
The Bézier curve's end point.
The Bézier curve's start control point.
The Bézier curve's end control point.
The UID of this drawable object.
Clone this Bézier curve (deep clone).
Convert a relative curve position u to the absolute curve position t.
The relative position on the curve in [0,arcLength].
This function should invalidate any installed listeners and invalidate this object. After calling this function the object might not hold valid data any more and should not be used.
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.
Get the bounds of this bezier curve.
The bounds are approximated by the underlying segment buffer; the more segment there are, the more accurate will be the returned bounds.
The bounds of this curve.
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 end control point of the curve.
This function just returns this.endControlPoint.
this.endControlPoint
Get the end point of the curve.
This function just returns this.endPoint.
this.endPoint
Get the tangent's end point at the end point of this segment.
The end point of the ending point's tangent.
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
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].
Get the curve perpendicular at a given absolute position t in [0,1] as a vector.
Note that the returned vector (end point) is not normalized.
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).
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).
Get one of the four curve points specified by the passt point ID.
One of START_POINT, START_CONTROL_POINT, END_CONTROL_POINT or END_POINT.
Get the start control point of the curve.
This function just returns this.startControlPoint.
this.startControlPoint
Get the start point of the curve.
This function just returns this.startPoint.
this.startPoint
Get the tangent's end point at the start point of this segment.
The end point of the starting point's tangent.
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.
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.
Get the curve tangent vector at a given relative position u in [0,arcLength].
Note that the returned tangent vector (end point) is not normalized.
The position on the curve in [0,arcLength].
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].
This 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.
Reverse this curve, means swapping start- and end-point and swapping start-control- and end-control-point.
this (for chaining).
Convert this curve to a JSON string.
The JSON data.
Translate the whole curve by the given {x,y} amount: moves all four points.
The amount to translate this curve by.
this (for chaining).
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.
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.
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.
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.
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.
Convert a 4-element array of vertices to a cubic bézier curve.
[ startVertex, endVertex, startControlVertex, endControlVertex ]
Parse a Bézier curve from the given JSON string.
The JSON data to parse.
Try to convert the passed object to a CubicBezierCurve.
The object to convert.
Quick check for class instance. Is there a better way?
Check if the passed object/value is an instance of CubicBezierCurve.
Helper 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.
– 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]).
The sub curve as a new curve.
Generated using TypeDoc
A refactored cubic bezier curve class.
Bounds
Vertex
Vector
XYCoords
UID
UIDGenerator