-
We can find the maximum distance by solving for theta,

Input := 


FindRoot[distance'[theta]==0,{theta, Pi/6}]

Output =


{theta -> 0.785398}