float x1 = x[0]; float y1 = x[1]; float z1 = x[2]; double d = sqrt(x1*x1+y1*y1); if(d == 0) return 0; double c = x1/d; if(c > 1.0) c = 1; else if(c < -1.0) c = -1; double angle = acos(c); if(y1 < 0) angle = -angle; double r = sin(5*angle); float cyl = (3*r + 9)*(3*r + 9) - x1*x1 - y1*y1; float s1 = 400 - x1*x1 - y1*y1 - (z1+16)*(z1+16); float s2 = 400 - x1*x1 - y1*y1 - (z1-16)*(z1-16); float disk = R_int(s1, s2); float cyl2 = (r + 3)*(r + 3) - x1*x1 - y1*y1; return R_int(R_int(cyl, disk), -cyl2);