spiral static method

List<Point<num>> spiral(
  1. int distanceMultiplier,
  2. int count,
  3. Point<num> center
)

Implementation

static List<Point> spiral(int distanceMultiplier, int count, Point center) {
  num legLength = distanceMultiplier * spiralLengthStart;
  final separation = distanceMultiplier * spiralFootSeparation;
  final lengthFactor = distanceMultiplier * spiralLengthFactor * pi2;
  num angle = 0;

  final result = <Point>[];
  // Higher index, closer position to cluster center.
  for (var i = count; i >= 0; i--) {
    // Skip the first position, so that we are already farther from center and we avoid
    // being under the default cluster icon (especially important for Circle Markers).
    if (i < count) {
      result[i] = Point(center.x + legLength * cos(angle),
          center.y + legLength * sin(angle));
    }
    angle += separation / legLength + i * 0.0005;
    legLength += lengthFactor / angle;
  }
  return result;
}