docs: function sqSegSegDist(x0, y0, x1, y1, x2, y2, x3, y3) {
      var ux = x1 - x0;
      var uy = y1 - y0;
      var vx = x3 - x2;
      var vy = y3 - y2;
      var wx = x0 - x2;
      var wy = y0 - y2;
      var a = ux * ux + uy * uy;
      var b = ux * vx + uy * vy;
      var c = vx * vx + vy * vy;
      var d = ux * wx + uy * wy;
      var e = vx * wx + vy * wy;
      var D = a * c - b * b;
  
      var sc, sN, tc, tN;
      var sD = D;
      var tD = D;
  
      if (D === 0) {
          sN = 0;
          sD = 1;
          tN = e;
          tD = c;
      } else {
          sN = b * e - c * d;
          tN = a * e - b * d;
          if (sN < 0) {
              sN = 0;
              tN = e;
              tD = c;
          } else if (sN > sD) {
              sN = sD;
              tN = e + b;
              tD = c;
          }
      }
  
      if (tN < 0.0) {
          tN = 0.0;
          if (-d < 0.0) sN = 0.0;
          else if (-d > a) sN = sD;
          else {
              sN = -d;
              sD = a;
          }
      } else if (tN > tD) {
          tN = tD;
          if ((-d + b) < 0.0) sN = 0;
          else if (-d + b > a) sN = sD;
          else {
              sN = -d + b;
              sD = a;
          }
      }
  
      sc = sN === 0 ? 0 : sN / sD;
      tc = tN === 0 ? 0 : tN / tD;
  
      var cx = (1 - sc) * x0 + sc * x1;
      var cy = (1 - sc) * y0 + sc * y1;
      var cx2 = (1 - tc) * x2 + tc * x3;
      var cy2 = (1 - tc) * y2 + tc * y3;
      var dx = cx2 - cx;
      var dy = cy2 - cy;
  
      return dx * dx + dy * dy;
  }