# How to check if point lies on arc

Hello guys
It’s an urgent for me so any one can help
Let’s say I have an curve with start point sp and end point ep and center point cp and direction cw or ccw
And I have a point p which I am pretty sure that it lies on the circle contains the arc
But I need to check if it lies on my arc ?
Any one can help ?
I have written many many algorithms but only fail I have got

Could you make a schematic of the problem.
What algorithm did you try with three.js ( code snippet )?

You have a center and two points - your arc. You have a point you need to know if it’s on the arc.
You can get the angle of the segment (center - startPoint, center - endPoint) and check if the point on the arc is within this sector.

1 Like

the angle of the arc conflict with cw or ccw case how could i calculate the angle of arc considering cw case?

Have a look at this:

1 Like

Thanks @prisoner849
Actually I ended up with the following which is the only code works with me
I know it will take much more cost but that’s the only way worked with me

The idea is getting the arc total length tl and then get the arc length l1 from arc mid point to the point I want to check and check if the l1<tl

``````a1 = angleFromOrigin(arc.userData.cTP_c2PR.cp, p);
a2 = angleFromOrigin(arc.userData.cTP_c2PR.cp, arc.userData.cTP_c2PR.mp);
if (a2 - a1 > +180.0) a2 -= 360.0;
if (a2 - a1 < -180.0) a2 += 360.0;
if (a2 - a1 < 0) cw = true;
if (a2 - a1 >= 0) cw = false;

newCur.absarc(arc.userData.cTP_c2PR.cp.x, arc.userData.cTP_c2PR.cp.y, arc.userData.cTP_c2PR.r, a1 * Math.PI / 180, a2 * Math.PI / 180, cw);
newCurLength = newCur.curves[0].getLength();
if (newCurLength <= arc.userData.Tlength / 2) {
return true ;
} else {
return false;
}
``````