以灰度形式再现两片双曲面 $− x^2/a^2 + y^2/b^2 − z^2/c^2 = 1$

以灰度形式再现两片双曲面 $− x^2/a^2 + y^2/b^2 − z^2/c^2 = 1$

我想以灰度形式重现两片双曲面 $− x^2/a^2 + y^2/b^2 − z^2/c^2 = 1$。

请帮忙。 在此处输入图片描述

下面我使用了以下参数化:

x = a * sinh(θ) * cos(ϕ),y = b * sinh(θ) * sin(ϕ),z = ±c * cosh(θ)

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        xlabel=$x$,
        ylabel=$y$,
        zlabel=$z$,
        domain=0:360,
        y domain=0:360,
        samples=30,
        view={60}{30},
    ]
        \addplot3[surf, shader=interp, variable=\u, variable y=\v] ({sinh(\u) * cos(\v)}, {sinh(\u) * sin(\v)}, {cosh(\u)});
          \addplot3[surf, shader=interp, variable=\u, variable y=\v] ({sinh(\u) * cos(\v)}, {sinh(\u) * sin(\v)}, -{cosh(\u)});
    \end{axis}
\end{tikzpicture}
\end{document}

我曾经用 colormap={bw}{gray(0cm)=(0); gray(1cm)=(1)}灰度图来获取该图,但它并不像给定的图那样突出。还需要绘制痕迹。

根据 John Kormylo 的建议进行编辑:

\documentclass[tikz, margin=40]{standalone}
\usetikzlibrary{patterns}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[scale=2]
    \pgfmathsetmacro{\e}{1.09}   % eccentricity
    \pgfmathsetmacro{\a}{3}
    \pgfmathsetmacro{\b}{(\a*sqrt((\e)^2-1)} 
    \draw plot[domain=-2:2] ({\a*cosh(\x)},{\b*sinh(\x)});
    \draw plot[domain=-2:2] ({-\a*cosh(\x)},{\b*sinh(\x)});
      \draw (11.34,0) ellipse (1.2cm and 4.7cm);
     \draw (-11.34,0) ellipse (1.2cm and 4.7cm);
     \draw[fill=gray] (7.34,0) ellipse (1.2cm and 2.85cm);
      \draw [color=black, line width = 0.6pt] (-5, -5) -- (5, 5) node [right] {$x$};
     \draw [color=black, line width = 0.6pt] (-14, 0) -- (14, 0) node [right] {$y$};
     \draw [color=black, line width = 0.6pt] (0, -5) -- (0, 5) node [right] {$z$};
     \draw plot[variable=\t,samples=1000,domain=-72.85:76.1] ({3*sec(\t)},{.2*tan(\t)});
     \draw [color=black, line width = 0.6pt] (10.115, -.66) -- (12.54, .835);
     \draw plot[domain=-1.89:2.1086] ({-3*cosh(\x)},{.2*sinh(\x)});
     plot[variable=\t,samples=1000,domain=-72.85:76.1] ({3*sec(\t)},{.2*tan(\t)});
     \draw [color=black, line width = 0.6pt] (-10.32, -.65) -- (-12.72, .825);
\end{tikzpicture}
\end{document}

答案1

这只是修改了使用的域。着色插值器似乎会任意选择哪一侧最近,因此我一次只绘制一侧。

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        xlabel=$x$,
        ylabel=$y$,
        zlabel=$z$,
        domain=0:2,
        samples=30,
        view={60}{20},
    ]
        \addplot3[surf, shader=interp, variable=\u, variable y=\v, y domain=90:270] ({sinh(\u) * cos(\v)}, {sinh(\u) * sin(\v)}, {cosh(\u)});
        \addplot3[surf, shader=interp, variable=\u, variable y=\v, y domain=-90:90] ({sinh(\u) * cos(\v)}, {sinh(\u) * sin(\v)}, {cosh(\u)});
        \addplot3[surf, shader=interp, variable=\u, variable y=\v, y domain=90:270] ({sinh(\u) * cos(\v)}, {sinh(\u) * sin(\v)}, {-cosh(\u)});
        \addplot3[surf, shader=interp, variable=\u, variable y=\v, y domain=-90:90] ({sinh(\u) * cos(\v)}, {sinh(\u) * sin(\v)}, {-cosh(\u)});
    \end{axis}
\end{tikzpicture}
\end{document}

演示

答案2

这是渐近线替代方案的起点。

在此处输入图片描述

// http://asymptote.ualberta.ca/
import graph3;
size(200,0);
currentprojection=orthographic(3,2,1,zoom=.9);
/////////////////////////////////////
// PART 2: the 2-surface hyperboloid
// x^2/a^2 + y^2/b^2 - z^2/c^2 = - 1
real a=1, b=1, c=1;
triple g(real u,real v) {
real x=a*sinh(v)*cos(u);
real y=b*sinh(v)*sin(u);
real z=c*cosh(v);
return (x,y,z);}
// more flexibe usage: g(u,v) for g((u,v))
triple g(pair P) {return g(P.x,P.y);}

// when v = constant 
typedef triple gvertical(real);
gvertical gv(real u) {
return new triple(real v) {
return g(u,v);
};}
// when u = constant
typedef triple ghorizontal(real);
ghorizontal gh(real v) {
return new triple(real u) {
return g(u,v);
};}

surface g2hyp=surface(g,(0,0),(2pi,2),12,8,Spline);
pen spen=yellow+opacity(.5);
draw(g2hyp,spen,meshpen=gray+.05pt);
transform3 t=zscale3(-1);
draw(t*g2hyp,spen,meshpen=gray+.05pt);

dot(O,red);
xaxis3("$x$",Arrow3);
yaxis3("$y$",Arrow3);
zaxis3("$z$",zmin=-4,zmax=6,Arrow3);

path3 ggv=graph(gv(u=1),-2,2,Spline);
draw(ggv^^t*ggv,red+1.5pt);
path3 ggv=ggv--cycle;   // important! need to be cyclic
surface s1=surface(ggv);
draw(s1,red+opacity(.3));

path3 ggh=graph(gh(v=1.6),0,2pi,Spline); 
path3 ggh=ggh..cycle;   // important! need to be cyclic
draw(ggh^^t*ggh,blue+1.5pt);
surface s2=surface(ggh);
draw(s2,blue+opacity(.3));

//surface s=surface(ggh);
//import patterns;
//add("hatch",hatch());
//draw(s,blue+pattern("hatch"));

//filldraw(project(ggh), pattern("hatch"));

相关内容