SPath.regularPolygon constructor
SPath.regularPolygon({})
A regular polygon shape
Implementation
SPath.regularPolygon(
{required double radius,
required Point<double> at,
int n = 5,
double startAngle = 0}) {
var a = -pi / 2 + startAngle;
final dA = (pi * 2) / n;
currentPoint = Point(at.x + radius * cos(a), at.y + radius * sin(a));
for (var i = 1; i < n; i++) {
line(
to: Point(at.x + radius * cos(a + i * dA),
at.y + radius * sin(a + i * dA)));
}
close();
}