Solution (source code)

= Solution

For $ab\ne0$, elimination of the trigonometric parameter gives
$$
\boxed{\frac{x^2}{a^2}+\frac{y^2}{b^2}=1.}
$$
As real $\theta$ varies, the whole <ellipse> is traced, with semiaxes $|a|,|b|$. Signs of $a,b$ affect the traversal direction but not the set. If $a=0$, the locus is the vertical segment $x=0$, $|y|\leq|b|$; if $b=0$, it is the horizontal segment $y=0$, $|x|\leq|a|$. Both zero give only the origin.