I need to increase/reduce phi angle by value d infinitely. (d can be negative or positive).
“Infinitely” means that cycling change can happen as much as long. But to avoid overflowing it is necessary “drop” value, relying on periodicity of sin () and cos (). (0 <=> 2*pi <=> 2*n*pi).
How it can be implemented in function? (e.g. double stepAngle(double phi, double d)).
One approach is to renormalize to the desired range:
That will be efficient as long as
dis not extremely far outside the range of 0..2*pi.