我正在尝试复制下图,该图与广义相对论中的矢量平行传输有关,在扭转空间中,两个矢量相加后如何交换会产生无法闭合的平行四边形,闭合之间的空间就是扭转的量度。
我的问题是,是否有一种方便的方法可以在曲线最顶端绘制与切向量平行的向量,然后在曲线的其余部分等距地绘制这些相等大小的平行向量?
我知道我可以借助一些 GUI(例如 TikZEdt)来实现这一点,但我仍然想知道是否有不使用 GUI 的解决方案。
我迄今为止的代码:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{graphicx}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
\begin{tikzpicture}[
tangent/.style={
decoration={
markings,% switch on markings
mark=
at position #1
with
{
\coordinate (tangent point-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,0pt);
\coordinate (tangent unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (1,0pt);
\coordinate (tangent orthogonal unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,1);
}
},
postaction=decorate
},
use tangent/.style={
shift=(tangent point-#1),
x=(tangent unit vector-#1),
y=(tangent orthogonal unit vector-#1)
},
use tangent/.default=1
]
\draw[
tangent=0,
tangent=0.125,
tangent=0.25,
tangent=0.375,
red,line width=1pt] (-0.8,-0.725) .. controls (-0.975,0.3) and (-0.825,1.6) .. (0.05,2.125) .. controls (0.95,1.825) and (1.425,0.525) .. (1.175,-0.65) .. controls (0.3,-0.825) and (0.05,-0.775) .. cycle;
\draw [blue, thick, use tangent, -stealth] (0,0) -- (1.1,0);
\draw [blue, thick, use tangent=2, -stealth] (0,0) -- (1.1,0);
\draw [blue, thick, use tangent=3, -stealth] (0,0) -- (1.1,0);
\draw [blue, thick, use tangent=4, -stealth] (0,0) coordinate (a) -- (1.1,0) coordinate (b);
\end{tikzpicture}
\end{document}
与绘制切向量有关的部分代码取自 Jake 在这篇文章中的回答:如何在 TikZ 中绘制路径上任意点的切线
答案1
如果您基本上想绘制与切线处绘制的矢量平行的矢量,则可以使用calc
节点并进行简单计算。对于曲线上的每个位置,您基本上取坐标,添加切线矢量的终点并减去其起点。
\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.markings,through,calc,angles,quotes}
\begin{document}
\begin{tikzpicture}[% ateb: https://tex.stackexchange.com/a/700977/ i gwestiwn SolidMark: https://tex.stackexchange.com/q/700974/ sy'n defnyddio côd o ateb Jake: https://tex.stackexchange.com/a/25940/
tangent/.style={
decoration={
markings,% switch on markings
mark=
at position #1
with
{
\coordinate (tangent point-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,0pt);
\coordinate (tangent unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (1,0pt);
\coordinate (tangent orthogonal unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,1);
}
},
postaction=decorate
},
use tangent/.style={
shift=(tangent point-#1),
x=(tangent unit vector-#1),
y=(tangent orthogonal unit vector-#1)
},
use tangent/.default=1
]
\draw[
tangent=0,
tangent=0.125,
tangent=0.25,
tangent=0.375,
red,line width=1pt] (-0.8,-0.725) coordinate (c0) coordinate (C)
.. controls (-0.975,0.3) and (-0.825,1.6) .. (0.05,2.125)
.. controls (0.95,1.825) and (1.425,0.525) .. coordinate [pos=0.3333] (c1) coordinate [pos=0.6667] (c2) (1.175,-0.65) coordinate (c3)
.. controls (0.3,-0.825) and (0.05,-0.775) ..
coordinate [pos=0.5] (c4) cycle ;
\draw [blue, thick, use tangent, -stealth] (0,0) -- (1.1,0) coordinate (A);
\draw [blue, thick, use tangent=2, -stealth] (0,0) -- (1.1,0);
\draw [blue, thick, use tangent=3, -stealth] (0,0) -- (1.1,0);
\draw [blue, thick, use tangent=4, -stealth] (0,0) coordinate (a) -- (1.1,0) coordinate (b);
\foreach \i in {0,...,4} \draw [blue,thick,-stealth] (c\i) -- ++($(b)-(a)$) coordinate (b\i);
\coordinate (B) at (b0);
\path pic [draw,"$\alpha$"] {angle=B--C--A};
\node [draw] at (0,0) [circle through={(a)}] {};
\end{tikzpicture}
\end{document}