distanceToCenter static method

double distanceToCenter(
  1. FreeHexagon hex,
  2. Offset point
)

计算点到六边形中心的距离

Implementation

static double distanceToCenter(FreeHexagon hex, Offset point) {
  return math.sqrt(
    math.pow(hex.center.dx - point.dx, 2) +
        math.pow(hex.center.dy - point.dy, 2),
  );
}