SPath class
A higher level Path class; allows both building and manipulation of paths, prior to drawing
Constructors
-
SPath(Point<
double> start) -
SPath.fromPoints(List<
Point< points)double> > - Conveniently construct from a List of Point
-
SPath.rect({required Point<
double> at, required Size size, bool centered = false}) - A rectangle shape
-
SPath.regularPolygon({required double radius, required Point<
double> at, int n = 5, double startAngle = 0}) - A regular polygon shape
-
SPath.spiral({required Point<
double> at, required int n, required double l, dynamic startAngle = 0, double rate = 20}) - A spiral shape made up of lines
-
SPath.star({double? innerRadius, required double radius, required Point<
double> at, int n = 5, double startAngle = 0}) - A star shape
Properties
-
centroid
→ Point<
double> -
Centroid (average) point. Is often a good enough approximation for true centroid of a shape
no setter
-
currentPoint
↔ Point<
double> -
getter/setter pair
-
edges
↔ List<
PathEdge> -
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- path → Path
-
Get as a Path (for drawing in Flutter etc)
no setter
-
points
→ List<
Point< double> > -
List of points. Loses details on curves
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
segmented
→ List<
SPath> -
Thinking looking down on orange segments
no setter
Methods
-
chaikin(
{int n = 1, bool looped = false}) → SPath - A way to smooth out a path of lines; after just a few applications it will look like a nice curve. NB this converts the SPath to lines i.e. detail in any existing curves will be lost If the path forms a look you probably want to opt in to the looped option.
-
close(
) → void - Close a shape (add a line to the start)
-
curve(
{required Point< double> to, bool positive = true, double curveSize = 1, double curveAngle = 0, double bulbousness = 1, double twist = 0}) → void - Add a curve to a point
-
draw(
Canvas canvas, Paint paint) → void - Draw the shape
-
exploded(
{double magnitude = 1.2, double scale = 1}) → List< SPath> - Segment then explode outwards and scale
-
line(
{required Point< double> to}) → void - Add a line to a point
-
moved(
Point< double> by) → SPath - Move the shape
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rotated(
double angle) → SPath - Rotate the shape about its approximate centroid
-
scaled(
double scale, {Point< double> ? about}) → SPath - Scale the shape about its approximate centroid
-
toString(
) → String -
A string representation of this object.
inherited
-
transformed(
Point< double> transform(Point<double> )) → SPath - Transform via transform on Point
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited