function csgsurface=CSGtoSurface(CSGobj,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);

csgsurface=isosurface(x,y,z,CSGobj,0);
