
%Radius of rolling circle
\pgfmathparse{1} \let\r\pgfmathresult
 
%Relative position of rolling point. Lambda=\pm 1: cycloid
\pgfmathparse{1.0} \let\Lambda\pgfmathresult

%CalculateR: point: store in (R)
%Parameters: #1: lambda, #2: t
\newcommand{\CalcR}[2]
{
   \CalcRolling{#2}
   \CalcQ{#2}
   
   \coordinate (R) at ($(Rolling)-\r*#1*(q)$);
}


%CalculateV point: store in \v - point (V)
%Parameters: #1: lambda, #2: t
\newcommand{\CalcV}[2]
{
   \pgfmathparse{deg(#2)} \let\Angle\pgfmathresult 
   
   \pgfmathparse{1+#1*#1-2*#1*cos(\Angle)} \let\v\pgfmathresult
   \pgfmathparse{\r*sqrt(\v)} \let\v\pgfmathresult
   
   \coordinate (V) at (#2,\v);
}

%CalcDr: Calc r'
%Parameters: #1: lambda, #2: t
\newcommand{\CalcDr}[2]
{
   \CalcRolling{#2}
   \CalcdRolling{#2}
   \CalcdRollingHat{#2}
   
   \CalcQ{#2}
   \CalcP{#2}
   
   \coordinate (dR) at ($-\r*#1*(p)$);
   \coordinate (dR) at ($(dRolling)+(dR)$);
   
   \coordinate (dRHat) at ($-\r*#1*(q)$);
   \coordinate (dRHat) at ($(dRollingHat)+(dRHat)$);
}

%CalcDDr: Calc r''
%Parameters: #1: lambda, #2: t
\newcommand{\CalcDDr}[2]
{
   \CalcRolling{#2}
   \CalcddRolling{#2}
   
   \CalcQ{#2}
   
   \coordinate (ddR) at ($\r*#1*(q)$);
   \coordinate (ddR) at ($(ddRolling)+(ddR)$);
}

