I am currently in need of locating an algorithm that will determine if a point is to the right or left of an arc. This is an extension of the following algorithm to include arcs:
// isLeft(): tests if a point is Left|On|Right of an infinite line.
// Input: three points P0, P1, and P2
// Return: >0 for P2 left of the line through P0 and P1
// =0 for P2 on the line
// <0 for P2 right of the line
// See: Algorithm 1 "Area of Triangles and Polygons"
inline int
isLeft( Point P0, Point P1, Point P2 )
{
return ( (P1.x - P0.x) * (P2.y - P0.y)
- (P2.x - P0.x) * (P1.y - P0.y) );
}
//===================================================================
This code was retrieved from the site: http://geomalgorithms.com/a03-_inclusion.html
And this is used for the winding number algorithm. My goal is to expand this algorithm to include arcs and not just lines.
It is not quite like this post here: How to determine whether a point (X,Y) is contained within an arc section of a circle (i.e. a Pie slice)?
In the post mentioned, the author is trying to determine if the point lies within the central angle of the arc. Mine is slightly different in the sense that a point can be beyond the radius but the arc still contains the point in question.
I created a picture of what I am attempting to describe. Please note that I am not a drawer in any way. Anyways, the arc in question is green. I created two parallel lines that intersect the arc at the start and end nodes respectively. These lines are colored red. Please forgive my drawing skills. Even though the red lines in the drawing may appear to not be parallel, they are suppose to be parallel. The drawing is just for reference. I am defining in this post that the lines are parallel. This post here supersedes whatever is in the drawing. This means that even if the drawing does not indicate that the lines are parallel to each other, they are in fact suppose to be parallel to each other since I have stated this in the post. I need assistance in coming up with an algorithm that will determine if a point lies within the blue area. Note that the red lines can extend infinitely. For the sake of discussion, I ended the lines at an arbitrary point to color in the blue area.
If the point lies within the blue area, I consider this as the arc containing the point. As a side note, I am coding this algorithm in C++ (hence the c++ tag)
The type of arc I'm talking about is a circle's arc with a start and end node, an arc angle, and a circle center point and radius.
Edit:
The two answers by Yves and MBo contain better pictures at what I am attempting to explain. Please refer to these pictures. MBo contains the better of the pictures.
As Yves has described, I am attempting to test if a point lies within a semi infinite slab delimited by the arc and two parallel lines. These lines intersect the start and end node. Refer to MBo drawing for a clearer picture. Yves first drawing is also a clear picture. I am testing if the point lies in the shaded region.
I am using the terms left and right as a perspective. I apologize that I did not clearly explain this the first time I created the post. Imagine that you are traveling on this arc in a counter clock wise motion. The first node would be the right most node and the end node would be the left most node. From the perspective of the traveler, a point that is contained by this arc (or the semi-infinite slab) would be to the left of the arc. Any points to the right would be outside of the arc.