# Point in (skewed) circle sector

This topic is 3588 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi all, I have two circles - one inside the other, and I need to and I'm trying to figure out which sector (of which circle) a given point is inside. The obvious easy scenario is when one circle is perfectly centered within another; but if the inner circle isn't centered, how do I find out what I want to know? The sector edges are (2pi / #sectors) on the circumference on the outer circle. Diagram to explain: <br/> Thanks - I'd very much appreciate any tips / pointers in the right direction!

##### Share on other sites

1. Run point-in-circle tests on the given point for both circles. This will tell you if the point is outside both circles, inside the larger circle but not the smaller circle, or inside both.

2. Construct hyperplanes corresponding to each of the 'spokes' that define the sectors. These will be lines in the form ax+by+d = 0. (Post back if you're not sure how to do this.)

3. Each consecutive pair of hyperplanes forms an unbounded triangle. For each of these triangles, test the point for inclusion by performing a 'which side' test against each of the two bounding hyperplanes.

You now have enough info to determine which circle and sector (if any) the point is in (assuming I didn't mess anything up).

##### Share on other sites
You can also use the CCW function to determine on which side of a spoke you are

From http://www.macs.hw.ac.uk/~alison/ds98/node114.html :
int ccw(point p1, point p2, point p3)// Slightly deficient function to determine if the two lines p1, p2 and// p2, p3 turn in counter clockwise direction}{  int dx1, dx2, dy1, dy2;  dx1 = p2.x - p1.x; dy1 = p2.y - p1.y;  dx2 = p3.x - p2.x; dy2 = p3.y - p2.y;  if(dy1*dx2 < dy2*dx1) return 1;  else return 0;}

##### Share on other sites
Thanks for the ideas - I hadn't even thought about just performing a above/below plane test, that seems in theory to be the best way to tackle this.

Much appreciated :)

1. 1
Rutin
67
2. 2
3. 3
4. 4
5. 5

• 21
• 10
• 33
• 20
• 9
• ### Forum Statistics

• Total Topics
633420
• Total Posts
3011790
• ### Who's Online (See full list)

There are no registered users currently online

×