function distance(p1, p2) {
  return Math.hypot(p1.x - p2.x, p1.y - p2.y);
}
Calculates distance between two points. Each point must have `x` and `y` property
@param {*} p1 point 1
@param {*} p2 point 2
@returns distance between two points