code: function getSqDist(p1, p2) {
  
      var dx = p1.x - p2.x,
          dy = p1.y - p2.y;
  
      return dx * dx + dy * dy;
  }
docs: to suit your point format, run search/replace for '.x' and '.y'; for 3D version, see 3d branch (configurability would draw significant performance overhead) square distance between 2 points