10

Is there any built-in functionality in TiKz/PGF that allows for drawing quadric surfaces, i.e. surfaces given by the equation

Ax^2 + By^2 + Cz^2 + Dz = E?

I'm aware of the raw gnuplot command enabling the use of virtually every gnuplot command (at least to my knowledge).

I tried using the following command:

\begin{tikzpicture}  
\draw[thick] plot[raw gnuplot] function{set urange [0:2*pi]; set vrange [0:pi]; set parametric; set isosample 40; splot cos(u)*sin(v)/3, sin(u)*sin(v), cos(v)};  
\end{tikzpicture}

but the result is less than satisfactory.

1
  • welcome to TeX and friends! I hope you enjoy your stay here. Use four spaces inthe begining of a line (or select and click the 10101 button) to create a "code" section and please note that as your badge appears at the end of your entry, there's no need to sign-off. Commented Jan 25, 2011 at 11:41

2 Answers 2

8

You might be interessted in PGFplots (see: pgfplots.sf.net)

  \begin{tikzpicture}
    \begin{axis}[
         3d box=background,
      % pretty printing, but irrelevant:
   title={3d box=background},
   samples=5,
   domain=-4:4,
   xtick=-4:4,
   ytick=-4:4,
  ]
  \addplot3[surf] {1*x*y};
 \end{axis}
\end{tikzpicture}

In the official documentation of PGFplots, therer's are some options mentioned about parametric ploting:

  • /pgfplots/parametric
  • /pgfplots/parametric/var 1d
  • /pgfplots/parametric/var 2d

With PGFplots you can use GNUplot aswell:

\begin{tikzpicture}
  \begin{axis}
    \addplot3 gnuplot[raw gnuplot] {set parametric;splot[t=0:6*pi] cos(t),sin(t),t/2*pi};
  \end{axis}
\end{tikzpicture}
0
4

with pst-solides3d which allows hidden surfaces. Here is only the code for the first example. Can be run with xelatex if you need a pdf output

\documentclass{minimal}
\usepackage{pst-solides3d,pgfplots}

\begin{document}

\psset{viewpoint=30 90 0 rtp2xyz,lightsrc=viewpoint,Decran=90}
\begin{pspicture}(-3,-3)(3,3)
\defFunction[algebraic]{Func}(u,v){cos(u)*sin(v)/3}{sin(u)*sin(v)}{cos(v)}
\psSolid[object=surfaceparametree,
  base=0 pi dup add 0 pi,
  function=Func,linewidth=0.5\pslinewidth,ngrid=25]
\end{pspicture}

\end{document}

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .