Skip to main content
I modified the previous answer to connect the side \s to the initial angle \asrt, in case the latter is modified.
Source Link
Daniel N
  • 6.2k
  • 15
  • 29

fig

With some mathematics... I tried to use useful names for the variables: radius, side of the equilateral triangle (since the initial angle is \asrt=45), and various angles. If it is not clear, let me know.

Remark I updated the code; there are three variables: the radius \r, the initial angle \asrt, and the correcting angle \adif needed to obtain the rounded corners. Note that the rounded corners does not work correctly if \adif=3 for example.

The code

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, math}
\begin{document}

\begin{tikzpicture}[%
  evaluate={%
    \r = 2.8;
    \s\asrt = \r/pow(2, .5);45;
    \asrt\aend = 45;180 -\asrt;
    \aend\adif = 135;5;
    \adif\s = 5;\r*sin(\asrt);
  }]
  \draw [help lines] (-2, -2) grid (2, 2);
  \draw[blue] (-2.5, 0) -- (2.5, 0);
  
  \draw[red, rounded corners, fill=cyan!20]
  ($(0, -\s) +(\asrt +\adif: \r)$)
  arc (\asrt +\adif:\aend -\adif: \r)
  -- ($(0, \s) +(-\aend +\adif: \r)$)
  arc (-\aend +\adif:-\asrt -\adif: \r) -- cycle;
\end{tikzpicture}
\end{document}

fig

With some mathematics... I tried to use useful names for the variables: radius, side of the equilateral triangle, and various angles. If it is not clear, let me know.

The code

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, math}
\begin{document}

\begin{tikzpicture}[%
  evaluate={%
    \r = 2.8;
    \s = \r/pow(2, .5);
    \asrt = 45;
    \aend = 135;
    \adif = 5;
  }]
  \draw [help lines] (-2, -2) grid (2, 2);
  \draw[blue] (-2.5, 0) -- (2.5, 0);
  
  \draw[red, rounded corners, fill=cyan!20]
  ($(0, -\s) +(\asrt +\adif: \r)$)
  arc (\asrt +\adif:\aend -\adif: \r)
  -- ($(0, \s) +(-\aend +\adif: \r)$)
  arc (-\aend +\adif:-\asrt -\adif: \r) -- cycle;
\end{tikzpicture}
\end{document}

fig

With some mathematics... I tried to use useful names for the variables: radius, side of the equilateral triangle (since the initial angle is \asrt=45), and various angles. If it is not clear, let me know.

Remark I updated the code; there are three variables: the radius \r, the initial angle \asrt, and the correcting angle \adif needed to obtain the rounded corners. Note that the rounded corners does not work correctly if \adif=3 for example.

The code

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, math}
\begin{document}

\begin{tikzpicture}[%
  evaluate={%
    \r = 2.8;
    \asrt = 45;
    \aend = 180 -\asrt;
    \adif = 5;
    \s = \r*sin(\asrt);
  }]
  \draw [help lines] (-2, -2) grid (2, 2);
  \draw[blue] (-2.5, 0) -- (2.5, 0);
  
  \draw[red, rounded corners, fill=cyan!20]
  ($(0, -\s) +(\asrt +\adif: \r)$)
  arc (\asrt +\adif:\aend -\adif: \r)
  -- ($(0, \s) +(-\aend +\adif: \r)$)
  arc (-\aend +\adif:-\asrt -\adif: \r) -- cycle;
\end{tikzpicture}
\end{document}
Source Link
Daniel N
  • 6.2k
  • 15
  • 29

fig

With some mathematics... I tried to use useful names for the variables: radius, side of the equilateral triangle, and various angles. If it is not clear, let me know.

The code

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, math}
\begin{document}

\begin{tikzpicture}[%
  evaluate={%
    \r = 2.8;
    \s = \r/pow(2, .5);
    \asrt = 45;
    \aend = 135;
    \adif = 5;
  }]
  \draw [help lines] (-2, -2) grid (2, 2);
  \draw[blue] (-2.5, 0) -- (2.5, 0);
  
  \draw[red, rounded corners, fill=cyan!20]
  ($(0, -\s) +(\asrt +\adif: \r)$)
  arc (\asrt +\adif:\aend -\adif: \r)
  -- ($(0, \s) +(-\aend +\adif: \r)$)
  arc (-\aend +\adif:-\asrt -\adif: \r) -- cycle;
\end{tikzpicture}
\end{document}