我想添加一个坐标,v\cos(\gamma)
如果一条线从点开始,平行于我的线将位于P7
该坐标处。但我不确定如何将这两条线移动到与我的原始线平行的位置。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc, intersections, arrows}
\begin{document}
\begin{tikzpicture}[line cap = round, line join = round, >=triangle 45,
scale = 1.25]
\coordinate (O) at (0, 0);
\coordinate (P1) at ($(O) + (-30:1.5cm and .75cm)$);
\draw[-latex] (P1) arc (-30:310:1.5cm and .75cm) coordinate (P2);
\draw[-latex] (O) -- (0, 1.75) node[above, scale = .75] {\(\mathbf{h}\)};
\draw ($(P1)!.5!(P2)$) circle (.18cm) coordinate (P3);
\draw[blue] (O) -- ($(P3)!.18cm!(O)$) node[scale = .75, pos = .5,
fill = white, inner sep = 0cm] {\(\mathbf{r}\)} coordinate (P4);
\draw[dotted, blue, name path = line] (P4) -- ($(P4)!.36cm!(P3)$)
coordinate (P5);
\path[name path = aux] (P5) circle [radius = 1bp];
\draw[name intersections = {of = line and aux}, -latex, blue] (P5) --
($(intersection-1)!.5cm!(P5)$) node[scale = .75, shift = {(.25cm, -.2cm)}]
{\(v\cos(\gamma)\)};
\draw[dotted, name path = line2, blue] ($(P4)!.5!(P5)$) -- (P1)
coordinate (P6);
\path[name path = aux2] (P6) circle [radius = 1bp];
\draw[name intersections = {of = line2 and aux2}, -latex, blue] (P6) --
($(intersection-1)!.75cm!(P6)$) node[scale = .75, shift = {(.25cm, .2cm)}]
{\(v\sin(\gamma)\)} coordinate (P7);
\end{tikzpicture}
\end{document}
答案1
如果箭头的终点cos(\gamma)
称为P8
,则可以使用该calc
库来计算该箭头的起点和终点的差向量(P5
和P8
),然后将其用作相对坐标(使用+
运算符):
\draw [red, -latex] (P7) -- +($(P8)-(P5)$);
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, arrows, intersections}
\begin{document}
\begin{tikzpicture}[line cap = round, line join = round, >=triangle 45,
scale = 1.25]
\coordinate (O) at (0, 0);
\coordinate (P1) at ($(O) + (-30:1.5cm and .75cm)$);
\draw[-latex] (P1) arc (-30:310:1.5cm and .75cm) coordinate (P2);
\draw[-latex] (O) -- (0, 1.75) node[above, scale = .75] {\(\mathbf{h}\)};
\draw ($(P1)!.5!(P2)$) circle (.18cm) coordinate (P3);
\draw[blue] (O) -- ($(P3)!.18cm!(O)$) node[scale = .75, pos = .5,
fill = white, inner sep = 0cm] {\(\mathbf{r}\)} coordinate (P4);
\draw[dotted, blue, name path = line] (P4) -- ($(P4)!.36cm!(P3)$)
coordinate (P5);
\path[name path = aux] (P5) circle [radius = 1bp];
\draw[name intersections = {of = line and aux}, -latex, blue] (P5) --
($(intersection-1)!.5cm!(P5)$) coordinate (P8) node[scale = .75, shift = {(.25cm, -.2cm)}]
{\(v\cos(\gamma)\)};
\draw[dotted, name path = line2, blue] ($(P4)!.5!(P5)$) -- (P1)
coordinate (P6);
\path[name path = aux2] (P6) circle [radius = 1bp];
\draw[name intersections = {of = line2 and aux2}, -latex, blue] (P6) --
($(intersection-1)!.75cm!(P6)$) node[scale = .75, shift = {(.25cm, .2cm)}]
{\(v\sin(\gamma)\)} coordinate (P7);
\draw [red, -latex] (P7) -- +($(P8)-(P5)$);
\end{tikzpicture}
\end{document}