
又一次,有一個數字我似乎不太對。這是所需的輸出:
這是我到目前為止得到的:
這是一個 MWE,它產生了我得到的結果:
\documentclass[dvipsnames]{standalone}
\usepackage{tikz}
\usetikzlibrary{fit, calc, matrix, positioning, arrows.meta, intersections, through, backgrounds, patterns}
\begin{document}
\begin{tikzpicture}[node distance = 0pt, every pin/.style = {pin distance=11mm, pin edge={stealth-}}, every node/.style = {color=Blue!60!black}, dot/.style = {circle, fill=black, inner sep=0mm, minimum size=2mm, node contents={}}, line/.style = {-stealth, shorten >=1mm, shorten <= 1mm},]
\coordinate (s) at (3,3);
\coordinate (O) at (0,0);
\coordinate (P) at (-0.5,0.5);
\coordinate[right=55mm of O] (X);
\coordinate[above=55mm of O] (Y);
\coordinate[above right=1 and 2 of O] (d);
\coordinate[right=2 of X |- Y] (e);
\coordinate (a) at (10,10);
\draw[-latex] ([xshift=-0.1] O) -- (X) node[right] {$h_1$};
\draw[-latex] ([yshift=-0.1] O) -- (Y) node[above] {$h_2$};
\path[name path=S] (O) -- (45:6);
\coordinate[left =of s -| O] (s1);
\coordinate[below=of s |- O] (s2);
\draw[Blue,thick] let \p1 = ($(s)-(O)$), \n1 = {veclen(\x1,\y1)} in ($(O)+(\n1,0)$) arc(0:90:\n1);
\draw[Blue,thick] let \p1 = ($(s)-(P)$), \n1 = {veclen(\x1,\y1)} in ($(P)+(\n1,0)$) arc(0:83.5:\n1);
\node[dot,at=(s),pin=60:{$f(T,d)=f(S,d)$}];
\node[below] at (1,1) {$d$};
\node[below] at (1,4) {$S$};
\draw[fill] (1,1) circle (2pt);
\path[name path=D] (s2) -- (15:8);
\end{tikzpicture}
\end{document}
誰能幫我得到想要的輸出嗎?我擔心我錯過了一些相當愚蠢的東西,但我不知道它是什麼。預先感謝大家抽出時間。
答案1
您arc
從 x 軸上方開始 0.5,因為它的起點是(P)+(\n1,0)
,並且P
位於 (-0.5,0.5)。另外也可以從該點開始逆時針繪製曲線,將其向下延伸到軸,即
\draw[Blue,thick] let
\p1 = ($(s)-(P)$),
\n1 = {veclen(\x1,\y1)}
in
($(P)+(\n1,0)$) arc(0:83.4:\n1)
($(P)+(\n1,0)$) arc(0:-6.6:\n1);
但也許更簡單的方法是在through
庫的幫助下剪輯兩個圓圈,即
\begin{scope}
\clip (X) rectangle (Y);
\node [draw,thick,circle,Blue,circle through=(s)] at (O) {};
\node [draw,thick,circle,Blue,circle through=(s)] at (P) {};
\end{scope}
完整的程式碼,我刪除了一些未使用的元素,並進行了一些整理:
\documentclass[dvipsnames]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, positioning, arrows.meta, through}
\begin{document}
\begin{tikzpicture}[
node distance = 0pt,
every pin/.style = {pin distance=11mm, pin edge={Stealth-}},
every node/.style = {color=Blue!60!black},
dot/.style = {circle, fill=black, inner sep=0mm, minimum size=2mm, node contents={}},
]
\coordinate (s) at (3,3);
\coordinate (O) at (0,0);
\coordinate (P) at (-0.5,0.5);
\coordinate[right=55mm of O] (X);
\coordinate[above=55mm of O] (Y);
\draw[Latex-Latex] (Y) node[above] {$h_2$} -- (O) -- (X) node[right] {$h_1$};
%alternative 1
%\begin{scope}
%\clip (X) rectangle (Y);
%\node [draw,thick,circle,Blue,circle through=(s)] at (O) {};
%\node [draw,thick,circle,Blue,circle through=(s)] at (P) {};
%\end{scope}
% alternative 2
\draw[Blue,thick] let
\p1 = ($(s)-(O)$),
\n1 = {veclen(\x1,\y1)}
in
($(O)+(\n1,0)$) arc(0:90:\n1);
\draw[Blue,thick] let
\p1 = ($(s)-(P)$),
\n1 = {veclen(\x1,\y1)}
in
($(P)+(\n1,0)$) arc(0:83.4:\n1)
($(P)+(\n1,0)$) arc(0:-6.6:\n1);
% end alternative 2
%%%%%%%
\node[dot,at=(s),pin=60:{$f(T,d)=f(S,d)$}];
\node[dot,at={(1,1)},label=below:{$d$}];
\node[below] at (1,4) {$S$};
\end{tikzpicture}
\end{document}
計算角度
為了避免透過反覆試驗在程式碼中找到角度,您可以計算它們,請參見下面的範例。
\documentclass[dvipsnames,border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, positioning, arrows.meta, through,intersections}
\begin{document}
\begin{tikzpicture}[
node distance = 0pt,
every pin/.style = {pin distance=11mm, pin edge={Stealth-}},
every node/.style = {color=Blue!60!black},
dot/.style = {circle, fill=black, inner sep=0mm, minimum size=2mm, node contents={}},
]
\coordinate (s) at (3,3);
\coordinate (O) at (0,0);
\coordinate (P) at (-0.5,0.5);
\coordinate[right=55mm of O] (X);
\coordinate[above=55mm of O] (Y);
% note name path=axis
\draw[Latex-Latex,name path=axis] (Y) node[above] {$h_2$} -- (O) -- (X) node[right] {$h_1$};
\draw[Blue,thick] let
\p1 = ($(s)-(O)$),
\n1 = {veclen(\x1,\y1)}
in
($(O)+(\n1,0)$) arc[start angle=0,end angle=90,radius=\n1];
% define circle around P through s
\path[overlay,name path=circle] let
\p1 = ($(s)-(P)$),
\n1 = {veclen(\x1,\y1)}
in
(P) circle[radius=\n1];
% calculate angles between P and intersection points with circle and axis lines
\draw[Red,thick,name intersections={of=axis and circle,name=i}] let
\p1 = ($(i-1)-(P)$),
\p2 = ($(i-2)-(P)$),
\n1 = {veclen(\x1,\y1)},
\n2 = {atan2(\y1,\x1)},
\n3 = {atan2(\y2,\x2)}
in
(i-1) arc[radius=\n1,start angle=\n2,end angle=\n3];
\node[dot,at=(s),pin=60:{$f(T,d)=f(S,d)$}];
\node[dot,at={(1,1)},label=below:{$d$}];
\node[below] at (1,4) {$S$};
\end{tikzpicture}
\end{document}
答案2
為了不打擾計算,畫一個完整的圓,以及clip
我們感興趣的部分(右上象限)。
\documentclass[dvipsnames]{standalone}
\usepackage{tikz}
\usetikzlibrary{fit, calc, matrix, positioning, arrows.meta, intersections, through, backgrounds, patterns}
\begin{document}
\begin{tikzpicture}[node distance = 0pt, every pin/.style = {pin distance=11mm, pin edge={stealth-}}, every node/.style = {color=Blue!60!black}, dot/.style = {circle, fill=black, inner sep=0mm, minimum size=2mm, node contents={}}, line/.style = {-stealth, shorten >=1mm, shorten <= 1mm},]
\coordinate (s) at (3,3);
\coordinate (O) at (0,0);
\coordinate (P) at (-0.5,0.5);
\coordinate[right=55mm of O] (X);
\coordinate[above=55mm of O] (Y);
\coordinate[above right=1 and 2 of O] (d);
\coordinate[right=2 of X |- Y] (e);
\coordinate (a) at (10,10);
\draw[-latex] ([xshift=-0.1] O) -- (X) node[right] {$h_1$};
\draw[-latex] ([yshift=-0.1] O) -- (Y) node[above] {$h_2$};
\path[name path=S] (O) -- (45:6);
\coordinate[left =of s -| O] (s1);
\coordinate[below=of s |- O] (s2);
\draw[Blue,thick] let \p1 = ($(s)-(O)$), \n1 = {veclen(\x1,\y1)} in ($(O)+(\n1,0)$) arc(0:90:\n1);
\begin{scope}
\clip (X) rectangle (Y);
\draw[Blue,thick] let \p1 = ($(s)-(P)$), \n1 = {veclen(\x1,\y1)} in ($(P)+(\n1,0)$) arc(0:360:\n1);
\end{scope}
\node[dot,at=(s),pin=60:{$f(T,d)=f(S,d)$}];
\node[below] at (1,1) {$d$};
\node[below] at (1,4) {$S$};
\draw[fill] (1,1) circle (2pt);
\path[name path=D] (s2) -- (15:8);
\end{tikzpicture}
\end{document}
答案3
另一個可能的解決方案(基於您先前類似問題的經驗):
\documentclass[tikz,dvipsnames,margin=3mm]{standalone}
\usetikzlibrary{arrows.meta, backgrounds, calc, fit, intersections,
matrix, positioning,
through, patterns}
\begin{document}
\begin{tikzpicture}[node distance = 10mm and 20mm,
every pin/.style = {pin distance=11mm, pin edge={stealth-}},
every node/.style = {color=Blue!60!black},
dot/.style = {circle, fill=black, inner sep=0mm, minimum size=2mm, node contents={}},
line/.style = {-stealth, shorten >=1mm, shorten <= 1mm}
]
\coordinate (O) at (0,0);
\coordinate[above right=of O] (d);
% axis
\draw[-latex] (-0.1,0) -- (6.5,0) node[right] {$h_1$};
\draw[-latex] (0,-0.1) -- (0,5.5) node[above] {$h_2$};
% arc
\draw[Blue,thick,name path=A] (4.0,0) arc(0:90:4);
\draw[TealBlue,thick,name path=B] (4.5,0) arc(0:90:5 and 3.5);
% intersection, dashed S line
\draw[densely dashed, name intersections={of=A and B, by={s}}]
(s -| O) -| ( s|- O) node[pos=0.25,above] {$S$};
\node[dot,at=(s), pin=above right:{$f(T,d)=f(S,d)$}];
% d point
\node[dot,at=(d), label=below:$d$];
\end{tikzpicture}
\end{document}
附錄:如果S
和T
是 arcus 的名稱,而不是以下 MWE 顯示,該怎麼做:
\documentclass[tikz,dvipsnames,margin=3mm]{standalone}
\usetikzlibrary{arrows.meta, backgrounds, calc, fit, intersections,
matrix, positioning,
through, patterns}
\begin{document}
\begin{tikzpicture}[node distance = 10mm and 20mm,
every pin/.style = {pin distance=11mm, pin edge={stealth-}},
every node/.style = {color=Blue!60!black},
dot/.style = {circle, fill=black, inner sep=0mm, minimum size=2mm, node contents={}},
line/.style = {-stealth, shorten >=1mm, shorten <= 1mm}
]
\coordinate (O) at (0,0);
\coordinate[above right=of O] (d);
% axis
\draw[-latex] (-0.1,0) -- (6.5,0) node[right] {$h_1$};
\draw[-latex] (0,-0.1) -- (0,5.5) node[above] {$h_2$};
% arc
\draw[Blue,thick,name path=A] (4.0,0) arc(0:90:4) node[above right] {$S$};
\draw[TealBlue,thick,name path=B] (4.5,0) arc(0:90:4.5 and 3.5) node[above right] {$T$};
% intersection, dashed S line
\coordinate[densely dashed, name intersections={of=A and B, by={s}}];
\node[dot,at=(s), pin=75:{$f(T,d)=f(S,d)$}];
% d point
\node[dot,at=(d), label=below:$d$];
\end{tikzpicture}
\end{document}