# How to get the center point of a circle

I am a computer programmer trying to find if the movement of mouse was in clockwise or anticlock wise direction when user moves the mouse in circles, i am using this formulae to find the if direction was clockwise or anti clockwise.

((b.x ‐ a.x)(c.y ‐ a.y) ‐ (b.y ‐ a.y)(c.x ‐ a.x))

where b = First click

c = second click

a = Mid point of the circle

How can i get the values for point a.

If you're just wanting to know whether it is clockwise or anticlockwise, suppose you have three points on the path, $p_1$, $p_2$, and $p_3$, and consider vectors $v_1=p_2-p_1$ and $v_2=p_3-p_2$. Let $R$ be the rotation matrix for the angle 90 degrees anticlockwise. Compute the number $a=(Rv_1)\cdot v_2$, where the dot is dot product. If this number $a$ is positive, the points are along an anticlockwise path, and if it is negative, the points are along a clockwise path. This formula represents projecting the second vector onto a vector perpendicular to the first, then seeing in which direction that projection goes.
Just to be more concrete, suppose $v_1=(x_1,x_2)$ and $v_2=(y_1,y_2)$. Then $a=x_1y_2-x_2y_1$. (This is the third component of a cross product of $v_1$ and $v_2$ as if they were 3D vectors.)
• I'm not exactly sure what you are doing, but this might be a sampling problem: make sure the three points are far enough away from each other. Or you might consider summing up this number $a$ along the whole path and seeing whether the result is positive or negative (this amounts to a line integral). – Kyle Miller Oct 5 '15 at 17:02