Peter
Sometimes, I see picture of an ellipsoid. I cannot draw it in 3d. How can I draw it?

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;}]
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}

![Screen Shot 2021-05-28 at 8.05.32 PM.png](/image?hash=79adc9586b8704c0dff987aa8348400feb9d9ce9c1fc1a216cded37ee9062552)

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.


Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.