Peter
Sometimes, I see picture of an ellipsoid. I cannot draw it in 3d. How can I draw it?
Top Answer
user 3.14159
There are excellent tools such as `asymptote`, which others on this site are more familiar with. If you do not want to use external tools, you can use `pgfplots` or "just" Ti*k*Z. With `pgfplots` it is as simple as the following code, which allow you to set the three half axes `a`, `b` and `c`.
```
\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[hide axis,unit vector ratio=1 1 1,
width=12cm,
declare function={a=2;b=1.5;c=1;}]
\addplot3[surf,shader=interp,colormap/blackwhite,
samples=51,samples y=51,
z buffer=sort,domain=0:360,domain y=-90:90]
({a*cos(x)*cos(y)},{b*sin(x)*cos(y)},{c*sin(y)});
\end{axis}
\end{tikzpicture}
\end{document}
```

Notice that the shading is not lighting but controlled by `point meta`, the default value of which is `z`. If you want realistic shading, most likely `asymptote` is your number one choice. If you want to draw it with Ti*k*Z one would have to work out the projection, which may well be done somewhere already.