tensor_predictors/LaTeX/images/TorustangentSpace.tex

126 lines
4.4 KiB
TeX

\documentclass{standalone}
\usepackage{pgfplots} % TikZ (TeX ist kein Zeichenprogramm)
\usetikzlibrary{calc} % for vector arithmetics
\usepackage{amssymb, bm}
\renewcommand{\t}[1]{{#1}^{T}}
\newcommand{\mat}[1]{\boldsymbol{#1}}
\newcommand{\manifold}[1]{\mathfrak{#1}}
% PGF-Plot / TikZ config
\usetikzlibrary{%
calc, through, intersections, patterns, patterns.meta, pgfplots.colormaps
}
\pgfplotsset{
compat = newest,
colormap = {grayscale}{color=(lightgray) color=(white) color=(lightgray)},
colormap = {blackscale}{color=(black!70) color=(black!50) color=(black!70)},
colormap = {redscale}{color=(black!70!red) color=(black!50!red) color=(black!70!red)},
colormap = {bluescale}{color=(black!70!blue) color=(black!50!blue) color=(black!70!blue)},
}
\begin{document}
\begin{tikzpicture}[
>=latex,
scale = 1,
declare function = { % Note: NO spaces in function argument list!
X(\u,\v) = (2 + cos(\u)) * cos(\v);
Y(\u,\v) = (2 + cos(\u)) * sin(\v);
Z(\u,\v) = sin(\u);
tx(\u,\v,\x,\y) = - sin(\u) * cos(\u) * \x - (2 + cos(\u)) * sin(\v) * \y;
ty(\u,\v,\x,\y) = - sin(\u) * cos(\u) * \x + (2 + cos(\u)) * cos(\v) * \y;
tz(\u,\v,\x,\y) = + cos(\u) * \x;
}
]
\begin{axis}[
axis equal image,
hide axis,
view = {120}{30},
scale = 2
]
\addplot3[
surf,
shader = faceted interp,
samples = 20,
samples y = 40,
domain = 0:360,
domain y = 0:360,
z buffer = sort,
colormap name = grayscale,
thin
]
({X(\x, \y)}, {Y(\x, \y)}, {Z(\x, \y)});
% at = (1.433013, 2.482051, 0.5) // \u, \v = (30, 60)
% into = (-0.4330127, -0.4330127, 0.8660254)
% and = (-2.482051, 1.433013, 0)
% X <- c(1.433013, 2.482051, 0.5)
% dx <- c(-0.4330127, -0.4330127, 0.8660254)
% dy <- c(-2.482051, 1.433013, 0)
\addplot3[
mesh,
shader = interp,
patch type = line,
variable = t,
domain = -44:210.5,
samples = 64,
samples y = 1,
colormap name = redscale
]
({X(\t, \t + 30)}, {Y(\t, \t + 30)}, {Z(\t, \t + 30)});
\addplot3[
mesh,
shader = interp,
patch type = line,
variable = t,
domain = -50:119,
samples = 64,
samples y = 1,
colormap name = bluescale
]
({X(\t, -0.3 * \t + 69)}, {Y(\t, -0.3 * \t + 69)}, {Z(\t, -0.3 * \t + 69)});
\coordinate (x) at ({X(30, 60)}, {Y(30, 60)}, {Z(30, 60)});
\draw[dashed, fill = gray, opacity = 0.4] (
{X(30, 60) + tx(30, 60, 0.4 + 0.8, 0.4 - 0.24)},
{Y(30, 60) + ty(30, 60, 0.4 + 0.8, 0.4 - 0.24)},
{Z(30, 60) + tz(30, 60, 0.4 + 0.8, 0.4 - 0.24)}
) -- (
{X(30, 60) + tx(30, 60, -0.4 + 0.8, -0.4 - 0.24)},
{Y(30, 60) + ty(30, 60, -0.4 + 0.8, -0.4 - 0.24)},
{Z(30, 60) + tz(30, 60, -0.4 + 0.8, -0.4 - 0.24)}
) node[anchor = west, opacity = 1, outer sep=0.5em] {$T_{\mat{x}}\manifold{A}$} -- (
{X(30, 60) + tx(30, 60, -0.4 - 0.8, -0.4 + 0.24)},
{Y(30, 60) + ty(30, 60, -0.4 - 0.8, -0.4 + 0.24)},
{Z(30, 60) + tz(30, 60, -0.4 - 0.8, -0.4 + 0.24)}
) -- (
{X(30, 60) + tx(30, 60, 0.4 - 0.8, 0.4 + 0.24)},
{Y(30, 60) + ty(30, 60, 0.4 - 0.8, 0.4 + 0.24)},
{Z(30, 60) + tz(30, 60, 0.4 - 0.8, 0.4 + 0.24)}
) -- cycle;
\draw[->, black!50!red] (x) -- (
{X(30, 60) + tx(30, 60, 0.4, 0.4)},
{Y(30, 60) + ty(30, 60, 0.4, 0.4)},
{Z(30, 60) + tz(30, 60, 0.4, 0.4)}
) node[pos = 0.7, anchor = north west, inner sep = 0pt] {$\t{\nabla\gamma_1(0)}$};
\draw[->, black!50!blue] (x) -- (
{X(30, 60) + tx(30, 60, 0.8, -0.24)}, % -0.24 = 0.8 * -0.3
{Y(30, 60) + ty(30, 60, 0.8, -0.24)},
{Z(30, 60) + tz(30, 60, 0.8, -0.24)}
) node[pos = 0.7, anchor = south west, inner sep = 0pt] {$\t{\nabla\gamma_2(0)}$};
\node[anchor = north] at (x) {$\mat{x}$};
\node[circle, inner sep={1pt}, outer sep={0pt}, fill=black] at (x) {};
\end{axis}
\end{tikzpicture}
\end{document}