code: static int computeRadius(final Dimension dimension, final Point start) {
          final int maxDistanceX = Math.max(start.x, dimension.width - start.x) + 1;
          final int maxDistanceY = Math.max(start.y, dimension.height - start.y) + 1;
          
          // we use the pythagorean theorem to determinate the maximum radius
          return (int) Math.ceil(Math.sqrt(maxDistanceX * maxDistanceX + maxDistanceY * maxDistanceY));
      }
docs: compute the maximum radius for the placing spiral
  
  @param dimension the size of the backgound
  @param start the center of the spiral
  @return the maximum usefull radius