1

Here's a problem I can't solve. As you can see in the figure below, the clip is bounded by the sector, but the bounding box is modified. I can get around this problem easily, but I'd like to find out what's causing it.

Here are some possible workarounds:

1) \tkzClipBB
    \tkzClipSector(O,A)(C)
    \tkzDrawLines[ultra thick](O,B A,C)

2) \tkzClipSector(O,A)(C)
   \tkzClipCircle(O,A)
   \tkzDrawLines[ultra thick](O,B A,C)

3) \pgfinterruptboundingbox
   \tkzClipSector(O,A)(C)
   \tkzDrawLines[ultra thick](O,B A,C)
   \endpgfinterruptboundingbox

\documentclass{standalone}
\usepackage{tkz-euclide}
\begin{document}
  
\begin{tikzpicture}
\tkzDefPoints{0/0/O,2/0/A,0/6/B,-2/0/C}
\tkzDrawPoints(O,A,C)
\tkzDrawCircle(O,A)
\tkzClipSector(O,A)(C)
\tkzDrawLines[ultra thick](O,B A,C)
\end{tikzpicture}
\end{document}

enter image description here

Note that if, instead of drawing a straight line, I fill in a disk, the problem is identical:

\fbox{\begin{tikzpicture}
\tkzDefPoints{0/0/O,2/0/A,0/6/B,-2/0/C}
\tkzDrawPoints(O,A,C)
\tkzDrawCircle(O,A)
\tkzClipSector(O,A)(B)
\tkzFillCircle[red](O,B)
\end{tikzpicture}}

enter image description here

Last remark: no problem if I clip a circle.

\fbox{\begin{tikzpicture}
\tkzDefPoints{0/0/O,2/0/A,0/6/B,-2/0/C}
\tkzDrawPoints(O,A,C)
\tkzDrawCircle(O,A)
\tkzClipCircle(O,A)
\tkzDrawLines[ultra thick](O,B A,C)
\end{tikzpicture}}

enter image description here You can find the macros for sector layouts here : tkz-obj-eu-sectors.tex. I tried to find out from these macros when the bounding box could be modified, but without success!

Do you have an explanation for this problem?

2
  • by deleting begingroup and endgroup line 230-249 and 272-277, this may solve the problem?
    – pascal974
    Commented Jul 15 at 12:04
  • @pascal974 Exact ! but why ? I work so much with Lua, I forget how to use TeX and TikZ. Strangely, I didn't use a group for tkzClipCircle or for tkzClipPolygon. You can pass this comment as a reply, I think. I've just tried it with TikZ only and the problem is the same. Commented 2 days ago

1 Answer 1

1

What I think I understood: The clip inserted between begingroup and endgroup limits the draws but not the bounding box.

Without clip

enter image description here

With clip and without begingroup

enter image description here

With clip and begingroup

enter image description here

CODE

    \documentclass{standalone}
    \usepackage{tikz}
    \begin{document}

    \fbox{%
    \begin{tikzpicture}
    \node (O) at(0,0){$O$};
    \node (A) at(2,0){$A$};
    \node (B) at(0,6){$B$};
    \node (C) at(-2,0){$C$};
    % \begingroup
    % \clip[draw](O) -- (0:2) arc(0:180:2) -- cycle;
    % \endgroup
    \draw(O)--(B)--+(0,1);
    \node (D) at (0,10){D};
    \end{tikzpicture}
    }


    \fbox{%
    \begin{tikzpicture}
    \node (O) at(0,0){$O$};
    \node (A) at(2,0){$A$};
    \node (B) at(0,6){$B$};
    \node (C) at(-2,0){$C$};
    % \begingroup
    \clip[draw](O) -- (0:2) arc(0:180:2) -- cycle;
    % \endgroup
    \draw(O)--(B)--+(0,1);
    \node (D) at (0,10){D};
    \end{tikzpicture}
    }

    \fbox{%
    \begin{tikzpicture}
    \node (O) at(0,0){$O$};
    \node (A) at(2,0){$A$};
    \node (B) at(0,6){$B$};
    \node (C) at(-2,0){$C$};
    \begingroup
    \clip[draw](O) -- (0:2) arc(0:180:2) -- cycle;
    \endgroup
    \draw(O)--(B)--+(0,1);
    \node (D) at (0,10){D};
    \end{tikzpicture}
    }
    \end{document}

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.