function solidcylinder=CSGcylinder(xc,yc,zc,r,axis,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);

if (axis=='x')
   solidcylinder=sqrt(  (y-yc).^2 + (z-zc).^2 ) - r ;
elseif (axis=='y')
   solidcylinder=sqrt( (x-xc).^2  + (z-zc).^2 ) - r ;  
elseif (axis=='z')
   solidcylinder=sqrt( (x-xc).^2 + (y-yc).^2 ) - r ; 
else
   error('axis must be x,y,or z')
end


