0

I'm working with tkz-euclide and I'm having a problem with the corners of each inscribed triangle sticking out of the circumference of the circle. This is what it looks like: Uh oh!

... and this is the code I used:

\documentclass[convert]{standalone}
\usepackage{tkz-euclide}

\begin{document}
\begin{tikzpicture}
\tkzDefPoints{0/0/O, 3/0/P, 3/0/R}
\tkzDrawCircle(O,P)
\tkzDrawPoint(O)
\tkzLabelPoints(O)

\foreach \i in {0,...,2}
{
    \tkzDefPointOnCircle[angle=120*\i ,center=O,radius=3]
    \tkzGetPoint{P}
    \tkzDefPointOnCircle[angle=120*\i + 120,center=O,radius=3]
    \tkzGetPoint{R}
    \tkzDrawPolygon[fill=blue!20!white](O,P,R)
}

\end{tikzpicture}
\end{document}

I understand this is only a small bit of detail, but I would like to know how I can fix this in case other people have this problem too. Thanks in advance!

4
  • Please make your code compilable. Nov 16 '20 at 14:12
  • @hpekristiansen Isn't it compilable? You could just copy and paste the code between the \begin{document} and \end{document} tags, and don't forget to import the tkz-euclide package right?
    – Kookie
    Nov 16 '20 at 14:15
  • 3
    Yes I could do that. But YOU should do that. Nov 16 '20 at 14:16
  • 1
    @hpekristiansen alright, I'll include the rest of the code.
    – Kookie
    Nov 16 '20 at 14:16
4

This question is probable a duplicate. You can change the line join to a type that is more suitable - see: In TikZ when is "line join=miter" the preferrable over "line join=round"?

\documentclass[convert]{standalone}
\usepackage{tkz-euclide}

\begin{document}
\begin{tikzpicture}
\tkzDefPoints{0/0/O, 3/0/P, 3/0/R}
\tkzDrawCircle(O,P)
\tkzDrawPoint(O)
\tkzLabelPoints(O)

\foreach \i in {0,...,2}
{
    \tkzDefPointOnCircle[angle=120*\i ,center=O,radius=3]
    \tkzGetPoint{P}
    \tkzDefPointOnCircle[angle=120*\i + 120,center=O,radius=3]
    \tkzGetPoint{R}
    \tkzDrawPolygon[fill=blue!20!white, line join=round](O,P,R)
}

\end{tikzpicture}
\end{document}

Circle and triangle with Better line loints

1
  • Oh, I wasn't aware of this. Thanks!
    – Kookie
    Nov 16 '20 at 14:24
3

You should adapt the join type:

\documentclass[convert]{standalone}
\usepackage{tkz-euclide}

\begin{document}
    \begin{tikzpicture}
        \tkzDefPoints{0/0/O, 3/0/P, 3/0/R}
        \tkzDrawCircle(O,P)
        \tkzDrawPoint(O)
        \tkzLabelPoints(O)
        
        \foreach \i in {0,...,2}
        {
            \tkzDefPointOnCircle[angle=120*\i ,center=O,radius=3]
            \tkzGetPoint{P}
            \tkzDefPointOnCircle[angle=120*\i + 120,center=O,radius=3]
            \tkzGetPoint{R}
            \tkzDrawPolygon[fill=blue!20!white,line join=bevel](O,P,R)
        }
        
    \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.