Say I have a triangle with vertices defined using
\coordinate (a) at (0,0);
\coordinate (b) at (1,0);
\coordinate (c) at (0,1);
Let us denote by T(x,y)
the triangle defined by (a),(b)
and (c)
which is translated by a vector (x,y)
. I can now easily draw T(0,0)
as follows:
\draw (a) -- (b) -- (c) -- cycle;
So far so good. Now, lets say that I want to plot the triangle T(2,3)
. Ideally, I would like to do something like:
\begin{scope}[shift={(2,3)}]
\draw (a) -- (b) -- (c) -- cycle;
\end{scope}
However, as the coordinates were defined outside of the scope the transformation (translation in this case) won't effect them. See this answer. What would be the smart way to do it? Or more generally:
What is the best way to reuse coordinates that are defined once under varying transformations?
Possible solution: Basing on the comment of @Qrrbrbirlbel I posted an answer. This answer however, is very limited and local - is the something more general?
\draw ([shift={(2,3)}] a) -- ([shift={(2,3)}] b) -- ([shift={(2,3)}] c) -- cycle;
) or using a canvas transformation can be the solution. See the top part of another answer.