I have a region plot, and I would like to calculate the area:

With[{b = 2, h = 2}, RegionPlot[

{(x)^2 + (y – b)^2 > h^2 + b^2 &&

(x)^2 + (y – b – h)^2 > h^2 + b^2 &&

(x – h)^2 + (y – 2 b – h)^2 > h^2 + b^2 &&

(x – h – b)^2 + (y – 2 b – h)^2 > h^2 + b^2 &&

(x – 2 h – b)^2 + (y – b – h)^2 > h^2 + b^2 &&

(x – 2 h – b)^2 + (y – b)^2 > h^2 + b^2 &&

(x – h – b)^2 + (y)^2 > h^2 + b^2 &&

(x – h)^2 + (y)^2 > h^2 + b^2}, {x, 0, 2 h + b}, {y, 0, 2 b + h}]]

I have tried defining it as an ImplicitRegion but Area evaluates to Infinity. I am sure I am doing something wrong that is very simple, but I can’t see what.

=================

1

Well, if you can extract the polygons, there’s this.

– J. M.♦

Jun 30 ’15 at 3:16

1

For approximate area: Area @ DiscretizeGraphics @ g. Where g is your graphics.

– RunnyKine

Jun 30 ’15 at 5:10

=================

1 Answer

1

=================

ImplicitRegion seems to work fine:

ir = With[{b = 2, h = 2},

ImplicitRegion[{(x)^2 + (y – b)^2 >

h^2 + b^2 && (x)^2 + (y – b – h)^2 >

h^2 + b^2 && (x – h)^2 + (y – 2 b – h)^2 >

h^2 + b^2 && (x – h – b)^2 + (y – 2 b – h)^2 >

h^2 + b^2 && (x – 2 h – b)^2 + (y – b – h)^2 >

h^2 + b^2 && (x – 2 h – b)^2 + (y – b)^2 >

h^2 + b^2 && (x – h – b)^2 + (y)^2 >

h^2 + b^2 && (x – h)^2 + (y)^2 > h^2 + b^2},

{{x, 0, 2 h + b}, {y, 0, 2 b + h}}]];

FullSimplify[Area[ir]]

(* (8 Pi)/3 – 4 (-7 + 2 Sqrt[3] + Sqrt[7] + 4 ArcCos[3/4]) *)

which agrees with the approximate area based on the plot per RunnyKine’s comment

Area[DiscretizeGraphics[RegionPlot[ir]]]

(* 0.375737 *)

or the approximate area based on the discretized region

Area[DiscretizeRegion[ir]]

(* 0.374631 *)

The last value can be made more accurate by using a finer mesh.

Area[DiscretizeRegion[ir, PrecisionGoal -> 9]]

(* 0.374421 *)

ah – thank you! I was using {x,y} at the end insterad of {{x, 0, 2 h + b}, {y, 0, 2 b + h}} – I didn’t realise you needed the extra curly brackets around it & wondered why {x, 0, 2 h + b}, {y, 0, 2 b + h} didn’t work!!

– martin

Jun 30 ’15 at 6:44