当我使用语法时,如何\filldraw
填充楔子\filldraw let .. in
?
\documentclass[convert = false]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\filldraw[inner color = blue!50!, outer color = blue!10!black] let
\p0 = (0, 0),
\p1 = (1, 0),
\p2 = (.707, .707),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {1cm}
in (0, 0) +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2];
\end{tikzpicture}
\end{document}
我想要实现的是:
\filldraw
其中使用方式如下:
\filldraw[inner color = blue!50!, outer color = blue!10!black] (2.5, 0) --
+(.5, 0) arc (0:35.2644:.5cm);
答案1
您缺少--
构建路径(我只是为了示例而更改了比例):
\documentclass[convert = false]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[scale=5]
\filldraw[inner color = blue!50!, outer color = blue!10!black] let
\p0 = (0, 0),
\p1 = (1, 0),
\p2 = (.707, .707),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {1cm}
in (\p0) -- +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2];
\end{tikzpicture}
\end{document}
-- cycle
当填充(filldrawing)时,我总是喜欢在路径的末尾使用,如下所示:
\begin{tikzpicture}[scale=5]
\filldraw[inner color = blue!50!, outer color = blue!10!black] let
\p0 = (0, 0),
\p1 = (1, 0),
\p2 = (.707, .707),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {1cm}
in (\p0) -- +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2] -- cycle;
\end{tikzpicture}