Cubic class
This class holds the anchor and control point data for a single cubic Bézier curve, with anchor points (anchor0X, anchor0Y) and (anchor1X, anchor1Y) at either end and control points (control0X, control0Y) and (control1X, control1Y) determining the slope of the curve between the anchor points.
- Annotations
Constructors
- Cubic(double anchor0X, double anchor0Y, double control0X, double control0Y, double control1X, double control1Y, double anchor1X, double anchor1Y)
-
Creates a Cubic that holds the anchor and control point data for a
single Bézier curve, with anchor points (
anchor0X,anchor0Y) and (anchor1X,anchor1Y) at either end and control points (control0X,control0Y) and (control1X,control1Y) determining the slope of the curve between the anchor points. - Cubic.circularArc(double centerX, double centerY, double x0, double y0, double x1, double y1)
-
Generates a bezier curve that approximates a circular arc, with p0 and
p1 as the starting and ending anchor points. The curve generated is the
smallest of the two possible arcs around the entire 360-degree circle.
Arcs of greater than 180 degrees should use more than one arc together.
Note that p0 and p1 should be equidistant from the center.
factory
- Cubic.empty(double x0, double y0)
- Generates an empty Cubic defined at (x0, y0).
- Cubic.fromPoints(Point anchor0, Point control0, Point control1, Point anchor1)
- Cubic.straightLine(double x0, double y0, double x1, double y1)
-
Generates a bezier curve that is a straight line between the given anchor
points. The control points lie 1/3 of the distance from their respective
anchor points.
factory
Properties
- anchor0X → double
-
no setter
- anchor0Y → double
-
no setter
- anchor1X → double
-
no setter
- anchor1Y → double
-
no setter
- control0X → double
-
no setter
- control0Y → double
-
no setter
- control1X → double
-
no setter
- control1Y → double
-
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
-
points
→ List<
double> -
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
calculateBounds(
List< double> bounds, {bool approximate = false}) → void -
Returns the true bounds of this curve, filling
boundswith the axis-aligned bounding box values for left, top, right, and bottom, in that order. -
convexTo(
Cubic next) → bool -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pointOnCurve(
double t) → Point -
Returns a point on the curve for parameter
t, representing the proportional distance along the curve between its starting point at anchor0 and ending point at anchor1. -
reverse(
) → Cubic - Utility function to reverse the control/anchor points for this curve.
-
split(
double t) → (Cubic, Cubic) -
Returns two Cubics, created by splitting this curve at the given
distance of
tbetween the original starting and ending anchor points. -
toString(
) → String -
A string representation of this object.
override
-
transformed(
PointTransformer f) → Cubic -
zeroLength(
) → bool
Operators
-
operator *(
double x) → Cubic -
operator +(
Cubic o) → Cubic -
operator /(
double x) → Cubic -
operator ==(
Object other) → bool -
The equality operator.
override