我有一条命名路径(三角形)。如何围绕点 A 以各种角度旋转它而不重新计算点 B 和 C?
这是我的代码。我想通过简单地将黑色三角形旋转 60 度的倍数来创建红色和绿色三角形。
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\providecommand* \angle {30}
\coordinate[label=above left:A](A) at (2,3);
\coordinate[label=below:B](B) at (0,0);
\coordinate[label=below:C](C) at (6,0);
\draw
(A) -- (B) -- (C) -- cycle;
\coordinate[label=B'](B') at ($(A)!1!60:(B)$);
\coordinate[label=C'](C') at ($(A)!1!60:(C)$);
\draw[dashed,red]
(A) -- (B') -- (C') -- cycle;
\coordinate[label=B''](B'') at ($(A)!1!60:(B')$);
\coordinate[label=C''](C'') at ($(A)!1!60:(C')$);
\draw[dashed,green]
(A) -- (B'') -- (C'') -- cycle;
\end{tikzpicture}
\end{document}
答案1
您正在覆盖节点,因此这有点棘手,但本质上您可以确定路径范围并使用rotate around
转换。
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\providecommand* \angle {30}
\coordinate[label=above left:A](A) at (2,3);
\coordinate[label=below:B](B) at (0,0);
\coordinate[label=below:C](C) at (6,0);
\draw
(A) -- (B) -- (C) -- cycle;
\begin{scope}[rotate around={60:(A)}]
\coordinate[label=above left:A](A) at (2,3);
\coordinate[label=below:B](B) at (0,0);
\coordinate[label=below:C](C) at (6,0);
\draw[dashed,red]
(A) -- (B) -- (C) -- cycle;
\end{scope}
\end{tikzpicture}
\end{document}
答案2
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
%\providecommand* \angle {30}
\coordinate[label=above left:A](A) at (2,3);
\coordinate[label=below:B](B) at (0,0);
\coordinate[label=below:C](C) at (6,0);
\draw
(A) -- (B) -- (C) -- cycle;
\begin{scope}[rotate around={60:(A)}]
\coordinate[label=above left:A](A) at (2,3);
\coordinate[label=below:B](B) at (0,0);
\coordinate[label=below:C](C) at (6,0);
\draw[dashed,red]
(A) -- (B) -- (C) -- cycle;
\end{scope}
\end{tikzpicture}
\end{document}