Why does rotating a circle alter its bounding box?

A circle is drawn by four Bézier curves. The control points of the Bézier curves are taken into account to compute the bounding box:

\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[>=stealth, every node/.style={midway, sloped, font=\tiny},
  decoration={show path construction,
    moveto code={},
    lineto code={},
    curveto code={
      \fill[red] (\tikzinputsegmentsupporta) circle(.5pt);
      \fill[red] (\tikzinputsegmentsupportb) circle(.5pt);
      \fill[blue] (\tikzinputsegmentfirst) circle(.5pt);
      \fill[blue] (\tikzinputsegmentlast) circle(.5pt);
      \draw[blue,->] (\tikzinputsegmentfirst) -- (\tikzinputsegmentsupporta);
      \draw[blue,->] (\tikzinputsegmentlast) -- (\tikzinputsegmentsupportb);
      \draw [black] (\tikzinputsegmentfirst) .. controls
      (\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb)
      ..(\tikzinputsegmentlast);
    },
    closepath code={},
  }]
  \draw [help lines] grid (6,3);
  \begin{scope}[local bounding box=lbb]
    \path [decorate,rotate around={0:(1.5,1.5)}] (1.5,1.5) circle(1);
    \draw[red] (lbb.north west) rectangle (lbb.south east);
  \end{scope}
  \begin{scope}[local bounding box=lbb]
    \path [decorate,rotate around={30:(4.5,1.5)}] (4.5,1.5) circle(1);
    \draw[red] (lbb.north west) rectangle (lbb.south east);
  \end{scope}
\end{tikzpicture}
\end{document}

enter image description here


I guess that you are using not the appropriate means to rotate the circles. If you use transform canvas instead, none of the issues arises. UPDATE I forgot to put transform canvas to the third circle.

\documentclass{article}
\usepackage{tikz}
\usepackage{xstring}

\newcommand*{\DrawBoundingBox}[1][]{%
    \draw [red]
    ([shift={(-5pt,-5pt)}]current bounding box.south west)
    rectangle
    ([shift={(5pt,+5pt)}]current bounding box.north east);

  % https://tex.stackexchange.com/questions/418499/
  %         align-tikzpictures-at-internal-bounding-box-with-text-below-it
  \coordinate (X) at (current bounding box.south);
  \tikzset{baseline={(X)}} % X is the alignment point

    \IfStrEq{#1}{}{}{% 
        \node [below, anchor=north,  align=center, 
            baseline=0pt, thin, shift only, solid,
        ] 
            at (current bounding box.south)
            {#1\strut};
    }%
}

\newcommand*{\MyCircle}[2][]{%
    %% #1 = tikz picture options
    %% #2 = text
    \begin{tikzpicture}
        \draw [fill=yellow!20, draw=black, #1] (0,0) circle (1.0cm);
        \draw [#1] (-1,0) -- (1,0); % added to see that the transformatio does
                                    % something
        \DrawBoundingBox[#2]
    \end{tikzpicture}%
}

\begin{document}
\section{No Height Changes}
\noindent
    \MyCircle[fill=green!25]{rotate=0}~%
    \MyCircle[fill=cyan!40, transform canvas={rotate=20}]{rotate=20}~%
    \MyCircle[fill=orange!40, transform canvas={rotate=60}]{rotate=60}%

\section{No Width Changes}
\par\noindent\MyCircle[fill=green!25]{rotate=0}%
\par\noindent\MyCircle[fill=cyan!40, transform canvas={rotate=20}]{rotate=20}%

\end{document}

enter image description here

(I added a line in order to show that this transformation does indeed rotate the circles, which is hard to see otherwise ;-)