Hot answers tagged

5

DiscretizeRegion[# , AccuracyGoal -> 3 , PerformanceGoal -> "Speed" (*,Method\[Rule]"Continuation"*) ] &@RegionDifference[Rectangle[{-2, -1}, {5, 1}], RegionUnion[Disk[{0.5, 0}, 0.25], Disk[{3.5, 0}, 0.25]]] AccuracyGoal can be set to 2 to get good enough circles. A value such as 10 locks my computer up but that ...


5

This irregularity only appears in the visualization from the Region wrapper. Under the hood the region is still exactly intact: reg = RegionDifference[Rectangle[{-2, -1}, {5, 1}], RegionUnion[Disk[{0.5, 0}, 0.25], Disk[{3.5, 0}, 0.25]]]; Area[Rationalize[reg]] 14 - π/8 Most likely Region is using a general method like marching squares to visualize this ...


5

Try DiscretizeRegion in the definition of hole,rim and disk: hole = Region[Cylinder[{base, tip},radiusHole]] // DiscretizeRegion; rim = Region[Cylinder[{base, tip},radiusRim]] // DiscretizeRegion; disk = Region[Cylinder[{origin, base},radiusBase]] //DiscretizeRegion; r=RegionUnion[RegionDifference[rim,hole],disk]; Show[r]


4

Since Mma v12.2 spatial point processes have opened yet another possibility with HardcorePointProcess, which prevents processes from resulting points being pairwise closer than a specified distance from each other. This is not to such an extent a "packing" as many other answers to this question, since only minimum distance is constrained, but it ...


4

ClearAll["Global`*"] m[θ_] := √Abs[Sin[θ]]; F2[a_, θ_] := -15 m[θ] a Cot[m[θ] a]^3 + 15 Cot[m[θ] a]^2 - 9 m[θ] a Cot[m[θ] a] + 4; (*-pi<theta<0*) G2[a_, θ_] := -2 (m[θ] a Cot[m[θ] a] - 1);(*-pi<theta<0*) U = 1; Q2[a_, θ_] := -(Cos[θ]/(9 m[θ]^4)) F2[a, θ] + U/m[θ]^2 G2[a, θ]; (*-pi<theta<0*) You appear to be ...


4

ContourPlot[ Q2[a, θ] == 1, {a, 1, 8}, {θ, -π + 0.001, -0.001}] Since RegionPlot not always auto discretize the region, so we need to add DiscretizeRegion by hand. RegionPlot@ DiscretizeRegion@ ImplicitRegion[ Q2[a, θ] == 1, {{a, 1, 8}, {θ, -π + 0.001, -0.001}}]


3

specifying the PlotStyle solve it too RegionPlot[x^2 + y^3 < 2, {x, -2, 2}, {y, -2, 2}, PlotStyle -> Yellow]


3

From 2016 and Version 11.0 we can use ImageMesh. img = ImagePad[ColorNegate@Image@Graphics[Polygon[shape]], 30]; imgD = Dilation[img, DiskMatrix[30]]; mesh0 = ImageMesh@img; meshD = ImageMesh@imgD; Graphics[{Green, Arrow[Flatten[pts0 = MeshPrimitives[mesh0, 1][[All, 1]], 1]], Red, Arrow@Flatten[ptsD = MeshPrimitives[meshD, 1][[All, 1]], 1]}]


3

A one more way is as follows. RegionPlot[RegionDifference[Rectangle[{-2, -1}, {5, 1}], RegionUnion[Disk[{0.5, 0}, 0.25], Disk[{3.5, 0}, 0.25]]], AspectRatio -> 2/7]


3

shape = First @ CountryData["Chad", "Coordinates"]; poly = Polygon @ shape; srd = SignedRegionDistance @ poly; ranges = Flatten /@ Transpose[{{x, y}, CoordinateBounds[ScalingTransform[1.4 {1, 1}, Mean @ shape] @ shape]}]; ContourPlot[srd[{x, y}], ranges[[1]], ranges[[2]], Contours -> Thread[{{-1, -.5, -.25, .25, .5, 1}, ...


2

Since the finite region in the first quadrant of x-y plane is 0 <= x <= 1, 0 <= y <= x,and the finite region in the space is as below. reg=ImplicitRegion[{y^2 + z^2 <= 1, 0 <= x <= 1, 0 <= y <= x}, {x, y, z}] reg// Volume reg//Region 1/6 (-4 + 3 Pi)


2

Clear["Global`*"] Graphics and Graphics3D are not regions. The primitives (e.g., Pyramid, Sphere, Ball) are regions. A Sphere is just the thin shell, the filled-in solid object is a Ball. Since you are cutting the Pyramid out, I assume that you mean Ball rather than Sphere. reg1 = Pyramid[{{0, 0, 0}, {1, 0, 0}, {1, 1, 0}, {0, 1, 0}, {0, 0, 2}}]; ...


2

Use PlotPoints and PlotRangePadding for the first case. ComplexRegionPlot[{Arg[z - 1] <= 3 Pi/4, Abs[z + 1 - I] <= 1, Arg[z - 1] <= 3 Pi/4 && Abs[z + 1 - I] <= 1}, {z, -2, 1 + 2 I}, AxesOrigin -> {0, 0}, AspectRatio -> Automatic, PlotRangePadding -> {{0.1, 0.1}, {0.1, 0.1}}, PlotPoints -> 50 ] Where the circle is not ...


2

contrains = 0 < y[1] < 1 && y[2] == 0 && y[3] == 1 - y[1] && x[1] == 1 && x[2] == 0 && x[3] == 0; reg = ParametricRegion[{{y[1], y[2], y[3]}, contrains}, {{y[1], 0, 1}, {y[2], 0, 1}, {y[3], 0, 1}, x[1], x[2], x[3]}]; DiscretizeRegion[reg, Boxed -> True] Region[Style[reg, Thick, Blue], Boxed -&...


2

Since the problem appears due to the default Opacity[0.3] color directive, we can avoid it by converting color directives with transparency into the corresponding color directives without transparency. By inspecting the internal structure of the default plot we can find that the default style is: Directive[RGBColor[0.368417, 0.506779, 0.709798], ...


1

The powerful OpenCascadeLink can handle the surface independently and it is easy to be use in NDSolve. tower = 2000; substrate = 100; radiusHole = 500; radiusRim = 600; radiusBase = 1000; origin = {0, 0, 0}; base = {0, 0, substrate}; tip = {0, 0, tower + substrate}; reg1 = Cylinder[{base, tip}, radiusHole]; reg2 = Cylinder[{base, tip}, radiusRim]; reg3 = ...


1

ComplexRegionPlot[{Arg[z - 1] <= 3 Pi/4 && Abs[z + 1 - I] <= 1}, {z, -2, 1 + 3 I}, GridLines -> {{-1, 0}, {0, 1, 2}}, PlotLegends -> "Expressions", AspectRatio -> 1]; ComplexContourPlot[{Arg[z - 1] == 3 Pi/4, Abs[z + 1 - I] == 1}, {z, -2, 1 + 3 I}]; Show[%%, %]


1

For visualization purposes only I propose a simple and robust approach using a thick boundary line: shape = CountryData["Chad", "Coordinates"]; r = 2; xmin = Min[shape[[1, ;; , 1]]] - r; xmax = Max[shape[[1, ;; , 1]]] + r; ymin = Min[shape[[1, ;; , 2]]] - r; ymax = Max[shape[[1, ;; , 2]]] + r; Graphics[{{FaceForm[Blue], EdgeForm[{...


1

shape = CountryData["Chad", "Coordinates"]; pr1 = Region@Polygon[shape, BaseStyle -> Red] pr2 = Region@Polygon@(Mean /@ Partition[shape[[1]], 3, 1]) Show[Scale[pr2, {1.5, 1.5}], pr1]


Only top voted, non community-wiki answers of a minimum length are eligible