implicit equation for elliptical torus I just wondering what the implicit equation would be if an ellipse with major axis a and minor axis b, rotating about the Z axis with a distance of $R_0$. The $R_0$>a and $R_0$>b which means the rotation will result in a non-degenerate torus. 
My aim is to determine if some points are inside the toroidal surface. The surface is shown in the image found online. 
 
 A: I'll suppose that, as in the diagram, the minor axis $b$ is in the radial direction.
This is a surface of revolution generated, for example, by the ellipse
$$\frac{(x - R_0)^2}{b^2} + \frac{z^2}{a^2} = 1$$ in the $xz$-plane. We can produce the formula for the surface of revolution generated by rotating this ellipse about the $z$-axis by replacing $x$ with the radial variable $\sqrt{x^2 + y^2}$:
$$\frac{\left(\sqrt{x^2 + y^2} - R_0\right)^2}{b^2} + \frac{z^2}{a^2} = 1.$$
A point $(x, y, z)$ is inside the elliptical torus iff the LHS of the previous display is $< 1$.
A: You can obtain this as follows.
If you start with a slice where $y = 0$, you begin with the equation
$$
\frac{z^2}{a^2} + \frac{(x - R_0)^2}{b^2} - 1 = 0
$$
However, this doesn't give you the rotated version; to rotate it about the $z$-axis, simply replace the $x$ by $\sqrt{x^2 + y^2}$, yielding
$$
\frac{z^2}{a^2} + \frac{\Big(\sqrt{x^2 + y^2} - R_0\Big)^2}{b^2} - 1 = 0
$$
This is a little unsatisfying though, since polynomials are much nicer than radicals. However, a little bit of manipulation yields
$$
\frac{z^2}{a^2} + \frac{x^2 + y^2 + R_0^2}{b^2} - \frac{2R_0}{b^2}\sqrt{x^2 + y^2} - 1 = 0
$$
which, if you isolate the radical and square both sides yields
$$
\bigg(\frac{z^2}{a^2} + \frac{x^2 + y^2 + R_0^2}{b^2} - 1\bigg)^2 - \frac{4R_0^2}{b^4}(x^2 + y^2) = 0
$$
Voila, a polynomial!
