function in = InSphere2(rn,SphereRadius)
%Check if coordinate is inside sphere.
%attempt to make more efficient insphere routine... didn't work almost twice as slow.

if ~InBox(rn,OuterBoxHalfSideSize )
   in=0;   
elseif InBox(r,InnerBoxHalfSideSize )
   in=1;
elseif (rn(1)^2+rn(2)^2+rn(3)^2)>SphereRadius^2
   in= 0;
else
   in= 1;
end
