i have arc A ,i know startangle,endangle,startPoint,Endpoint,centre,radius of arc and i have point B, i like to find point B lies or not in arc A , i need formula or algorithum for this
how to find point lie on the arc
-
0You probably need to worry about numeric precision. These are clearly floating point numbers and B may not be *exactly* on the arc, even if it should be. – 2014-05-01
3 Answers
Assuming you're talking about an arc of a circle, the first question to ask is whether the point lies on the circle. This just means that the distance from the center of the circle to your point is equal to the radius. Then find out the angle between the radius to your point and, say, a horizontal line, and figure out whether the point is within the bounds of the arc.
-
2@ratty. In the second step using $\arctan(y/x)$ is not sufficient. You must use atan2: http://en.wikipedia.org/wiki/Atan2 – 2010-10-06
Did you take a look here: http://mathforum.org/library/drmath/view/54365.html
-
2This sort of answers (pointing to a URL) is better as a comment, IMO. – 2010-10-06
-
0@Muad: Right, i keep that in Mind from now on. – 2010-10-06
There is a simple test in cases where the arc does not sweep 180 degrees...
After determining if the point lies on the arc, the next step is to calculate the distance between the two arc endpoints. On a short arc, the point in question will be within this distance of both endpoints. On a long arc, the point will not be within this distance of both points (none, one, or the other, but not both).