我尝试执行以下代码片段,但一直失败,并显示“包 pgf 错误:没有已知的名为 -O 的形状 }”
\foreach \x in {180,185,...,360} {
% lines from center to point
\draw[dotted,->-=0.8,gray] (0cm,0cm) -- (\x:1cm);
\draw[] (-0.5cm*sin(270-\x),-0.5cm*cos(270-\x)) -- (-0.5cm*sin(270-\x),-0.7cm*cos(270-\x));
% dots at each point
\filldraw[black] (\x:1cm) circle(0.4pt);
}
是不是不能像我上面尝试的那样,用度数来计算这些比率,而只能用弧度来表示?
答案1
这可能是您想要实现的吗?
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\foreach \x in {180,185,...,360} {
\pgfmathsetmacro\A{-0.5*sin(270-\x)}
\pgfmathsetmacro\B{-0.5*cos(270-\x)}
\pgfmathsetmacro\C{-0.7*cos(270-\x)}
% lines from center to point
\draw[dotted,->=0.8,gray] (0cm,0cm) -- (\x:1cm);
\draw[] (\A,\B) -- (\A,\C);
% dots at each point
\filldraw[black] (\x:1cm) circle(0.4pt);
}
\end{tikzpicture}
\end{document}