I want to get the difference between the following two regions, an annulus and a crown:
Here's the code:
Rin = 0.75;
width = 0.25;
Rout = Rin + width;
nTriangles = 24;
basepoints = Rin*{Cos[#], Sin[#]} & /@ Range[0, 2 Pi, 2 Pi/nTriangles];
basesegments = {basepoints[[# + 1]],
basepoints[[Mod[# + 1, nTriangles] + 1]]} & /@
Range[1, nTriangles];
triad[segment_, height_] := {segment[[1]],
segment[[2]], # +
height Normalize[#] &[(segment[[1]] + segment[[2]])/2 ]}
tiltangle = ArcCos[1];
flatsegmentsE = {{Cos[tiltangle] #[[1, 1]],
Cos[tiltangle] #[[1, 2]]}, {Cos[tiltangle] #[[2, 1]],
Cos[tiltangle] #[[2, 2]]}} & /@
basesegments[[1 ;; nTriangles ;; 2]];
flatsegmentsO = {{Cos[tiltangle] #[[1, 1]],
Cos[tiltangle] #[[1, 2]]}, {Cos[tiltangle] #[[2, 1]],
Cos[tiltangle] #[[2, 2]]}} & /@
basesegments[[2 ;; nTriangles ;; 2]];
triads = triad[#, width] & /@ Join[flatsegmentsE, flatsegmentsO];
flattriangles = Triangle[#] & /@ %;
(*Create a region using DiscretizerGraphics on Graphics*)
flatpicture = Graphics[flattriangles]
regiontriangles = DiscretizeGraphics[flatpicture]
regionAnnulus =
ImplicitRegion[x^2 + y^2 <= Rout^2 && x^2 + y^2 >= Rin^2, {x, y}];
RegionDifference[regionAnnulus, regiontriangles];
RegionDifference
works, but its output is not 'clean', which is to say there are some small hanging slivers of 'region' left at the inner tips:
I subsequently want to export this region as an STL file with meshing, so I need to get a clean RegionDifference
product. Can someone please help?