
円柱を描く方法を探していたのですが、方法が見つからないようです。次の暗黙の関数から座標を取得し、pgfplots を使用して描画するにはどうすればよいですか? または、行列形式を使用してプロットする方法はありますか?
$$1=q(x,y,z)=(x,y,z) \begin{bmatrix}
2& -1 & -1\\
-1 & 2 & -1\\
-1 &-1 &2
\end{bmatrix} (x,y,z)^T$$
答え1
この種の無限に拡大する退化した楕円体をパラメーター化できます (これは数学です!)。私はあなたのためにこれを行いました。
プロット間の偽の3Dを処理するために、シリンダーを2回描画する必要があります。線を"内部"シリンダー。
シリンダーを 1 つ取り外すのは練習として残しておきます。
出力
コード
\documentclass[12pt,tikz,border=0pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset%{{{
{
mySurface/.style =
{
mesh, % there should be better options : look at the PGFplots manual
opacity=.1,
}
}
%}}}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
%{{{
width=30cm,
xticklabels=\empty,
yticklabels=\empty,
zticklabels=\empty,
samples = 2, % for the lines
samples y = 100, % for the circles
% limits of the box
xmin = -12, xmax = 12,
ymin = -12, ymax = 12,
zmin = -12, zmax = 12,
unit vector ratio = 1 1 1,
% parametrize the 3d view
view/az=15,
view/h=80,
%length of the cylinder
domain = -8:8,
%}}}
]
\def\X{\r*cos(y)-\r*sin(y) + x}
\def\Y{-\r*cos(y)-\r*sin(y) + x}
\def\Z{2 * \r*sin(y) + x}
\def\r{2}
\addplot3[mySurface,domain y= 90:270] ({\X},{\Y},{\Z});
\def\r{1}
\addplot3[mySurface,domain y= 90:270] ({\X},{\Y},{\Z});
\addplot3[domain=-12:12, samples=2, blue, thick] (x,x,x);
\addplot3[mySurface,domain y= -90:90] ({\X},{\Y},{\Z}); ;
\def\r{2}
\addplot3[mySurface,domain y= -90:90] ({\X},{\Y},{\Z}); ;
\end{axis}
\end{tikzpicture}
\end{document}