function solidsphere=CSGsphere(xc,yc,zc,r,res)

if (res>50)
   res=50;
elseif (res<1)
   res=1;
end

res=1/res;
[x,y,z]=meshgrid(-1-res:res:1+res, ...
   -1-res:res:1+res, -1-res:res:1+res);
solidsphere=sqrt( (x-xc).^2 + (y-yc).^2 + (z-zc).^2 ) - r ;


