Reputation: 137
I have two circles, an inner circle and an outter circle. I'm trying to find points that reside within the area between the edge of the inner circle and the edge of the outer circle.
Does anyone know a formula for this?
Thanks a lot!
Upvotes: 0
Views: 246
Reputation: 4431
Let C_inner and C_outer be the centers of your two circles with radii r_outer > r_inner. Any point P is inside the circle if the distance from the center is smaller than the radius. You're looking for points P that satisfy
( | P - C_outer | < r_outer ) and not ( | P - C_inner | < r_inner )
where the distance is calculated through
| P - C | = (p_x - c_x) ^ 2 + (p_y - c_y) ^ 2
The formula then is
r_inner < (p_x - c_inner_x) ^ 2 + (p_y - c_inner_y) ^ 2 && (p_x - c_outer_x) ^ 2 + (p_y - c_outer_y) ^ 2 < r_outer
Upvotes: 1