# Drawing an arc between 2 nodes with a specific radius

I use the following code, as a part of a complicated drawing, to draw an arc specifying start angle, end angle, radius.

Is it possible to draw the same arc from node z to node x with radius .5cm (i.e. maintaining the shape of the arc without enlarging it). I tried to fake the end of the arc at node x by making the radius .88cm (as shown in the lower figure); but I need to maintain the radius .5cm.

\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\begin{tikzpicture}[scale=2]
\node [thin, black] (0,0) (oscnd){}
([shift={(180.:.3)}]oscnd.center) node (oscndl){}
([shift={(90.:.3)}]oscndl.center) node (oscndlu){} node{\textcolor{red} x}
([shift={(180.:1.)}]oscndlu.center) node (oscndlul){}
([shift={(-90.:.3)}]oscndl.center) node (oscndld){} node{\textcolor{red}z}
([shift={(180.:1.)}]oscndld.center) node (oscndldl){}
;
\draw[thick,  green, fill=green!40!white, opacity=.4] (oscndldl.center) -- (oscndld.center) arc (-160:160:.5cm) -- (oscndlu.center) -- (oscndlul.center);
\end{tikzpicture}
\end{frame}
\end{document}


This drawing is a part of the following figure. It was made with a circle not an arc.

Edit: At the request of OP, addition of some mathematical elements

According to my calculs and if I understood your question correctly, this arc of circle starts at an angle of 180+asin(3/5) and ends at 180-asin(3/5).

\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\begin{tikzpicture}[scale=2]
\node [thin, black] (0,0) (oscnd){}
([shift={(180.:.3)}]oscnd.center) node (oscndl){}
([shift={(90.:.3)}]oscndl.center) node (oscndlu){} node{\textcolor{red} x}
([shift={(180.:1.)}]oscndlu.center) node (oscndlul){}
([shift={(-90.:.3)}]oscndl.center) node (oscndld){} node{\textcolor{red}z}
([shift={(180.:1.)}]oscndld.center) node (oscndldl){}
;
\draw[thick,  green, fill=green!40!white, opacity=.4] (oscndldl.center) -- (oscndld.center) arc (-180+asin(3/5):180-asin(3/5):.5cm) -- (oscndlu.center) -- (oscndlul.center);
\end{tikzpicture}
\end{frame}
\end{document}


## Some elements of geometry:

In a rectangular triangle with a hypotenuse of length 1 unit, the sinus of an acute angle is the length of the opposite side. Here the sinus of the angle AOB (alpha) is the length of the side AB.

A circle with a radius of 1 unit is called a trigonometric circle. The circle below has a radius of 1 unit. The sine of 140° is equal to the sine of 40°. since the segments colored blue have the same length.

For each angle between 90° and 180° corresponds a single length, a single sinus. Thus, requiring that a length be equal to the sinus is equivalent to imposing an alpha angle measurement.

On your figure, the sinus is equal to 0.3 [shift={(90.:.3)}] and the hypotenuse is equal to 0.5 arc (-160:160:.5cm).

Which imposes an angle such as I calculated it. If you want to change this angle, you must either change the sine : [shift={(90.:.3)}] or change the hypotenuse, i. e. the radius of the circle arc (-160:160:.5cm)

## Some additional explanation on the solution (at the request of the OP):

Since the radius of the trigonometric circle is equal to 1 unit, then the sine is smaller than 1. The sinus functions sin() and arcsine asin() are called reciprocal.

The sine function, as its name suggests, when the angle is between 0° and 90°, gives the length of the opposite side AB of the angle AOB in the triangle AOB, for example sin(20)=0,342...

The arcsine function does "the opposite", i. e. from a given length (smaller than 1 unit) gives the corresponding angle.

Since 0.5 is the hypotenuse (radius of the circle) is half of 1 unit, the corresponding sinus is twice as much as 0.3, i.e. 0.6.

This sinus is found directly by dividing 0.3/0.5=0.6 (which is equivalent to 3/5=0.6). Thus the formula calculates the angle whose sinus is equal to 0.3 and the hypotenuse is equal to 0.5

This angle (you can calculate it with the calculator installed on your computer) is around 36.87...° asin(3/5)=36,869897645844021296855612559093...°

I add this angle at 180 to get the starting angle of the arc to be drawn and I remove it at 180° to get its terminal angle. I could very well have (and I am correcting my solution) written arc (-180+asin(3/5):180-asin(3/5):.5cm).

Translated with www.DeepL.com/Translator

• Thank you very much. Just one more request please. Can the starting angle be -170 instead of -160, and the end angle be 170 instead of 160; so the arc would look more curved. – Hany Sep 28 '18 at 7:49
• @Hany I did not understand your request correctly. In the solution I gave 180-asin(3/5) =143,13°... and 180+asin(3/5)=-143,13°... What do you mean with 160° or 170°? – AndréC Sep 28 '18 at 14:30
• My original code was drawing an arc with the specifications (-160:160:.5cm), I would like it to be (-170:170:.5cm). I will appreciate it, if you have the time to explain to me what your code means, and how can I modify it. – Hany Sep 28 '18 at 16:12
• @Hany If you change the angles, the radius of the circle will no longer be the same. Do you want a solution with 170°, but with a different radius? – AndréC Sep 28 '18 at 16:17
• No, I want it with 170 degree and with radius .5cm, if possible. – Hany Sep 28 '18 at 16:18

Just for fun and learning... an implementation to create the shapes depending on the values of line width, line longitude, circle termination radio, condition line_width<=termination_radio; extended to the red shape in two drawing definitions. decorations.fractals is used for the right termination in the red shape.

RESULT:

MWE:

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{decorations.fractals}
\begin{document}
\begin{tikzpicture}[]

\def\GreenShape(#1)[#2][#3][#4]
{%1: Position 2: Line width 3:Line Longitude 4: Circle termination radio
\pgfmathparse{asin(0.5*#2/#4)}
\edef\Theta{\pgfmathresult}
\draw[
fill=green!50!black,
transform canvas={shift={(2pt,-3pt)}},
fill=gray,
fill opacity=0.4,
}
](#1) |- ++(#3,0.5*#2) arc (180-\Theta:\Theta-180:#4) -| cycle;
\path(#1)-- ++(#3,0.5*#2)++(-\Theta:#4) coordinate (A);
\shade[inner color=yellow, outer color=green!50!black](A) circle (0.8*#4);
\shade[inner color=yellow, outer color=green!50!black](A) circle (0.5*#4);
}

%For the red shape:
\def\RedShape(#1)[#2][#3][#4]
{%1: Position 2: Line width 3:Line Longitude 4: Circle termination size
\draw[
decoration=Koch snowflake,
fill=red,
thick,
transform canvas={shift={(2pt,-3pt)}},
fill=gray,
fill opacity=0.4,
}
]
(#1)++(#4,-0.5*#2) coordinate (init)
.. controls +(-180:0.5) and +(-45:0.1) .. ++(-#4*1.5,-0.5*#2)
.. controls +(135:0.1) and +(-90:0.2) .. ++(#4*0.5,#2)
.. controls +(90:0.2) and +(-135:0.1) .. ++(-#4*0.5,#2)
.. controls +(45:0.1) and +(-180:0.5) .. ++(#4*1.5,-0.5*#2)
-- ++(0.4*#3,0)
.. controls +(90:0.5) and +(-90:0.5) .. ++(-#4+0.25*#2,#4+0.7) coordinate (ball)
arc (180:0:#4)
.. controls +(-90:0.5) and +(90:0.5) .. ++(-#4+0.25*#2,-#4-0.7)
-- ++(0.6*#3,0)
decorate{decorate{--++(#4*1.5,0.5*#2) -- ++(0,-#2*2) --++(-#4*1.5,+0.5*#2)}}
-- (init)
;
\path (ball)++(#4,0) coordinate (B);
\shade[inner color=yellow, outer color=red!70!black](B) circle (0.5*#4);
}

%Start drawing the thing
\GreenShape(0,0)[0.5][1][0.5]
\RedShape(2.1,0)[0.5][6][0.5]
\end{tikzpicture}
\end{document}

• Thank you very much for your answer, it is very inspiring. – Hany Sep 30 '18 at 5:03