distance static method

dynamic distance(
  1. Vector2 p1,
  2. Vector2 p2
)

Compute distance between two point.

计算两点间的距离。

Implementation

static distance(Vector2 p1, Vector2 p2) {
  return math.sqrt(
    math.pow((p1.x) - (p2.x), 2) + math.pow((p1.y) - (p2.y), 2),
  );
}