circleToPolygon static method

bool circleToPolygon(
  1. CircleShape a,
  2. PolygonShape b
)

Implementation

static bool circleToPolygon(CircleShape a, PolygonShape b) {
  if (!rectToRect(a.rect, b.rect)) return false;

  if (b.points.isNotEmpty) {
    final points = b.points.toList();
    points.add(points.first);
    for (var i = 0; i < points.length - 1; i++) {
      final distance = getNearestDistance(points[i], points[i + 1], a.center);
      if (distance <= a.radius) {
        return true;
      }
    }
  }

  return false;
}