r=(w+h-sqrt(2*w*h))/2