Finding the orientation (Clockwise vs Anticlockwise) of a well-defined arc Given an arc, with two endpoints, a known radius, and a known center, is it possible to arbitrarily choose an endpoint as the start point, and determine if the motion of drawing the arc from that start point to the other endpoint is Clockwise or Anticlockwise.
That's my general question, I'm working on writing a geometry program, and this program will take in the radius, end point, and start point of an arc. It will then determine the two (or one/zero in some cases) arcs that fit the givens. Finally, based on a Clockwise/Anticlockwise option, it will draw the appropriate arc. I've (with some help from another question here) already derived the formula for finding the center points, and now I just need the Clockwise versus Anticlockwise calculation. Unlike the center of the arc derivation, I have no idea where to begin. I think I've bitten of a bit more than I can chew, as I getting into topics that I've yet to learn in school. (I feel like any knowledge of calculus would make this indefinitely easier).
Anyway, thanks for any help!
 A: Let us assume you are given the start point $A:(a_1,a_2)$, the endpoint $B:(b_1,b_2)$ and the radius $r$ ($2r$ being bigger than the distance from $A$ to $B$). Let us assume that from that data you have correctly computed the wo possible centers, namely $C:(c_1,c_2)$ and $D:(d_1,d_2)$.
You need to take the vectors $u=\vec{CA}:(u_1,u_2)$ and $v=\vec{CB}:(v_1,v_2)$ and compute the following determinant:
$$K = \begin{vmatrix}u_1 & u_2 \\ v_1 & v_2\end{vmatrix}$$
Then check the sign of $K$:


*

*If $K<0$, then $C$ is the center you are looking for.

*If $K>0$, you are going from $A$ to $B$ anticlockwisely and, thus, the center should be D.

*If $K=0$, then $A$, $B$ and $C$ are on the same line. Since we were assuming that the distance from both $A$ and $B$ to $C$ is $r>0$, there are two possibilities: either $A=B$ or $dist(A,B)=r$ and $C$ is the midpoint between $A$ and $B$.

A: As long as the arc does not pass through the center they yes, it is possible to do this using methods of calculus. The method is by computing the winding number of the arc, which is a certain integral that you can calculate. I'm going to give a very general answer, which is perhaps more general than you need, but it's a nice answer that will fit many needs.
Using Cartesian coordinates $\mathbb{R}^2$, lets say that the center is given in vector form as $\vec C = (a,b)$ and that the arc is expressed in vector form as
$$\vec \gamma(t) = (f(t), g(t)), \quad 0 \le t \le 1
$$
So, for instance, the start point is $\vec\gamma(t) = (f(0),g(0))$ and the endpoint point is $\vec\gamma(1) = (f(1),g(1))$.
Then the winding number is
$$W(\vec \gamma) = \int_0^1 \, \frac{d}{dt}\bigl(\theta(t)\bigr) \quad dt
$$
where 
$$\theta(t) =
\begin{cases}
 arctan\bigl((g(t)-b)\,/\,(f(t)-a)\bigr)  & \quad\text{for $f(t) \ne 0$} \\
 arccotan\bigl((f(t)-a)\,/\,(g(t)-b)\bigr) & \quad\text{for $g(t) \ne 0$}
\end{cases}
$$
Notice that the integrand $d/dt(\theta(t))$ is a well-defined and continuous function of $t$, which is where one uses the hypothesis that $\vec\gamma(t)$ does not pass through $\vec C$: at least one of the denominators $f(t)-a$ or $g(t)-b$ is nonzero, for each $t \in [0,1]$.
Now let's look at some conclusions that you can derive from this. 
If the integrand $d/dt(\theta(t))$ is positive then it is fair to say that the curve is anticlockwise at every point, whereas if the integrand is negative then the curve is clockwise at every point.  
On the other hand, it is possible that the integrand is positive at some points and negative at other points, in which case perhaps you might not be willing to commit to distinguish between clockwise and anticlockwise. On the other hand, if you were willing to thing about the "overall orientation" or "net orientation" of the curve, then you might say that the curve is "net anticlockwise" if $W(\vec\gamma)$ is positive, or that it is "net clockwise" if $W(\vec\gamma)$ is negative. 
One of the really interesting features of the winding number is that if $\vec\gamma$ is a closed curve, meaning that $\vec \gamma(0)=\vec\gamma(1)$ (i.e. it starts and ends at the same point), then the winding number is an integer multiple of $2\pi$.
