Jump to content

Area of squares bisected by part of a circle


Prometheus

Recommended Posts

I have a grid through upon which a circle is drawn, as shown below.

CircleOnSq.thumb.jpg.369cfc836cba4a8dc9d690fc43307806.jpg

Now, for every square in the grid through which the circle runs, i want to calculate the proportion of the square covered by the circle. So one of the squares close up:

 

ZoomedCircleOnSq.thumb.jpg.6c30f776cc4e0c49813182c776024441.jpg

I thought this would be relatively straightforward but i've ended up with a horribly convoluted way involving working at some angles where the circle crosses the squares, using that to find the area of the circle, then subtracting that from the area of a rectangle that contains that circle segment, and so on for other squares. Only need to do this for three squares as symmetry saves me a lot of work, but it's still a meandering method. Just seems to me there should be a much more simple method, but i can't figure it out.

Does anybody know of a more elegant way of solving this problem?

Link to comment
Share on other sites

29 minutes ago, Prometheus said:

I have a grid through upon which a circle is drawn, as shown below.

CircleOnSq.thumb.jpg.369cfc836cba4a8dc9d690fc43307806.jpg

Now, for every square in the grid through which the circle runs, i want to calculate the proportion of the square covered by the circle. So one of the squares close up:

 

ZoomedCircleOnSq.thumb.jpg.6c30f776cc4e0c49813182c776024441.jpg

I thought this would be relatively straightforward but i've ended up with a horribly convoluted way involving working at some angles where the circle crosses the squares, using that to find the area of the circle, then subtracting that from the area of a rectangle that contains that circle segment, and so on for other squares. Only need to do this for three squares as symmetry saves me a lot of work, but it's still a meandering method. Just seems to me there should be a much more simple method, but i can't figure it out.

Does anybody know of a more elegant way of solving this problem?

Wouldn't you be looking for the Area under a Curve? Look at each square as a quadrant in graph.

Edited by StringJunky
Link to comment
Share on other sites

If it is the real work, not mathematical play, I would simply boolean one object from other object to get intersecting polygons, and use area calculation tool in 3D application on remaining polygons (eventually triangulate it).

You might need to temporarily extend 2D shape to 3D because some boolean tools don't like to work in 2D (depending on application that you're using).

 

Edited by Sensei
Link to comment
Share on other sites

Here are some thoughts.

Use symmetry. That substantially reduces the workload.

Then you can calculate the coordinates of the intercepts with the sides of the squares by calculating the offsets from the tangent.

The four sides of the outer box are tangent to the circle as shown.

The simple formula for perpendicular offsets from the tangent to a circular curve is

Offset = (Length along the tangent)2 / twice radius

 

prometheus1.thumb.jpg.781c3fa4f3a96e990c7168c10c0e0c79.jpg

 

 

Link to comment
Share on other sites

I should perhaps add how to get the areas?

 

Well in each square you have to add the area of a rectangle R, a triangle T and a circular segement S.

You already have the circle radius and can easily find the chord length as the hypotenuse of a right angled triangle.

So these are easily calculable from the intercepts, or you can use an online calculator for the segments.

You haven't stated your mesh size, but with the size shown in the drawing you only need three sizes and to find these you only need two intercepts.
Symmetry does the rest.

prometheus2.jpg.5280b66f87ed9af67aca33df48cfd224.jpg

Link to comment
Share on other sites

Following String's hint and using studiot's notation for the squares, of which we need only 3, i've come up with:

\( A = int_{0}^{1}(r^2 - x^2) dx - 2  \)

\( B = int_{1}^{2}(r^2 - x^2) dx - 2  \)

\( C = int_{2}^{3}(r^2 - x^2) dx - (A+B)  \)

Which give reasonable looking answers too.

I'll give Studiot's method a go later, it looks like a more refined approach to the one i first described.

Edited by Prometheus
i seem to be getting worse at using latex
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.