float x2 = x[0]*1.5; float y2 = x[1]*1.5; float z2 = x[2]*1.5; double angle = PI*x2/20.0f; float x1 = x2; float y1 = -y2*sin(angle) + z2*cos(angle); float z1 = y2*cos(angle) + z2*sin(angle); float p1[] = {x1,y1,z1}; float sphere = 255 - x1*x1 - y1*y1 - z1*z1; float cen[] = {0,0,0}; float p[3]; p[0] = x1; p[1] = cos(PI/4)*y1 - sin(PI/4)*z1; p[2] = sin(PI/4)*y1 + cos(PI/4)*z1; float torus1 = hfTorusZ(p, cen, 15, 4); p[0] = x1; p[1] = cos(-PI/4)*y1 - sin(-PI/4)*z1; p[2] = sin(-PI/4)*y1 + cos(-PI/4)*z1; float torus2 = hfTorusZ(p, cen, 15, 4); float torusD = R_uni(torus1, torus2); return R_int(sphere, -torusD);