我想绘制 3 个从 (m) 开始并计算长度的向量,但出现问题。基本上,我在最后的第 1 行和第 3 行中收到错误或渲染错误(根据不同的尝试):
\draw[->, very thin] (m) -- ($-155:1*sin(65)$) coordinate (m);
\draw[->, very thin] (m) -- ($-65:1*cos(65)$) coordinate (m);
梅威瑟:
\documentclass{article}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{calc,patterns,angles,quotes,intersections}
\tikzset{bullet/.style={circle, fill,minimum size=4pt,inner sep=0pt, outer sep=0pt}}
\begin{document}
\begin{tikzpicture}[scale=1,
interface/.style={
postaction={draw,decorate,decoration={border,angle=-45,
amplitude=0.15cm,segment length=1mm}}},
]
\draw[black,line width=.5pt,interface](1,0)--(-1,0);
\draw[dotted, thin] (0,0) -- (0,-2.5);
\coordinate (m) at (-65:2);
\draw[thin] (0,0) -- (m);
\begin{scope}
\clip(-1,0) rectangle (1,-2.5);
\draw[thin] (0,0) circle(2);
\end{scope}
\node[bullet, minimum size=4pt] at (m) {};
\draw[->, very thin] (m) -- ($-155:1*sin(65)$) coordinate (m);
\draw[->, very thin] (m) -- (-90:1) coordinate (m);
\draw[->, very thin] (m) -- ($-65:1*cos(65)$) coordinate (m);
\end{tikzpicture}
\end{document}
答案1
如果执行涉及一些括号的计算,则需要使用括号。我也不认为您$
在这里需要,因为您只使用极坐标(而不使用坐标计算calc
)。
\documentclass{article}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{calc,patterns,angles,quotes,intersections}
\tikzset{bullet/.style={circle, fill,minimum size=4pt,inner sep=0pt, outer sep=0pt}}
\begin{document}
\begin{tikzpicture}[scale=1,
interface/.style={
postaction={draw,decorate,decoration={border,angle=-45,
amplitude=0.15cm,segment length=1mm}}},
]
\draw[black,line width=.5pt,interface](1,0)--(-1,0);
\draw[dotted, thin] (0,0) -- (0,-2.5);
\coordinate (m) at (-65:2);
\draw[thin] (0,0) -- (m);
\begin{scope}
\clip(-1,0) rectangle (1,-2.5);
\draw[thin] (0,0) circle(2);
\end{scope}
\node[bullet, minimum size=4pt] at (m) {};
\draw[->, very thin] (m) -- (-155:{1*sin(65)}) coordinate (m);
\draw[->, very thin] (m) -- (-90:1) coordinate (m);
\draw[->, very thin] (m) -- (-65:{1*cos(65)}) coordinate (m);
\end{tikzpicture}
\end{document}
此代码重新定义m
,即如果你说
\draw[->, very thin] (m) -- (-155:{1*sin(65)}) coordinate (m);
则为m
处的坐标(-155:{1*sin(65)})
,依此类推。如果您不想这样做,请使用例如(根据您的评论)
\documentclass{article}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{patterns}
\tikzset{bullet/.style={circle, fill,minimum size=4pt,inner sep=0pt, outer sep=0pt}}
\begin{document}
\begin{tikzpicture}[scale=1,
interface/.style={
postaction={draw,decorate,decoration={border,angle=-45,
amplitude=0.15cm,segment length=1mm}}},
]
\draw[black,line width=.5pt,interface](1,0)--(-1,0);
\draw[dotted, thin] (0,0) -- (0,-2.5);
\coordinate (m) at (-65:2);
\draw[thin] (0,0) -- (m);
\begin{scope}
\clip(-1,0) rectangle (1,-2.5);
\draw[thin] (0,0) circle[radius=2];
\end{scope}
\node[bullet, minimum size=4pt] at (m) {};
\draw[->, very thin] (m) -- ++(-155:{1*sin(65)});
\draw[->, very thin] (m) -- ++(-90:1);
\draw[->, very thin] (m) -- ++(-65:{1*cos(65)});
\end{tikzpicture}
\end{document}