I have this snippet:
points = CirclePoints[{10, 0}, 4];
The result will be an array of 2D coordinates.
{{10, 0}, {0, 10}, {-10, 0}, {0, -10}}
I want to shift all of them by a certain vector $\mathbf{p}$.
p = {4, 5};
points + {p, p, p, p}
Nothing is wrong up to now. But instead of a square, suppose I want a dodecagon. Then the code changes to:
points = CirclePoints[{10, 0}, 12];
p = {4, 5};
points + {p, p, p, p, p, p, p, p, p, p, p, p}
How can I avoid entering all those repeated p's ?
#+p& /@ points. – Szabolcs Jun 08 '16 at 05:23/@(for example). – AHB Jun 08 '16 at 05:25TranslationTransform[]as well. – J. M.'s missing motivation Jun 08 '16 at 05:57in = p + # & /@ points;? – AHB Jun 08 '16 at 06:00#andpswitching places, and that won't make a difference in the output. – march Jun 08 '16 at 06:50displaced = points + ConstantArray[p, 12]– m_goldberg Jun 08 '16 at 07:21CirclePoints[{4, 5}, {10, 0}, 12]– m_goldberg Jun 08 '16 at 09:23