我有一个带有一些虚线的矩形,位于原点 (0,0) 以外的某处,如下所示:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% just to show the origin, not really there.
\draw[fill=black] (0,0) circle (0.06);
% a simple thin rectangle
\draw[fill=black!50] (3.1,-2.2) rectangle (3,2.2);
% some lines
\foreach \x in{0,0.1,...,4.4}
\draw (3.1,-2.2+\x+0.1) -- (3,-2.2+\x+0.1);
\end{tikzpicture}
\end{document}
这将绘制一个细矩形。但我希望此矩形为实心圆弧,其曲率/半径为其与原点的距离。
我知道如何绘制线弧,但是我怎样才能将整个东西画成弧形呢?
答案1
使用极坐标就很简单了:
梅威瑟:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% just to show the origin, not really there.
\draw[fill=black] (0,0) circle (0.06);
% a simple thin rectangle
\draw[fill=black!50] (3.1,-2.2) rectangle (3,2.2);
% some lines
\foreach \x in{0,0.1,...,4.4}
\draw (3.1,-2.2+\x+0.1) -- (3,-2.2+\x+0.1);
\draw[fill=black!50] (0,0) ++(-45:3) arc (-45:45:3) -- ++(45:0.1) arc (45:-45:3.1) -- cycle;
\foreach \x in {-45,-43,...,45}{
\draw (0,0) ++(\x:3) -- ++(\x:0.1);
}
\end{tikzpicture}
\end{document}