# Rotate a set of points in Tikz figure

I am trying to draw some Feynman diagrams using TikZ. An object I need to use several times is the one in the picture below. But depending on the case I'd like to present it in one of the two ways in the picture (either as an "x" or as a "cross")

I've drawn the x version as follows. I know I could draw the cross version in the same way changing all the coordinates by hand but I was wondering if there was a way to rotate all the coordinates 45° to do it automatically.

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-feynman}
\tikzfeynmanset{compat=1.1.0}
\usetikzlibrary{shapes,arrows,positioning,automata,backgrounds,calc,er,patterns,positioning,quotes}

\begin{document}
\begin{tikzpicture}

\coordinate (A1) at (-1,2);
\coordinate (A2) at (0,1);
\coordinate (A3) at (1,2);
\coordinate (A4) at (2,1);
\coordinate (A5) at (1,0);
\coordinate (A6) at (2,-1);
\coordinate (A7) at (1,-2);
\coordinate (A8) at (0,-1);
\coordinate (A9) at (-1,-2);
\coordinate (A10) at (-2,-1);
\coordinate (A11) at (-1,0);
\coordinate (A12) at (-2,1);

\draw (A1) -- (A2) -- (A3);
\draw (A4) -- (A5) -- (A6);
\draw (A7) -- (A8) -- (A9);
\draw (A10) -- (A11) -- (A12);
\end{tikzpicture}

\end{document}


Edit: Regarding the sugestions of adding [rotate=45], that does indeed work when only one of the "x" is present. I should have mentioned that some of the diagrams I want to draw has two "x" side by side. In that case adding [rotate=45] makes it so they are not side by side, but one them is diagonaly above the other.

This code is working (3 adjacent cross):

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\foreach \an in {0,90,180,270}
\draw[rotate=\an] (2,-1)--(1,0)--(2,1);

\begin{scope}[xshift=5cm,red,rotate=45]
\foreach \an in {0,90,180,270}
\draw[rotate=\an] (2,-1)--(1,0)--(2,1);
\end{scope}

\begin{scope}[xshift=10cm,blue,rotate=30]
\foreach \an in {0,90,180,270}
\draw[rotate=\an] (2,-1)--(1,0)--(2,1);
\end{scope}
\end{tikzpicture}
\end{document}


The output is:

ADD: A new simple version that define a newcommand (\cross) inside a scope environment with 4 parameters:

#1 : xshift for the \cross (in cm); #2 : the color; #3 : the rotation angle (in degree); #4 : the scale factor for adapting the cross to complete picture.

The code (with 2 examples of crosses):

\documentclass{article}
\usepackage{tikz}
\newcommand*{\cross}[4]{
\begin{scope}[xshift=#1cm,#2,rotate=#3,scale=#4]
\foreach \an in {0,90,180,270}
\draw[rotate=\an] (2,-1)--(1,0)--(2,1);
\end{scope}
}
\begin{document}
\begin{tikzpicture}
\cross{5}{blue}{0}{1}
\cross{0}{red}{45}{.5}
\end{tikzpicture}
\end{document}


The output:

• I just tried it, but it does not seem to work. Dec 2, 2023 at 23:44
• @dorrel It works. See the picture that I have added. Dec 3, 2023 at 0:31
• I obtain that output both with, or without the [rotate=45]. Without the [rotate=45] do you obtain the cross one? Dec 3, 2023 at 0:33
• @dorrel No! I dont know why. I use this method for pictures more and more complex and it works well. I need to investigate. Dec 3, 2023 at 0:36
• @dorrel See my updated answer. Now You can draw crosses at any angle... starting from only 3 base points! Dec 3, 2023 at 6:09

I had the same problem once, the easy solution is no use coordinate command with transformations.

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-feynman}
\tikzfeynmanset{compat=1.1.0}
\usetikzlibrary{shapes,arrows,positioning,automata,backgrounds,calc,er,patterns,positioning,quotes}

\begin{document}
\begin{tikzpicture}

\coordinate (A1) at (-1,2);
\coordinate (A2) at (0,1);
\coordinate (A3) at (1,2);
\coordinate (A4) at (2,1);
\coordinate (A5) at (1,0);
\coordinate (A6) at (2,-1);
\coordinate (A7) at (1,-2);
\coordinate (A8) at (0,-1);
\coordinate (A9) at (-1,-2);
\coordinate (A10) at (-2,-1);
\coordinate (A11) at (-1,0);
\coordinate (A12) at (-2,1);

\begin{scope}[rotate=40]
\draw (-1,2)--(0,1)-- (1,2);
\draw (2,1) -- (1,0)-- (2,-1);
\draw  (1,-2) -- (0,-1) --  (-1,-2);
\draw  (-2,-1) --  (-1,0) -- (-2,1);
\end{scope}
\end{tikzpicture}

\end{document}