The TikZ arc command is a little unusual, since the center of the circle used is not actually specified in the API. The API does not follow standard arc construction. From example, in Mathematica, to draw an arc, one gives the center of the circle, radius, and the two angles.
But these four parameters are defined indirectly in TikZ arc, in a roundabout way. Only the radius and two angles are specified, but not the center of the circle.
So it was a struggle to find where the center that is used is located to understand how the arc came about.
The best help I found that explains the formula is in the second answer to How is arc defined in TikZ?. Here is screenshot of the formula:
I verified it is correct below. My two questions are:
(1) Once I make an arc, is there a way to automatically ask TikZ to tell me the center of the circle used for making the arc, instead of me having to calculate it from the above formula?
(2) Does there exist another arc command in TikZ or library that uses the more normal API: center of circle, radius, and two angles? Since it is easier for me to use that.
MWE:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\fbox{
\begin{tikzpicture}
\draw (-2,0)--(2,0) ; % Draw axes
\draw (0,-2)--(0,2) ;
\def\x{1} %Define arc API, as in (x,y) arc (from,to,r)
\def\y{0}
\def\r{1}
\def\from{-25}
\def\to{45}
%Now draw the arc
\draw[color=blue,line width=1mm] (\x,\y) arc (\from:\to:\r);
%Calculate its center from the formula above
\coordinate (c) at ({\x + \r * cos(\from + 180)},{\y + \r * sin(\from + 180)});
%Draw the circle used to get the arc from
\draw[color=red,thin] (c) circle (\r);
\draw[fill] (c) circle({0.05*\r});
\end{tikzpicture}
}
\end{document}
PS: For illustration of the Arc API in Mathematica:
So, to draw an arc with circle at (0,0)
, radius 1, and from -25 degrees to 45 degrees, the command is
x = 0; y = 0; r = 1; theta1 = -25 Degree; theta2 = 45 Degree;
Graphics[Circle[{x, y}, r, {theta1, theta2}], Axes -> True,
AspectRatio -> Automatic, AxesOrigin -> {0, 0}]