Or lies on chord? Is there any algorithm to determine it?
In the first case the center lies outside the arc. In the second it is conversely.
Thanks!
Or lies on chord? Is there any algorithm to determine it?
In the first case the center lies outside the arc. In the second it is conversely.
Thanks!
On
Let $C=(x_0,y_0)$ be the circle’s center. Examine the sign of $(x_2-x_0)(y_1-y_0)-(x_1-x_0)(y_2-y_0)$. This is basically the $z$-component of $(P_2-C)\times(P_1-c)$. (Since we’re going clockwise, which by convention is a negative angle, we take $P_2$ first to reverse the sign.) If it’s positive, then the center is outside of the segment; if negative, the center is inside. If it’s zero, you either have $P_1=P_2$, or the points are on opposite sides of a diameter.
Let $P_1$ and $P_2$ be the points on the circle, and let $C$ be the center. We have that $C$ lies inside the region bounded by the chord $P_1P_2$ and the arc going clockwise from $P_1$ to $P_2$ if the angle of the arc is greater than $180^{\circ}$, outside if the angle is less than $180^{\circ}$, and on the chord if the angle is $180^{\circ}$.
Let $\vec{u} = P_1 - C$ and $\vec{v} = P_2-C$, and consider the cross product $\vec{u}\times\vec{v}$. (This is easily calculable if coordinates are given.) If the clockwise arc from $P_1$ to $P_2$ has angle greater than $180^{\circ}$, then by the right hand rule we have that the sign of $\vec{u}\times\vec{v}$ is positive. Correspondingly, if the arc has angle less than $180^{\circ}$, then the sign is negative, while if the arc has angle exactly $180^{\circ}$, then the cross product is zero.