r=piecewise[{{3 sec(theta), 0<=theta<=pi/4}, {3 sec(pi/2 - theta), pi/4<=theta<=pi/2}}]