home archives github knives links
tags latex tikz
categories
only title title and content
tikz笔记

overleaf:https://www.overleaf.com/learn/latex/LaTeX_Graphics_using_TikZ:_A_Tutorial_for_Beginners_(Part_3)%E2%80%94Creating_Flowcharts

\begin{tikzpicture}[very thick]
\draw[style={draw=blue!50, fill=blue!20,}] (0,0) ellipse [x radius=2cm, y radius=2cm];
\coordinate [label=center:{$G$}] (A) at (-1.2,0);
\draw[style={draw=red!50, fill=red!20, opacity=0.7,}] (0.2,-0.7) ellipse [x radius=1.2cm, y radius=1.1cm];
\coordinate [label=center:{$N$}] (A) at (0.2,-0.9);
\draw[style={draw=green!50, fill=green!20, opacity=0.7,}] (0.2,0.7) ellipse [x radius=1.2cm, y radius=1.1cm];
\coordinate [label=center:{$H$}] (A) at (0.2,0.9);
\coordinate [label=center:{$H\cap N$}] (A) at (0.2,0);
\end{tikzpicture}
\begin{tikzpicture}[
%overlay, remember picture
]
\coordinate (a0) at ( 0.3, 0.2);
\coordinate (b0) at ( 3.3, 1.2);
\coordinate (c0) at ( 4.1,-1.3);
\coordinate (d0) at ( 8.1,-0.3);
\draw (c0) -- (a0);
\draw (c0) -- (d0);
\draw[style={draw=green!50, fill=green!20,}](a0)ellipse[radius=1];
\draw[style={draw=green!50, fill=green!20,}](b0)ellipse[radius=1];
\draw[style={draw=green!50, fill=green!20,}](c0)ellipse[radius=1.3];
\draw[style={draw=green!50, fill=green!20,}](d0)ellipse[radius=1.3];

%\draw[style={draw=red!50, fill=red!20,}] (2,-4) ellipse [radius=0.2];
%\coordinate [label=center:{表示牛逼的点}] (info1) at (2,-5);
%\draw[style={draw=blue!50, fill=blue!20,}] (8,-4) ellipse [radius=0.2];
%\coordinate [label=center:{表示不牛逼的点}] (info2) at (8,-5);
\coordinate (a1) at ( 0 , 0 );
\coordinate (b1) at ( 0 , 0.7);
\coordinate (c1) at ( 0.8, 0.5);
\coordinate (d1) at ( 0.5,-0.2);
\draw (a1) -- (b1);
\draw (a1) -- (c1);
\draw (a1) -- (d1);
\coordinate (a2) at ( 0 +3, 0 +1);
\coordinate (b2) at ( 0 +3, 0.7+1);
\coordinate (c2) at ( 0.8+3, 0.5+1);
\coordinate (d2) at ( 0.5+3,-0.2+1);
\draw (a2) -- (b2);
\draw (a2) -- (c2);
\draw (a2) -- (d2);
\coordinate (a3) at (-3.9+8,-1.1);
\coordinate (b3) at (-3.2+8,-2.0);
\coordinate (c3) at (-4.5+8,-0.9);
\coordinate (d3) at (-4.4+8,-2.1);
\coordinate (e3) at (-3.0+8,-1.1);
\draw (a3) -- (b3);
\draw (a3) -- (c3);
\draw (a3) -- (d3);
\draw (a3) -- (e3);
\coordinate (a4) at (12-3.9,-1.1+1);
\coordinate (b4) at (12-3.2,-2.0+1);
\coordinate (c4) at (12-4.5,-0.9+1);
\coordinate (d4) at (12-4.4,-2.1+1);
\coordinate (e4) at (12-3.0,-1.1+1);
\draw (a4) -- (b4);
\draw (a4) -- (c4);
\draw (a4) -- (d4);
\draw (a4) -- (e4);

\draw[style={draw=blue!50, fill=blue!20,}](a1)ellipse[radius=0.2];
\draw[style={draw=blue!50, fill=blue!20,}](b1)ellipse[radius=0.2];
\draw[style={draw=blue!50, fill=blue!20,}](c1)ellipse[radius=0.2];
\draw[style={draw=blue!50, fill=blue!20,}](d1)ellipse[radius=0.2];

\draw[style={draw= red!50, fill= red!20,}](a2)ellipse[radius=0.2];
\draw[style={draw=blue!50, fill=blue!20,}](b2)ellipse[radius=0.2];
\draw[style={draw=blue!50, fill=blue!20,}](c2)ellipse[radius=0.2];
\draw[style={draw=blue!50, fill=blue!20,}](d2)ellipse[radius=0.2];

\draw[style={draw= red!50, fill= red!20,}](a3)ellipse[radius=0.2];
\draw[style={draw=blue!50, fill=blue!20,}](b3)ellipse[radius=0.2];
\draw[style={draw=blue!50, fill=blue!20,}](c3)ellipse[radius=0.2];
\draw[style={draw=blue!50, fill=blue!20,}](d3)ellipse[radius=0.2];
\draw[style={draw=blue!50, fill=blue!20,}](e3)ellipse[radius=0.2];

\draw[style={draw=blue!50, fill=blue!20,}](a4)ellipse[radius=0.2];
\draw[style={draw=blue!50, fill=blue!20,}](b4)ellipse[radius=0.2];
\draw[style={draw=blue!50, fill=blue!20,}](c4)ellipse[radius=0.2];
\draw[style={draw=blue!50, fill=blue!20,}](d4)ellipse[radius=0.2];
\draw[style={draw=blue!50, fill=blue!20,}](e4)ellipse[radius=0.2];
\end{tikzpicture}
\begin{tikzpicture}[
a/.style={circle,draw=blue!50,fill=blue!20,very thick,minimum size=10mm},
b/.style={circle,draw=green!50,fill=green!20,very thick,minimum size=10mm}
]
\node[a,label={[shift={(0,-2)}]1}] (n1) at (0, 0){a};
\node[a,label={[shift={(0,-2)}]2}] (n2) at (2, 0){a};
\node[b,label={[shift={(0,-2)}]3}] (n3) at (4, 0){b};
\node[a,label={[shift={(0,-2)}]4}] (n4) at (6, 0){a};
\node[b,label={[shift={(0,-2)}]5}] (n5) at (8, 0){b};
\draw[->,thick](n1) to (n2);
\draw[->,thick](n2) to (n3);
\draw[->,thick](n3) to (n4);
\draw[->,thick](n4) to (n5);
\draw[shorten >= 0pt,->,thick](n2) to[in=150,out=30,loop,looseness=4.8]node[midway,above]{a}(n2);
\draw[->,thick](n4) to[in=-30,out=-150]node[midway,below]{a}(n2);
\end{tikzpicture}
\newfontfamily\DejaVu{DejaVu Sans Mono for Powerline}
\def\Font#1{\fontsize{#1}{\baselineskip}\DejaVu\textbf}
\begin{tikzpicture}[remember picture, overlay]
\node [shift={(0cm,-3cm)}] at (current page.north west)
{%
\begin{tikzpicture}[remember picture, overlay]
\draw [fill=gray] (0,3) -- (3,3) -- (0,0) -- cycle ;
\draw [fill=white] (0,3) -- (2,3) -- (0,1) -- cycle ;
\draw (0,0) to node[midway, above, rotate=45] {\textcolor{white}{\Font{9}{fork me on github}}} (3,3) ;
\draw (0,1) to node[midway, above, rotate=45] {\includegraphics[width=.05\textwidth]{pictures/github}} (2,3) ;
\end{tikzpicture}
};
\end{tikzpicture}
\usetikzlibrary{
arrows.meta,
calc,
fit,
positioning,
quotes
}

\definecolor{G1}{RGB}{200, 200, 200}

\makeatletter
\tikzset{
% 矩形
meta box/.style = {
draw = black,
thick,
text centered
},
% 圆角矩形
punkt/.style = {
meta box,
rectangle,
rounded corners,
inner sep = 5pt,
minimum height = 3em,
minimum width = 6em,
align = center,
text width = 6em
},
arrows/.style = {
-{Stealth[length = 0pt 5]}
},
% 虚线框
every fit/.style = {
inner sep = 5pt,
draw = G1,
thick,
dashed,
}
}
\makeatother

\begin{tikzpicture}[scale = 0.47, transform shape, font=\huge, node font=\huge]
%% 拍摄, 操作元
\node[punkt]
(A) {obtain images};
\node[punkt, below = 0.5 of A]
(B) {detect posture};
\node[punkt, right = 0.5 of B]
(C) {adjust angles};

%% 拍摄
\path[arrows={->}]
(B) edge (C);
\node[
fit = (A) (B) (C),
label={[anchor=south]:{Photo Capturing}}]
(AA) {};

%% 拼接, 操作元
\node[punkt, right = 2.5 of AA]
(D) {feature detect and match};
\node[punkt, right = 1.5 of D]
(E) {similarity transform};
\node[punkt, above = 0.5 of E]
(F) {compute APAP vertices};
%% 网格优化 , 优化项
\node[punkt, right = 1.5 of F]
(G) {alignment term};
\node[punkt, right = 1.5 of E]
(H) {similarity transformation term};
\node[punkt, below = 0.5 of H]
(I) {local similarity term};
%% 网格优化
\node[fit = (G) (H) (I)]
(BB) {};
\node[style = {rectangle}, above = 0.1 of BB]
(J) {Mesh Optimization};
%% 拼接, 其余操作
\node[punkt, right = 1.5 of H]
(K) {seam finder};
\node[punkt, right = 0.5 of K]
(L) {texture mapping};

%% 拼接
\path[arrows={->}]
(D) edge node[above, near start]{$F^{ij}$} (E);
\path[arrows={-}, draw, out = 0, looseness = 1.5]
(D) to[in = 270]
($(D)!0.5!(F)$)[out = 90] to[in = 180] (F);
\path[arrows={->}]
(E) edge
node[above]{$V^{ij}$}
node[below]{$T^i$}
(H);
\path[arrows={->}]
(F) edge node[above]{$u_i, Q$} (G);
\path[arrows={->}, draw, out = 0, looseness = 1.5]
(G) to[in = 90]
node[above, near start]{$\varPhi_a$}
($(G)!0.5!(K)$)[out = 270] to[in = 180] (K);
\path[arrows={->}]
(H) edge
node[above, near start]{$\varPhi_s$}
node[above, near end]{$\tilde{P}$}
(K);
\path[arrows={->}, draw, out = 0, looseness = 1.5]
(I) to[in = 270]
node[below, near start]{$\varPhi_l$}
($(I)!0.5!(K)$)[out = 90] to[in = 180] (K);
\path[arrows={->}]
(K) edge (L);
\node[
fit = (D) (F) (G) (BB) (J) (K) (L),
label={[anchor=south]:{Image Stitching}}]
(CC) {};

%% 结果
\node[punkt, right = 1 of CC]
(DD) {Panorama};

%% 框架箭头
\path[arrows={->}, thick]
(AA) edge
node[above]{$I_1, I_2 \cdots I_n, J$}
node[below]{$\theta^i_1, \theta^i_2 \cdots \theta^i_n$}
(CC);
\path[arrows={->}, thick]
(CC) edge (DD);
\end{tikzpicture}
\usetikzlibrary{
arrows.meta,
calc,
fit,
positioning,
quotes,
angles
}


\begin{tikzpicture}
% 坐标系
\coordinate (x) at (-3.7, -3.7);
\coordinate (y) at (5.2, 0);
\coordinate (z) at (0, 5.2);
\coordinate (O) at (0, 0);
\node[below] at (x){$x$};
\node[right] at (y){$y$};
\node[above] at (z){$z$};
\node[shift={(0.2, 0.2)}] at (O){$O$};
\draw[->] (O) -- (y);
\draw[->] (O) -- (z);
\draw[->] (O) -- (x);

% 画刻度
\foreach \x in {1,...,4}
{
\draw[xshift=\x cm] (0, 0) -- (0, 0.1);
\draw[yshift=\x cm] (0, 0) -- (0.1, 0);
\draw[xshift=-\x*0.6 cm, yshift=-\x*0.6 cm] (0, 0) -- (0, 0.1);
};

% 标x轴刻度值
\foreach \y in {1, 2, ..., 4}
\node[below] at(\y,0){\y};
% 标注y轴刻度
\foreach \y in {1, 2, ..., 4}
\node[left] at(0,\y){\y};
% 标注z轴刻度
\foreach \z in {1, 2, ..., 4}
\node[right] at(-\z*0.6, -\z*0.6){\z};
\end{tikzpicture}

\begin{tikzpicture}
% 坐标系
\coordinate (x) at (-3.7, -3.7);
\coordinate (y) at (5.2, 0);
\coordinate (z) at (0, 5.2);
\coordinate (O) at (0, 0);
\node[below] at (x){$x$};
\node[right] at (y){$y$};
\node[above] at (z){$z$};
\node[shift={(0.2, 0.2)}] at (O){$O$};
\draw[->] (O) -- (y);
\draw[->] (O) -- (z);
\draw[->] (O) -- (x);

% 球
\draw (0, 0) circle (4);

% 随机坐标
\coordinate (I1) at (2.3, 1.7);
\coordinate (I2) at (0.3, -3);
\coordinate (I3) at (-3, -0.3);
\node[shift={(0.2, 0.2)}] at (I1){$I_1$};
\node[shift={(0.2, 0.2)}] at (I2){$I_2$};
\node[shift={(0.2, 0.2)}] at (I3){$I_3$};
\fill[color = red](I1) circle (1pt);
\fill[color = red](I2) circle (1pt);
\fill[color = red](I3) circle (1pt);
\draw[dashed] (O) -- (I1);
\draw[dashed] (O) -- (I2);
\draw[dashed] (O) -- (I3);

% 北极
\coordinate (N) at (0, 4);
\node[shift={(0.2, 0.2)}] at (N){$N$};
\fill[color = black](N) circle (1pt);
% 平均坐标
\coordinate (A) at (-1, -0.3);
\node[shift={(0.2, 0.2)}] at (A){$A$};
\fill[color = black](A) circle (1pt);
\draw[dashed, color = blue] (O) -- (A);
\draw[->, color = blue] (A) -- (${3}*(A)$);
% 新北极
\coordinate (M) at (0.3, 3.9);
\coordinate (zz) at (${1.3}*(M)$);
\node[shift={(0.2, 0.2)}] at (M){$M$};
\fill[color = black](M) circle (1pt);
\draw[dashed, color = blue] (O) -- (M);
\draw[->, color = blue] (M) -- (zz);
\node[above] at (zz){$z'$};
\end{tikzpicture}

\begin{tikzpicture}
% 坐标系
\coordinate (x) at (-3.7, -3.7);
\coordinate (y) at (5.2, 0);
\coordinate (z) at (0, 5.2);
\coordinate (O) at (0, 0);
\node[below] at (x){$x$};
\node[right] at (y){$y$};
\node[above] at (z){$z$};
\node[shift={(0.2, 0.2)}] at (O){$O$};
\draw[->] (O) -- (y);
\draw[->] (O) -- (z);
\draw[->] (O) -- (x);

% 球
\draw (0, 0) circle (4);

% 随机坐标
\coordinate (I1) at (2.3, 1.7);
\node[shift={(0.2, 0.2)}] at (I1){$I_1$};
\fill[color = red](I1) circle (1pt);
\draw[dashed] (O) -- (I1);

% 北极
\coordinate (N) at (0, 4);
\node[shift={(0.2, 0.2)}] at (N){$N$};
\fill[color = black](N) circle (1pt);
% 新北极
\coordinate (M) at (0.3, 3.9);
\coordinate (zz) at (${1.3}*(M)$);
\node[shift={(0.2, 0.2)}] at (M){$M$};
\fill[color = black](M) circle (1pt);
\draw[dashed, color = blue] (O) -- (M);
\draw[->, color = blue] (M) -- (zz);
\node[above] at (zz){$z'$};

% 切面
\coordinate (w) at (2.5, 2);
\coordinate (h) at (-2, 3);
\coordinate (s1) at (2, -0.8);
\coordinate (s2) at ($(s1) + (w)$);
\coordinate (s3) at ($(s1) + (h)$);
\coordinate (s4) at ($(s1) + (w) + (h)$);
\draw (s1) -- (s2);
\draw (s1) -- (s3);
\draw (s4) -- (s2);
\draw (s4) -- (s3);

% 原始正北
\coordinate (h1) at (${0.3}*(h)$);
\coordinate (R) at ($(I1) + (h1)$);
\node[shift={(-0.2, -0.2)}] at ($(I1) + (h1)$){$R$};
\draw[->] (I1) -- (R);
% 新正北
\coordinate (h2) at (-0.5, 1);
\coordinate (S) at ($(I1) + (h2)$);
\node[shift={(0.2, 0.2)}] at ($(I1) + (h2)$){$S$};
\draw[->, color = blue] (I1) -- (S);
% 手机朝向
\coordinate (h3) at (1, 0.5);
\coordinate (Q) at ($(I1) + (h3)$);
\node[shift={(0.2, 0.2)}] at ($(I1) + (h3)$){$Q$};
\draw[->, color = red] (I1) -- (Q);

% 弧线
\pic[draw = black, angle radius = 15pt]{angle = Q--I1--R};
\pic[draw = blue, angle radius = 17pt]{angle = Q--I1--S};
\end{tikzpicture}