Bug introduce in version 10 and presist in 11.2
In my this answer,I get some overlapped disk like this placed with red arrow point out
But actually that function of diskMake
is designed to produce nonoverlapping disk.And I don't think I write a wrong code. :) For this question I have some digs like following:
wordRegion =
BoundaryDiscretizeGraphics[
Text[Style["21", FontFamily -> "Arial"]], _Text];
disks = {Disk[{-2.4107273705611387`, 3.2155412094306577`},
0.10357806335605606`],
Disk[{-1.4610266485101935`, -0.1848766412849958`},
0.1371293137456506`],
Disk[{3.9597015795674757`, -2.0248306466733403`},
0.21070473733708972`],
Disk[{-1.4133143443551681`, -0.5609218789129127`},
0.2141073441827654`],
Disk[{3.4232452614725304`, 1.1487829210947051`},
0.062352195066279315`]};
disk = Fold[RegionDifference, wordRegion,
BoundaryDiscretizeRegion /@ disks];
r = .3;(*You can change the value to 0.3 or 0.6*)
Row[Magnify[#, 5] & /@
MapThread[
Labeled, {{disk,
Show[Graphics[{Opacity[.2], Red, Disk[{-1.5, 3}, r]}],
RegionDifference[disk,
DiscretizeRegion@Disk[{-1.5, 3}, r]]]}, {Style[
"Before RegionDifference", 6, Red],
Style["After RegionDifference", 6, Blue]}}]]
You can find the small disk I have point out with red arrow will disappear when the $r<0.3$.$\color{red}{\text{I think I get these overlapped disks caused by this}}$.
What about this?And how to avoid it?
Answer
It is confirmed as an improper behavior of RegionDifference
by Wolfram support([CASE:3624735]).
Here is their workaround:
Instead of using boundary representation of geometric regions as given below, try using just the geometric regions in geometric computations.
To be specific, here is the solution to this problem. Assuming wordRegion
and disks
have been initialized as given, and compare the old and new code:
old = Fold[RegionDifference, wordRegion, BoundaryDiscretizeRegion /@ disks];
RegionDifference[old, BoundaryDiscretizeRegion[Disk[{-1.5, 3}, 0.3]]]
new = Fold[RegionDifference, wordRegion, disks];
BoundaryDiscretizeRegion@RegionDifference[new, Disk[{-1.5, 3}, 0.3]]
As you can see, the small circle on the left of 1
is not missing anymore.
Comments
Post a Comment