function circleRect(cx, cy, r, rx, ry, rw, rh) {
  let testX = cx;
  let testY = cy;

  if (cx < rx) testX = rx;
  else if (cx > rx + rw) testX = rx + rw;

  if (cy < ry) testY = ry;
  else if (cy > ry + rh) testY = ry + rh;

  const distX = cx - testX;
  const distY = cy - testY;

  return Math.hypot(distX, distY) <= r;
}
@param {number} cx
@param {number} cy
@param {number} r
@param {number} rx
@param {number} ry
@param {number} rw
@param {number} rh