a:%pi/3;
b:%pi/6;
R:100;
r:70;

X:(R+r*cos(a))*cos(b);
Y:(R+r*cos(a))*sin(b);
Z:r*sin(a);

(X^2+Y^2+Z^2-R^2-r^2)^2-4*R^2*(r^2-Z^2);

(X^2+Y^2+Z^2+R^2-r^2)^2-4*R^2*(r^2-Z^2);

4*R*R*(r*r - Z*Z) - (X*X + Y*Y + Z*Z - R*R - r*r)^2;

4*R*R*(r*r - Z*Z) - (X*X + Y*Y + Z*Z + R*R - r*r)^2;