这就是我想要的。双曲面上的直线定义为:γ(θ)±(t):=a(0,cosθ,sinθ)+at(1,∓sinθ,±cosθ),其中 a=1,t 从 -inf 到 inf,theta 从 0 到 2pi。不知为何我无法完成。此外,如果在 xy 平面上有一个网格,并且在圆锥的网格上没有垂直线(当然函数除外 ;)),那就太好了。
提前致谢。
\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{decorations.markings,positioning,arrows,shapes}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
view={25}{25},
axis lines = middle,
height = 12cm,
width = 12cm,
xmin=-4,xmax=5,
ymin=-4,ymax=5,
zmin=-2,zmax=3,
xtick=\empty, ytick=\empty, ztick=\empty,
xlabel={$x^{2}$},
ylabel={$x^{1}$},
zlabel={$t$},
]
% x^2+y^2-z^2=1
\addplot3[mesh,blue,domain=1:2,y domain=0:2*pi,samples=30]({x*cos(deg(y))},{x*sin(deg(y))},{sqrt(x^2-1)});
\addplot3[mesh,blue,domain=1:2,y domain=0:2*pi,samples=30]({x*cos(deg(y))},{x*sin(deg(y))},{-sqrt(x^2-1)});
\addplot3[red,thick,domain=-2:2,samples=30]({x},{cos(0)-x*sin(0)},{sin(0)+x*cos(0)});
\addplot3[red,thick,domain=-2:2,samples=30]({x},{cos(0)+x*sin(0)},{sin(0)-x*cos(0)});
\addplot3[red,thick,domain=-2:2,samples=30]({x},{cos(pi)-x*sin(pi)},{sin(pi)+x*cos(pi)});
\addplot3[red,thick,domain=-2:2,samples=30]({x},{cos(pi)+x*sin(pi)},{sin(pi)-x*cos(pi)});
\end{axis}
\end{tikzpicture}
\end{document}
答案1
\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\newcommand{\ViewAzimuth}{20}
\newcommand{\ViewElevation}{10}
\begin{axis}[
view={\ViewAzimuth}{\ViewElevation},
axis lines=none,
xmin=-2, xmax=2,
ymin=-2, ymax=2,
zmin=-2, zmax=2,
trig format plots=rad,
line join=round,
colormap/violet,
mesh/interior colormap={CM}{color=(lightgray) color=(white) color=(lightgray)},
]
\addplot3[
surf, z buffer=sort,
domain=0:2*pi, samples=50, variable=v,
domain y=-1:1, samples y=50, variable y=z,
]({cos(v)-z*sin(v)},{sin(v)+z*cos(v)},{z});
\foreach[parse=true] \a in {3/2*pi}{
\addplot3[red, thick, domain=-1:1, samples=2, variable=t, samples y=1]
({cos(\a)-t*sin(\a)},{sin(\a)+t*cos(\a)},t);
}
\draw[red, thick] (0,0,1) circle[radius=sqrt(2)];
\draw[red, thick] (0,{-sqrt(2)},-1) arc[radius=sqrt(2), start angle=-90, end angle=\ViewAzimuth];
\draw[red, thick] (0,{-sqrt(2)},-1) arc[radius=sqrt(2), start angle=-90, end angle=-180+\ViewAzimuth];
\end{axis}
\end{tikzpicture}
\end{document}
答案2
我认为这与所示的图片足够接近(看到在 OP 代码中mesh
使用了该选项)并且直接用 Ti 绘制非常容易钾Z。
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{3d,perspective}
\begin{document}
\begin{tikzpicture}[red,line cap=round,line join=round,3d view={110}{25}]
\def\h{2}
% grid
\begin{scope}[canvas is xy plane at z=-\h]
\fill[gray!5] (-3,-3) rectangle (3,3);
\draw[gray] (-3,-3) grid (3,3);
\end{scope}
% circles
\foreach\i in {-1,-0.8,...,1}
\draw[canvas is xy plane at z=\i*\h] (0,0) circle ({sqrt(1+\i*\i*\h*\h)});
% lines
\foreach\i in {0,15,...,359} \foreach\j in{-1,1}
\draw ({cos(\i)+\j*\h*sin(\i)},{sin(\i)-\j*\h*cos(\i)},-\h) --
({cos(\i)-\j*\h*sin(\i)},{sin(\i)+\j*\h*cos(\i)}, \h);
\end{tikzpicture}
\end{document}
答案3
这里我们有一个圆(或椭圆)作为底面。顶部是一个移位的底面。设是底面上A
一个相对点,相对时间在底面上;将相对时间从移动到 得到顶部的一个点;然后画一条直线。这样就得到了一个单叶双曲面。t
t
t+phase
B
A--B
这些线条A--B
本身就构成了一个好看的图案。水平圆圈似乎没有必要。代码在渐近线绘图语言。
如果我们想要对双曲面及其上的直线的精确表达感兴趣,那么只需使用双曲面的参数方程进行一些数学计算。
// http://asymptote.ualberta.ca/
//import three;
import grid3;
unitsize(2cm);
currentprojection=orthographic(2.5,1,.9,zoom=.9);
path3 Cbase=unitcircle3;
path3 Ctop=shift(0,0,1.5)*Cbase;
draw(Cbase^^Ctop,blue+1pt);
real phase=.35;
for (real t=0; t<1; t=t+.02) {
triple A=relpoint(Cbase,t);
triple B=relpoint(Ctop,t+phase);
draw(A--B,lightblue);
}
// grid on XY-plane
real a=2;
limits((-a,-a,0),(a,a,0));
pen p=lightred+opacity(.5);
grid3(XYXgrid,Step=1,step=.5,p,p);