Not sure what you mean by "handling touch events", but here's the math:
hypot(circle.center.y - ring.center.y, circle.center.x - ring.center.x) < (r - c)
Question
Looking for some direction on this. Say you have a ring of radius r. Inside the ring you have a circle of radius c, where c < r. I want the user to be able to grab the inner circle and move/throw it, but circle should be constrained to stay inside the ring. Any suggestions on the following?
I am working in iOS, but the concept is general.
Solution
Not sure what you mean by "handling touch events", but here's the math:
hypot(circle.center.y - ring.center.y, circle.center.x - ring.center.x) < (r - c)