We’re rewarding the question askers & reputations are being recalculated! Read more.

New answers tagged

4

I think the failure to discretize your first Graphics object is a bug. But, instead of creating graphics objects and then converting them to MeshRegion objects with DiscretizeGraphics, I think it is simpler to use Region functionality instead, since Rectangle is already a Region primitive. When working with Region primitives you need to use ...


3

This is an extentsion to Tim Laska's answer. I have added the BoundaryElementMeshJoin (and a few other Boolean operations) for boundary element meshes into the FEMAddOns paclet. The installation of the pacelt is now very easy since the installation can be done via the FEMAddOnsInstall resource function. Install and load the paclet: ResourceFunction["...


0

Another approach is to rasterize each region with RegionImage. outerdisks = RegionDifference[#1, RegionUnion[##2]]& @@@ NestList[RotateRight, {rDisk, bDisk, gDisk}, 2]; diskints = {rgDisk, rbDisk, gbDisk}; complement = RegionDifference[FullRegion[2], RegionUnion[rDisk, bDisk, gDisk]]; Image[ImageAdd @@ MapThread[ ImageMultiply[ RegionImage[#1, ...


3

If we represent each part as a piecewise spline we'll have an exact representation, as opposed to DiscretizeRegion which approximates the regions with polygons. I'll use splineCircle defined here. rDisk2 = FilledCurve[{splineCircle[rDisk[[1]], 1, {0, π}], MapAt[Reverse, splineCircle[bDisk[[1]], 1, {π/3, 2 π/3}], {1}], MapAt[Reverse, splineCircle[...


4

pts={AngleVector[60°],{1,0},{0,0}}; colors=Join[{r,g,b}={Red,Green,Blue},Blend[#,0.5]&/@{{r,g},{r,b},{g,b}},{White}]; regions=BoundaryDiscretizeRegion/@RegionIntersection/@Rest@Subsets[Disk/@pts]; Graphics[Thread[{EdgeForm/@colors,colors,regions}]] or Graphics[Thread[{colors, MeshPrimitives[#,2]&/@regions}]] If need faster speed, I prefer use ...


10

In addtion to Carl's answer, you can also force to rasterize the image with customized resolution. Takes longer but creates higher resolution bitmap images. g = Show[Graphics[{Red, rDisk}], Graphics[{Blue, bDisk}], Graphics[{Green, gDisk}], Graphics[{Blend[{Red, Blue}, 0.5], BoundaryDiscretizeRegion[rbDisk]}], Graphics[{Blend[{Red, Green}, 0.5], ...


8

You can use BoundaryDiscretizeRegion instead of DiscretizeRegion to avoid the mesh lines when using Antialiasing->True: Graphics[{ {Red, rDisk}, {Blue, bDisk}, {Green, gDisk}, Antialiasing->True, BoundaryDiscretizeRegion[rbDisk, MeshCellStyle->{2->Blend[{Red, Blue}]}], BoundaryDiscretizeRegion[rgDisk, MeshCellStyle->{2-...


2

MeshTools package can help you with SelectElements function and some manual postprocessing. Needs["MeshTools`"] bm = ToBoundaryMesh[Cuboid[]] side = SelectElements[bm, #1 == 1 &] This "projects" 3D mesh with "BoundaryElements" to 2D mesh with "MeshElements". Reverse on element incidents is necessary to avoid warning messages about bad their quality (...


1

You can extract information about meshes using functions like MeshCells and MeshCoordinates. bm = BoundaryMesh[Cuboid[]] sel = Select[MeshCoordinates[bm], #[[1]] == 1&] hull = ConvexHullMesh[sel[[All, 2;;3]]] You might also be able to get away with using Polygon instead of ConvexHullMesh if your 2D mesh isn't always convex, but you'd have to be able to ...


2

Using Animate: Animate[With[{v = RotationTransform[\[Theta], {0, 0, 1}][{4, 0, 1}]}, Show[{region1}, SphericalRegion -> True, ViewPoint -> v, Method -> {"ShrinkWrap" -> False}]], {\[Theta], 0, 2 Pi}] Using Dynamic: Dynamic[Show[{region1}, ViewPoint -> RotationTransform[Clock[{0, 2 Pi}, 10], {0, 0, 1}][{4, 0, 1}], Method -&...


Top 50 recent answers are included