8

Why are there jumping frames when I increase the radius \r from 1.9 to 1.95 ?

\documentclass[tikz]{standalone}
\begin{document}
\pgfmathsetmacro{\r}{1.95}
\foreach \j in {0,10,20,...,110}{%
\begin{tikzpicture}%
 \draw (-2.2,-2.2) rectangle (2.2,2.2);%
 \draw(0,0) circle (.25);%
 \foreach \i in {0,1,2}{\draw[rotate=\i*120] (\j:\r) arc (\j:90+\j:\r) -- (90+\j:.3) arc (90+\j:\j:.3) -- cycle;}%
\end{tikzpicture}}%
\end{document}

\r=1.95 (wrong)

enter image description here

\r=1.9 (correct)

enter image description here

2
  • 1
    Its a size / dimension problem. A workaround is to use a bigger rectangle\draw[red] (-2.3,-2.3) rectangle (2.3,2.3); . Still now i don't know the reason for this behaviour. It also appear with a smaller radius and smaller rectangle (r=1.7, and rectangle =(-2.0,-2.0) to (2.0,2.0)).
    – Bobyandbob
    Aug 17 '17 at 18:54
  • The dimension problem in this case is counter intuitive. What is wrong with my settings? :-) Aug 18 '17 at 2:08
9

Make sure you know how to use \pgfresetboundingbox or \pgfinterruptboundingbox.

Playing code

This is basically the example of show path construction in the manual. In addition to curves I showed the support points so it can be seen that it is the support points that exceeds the frame.

\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\pgfmathsetmacro{\r}{2.1}
\tikzset{
    decoration={
        show path construction,
        moveto code={
            \fill[red](\tikzinputsegmentfirst)circle(2pt)
                node[fill=none,below]{moveto};},
        lineto code={
            \draw[blue,->](\tikzinputsegmentfirst)--(\tikzinputsegmentlast)
                node[pos=.5,auto]{lineto};
        },
        curveto code={
            \draw[green!75!black,dashed](\tikzinputsegmentfirst)--(\tikzinputsegmentsupporta)
                (\tikzinputsegmentlast)--(\tikzinputsegmentsupportb);
            \draw[green!75!black,->](\tikzinputsegmentfirst)..controls
                (\tikzinputsegmentsupporta)and(\tikzinputsegmentsupportb)
                ..(\tikzinputsegmentlast)node[pos=.5,auto]{curveto};
        },
        closepath code={
            \draw[orange,->](\tikzinputsegmentfirst)--(\tikzinputsegmentlast)
                node[pos=.5,auto]{closepath};
        }
    }
}
\foreach \j in {0,5,...,119}{
    \tikz[scale=3]{
        \draw[line width=1.2](-2.2,-2.2)rectangle(2.2,2.2)(0,0)circle(.25);
        \foreach\i in{0,1,2}{
            \draw[rotate=\i*120,decorate](\j:\r)arc(\j:90+\j:\r)--(90+\j:.3)arc(90+\j:\j:.3)--cycle;
        }% 
    }
}%
\end{document}

See also

1
  • 1
    Could you add the code?
    – Ignasi
    Aug 18 '17 at 9:09
3

Use a circle of radius \r (plus something) for calculating the bounding box.

\useasboundingbox overrides automatic BBox calculation which includes invisible path components, such as control points of curves.

\documentclass[tikz]{standalone}
\begin{document}
\pgfmathsetmacro{\r}{1.95}
\foreach \j in {0,10,20,...,110}{%
\begin{tikzpicture}%
% \draw (-2.2,-2.2) rectangle (2.2,2.2);%
  \useasboundingbox (0,0) circle (\r+0.01);                   
 \draw(0,0) circle (.25);%
 \foreach \i in {0,1,2}{\draw[rotate=\i*120] (\j:\r) arc (\j:90+\j:\r) -- (90+\j:.3) arc (90+\j:\j:.3) -- cycle;}%
\end{tikzpicture}}%
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.