I'm writing code.
My arc invariant is:
$$ \theta_0, \theta_1 \in [-2\pi, 2\pi], \\ \theta_1 - \theta_0 \leq 2\pi $$
where $\theta_0$ is the arc beginning angle and $\theta_1$ is the arc end angle.
The output range of atan2 is $[-\pi, \pi]$ at least according to dlang.org documentation and their implementation of it.
I check if an $x,y$ pixel lies on the arc with $\theta = \text{atan2}(y, x)$ and makeing sure it's in the range $\theta_0, \theta_1$. But because my invariant is more relaxed than this, some parts of the arc don't get drawn. However I'd still like to support negative angles within the stated invariant.
So how do I "shift the output" of atan2 for each special case of $\{\theta_0, \theta_1\}$ ?
It's boggling my mind!
Define a function called
remapAngle:T remapAngle(T theta, T c]) { // c = new start angle theta = theta % (2*PI); if (theta < 0) return c + 2*PI - theta; else return c + theta; }