I am trying to draw arc's by calling a function instead of macro. I don't know how to pass a coordinate to a function. I tried two ways: one is passing it directly (preferred), the other is to pass its x and y coordinates separately. They all failed with "! Missing \endcsname inserted. \sp". Please tell me debug the following code. Thanks.
\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary {math}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\draw[loosely dashed] (0,0) grid [step=2] (5,5)
\def \cpt {(1,2)}
\draw (0.3,0.5) node [right] {cpt position coordinate = \cpt } ;
\def \cptTwo {(4,2)+(180-30:3)}
\tikzmath{
function arcStartPoint(\center, \bAngle, \eAngle, \radius) {
%function arcStartPoint(\cx, \cy, \bAngle, \eAngle, \radius) {
coordinate \sp; % arc starting point
\sp = \center + ({radius * cos(\bAngle)}, {radius * sin(\bAngle)});
%\sp = (\cx, \cy) + ({radius * cos(\bAngle)}, {radius * sin(\bAngle)});
{ \draw[ultra thick, orange] (1,2) arc (\bAngle:\eAngle:\radius); };
};
arcStartPoint(\cpt, -30, 30, 1);
arcStartPoint(\cptTwo, -30, 30, 3);
};
\end{tikzpicture}
\end{document}
The expected result is:




