Render only the segment/area of a circle that intersects the main circle

Posted by Greenhouse Gases on Stack Overflow See other posts from Stack Overflow or by Greenhouse Gases
Published on 2011-02-16T09:30:05Z Indexed on 2011/02/16 23:25 UTC
Read the original article Hit count: 324

Filed under:
|
|
|

I absolutely love maths (or 'math' as most of you would say!) but I haven't done it to a level where I know the answer to this problem. I have a main circle which could have a centre point at any x and y on a display. Other circles will move around the display at will but at any given call to a render method I want to render not only those circles that intersect the main circle, but also only render the segment of that circle that is visible inside the main circle. An analogy would be a shadow cast on a real life object, and I only want to draw the part of that object that is 'illuminated'.

I want to do this preferably in Java, but if you have a raw formula that would be appreciated. I wonder how one might draw the shape and fill it in Java, I'm sure there must be some variation on a polyline with arcs or something?

Many thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about geometry