
答案1
我認為隱式曲面可以在 Ti 中繪製草圖kZ 當可以繪製水平曲線(或其他超平面部分)時。對於表面xyz - x - y - z + 2 = 0(事實上對於任何值西塔在問題中),水平曲線是雙曲線,繪製它們並不困難。
一些評論
我更改了座標以使奇點位於原點,即我考慮了由xyz + xy + yz + zx = 0。這只是前一篇的翻譯。
看看給的例子,我只代表了表面的「片」;明確地,我考慮了立方體中的表面部分[-1, 5]^3並且僅被每個分支的一個分支掃除z=h雙曲線。
為了z=0雙曲線退化為兩條線的並集。為了z=-1它再次退化成兩條線,但其中一條處於無窮遠。由於這些原因,電平曲線的繪製取決於z。在附近-1由於 Ti 的限制,事情變得更加微妙kZ很容易到達。例如,如果對或
\foreach
執行第一個,則獲得的曲線不是“真實的”(或至少是預期的曲線)。\i=1
\i=2
程式碼可能看起來很長,但重要的是
\foreach
繪製圖形的前兩個命令z=h水平曲線。之後,只需複製和修改它們即可獲得x=h和y=h水平曲線。雙曲線的每個分支都被繪製為參數化曲線;計算參數的邊界以僅取得立方體內部的部分。
程式碼
\documentclass[margin=.5cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{math}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d}
\usetikzlibrary{arrows.meta}
\begin{document}
\xdefinecolor{Cy}{RGB}{17, 170, 187}
\xdefinecolor{VB}{RGB}{102, 25, 240}
\tikzmath{
integer \N-, \N+;
\N- = 12;
\N+ = 50;
real \a;
\a = 5;
}
\tikzset{
pics/level curve+/.style args={height=#1, varbound=#2, color=#3}{%
code={%
\draw[#3, variable=\t, domain=-#2:#2, samples=40]
plot ({#1/(#1 +1)*(exp(\t) -1)}, {#1/(#1 +1)*(exp(-\t) -1)});
}
},
pics/level curve-/.style args={height=#1, varbound=#2, color=#3}{%
code={%
\draw[#3, variable=\t, domain=-#2:#2, samples=40]
plot ({-#1/(#1 +1)*(exp(\t) +1)}, {-#1/(#1 +1)*(exp(-\t) +1)});
}
}
}
\begin{tikzpicture}
\tdplotsetmaincoords{76}{67}
\begin{scope}[tdplot_main_coords]
% axes first part
\draw (-1, 0, 0) -- (\a +.2, 0, 0);
\draw (0, -1, 0) -- (0, \a +.2, 0);
\draw (0, 0, -1) -- (0, 0, \a +.2);
%%% $z=h$ level curves
% close to $0^-$
\foreach \i
[evaluate=\i as \h using {-(\N- +1 -\i)/(\N- +1))*\a/(\a +1)},
evaluate=\i as \b using {ln(-(\h +1)*\a/\h -1)}]
in {1, 2, 3, 4, ..., \N-}{
\path[canvas is xy plane at z=\h, transform shape] (0, 0)
pic {level curve-={height=\h, varbound=\b, color=Cy}};
}
% $h=0$
\draw[Cy, canvas is xy plane at z=0] (0, \a) |- (\a, 0);
% $h>0$
\foreach \i
[evaluate=\i as \h using {(\i/\N+)*\a},
evaluate=\i as \b using {ln((\h +1)*\a/\h +1)}]
in {1, 2, ..., \N+}{
\path[canvas is xy plane at z=\h, transform shape] (0, 0)
pic {level curve+={height=\h, varbound=\b, color=Cy}};
}
%%% $y=h$ level curves
% close to $0^-$
\foreach \i
[evaluate=\i as \h using {-(\N- +1 -\i)/(\N- +1))*\a/(\a +1)},
evaluate=\i as \b using {ln(-(\h +1)*\a/\h -1)}]
in {3, 4, ..., \N-}{
\path[canvas is xz plane at y=\h, transform shape] (0, 0)
pic {level curve-={height=\h, varbound=\b, color=Cy}};
}
% $h=0$
\draw[Cy, thin, canvas is xz plane at y=0] (0, \a) |- (\a, 0);
% $h>0$
\foreach \i
[evaluate=\i as \h using {(\i/\N+)*\a},
evaluate=\i as \b using {ln((\h +1)*\a/\h +1)}]
in {1, 2, ..., \N+}{
\path[canvas is xz plane at y=\h, transform shape] (0, 0)
pic {level curve+={height=\h, varbound=\b, color=Cy}};
}
%%% $x=h$ level curves
% close to $0^-$
\foreach \i
[evaluate=\i as \h using {-(\N- +1 -\i)/(\N- +1))*\a/(\a +1)},
evaluate=\i as \b using {ln(-(\h +1)*\a/\h -1)}]
in {3, 4, ..., \N-}{
\path[canvas is yz plane at x=\h, transform shape] (0, 0)
pic {level curve-={height=\h, varbound=\b, color=Cy}};
}
% $h=0$
\draw[VB, canvas is yz plane at x=0] (0, \a) |- (\a, 0);
% $h>0$
\foreach \i
[evaluate=\i as \h using {(\i/\N+)*\a},
evaluate=\i as \b using {ln((\h +1)*\a/\h +1)}]
in {1, 2, ..., \N+}{
\path[canvas is yz plane at x=\h, transform shape] (0, 0)
pic {level curve+={height=\h, varbound=\b, color=VB}};
}
%%% axes second part
\begin{scope}[arrows={->[length=1ex, width=1.5ex]}]
\draw (\a, 0, 0) -- (\a +2, 0, 0) node[pos=1.2] {$x$};
\draw (0, \a, 0) -- (0, \a +2, 0) node[pos=1.2] {$y$};
\draw (0, 0, \a) -- (0, 0, \a +2) node[pos=1.2] {$z$};
\end{scope}
\end{scope}
\end{tikzpicture}
\end{document}