CubicLine class

Line between two points. Curve of this line is controlled with other two points. Check https://cubic-bezier.com/ for more info about Bezier Curve.

Inheritance

Constructors

CubicLine({required OffsetPoint start, required Offset cpStart, required Offset cpEnd, required OffsetPoint end, Offset? upStartVector, Offset? upEndVector, double startSize = 0.0, double endSize = 0.0})
Based on Bezier Cubic curve. start point of curve. end point of curve. cpStart - control point of start vector. cpEnd - control point of end vector. startSize - size ratio at begin of curve. endSize - size ratio at end of curve. upStartVector - pre-calculated Up vector fo start point. upEndVector - pre-calculated Up vector of end point.

Properties

cpEnd Offset
Control of end point
final
cpStart Offset
Control of start point.
final
direction double
The angle of this offset as radians clockwise from the positive x-axis, in the range -pi to pi, assuming positive values of the x-axis go to the right and positive values of the y-axis go down.
no setterinherited
distance double
The magnitude of the offset.
no setterinherited
distanceSquared double
The square of the magnitude of the offset.
no setterinherited
dx double
The x component of the offset.
no setterinherited
dy double
The y component of the offset.
no setterinherited
end OffsetPoint
End point of curve.
final
endSize double
End ratio size of line.
getter/setter pair
hashCode int
The hash code for this object.
no setteroverride
isDot bool
Checks if point is dot. Returns 'true' if start and end is same -> velocity is zero.
no setter
isFinite bool
Whether both components are finite (neither infinite nor NaN).
no setterinherited
isInfinite bool
Returns true if either component is double.infinity, and false if both are finite (or negative infinity, or NaN).
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
start OffsetPoint
Initial point of curve.
final
startSize double
Start ratio size of line.
getter/setter pair
upEndVector Offset
Up vector of end point.
no setter
upStartVector Offset
Up vector of start point.
no setter

Methods

combineVelocity(double inVelocity, {double velocityRatio = 0.65, double maxFallOff = 1.0}) double
Combines line velocity with inVelocity based on velocityRatio.
cpeDown(double size, double maxSize) Offset
Returns Down offset of end point.
cpeUp(double size, double maxSize) Offset
Returns Up offset of end point.
cpsDown(double size, double maxSize) Offset
Returns Down offset of start point.
cpsUp(double size, double maxSize) Offset
Returns Up offset of start point.
endRadius(double size, double maxSize) double
Returns radius of end point.
length({double accuracy = 0.1}) double
Calculates length of Cubic curve with given accuracy. 0 - fastest, raw accuracy. 1 - slowest, most accurate. Returns length of curve.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
point(double t) Offset
Calculates point on curve at given t. t - 0 to 1. Returns location on Curve at t.
scale(double scaleX, double scaleY) CubicLine
Returns a new offset with the x component scaled by scaleX and the y component scaled by scaleY.
override
startRadius(double size, double maxSize) double
Returns radius of start point.
toArc(double size, double deltaSize, {double precision = 0.5}) List<CubicArc>
Converts this line to CubicArc.
toPath() Path
Converts this line to Cubic Path.
toShape(double size, double maxSize) Path
Converts this line to closed Path.
toString() String
A string representation of this object.
inherited
translate(double translateX, double translateY) CubicLine
Returns a new offset with translateX added to the x component and translateY added to the y component.
override
velocity({double accuracy = 0.0}) double
Velocity along this line.

Operators

operator %(double operand) Offset
Modulo (remainder) operator.
inherited
operator &(Size other) Rect
Rectangle constructor operator.
inherited
operator *(double operand) Offset
Multiplication operator.
inherited
operator +(Offset other) Offset
Binary addition operator.
inherited
operator -(Offset other) Offset
Binary subtraction operator.
inherited
operator /(double operand) Offset
Division operator.
inherited
operator <(OffsetBase other) bool
Less-than operator. Compares an Offset or Size to another Offset or Size, and returns true if both the horizontal and vertical values of the left-hand-side operand are smaller than the horizontal and vertical values of the right-hand-side operand respectively. Returns false otherwise.
inherited
operator <=(OffsetBase other) bool
Less-than-or-equal-to operator. Compares an Offset or Size to another Offset or Size, and returns true if both the horizontal and vertical values of the left-hand-side operand are smaller than or equal to the horizontal and vertical values of the right-hand-side operand respectively. Returns false otherwise.
inherited
operator ==(Object other) bool
Compares two Offsets for equality.
override
operator >(OffsetBase other) bool
Greater-than operator. Compares an Offset or Size to another Offset or Size, and returns true if both the horizontal and vertical values of the left-hand-side operand are bigger than the horizontal and vertical values of the right-hand-side operand respectively. Returns false otherwise.
inherited
operator >=(OffsetBase other) bool
Greater-than-or-equal-to operator. Compares an Offset or Size to another Offset or Size, and returns true if both the horizontal and vertical values of the left-hand-side operand are bigger than or equal to the horizontal and vertical values of the right-hand-side operand respectively. Returns false otherwise.
inherited
operator unary-() Offset
Unary negation operator.
inherited
operator ~/(double operand) Offset
Integer (truncating) division operator.
inherited

Static Methods

softCP(OffsetPoint current, {OffsetPoint? previous, OffsetPoint? next, bool reverse = false, double smoothing = 0.65}) Offset
Calculates current point based on previous and next control points.