
Asymptote
contour3
package draws 3D
surfaces described as the null space
of real-valued functions of (x, y, z). Note that the images here are
rendered into raster format (png).
% impsurf.tex :
%
\documentclass[10pt,a4paper]{article}
\usepackage{lmodern}
\usepackage{subcaption}
\usepackage[inline]{asymptote}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{asydef}
settings.outformat="png";
settings.render=8;
import graph3;
import contour3;
currentlight=light(gray(0.8),ambient=gray(0.1),specular=gray(0.7),
specularfactor=3,viewport=true,dir(42,48));
pen bpen=rgb(0.75, 0.7, 0.1);
material m=material(diffusepen=0.7bpen
,ambientpen=bpen,emissivepen=0.3*bpen,specularpen=0.999white,shininess=1.0);
\end{asydef}
%
\begin{document}
%
\begin{figure}
\captionsetup[subfigure]{justification=centering}
\centering
\begin{subfigure}{0.49\textwidth}
\begin{asy}
size(200,0);
currentprojection=orthographic(camera=(9,10,4),up=Z,target=O,zoom=1);
// ellipsoid
real f(real x, real y, real z) {return (x^2)/(2^2) + (y^2)/(3^2) + (z^2)/(2^2)-1;}
draw(surface(contour3(f,(-3,-3,-3),(3,3,3),32)),m
,render(compression=Low,merge=true));
xaxis3(Label("$x$",1),-4,4,red);
yaxis3(Label("$y$",1),-4,4,red);
zaxis3(Label("$z$",1),-4,4,red);
\end{asy}
%
\caption{$(\frac{x}{2})^2+(\frac{y}{3})^2+(\frac{z}{2})^2= 1$ (ellipsoid)}
\label{fig:1a}
\end{subfigure}
%
\begin{subfigure}{0.49\textwidth}
\begin{asy}
size(200,0);
currentprojection=orthographic(camera=(9,4,4),up=Z,target=O,zoom=1);
// hyperbolic cylinder
real f(real x, real y, real z) {return 2*x*y + 2*x*z-1;}
draw(surface(contour3(f,(-3,-3,-3),(3,3,3),32)),m
,render(compression=Low,merge=true));
xaxis3(Label("$x$",1),-4,4,red);
yaxis3(Label("$y$",1),-4,4,red);
zaxis3(Label("$z$",1),-4,4,red);
\end{asy}
%
\caption{$2xy + 2xz = 1$ (hyperbolic cylinder)}
\label{fig:1b}
\end{subfigure}
\caption{}
\label{fig:1}
\end{figure}
%
\end{document}
%
% Process:
%
% pdflatex impsurf.tex
% asy impsurf-*.asy
% pdflatex impsurf.tex