2

I need to draw a closed shape using controls and then round the heads. The problem is the starting point (The upper one) is not rounded as if the shape is not closed, and the cycle command is not working correctly.

Here is my code:

\documentclass[margin=10mm]{standalone}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}

        \draw[rounded corners = 50pt, fill=red] (0,5) .. controls(0.2,1) .. (10,0) ..controls (0.2,-1) ..(0,-5).. controls(-0.2,-1)..(-10,0)..controls(-0.2,1)..(0,5);

    \end{tikzpicture}
\end{document}

enter image description here I want to know why this is happening?

  • Welcome to TeX.SX! Why don't you just add another .. controls() .. (0, 5) that leads you back to your end point? – Timm Apr 06 '17 at 08:50
  • @Timm I tried this and the output is weird – Safwat Alshazly Apr 06 '17 at 08:55
  • I saw the problem, and tried playing with it, but could not really find a solution.. however, have a look at this and this, it might help you with your control points. However, I don't really understand this right now, when I apply the style defined there your example does not work like theirs. – Timm Apr 06 '17 at 09:33

1 Answers1

1

Not a real solution, but the following workaround may be acceptable. I used line width = 4pt, line join = round, red and cycle for the last point to give the effect of rounded corners = 50pt.

\documentclass[margin=10mm]{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[line width=4pt, line join=round, red]
\draw [fill=red] (0,5) .. controls(0.2,1) .. (10,0) ..controls (0.2,-1) ..(0,-5).. controls(-0.2,-1)..(-10,0) .. controls(-0.2,1).. cycle;
\end{tikzpicture}

\end{document}

enter image description here

AboAmmar
  • 46,352
  • 4
  • 58
  • 127