Bezier class abstract
Abstract base class of Bézier curves.
- Implementers
Constructors
-
Bezier(List<
Vector2> points) -
Constructs a Bézier curve from a List of
Vector2
. -
Bezier.fromPoints(List<
Vector2> curvePoints) -
Returns a new instance of the proper subclass of Bezier based on
the number of entries in
curvePoints
. IfcurvePoints
contains three points, returns a QuadraticBezier. IfcurvePoints
contains four points, returns a CubicBezier.factory
Properties
- boundingBox → Aabb2
-
Returns the axis-aligned bounding box of the curve.
no setter
- endPoint → Vector2
-
The ending guide point for the curve.
no setter
-
extrema
→ List<
double> -
Returns the parameter values that correspond with extrema on both the x
and y axes.
no setter
-
extremaOnX
→ List<
double> -
Returns the parameter values that correspond with minimum and maximum values
on the x axis.
no setter
-
extremaOnY
→ List<
double> -
Returns the parameter values that correspond with minimum and maximum values
on the y axis.
no setter
-
firstOrderDerivativePoints
→ List<
Vector2> -
Derivative points for the first order.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClockwise → bool
-
True if the curve is clockwise.
no setter
- isLinear → bool
-
True if the y values of the control points after being translated and rotated
are within a specified small distance (the constant linearTolerance) from zero.
no setter
- isSimple → bool
-
True if the normal vectors at the start and end points form an angle less
than 60 degrees.
no setter
- length → double
-
The approximate arc length of the curve.
no setter
- order → int
-
The order of the Bézier curve.
no setter
-
points
→ List<
Vector2> -
The start point, end point and control points of the Bézier curve.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- startPoint → Vector2
-
The starting guide point for the curve.
no setter
Methods
-
derivativeAt(
double t, {List< Vector2> ? cachedFirstOrderDerivativePoints}) → Vector2 -
Returns the tangent vector at parameter
t
. -
derivativePoints(
{int derivativeOrder = 1}) → List< Vector2> -
Derivative points for the order
derivativeOrder
. Derivative points describe the derivative function of the polynomial function of this and are used by other methods to calculate derivative values. -
hullPointsAt(
double t) → List< Vector2> -
Returns the hull points at the parameter value
t
. -
intersectionsWithCurve(
Bezier curve, {double curveIntersectionThreshold = 0.5, double minTValueDifference = 0.003}) → List< Intersection> -
Returns the List of intersections between this and
curve
. -
intersectionsWithLineSegment(
Vector2 lineStartPoint, Vector2 lineEndPoint) → List< double> -
Returns the List of parameter values for intersections between this and
the line segment defined by
lineStartPoint
andlineEndPoint
. -
intersectionsWithSelf(
{double curveIntersectionThreshold = 0.5, double minTValueDifference = 0.003}) → List< Intersection> - Returns the List of intersections between this and itself.
-
leftSubcurveAt(
double t) → Bezier -
Returns the subcurve obtained by taking the portion of the curve to the
left of parameter value
t
. -
nearestTValue(
Vector2 point, {List< Vector2> ? cachedPositionLookUpTable, double stepSize = 0.1}) → double -
Returns the parameter value along the curve that is closest (in terms of
geometric distance) to the given
point
. The approximation uses a two-pass projection test that relies on the curve's position look up table. First, the method determines the point in the look up table that is closest topoint
. Afterward, it checks the fine interval around that point to see if a better projection can be found. -
normalAt(
double t, {List< Vector2> ? cachedFirstOrderDerivativePoints}) → Vector2 -
The normal vector of the curve at parameter value
t
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
offsetCurve(
double distance, {double stepSize = 0.01}) → List< Bezier> -
Returns a List of
Bezier
instances that, when taken together, form an approximation of the offset curvedistance
units away from this. -
offsetPointAt(
double t, double distance, {List< Vector2> ? cachedFirstOrderDerivativePoints}) → Vector2 -
Returns the point
distance
units away in the clockwise direction from the point along the curve at parameter valuet
. -
overlaps(
Bezier curve) → bool -
True if the bounding box of this intersects with the bounding box of
curve
. -
pointAt(
double t) → Vector2 -
Returns the point along the curve at the parameter value
t
. -
positionLookUpTable(
{int intervalsCount = 50}) → List< Vector2> -
Returns a List of
Vector2
positions at evenly spaced parameter values from 0.0 to 1.0. -
rightSubcurveAt(
double t) → Bezier -
Returns the subcurve obtained by taking the portion of the curve to the
right of parameter value
t
. -
scaledCurve(
double distance) → Bezier -
Returns a Bezier instance whose endpoints are
distance
units away from the endpoints of this and whose control points have been moved in the same direction. -
simpleSlices(
{double stepSize = 0.01}) → List< BezierSlice> -
Returns a List of
BezierSlice
instances containing simple Bezier instances along with their endpoint parameter values from this. In cases where no simple subcurves can be found with the givenstepSize
, returns an empty List. -
simpleSubcurves(
{double stepSize = 0.01}) → List< Bezier> -
Returns a List of simple
Bezier
instances that make up this when taken together. In cases where no simple subcurves can be found with the givenstepSize
, returns an empty List. -
subcurveBetween(
double t1, double t2) → Bezier -
Returns the subcurve obtained by taking the portion of the curve between
parameter values
t1
andt2
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- linearTolerance → const double
- Maximum distance threshold used for determination of linear curves.
- originIntersectionTestDistance → const double
- Distance used when creating the lines to determine the origin for scaled curves.