# How to calculate different combinations of back and dotted perimeter

I have this code that generates the image below, my question is how to calculate the area and perimeter of the first figure and all the variations of it considering a side of square "L" or as possible. The figure shows some variations, I imagine that MMA can find others. Help me with more code, still very new to MMA

pts = RandomReal[{0, 1}, {20000, 2}];
pts = Select[pts,
And @@ Table[
Norm[# - p] < 1, {p, {{0, 0}, {1, 0}, {1, 1}, {0, 1}}}] &];
Graphics[{Thick, Line[{{0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 0}}],
Circle[{0, 0}, 1, {0, Pi/2}], Circle[{1, 0}, 1, {Pi/2, Pi}],
Circle[{1, 1}, 1, {Pi, 3 Pi/2}], Circle[{0, 1}, 1, {3 Pi/2, 2 Pi}],
PointSize[Small], Point[pts]}]


EDIT : The idea is to have a variety of areas to calculate by hand after (they are challenges but I need to check them) Below were some that I had not noticed, that is the grace of MMA

• Hi. I find it difficult to understand your question, in particular I do not understand "...all the variations of it considering a side of square "L" or as possible." I'd suggest you edit the question to make it clearer. Jul 16, 2022 at 5:42
• Hello, look at the edition above Jul 17, 2022 at 4:09

All the arc lengths are equal to Pi/6. For example,

arc = RegionIntersection[Circle[{0, 0}, 1, {0, Pi/2}],
Disk[{1, 0}, 1, {Pi/2, Pi}], Disk[{0, 1}, 1, {3 Pi/2, 2 Pi}]];
Show[Graphics[{Line[{{0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 0}}],
Circle[{0, 0}, 1, {0, Pi/2}], Circle[{1, 0}, 1, {Pi/2, Pi}],
Circle[{1, 1}, 1, {Pi, 3 Pi/2}],
Circle[{0, 1}, 1, {3 Pi/2, 2 Pi}]}],
Region[Style[arc, Directive[Thick, Red]]]]
arc // ArcLength


π/6

And we can calculate the areas at the same way. For example the center area.

reg = RegionIntersection[Disk[{0, 0}, 1, {0, Pi/2}],
Disk[{1, 0}, 1, {Pi/2, Pi}], Disk[{1, 1}, 1, {Pi, 3 Pi/2}],
Disk[{0, 1}, 1, {3 Pi/2, 2 Pi}]];
Show[Graphics[{Line[{{0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 0}}],
Circle[{0, 0}, 1, {0, Pi/2}], Circle[{1, 0}, 1, {Pi/2, Pi}],
Circle[{1, 1}, 1, {Pi, 3 Pi/2}],
Circle[{0, 1}, 1, {3 Pi/2, 2 Pi}]}], Region[reg]]
reg // Area


1/3 (3 - 3 Sqrt[3] + π)

• Thanks for answering, how do you calculate for other more complicated ones, how do you know which parameters to choose? Jul 17, 2022 at 4:04
{centers,arcs}={{{0,0},{1,0},{1,1},{0,1}},{{0,1/2},{1/2,1},{1,3/2},{3/2,2}}Pi};

Length[ineqs=Simplify@CylindricalDecomposition[0<x<1&&0<y<1&&
!(Or@@(#.#==1&[{x,y}-#]&/@centers)),{x,y},"Components"]]

impRegs=ImplicitRegion[#,{{x,0,1},{y,0,1}}]&/@ineqs;

regs=BoundaryDiscretizeRegion/@impRegs;

Round[Total/@Rest@Subsets[Area/@impRegs],10^-12.]}],Last]]//AbsoluteTiming

ans=SortBy[gb[[All,1,1]],Area];

{centers,arcs}]}],ImageSize->85,PlotRange->{{-0.1,1.1},{-0.1,1.1}},
PlotLabel -> ({#, NumberForm[#2, {16, 3}]} & @@@ {{"A", Area@#}, {"P", Perimeter@#}})
]&/@ans


{centers,arcs}={{{0,0},{1,0},{1,1},{0,1}},{{0,Pi/2},{Pi/2,Pi},{Pi,(3 Pi)/2},{(3 Pi)/2,2 Pi}}};
regs=BoundaryDiscretizeGraphics[Disk[#],PlotRange->{{0,1},{0,1}}]&/@centers;
ineqs=#.#<1&[{x,y}-#]&/@centers;
ops={And,Or,Xor,#&&!#2&};