Draw circles and compute -

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
7
down vote

favorite
1












The following code draws the polygons of VoronoiMesh[pts]:



SeedRandom[3]; 
pts = RandomReal[-1, 1, 25, 2];
mesh = VoronoiMesh[pts];
vertices = MeshCoordinates[mesh];
Show[mesh, Graphics[Black, Point[pts], Red, Point[vertices]]]


The output is:



enter image description here



The black points are pts, the red ones the vertices of the Voronoi mesh.



My questions:



  • How can I draw circles around each point in pts with a given radius $r$, such as $0.18$?

  • How can I compute <sum of circle areas>-<area of overlaps of the circles>, i.e.
    $$left(sum_cinmathrmCirclesmathrmArea(c)right)-left(sum_oinmathrmOverlapsmathrmArea(o)right)$$









share|improve this question



























    up vote
    7
    down vote

    favorite
    1












    The following code draws the polygons of VoronoiMesh[pts]:



    SeedRandom[3]; 
    pts = RandomReal[-1, 1, 25, 2];
    mesh = VoronoiMesh[pts];
    vertices = MeshCoordinates[mesh];
    Show[mesh, Graphics[Black, Point[pts], Red, Point[vertices]]]


    The output is:



    enter image description here



    The black points are pts, the red ones the vertices of the Voronoi mesh.



    My questions:



    • How can I draw circles around each point in pts with a given radius $r$, such as $0.18$?

    • How can I compute <sum of circle areas>-<area of overlaps of the circles>, i.e.
      $$left(sum_cinmathrmCirclesmathrmArea(c)right)-left(sum_oinmathrmOverlapsmathrmArea(o)right)$$









    share|improve this question

























      up vote
      7
      down vote

      favorite
      1









      up vote
      7
      down vote

      favorite
      1






      1





      The following code draws the polygons of VoronoiMesh[pts]:



      SeedRandom[3]; 
      pts = RandomReal[-1, 1, 25, 2];
      mesh = VoronoiMesh[pts];
      vertices = MeshCoordinates[mesh];
      Show[mesh, Graphics[Black, Point[pts], Red, Point[vertices]]]


      The output is:



      enter image description here



      The black points are pts, the red ones the vertices of the Voronoi mesh.



      My questions:



      • How can I draw circles around each point in pts with a given radius $r$, such as $0.18$?

      • How can I compute <sum of circle areas>-<area of overlaps of the circles>, i.e.
        $$left(sum_cinmathrmCirclesmathrmArea(c)right)-left(sum_oinmathrmOverlapsmathrmArea(o)right)$$









      share|improve this question















      The following code draws the polygons of VoronoiMesh[pts]:



      SeedRandom[3]; 
      pts = RandomReal[-1, 1, 25, 2];
      mesh = VoronoiMesh[pts];
      vertices = MeshCoordinates[mesh];
      Show[mesh, Graphics[Black, Point[pts], Red, Point[vertices]]]


      The output is:



      enter image description here



      The black points are pts, the red ones the vertices of the Voronoi mesh.



      My questions:



      • How can I draw circles around each point in pts with a given radius $r$, such as $0.18$?

      • How can I compute <sum of circle areas>-<area of overlaps of the circles>, i.e.
        $$left(sum_cinmathrmCirclesmathrmArea(c)right)-left(sum_oinmathrmOverlapsmathrmArea(o)right)$$






      computational-geometry






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 8 at 22:33









      Lukas Lang

      5,2381525




      5,2381525










      asked Sep 8 at 13:11









      Eman

      926




      926




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          6
          down vote



          accepted










          I am not sure are you interested in the union of the disks or the union sans the intersections. The code below can be used for both cases.



          Implicit regions



          r = 0.18;
          regs = ImplicitRegion[
          Sqrt[(x - #[[1]])^2 + (y - #[[2]])^2] <= r, x, y] & /@ pts;


          Circles drawing



          Show[mesh, 
          Graphics[Cyan, Circle[#, r] & /@ pts, Black, Point[pts], Red,
          Point[vertices]], Axes -> True]


          enter image description here



          Union



          c = Ceiling[Max[pts] + r, 0.5];

          AbsoluteTiming[
          dregs = DiscretizeRegion[RegionUnion[regs], -2, 2, -2, 2,
          ImageSize -> Medium]
          ]


          enter image description here



          RegionMeasure[dregs]

          (* 1.99653 *)


          Union Intersection



          ires = DeleteCases[
          Flatten[Table[
          RegionIntersection[regs[[i]], regs[[j]]], i, 1,
          Length[regs], j, i + 1, Length[regs]]], _EmptyRegion];

          AbsoluteTiming[
          dires = DiscretizeRegion[RegionUnion[ires], -c, c, -c, c,
          ImageSize -> Medium, Frame -> True, PlotRange -> -c, c, -c, c]
          ]


          enter image description here



          RegionMeasure[dregs] - RegionMeasure[dires]

          (* 1.56288 *)





          share|improve this answer






















          • Thanks so much for your answer. But, I want to draw circle around each pts point, which is represented by black points and keeps also the voronoi diagram. Then, detect the overlapping areas occurs between these circles. Then calculate the sum of these circles' areas subtracted by the overlapping areas. I think, there is a difference between the circle and the disk.
            – Eman
            Sep 8 at 13:39







          • 1




            @Eman See my edit. It should be close to what you want.
            – Anton Antonov
            Sep 8 at 13:50










          • Thanks so much for your help and your edit. I really appreciate that. Your edit is what I was looking for. Thanks so much.
            – Eman
            Sep 8 at 14:20










          • Excuse me, If I want to make only 15 circles with radius of 0.18 and the other 10 circles with radius of 0.25,then compute <sum of circle areas>-<area of overlaps of the circles> , what should I modify in your code to do that??
            – Eman
            Sep 12 at 16:55







          • 1




            @Eman You can have a separate list of radiuses and use MapThread when making the implicit regions. E.g. regs = MapThread[ ImplicitRegion[ Sqrt[(x - #1[[1]])^2 + (y - #1[[2]])^2] <= #2, x, y] &, pts, rs] .
            – Anton Antonov
            Sep 13 at 12:21

















          up vote
          5
          down vote













          radius = .18;
          disks = Disk[#, radius] & /@ pts;
          25 Area[disks[[1]]]



          2.54469




          Area[RegionUnion[disks]]



          2.03381




          Show[mesh, Graphics[Black, Point[pts], Red, Point[vertices], 
          FaceForm[Opacity[.5,LightGreen]],EdgeForm[Thick,Darker@Green], disks]]


          enter image description here






          share|improve this answer






















          • Thanks for your help.
            – Eman
            Sep 8 at 14:18






          • 1




            @eman, my pleasure.
            – kglr
            Sep 8 at 14:24

















          up vote
          3
          down vote













          I think it is much better to use RegionMeasure on the undiscretized regions. For instance:



          disks = Disk[#, .18]& /@ pts;

          ru = RegionMeasure @ RegionUnion[disks]
          RegionMeasure @ DiscretizeRegion @ RegionUnion[disks]



          2.03381



          1.99723




          The region measure of the discretized version is almost 2% off. Similarly:



          ires = DeleteCases[
          Flatten @ Table[
          RegionIntersection[disks[[i]], disks[[j]]],
          i, 1, 25,
          j, i + 1, 25
          ],
          _EmptyRegion
          ];

          int = RegionMeasure @ RegionUnion @ ires
          RegionMeasure @ DiscretizeRegion @ RegionUnion @ ires



          0.44757



          0.439748




          So a more accurate answer would be:



          ru - int



          1.58624




          Finally, it is possible to get this result directly by using BooleanCountingFunction:



          RegionMeasure @ BooleanRegion[
          BooleanCountingFunction[1, 25],
          disks
          ]



          1.58624




          although this version is slower than Antons.






          share|improve this answer




















          • Thanks so much for your help.
            – Eman
            Sep 9 at 14:02










          Your Answer




          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "387"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f181488%2fdraw-circles-and-compute-sum-of-circle-areas-area-of-overlaps-of-the-circles%23new-answer', 'question_page');

          );

          Post as a guest






























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          6
          down vote



          accepted










          I am not sure are you interested in the union of the disks or the union sans the intersections. The code below can be used for both cases.



          Implicit regions



          r = 0.18;
          regs = ImplicitRegion[
          Sqrt[(x - #[[1]])^2 + (y - #[[2]])^2] <= r, x, y] & /@ pts;


          Circles drawing



          Show[mesh, 
          Graphics[Cyan, Circle[#, r] & /@ pts, Black, Point[pts], Red,
          Point[vertices]], Axes -> True]


          enter image description here



          Union



          c = Ceiling[Max[pts] + r, 0.5];

          AbsoluteTiming[
          dregs = DiscretizeRegion[RegionUnion[regs], -2, 2, -2, 2,
          ImageSize -> Medium]
          ]


          enter image description here



          RegionMeasure[dregs]

          (* 1.99653 *)


          Union Intersection



          ires = DeleteCases[
          Flatten[Table[
          RegionIntersection[regs[[i]], regs[[j]]], i, 1,
          Length[regs], j, i + 1, Length[regs]]], _EmptyRegion];

          AbsoluteTiming[
          dires = DiscretizeRegion[RegionUnion[ires], -c, c, -c, c,
          ImageSize -> Medium, Frame -> True, PlotRange -> -c, c, -c, c]
          ]


          enter image description here



          RegionMeasure[dregs] - RegionMeasure[dires]

          (* 1.56288 *)





          share|improve this answer






















          • Thanks so much for your answer. But, I want to draw circle around each pts point, which is represented by black points and keeps also the voronoi diagram. Then, detect the overlapping areas occurs between these circles. Then calculate the sum of these circles' areas subtracted by the overlapping areas. I think, there is a difference between the circle and the disk.
            – Eman
            Sep 8 at 13:39







          • 1




            @Eman See my edit. It should be close to what you want.
            – Anton Antonov
            Sep 8 at 13:50










          • Thanks so much for your help and your edit. I really appreciate that. Your edit is what I was looking for. Thanks so much.
            – Eman
            Sep 8 at 14:20










          • Excuse me, If I want to make only 15 circles with radius of 0.18 and the other 10 circles with radius of 0.25,then compute <sum of circle areas>-<area of overlaps of the circles> , what should I modify in your code to do that??
            – Eman
            Sep 12 at 16:55







          • 1




            @Eman You can have a separate list of radiuses and use MapThread when making the implicit regions. E.g. regs = MapThread[ ImplicitRegion[ Sqrt[(x - #1[[1]])^2 + (y - #1[[2]])^2] <= #2, x, y] &, pts, rs] .
            – Anton Antonov
            Sep 13 at 12:21














          up vote
          6
          down vote



          accepted










          I am not sure are you interested in the union of the disks or the union sans the intersections. The code below can be used for both cases.



          Implicit regions



          r = 0.18;
          regs = ImplicitRegion[
          Sqrt[(x - #[[1]])^2 + (y - #[[2]])^2] <= r, x, y] & /@ pts;


          Circles drawing



          Show[mesh, 
          Graphics[Cyan, Circle[#, r] & /@ pts, Black, Point[pts], Red,
          Point[vertices]], Axes -> True]


          enter image description here



          Union



          c = Ceiling[Max[pts] + r, 0.5];

          AbsoluteTiming[
          dregs = DiscretizeRegion[RegionUnion[regs], -2, 2, -2, 2,
          ImageSize -> Medium]
          ]


          enter image description here



          RegionMeasure[dregs]

          (* 1.99653 *)


          Union Intersection



          ires = DeleteCases[
          Flatten[Table[
          RegionIntersection[regs[[i]], regs[[j]]], i, 1,
          Length[regs], j, i + 1, Length[regs]]], _EmptyRegion];

          AbsoluteTiming[
          dires = DiscretizeRegion[RegionUnion[ires], -c, c, -c, c,
          ImageSize -> Medium, Frame -> True, PlotRange -> -c, c, -c, c]
          ]


          enter image description here



          RegionMeasure[dregs] - RegionMeasure[dires]

          (* 1.56288 *)





          share|improve this answer






















          • Thanks so much for your answer. But, I want to draw circle around each pts point, which is represented by black points and keeps also the voronoi diagram. Then, detect the overlapping areas occurs between these circles. Then calculate the sum of these circles' areas subtracted by the overlapping areas. I think, there is a difference between the circle and the disk.
            – Eman
            Sep 8 at 13:39







          • 1




            @Eman See my edit. It should be close to what you want.
            – Anton Antonov
            Sep 8 at 13:50










          • Thanks so much for your help and your edit. I really appreciate that. Your edit is what I was looking for. Thanks so much.
            – Eman
            Sep 8 at 14:20










          • Excuse me, If I want to make only 15 circles with radius of 0.18 and the other 10 circles with radius of 0.25,then compute <sum of circle areas>-<area of overlaps of the circles> , what should I modify in your code to do that??
            – Eman
            Sep 12 at 16:55







          • 1




            @Eman You can have a separate list of radiuses and use MapThread when making the implicit regions. E.g. regs = MapThread[ ImplicitRegion[ Sqrt[(x - #1[[1]])^2 + (y - #1[[2]])^2] <= #2, x, y] &, pts, rs] .
            – Anton Antonov
            Sep 13 at 12:21












          up vote
          6
          down vote



          accepted







          up vote
          6
          down vote



          accepted






          I am not sure are you interested in the union of the disks or the union sans the intersections. The code below can be used for both cases.



          Implicit regions



          r = 0.18;
          regs = ImplicitRegion[
          Sqrt[(x - #[[1]])^2 + (y - #[[2]])^2] <= r, x, y] & /@ pts;


          Circles drawing



          Show[mesh, 
          Graphics[Cyan, Circle[#, r] & /@ pts, Black, Point[pts], Red,
          Point[vertices]], Axes -> True]


          enter image description here



          Union



          c = Ceiling[Max[pts] + r, 0.5];

          AbsoluteTiming[
          dregs = DiscretizeRegion[RegionUnion[regs], -2, 2, -2, 2,
          ImageSize -> Medium]
          ]


          enter image description here



          RegionMeasure[dregs]

          (* 1.99653 *)


          Union Intersection



          ires = DeleteCases[
          Flatten[Table[
          RegionIntersection[regs[[i]], regs[[j]]], i, 1,
          Length[regs], j, i + 1, Length[regs]]], _EmptyRegion];

          AbsoluteTiming[
          dires = DiscretizeRegion[RegionUnion[ires], -c, c, -c, c,
          ImageSize -> Medium, Frame -> True, PlotRange -> -c, c, -c, c]
          ]


          enter image description here



          RegionMeasure[dregs] - RegionMeasure[dires]

          (* 1.56288 *)





          share|improve this answer














          I am not sure are you interested in the union of the disks or the union sans the intersections. The code below can be used for both cases.



          Implicit regions



          r = 0.18;
          regs = ImplicitRegion[
          Sqrt[(x - #[[1]])^2 + (y - #[[2]])^2] <= r, x, y] & /@ pts;


          Circles drawing



          Show[mesh, 
          Graphics[Cyan, Circle[#, r] & /@ pts, Black, Point[pts], Red,
          Point[vertices]], Axes -> True]


          enter image description here



          Union



          c = Ceiling[Max[pts] + r, 0.5];

          AbsoluteTiming[
          dregs = DiscretizeRegion[RegionUnion[regs], -2, 2, -2, 2,
          ImageSize -> Medium]
          ]


          enter image description here



          RegionMeasure[dregs]

          (* 1.99653 *)


          Union Intersection



          ires = DeleteCases[
          Flatten[Table[
          RegionIntersection[regs[[i]], regs[[j]]], i, 1,
          Length[regs], j, i + 1, Length[regs]]], _EmptyRegion];

          AbsoluteTiming[
          dires = DiscretizeRegion[RegionUnion[ires], -c, c, -c, c,
          ImageSize -> Medium, Frame -> True, PlotRange -> -c, c, -c, c]
          ]


          enter image description here



          RegionMeasure[dregs] - RegionMeasure[dires]

          (* 1.56288 *)






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 8 at 14:12

























          answered Sep 8 at 13:32









          Anton Antonov

          21.9k164108




          21.9k164108











          • Thanks so much for your answer. But, I want to draw circle around each pts point, which is represented by black points and keeps also the voronoi diagram. Then, detect the overlapping areas occurs between these circles. Then calculate the sum of these circles' areas subtracted by the overlapping areas. I think, there is a difference between the circle and the disk.
            – Eman
            Sep 8 at 13:39







          • 1




            @Eman See my edit. It should be close to what you want.
            – Anton Antonov
            Sep 8 at 13:50










          • Thanks so much for your help and your edit. I really appreciate that. Your edit is what I was looking for. Thanks so much.
            – Eman
            Sep 8 at 14:20










          • Excuse me, If I want to make only 15 circles with radius of 0.18 and the other 10 circles with radius of 0.25,then compute <sum of circle areas>-<area of overlaps of the circles> , what should I modify in your code to do that??
            – Eman
            Sep 12 at 16:55







          • 1




            @Eman You can have a separate list of radiuses and use MapThread when making the implicit regions. E.g. regs = MapThread[ ImplicitRegion[ Sqrt[(x - #1[[1]])^2 + (y - #1[[2]])^2] <= #2, x, y] &, pts, rs] .
            – Anton Antonov
            Sep 13 at 12:21
















          • Thanks so much for your answer. But, I want to draw circle around each pts point, which is represented by black points and keeps also the voronoi diagram. Then, detect the overlapping areas occurs between these circles. Then calculate the sum of these circles' areas subtracted by the overlapping areas. I think, there is a difference between the circle and the disk.
            – Eman
            Sep 8 at 13:39







          • 1




            @Eman See my edit. It should be close to what you want.
            – Anton Antonov
            Sep 8 at 13:50










          • Thanks so much for your help and your edit. I really appreciate that. Your edit is what I was looking for. Thanks so much.
            – Eman
            Sep 8 at 14:20










          • Excuse me, If I want to make only 15 circles with radius of 0.18 and the other 10 circles with radius of 0.25,then compute <sum of circle areas>-<area of overlaps of the circles> , what should I modify in your code to do that??
            – Eman
            Sep 12 at 16:55







          • 1




            @Eman You can have a separate list of radiuses and use MapThread when making the implicit regions. E.g. regs = MapThread[ ImplicitRegion[ Sqrt[(x - #1[[1]])^2 + (y - #1[[2]])^2] <= #2, x, y] &, pts, rs] .
            – Anton Antonov
            Sep 13 at 12:21















          Thanks so much for your answer. But, I want to draw circle around each pts point, which is represented by black points and keeps also the voronoi diagram. Then, detect the overlapping areas occurs between these circles. Then calculate the sum of these circles' areas subtracted by the overlapping areas. I think, there is a difference between the circle and the disk.
          – Eman
          Sep 8 at 13:39





          Thanks so much for your answer. But, I want to draw circle around each pts point, which is represented by black points and keeps also the voronoi diagram. Then, detect the overlapping areas occurs between these circles. Then calculate the sum of these circles' areas subtracted by the overlapping areas. I think, there is a difference between the circle and the disk.
          – Eman
          Sep 8 at 13:39





          1




          1




          @Eman See my edit. It should be close to what you want.
          – Anton Antonov
          Sep 8 at 13:50




          @Eman See my edit. It should be close to what you want.
          – Anton Antonov
          Sep 8 at 13:50












          Thanks so much for your help and your edit. I really appreciate that. Your edit is what I was looking for. Thanks so much.
          – Eman
          Sep 8 at 14:20




          Thanks so much for your help and your edit. I really appreciate that. Your edit is what I was looking for. Thanks so much.
          – Eman
          Sep 8 at 14:20












          Excuse me, If I want to make only 15 circles with radius of 0.18 and the other 10 circles with radius of 0.25,then compute <sum of circle areas>-<area of overlaps of the circles> , what should I modify in your code to do that??
          – Eman
          Sep 12 at 16:55





          Excuse me, If I want to make only 15 circles with radius of 0.18 and the other 10 circles with radius of 0.25,then compute <sum of circle areas>-<area of overlaps of the circles> , what should I modify in your code to do that??
          – Eman
          Sep 12 at 16:55





          1




          1




          @Eman You can have a separate list of radiuses and use MapThread when making the implicit regions. E.g. regs = MapThread[ ImplicitRegion[ Sqrt[(x - #1[[1]])^2 + (y - #1[[2]])^2] <= #2, x, y] &, pts, rs] .
          – Anton Antonov
          Sep 13 at 12:21




          @Eman You can have a separate list of radiuses and use MapThread when making the implicit regions. E.g. regs = MapThread[ ImplicitRegion[ Sqrt[(x - #1[[1]])^2 + (y - #1[[2]])^2] <= #2, x, y] &, pts, rs] .
          – Anton Antonov
          Sep 13 at 12:21










          up vote
          5
          down vote













          radius = .18;
          disks = Disk[#, radius] & /@ pts;
          25 Area[disks[[1]]]



          2.54469




          Area[RegionUnion[disks]]



          2.03381




          Show[mesh, Graphics[Black, Point[pts], Red, Point[vertices], 
          FaceForm[Opacity[.5,LightGreen]],EdgeForm[Thick,Darker@Green], disks]]


          enter image description here






          share|improve this answer






















          • Thanks for your help.
            – Eman
            Sep 8 at 14:18






          • 1




            @eman, my pleasure.
            – kglr
            Sep 8 at 14:24














          up vote
          5
          down vote













          radius = .18;
          disks = Disk[#, radius] & /@ pts;
          25 Area[disks[[1]]]



          2.54469




          Area[RegionUnion[disks]]



          2.03381




          Show[mesh, Graphics[Black, Point[pts], Red, Point[vertices], 
          FaceForm[Opacity[.5,LightGreen]],EdgeForm[Thick,Darker@Green], disks]]


          enter image description here






          share|improve this answer






















          • Thanks for your help.
            – Eman
            Sep 8 at 14:18






          • 1




            @eman, my pleasure.
            – kglr
            Sep 8 at 14:24












          up vote
          5
          down vote










          up vote
          5
          down vote









          radius = .18;
          disks = Disk[#, radius] & /@ pts;
          25 Area[disks[[1]]]



          2.54469




          Area[RegionUnion[disks]]



          2.03381




          Show[mesh, Graphics[Black, Point[pts], Red, Point[vertices], 
          FaceForm[Opacity[.5,LightGreen]],EdgeForm[Thick,Darker@Green], disks]]


          enter image description here






          share|improve this answer














          radius = .18;
          disks = Disk[#, radius] & /@ pts;
          25 Area[disks[[1]]]



          2.54469




          Area[RegionUnion[disks]]



          2.03381




          Show[mesh, Graphics[Black, Point[pts], Red, Point[vertices], 
          FaceForm[Opacity[.5,LightGreen]],EdgeForm[Thick,Darker@Green], disks]]


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 9 at 5:40

























          answered Sep 8 at 13:33









          kglr

          162k8187386




          162k8187386











          • Thanks for your help.
            – Eman
            Sep 8 at 14:18






          • 1




            @eman, my pleasure.
            – kglr
            Sep 8 at 14:24
















          • Thanks for your help.
            – Eman
            Sep 8 at 14:18






          • 1




            @eman, my pleasure.
            – kglr
            Sep 8 at 14:24















          Thanks for your help.
          – Eman
          Sep 8 at 14:18




          Thanks for your help.
          – Eman
          Sep 8 at 14:18




          1




          1




          @eman, my pleasure.
          – kglr
          Sep 8 at 14:24




          @eman, my pleasure.
          – kglr
          Sep 8 at 14:24










          up vote
          3
          down vote













          I think it is much better to use RegionMeasure on the undiscretized regions. For instance:



          disks = Disk[#, .18]& /@ pts;

          ru = RegionMeasure @ RegionUnion[disks]
          RegionMeasure @ DiscretizeRegion @ RegionUnion[disks]



          2.03381



          1.99723




          The region measure of the discretized version is almost 2% off. Similarly:



          ires = DeleteCases[
          Flatten @ Table[
          RegionIntersection[disks[[i]], disks[[j]]],
          i, 1, 25,
          j, i + 1, 25
          ],
          _EmptyRegion
          ];

          int = RegionMeasure @ RegionUnion @ ires
          RegionMeasure @ DiscretizeRegion @ RegionUnion @ ires



          0.44757



          0.439748




          So a more accurate answer would be:



          ru - int



          1.58624




          Finally, it is possible to get this result directly by using BooleanCountingFunction:



          RegionMeasure @ BooleanRegion[
          BooleanCountingFunction[1, 25],
          disks
          ]



          1.58624




          although this version is slower than Antons.






          share|improve this answer




















          • Thanks so much for your help.
            – Eman
            Sep 9 at 14:02














          up vote
          3
          down vote













          I think it is much better to use RegionMeasure on the undiscretized regions. For instance:



          disks = Disk[#, .18]& /@ pts;

          ru = RegionMeasure @ RegionUnion[disks]
          RegionMeasure @ DiscretizeRegion @ RegionUnion[disks]



          2.03381



          1.99723




          The region measure of the discretized version is almost 2% off. Similarly:



          ires = DeleteCases[
          Flatten @ Table[
          RegionIntersection[disks[[i]], disks[[j]]],
          i, 1, 25,
          j, i + 1, 25
          ],
          _EmptyRegion
          ];

          int = RegionMeasure @ RegionUnion @ ires
          RegionMeasure @ DiscretizeRegion @ RegionUnion @ ires



          0.44757



          0.439748




          So a more accurate answer would be:



          ru - int



          1.58624




          Finally, it is possible to get this result directly by using BooleanCountingFunction:



          RegionMeasure @ BooleanRegion[
          BooleanCountingFunction[1, 25],
          disks
          ]



          1.58624




          although this version is slower than Antons.






          share|improve this answer




















          • Thanks so much for your help.
            – Eman
            Sep 9 at 14:02












          up vote
          3
          down vote










          up vote
          3
          down vote









          I think it is much better to use RegionMeasure on the undiscretized regions. For instance:



          disks = Disk[#, .18]& /@ pts;

          ru = RegionMeasure @ RegionUnion[disks]
          RegionMeasure @ DiscretizeRegion @ RegionUnion[disks]



          2.03381



          1.99723




          The region measure of the discretized version is almost 2% off. Similarly:



          ires = DeleteCases[
          Flatten @ Table[
          RegionIntersection[disks[[i]], disks[[j]]],
          i, 1, 25,
          j, i + 1, 25
          ],
          _EmptyRegion
          ];

          int = RegionMeasure @ RegionUnion @ ires
          RegionMeasure @ DiscretizeRegion @ RegionUnion @ ires



          0.44757



          0.439748




          So a more accurate answer would be:



          ru - int



          1.58624




          Finally, it is possible to get this result directly by using BooleanCountingFunction:



          RegionMeasure @ BooleanRegion[
          BooleanCountingFunction[1, 25],
          disks
          ]



          1.58624




          although this version is slower than Antons.






          share|improve this answer












          I think it is much better to use RegionMeasure on the undiscretized regions. For instance:



          disks = Disk[#, .18]& /@ pts;

          ru = RegionMeasure @ RegionUnion[disks]
          RegionMeasure @ DiscretizeRegion @ RegionUnion[disks]



          2.03381



          1.99723




          The region measure of the discretized version is almost 2% off. Similarly:



          ires = DeleteCases[
          Flatten @ Table[
          RegionIntersection[disks[[i]], disks[[j]]],
          i, 1, 25,
          j, i + 1, 25
          ],
          _EmptyRegion
          ];

          int = RegionMeasure @ RegionUnion @ ires
          RegionMeasure @ DiscretizeRegion @ RegionUnion @ ires



          0.44757



          0.439748




          So a more accurate answer would be:



          ru - int



          1.58624




          Finally, it is possible to get this result directly by using BooleanCountingFunction:



          RegionMeasure @ BooleanRegion[
          BooleanCountingFunction[1, 25],
          disks
          ]



          1.58624




          although this version is slower than Antons.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 9 at 6:57









          Carl Woll

          59k277151




          59k277151











          • Thanks so much for your help.
            – Eman
            Sep 9 at 14:02
















          • Thanks so much for your help.
            – Eman
            Sep 9 at 14:02















          Thanks so much for your help.
          – Eman
          Sep 9 at 14:02




          Thanks so much for your help.
          – Eman
          Sep 9 at 14:02

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f181488%2fdraw-circles-and-compute-sum-of-circle-areas-area-of-overlaps-of-the-circles%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay