- Besides of the
Mesh
method, here we provide a region method.
- We construct some holes in the Parameter {u,v}-domain.
d
is the thickness of the belts (the thickness of the top, bottom,left and right is d/2
)
0< d < Min[(xmax - xmin)/ m, (ymax - ymin)/n]
.
Clear["Global`*"];
{{xmin, xmax}, {ymin, ymax}} = {{0, π}, {0, 2 π}};
{m, n} = {19, 17};
d = .3 Min[(xmax - xmin)/ m, (ymax - ymin)/n];
x = (xmax - xmin)/m - d;
y = (ymax - ymin)/n - d;
datax = Accumulate@
Flatten@Join[{xmin, d/2}, Table[{x, d}, m - 1], {x, d/2}];
regx = MeshRegion[List /@ datax,
Line /@ Partition[Range[2, Length@datax], 2, 2]];
datay = Accumulate@
Flatten@Join[{ymin, d/2}, Table[{y, d}, n - 1], {y, d/2}];
regy = MeshRegion[List /@ datay,
Line /@ Partition[Range[2, Length@datay], 2, 2]];
rectangle =
BoundaryDiscretizeRegion[Rectangle[{xmin, ymin}, {xmax, ymax}]];
reg = RegionDifference[rectangle, RegionProduct[regx, regy]]
ParametricPlot3D[{Sin[u]Cos[v], Sin[u]Sin[v], Cos[u]}, {u, v} ∈ reg,
PlotStyle -> Directive[FaceForm[Cyan, Gray]], Mesh -> None,
Boxed -> False, Axes -> False, ImageSize -> Large, PlotRange -> All]
- The
datax
,datay
can be set as Mesh
.
ParametricPlot3D[{Sin[u] Cos[v], Sin[u] Sin[v], Cos[u]}, {u, xmin,
xmax}, {v, ymin, ymax},
PlotStyle -> Directive[FaceForm[Cyan, Gray]], Mesh -> {datax, datay},
MeshStyle -> None,
MeshShading -> {{None, Automatic}, {Automatic, Automatic}},
Boxed -> False, Axes -> False, ImageSize -> Large, PlotRange -> All]
- test the example by @eldo
Clear["Global`*"];
{{xmin, xmax}, {ymin, ymax}} = {{-2, 2}, {-2, 2}};
{m, n} = {19, 17};
d = .3 Min[(xmax - xmin)/ m, (ymax - ymin)/n];
x = (xmax - xmin)/m - d;
y = (ymax - ymin)/n - d;
datax = Accumulate@
Flatten@Join[{xmin, d/2}, Table[{x, d}, m - 1], {x, d/2}];
regx = MeshRegion[List /@ datax,
Line /@ Partition[Range[2, Length@datax], 2, 2]];
datay = Accumulate@
Flatten@Join[{ymin, d/2}, Table[{y, d}, n - 1], {y, d/2}];
regy = MeshRegion[List /@ datay,
Line /@ Partition[Range[2, Length@datay], 2, 2]];
rectangle =
BoundaryDiscretizeRegion[Rectangle[{xmin, ymin}, {xmax, ymax}]];
reg = RegionDifference[rectangle, RegionProduct[regx, regy]]
enneper = {u - (u^3/3) + u v^2, v - (v^3/3) + u^2 v,
u^2 - v^2};
plot1 = ParametricPlot3D[enneper, {u, v} \[Element] reg,
ImageSize -> Large, Lighting -> "ThreePoint", Mesh -> None,
PlotPoints -> 64,
PlotStyle -> Directive[FaceForm[Red, Darker@Green]]]; plot2 =
ParametricPlot3D[enneper, {u, -2, 2}, {v, -2, 2}, ImageSize -> Large,
Lighting -> "ThreePoint", MeshStyle -> None,
MeshShading -> {{None, Automatic}, {Automatic, Automatic}},
Mesh -> {datax, datay}, PlotPoints -> 64,
PlotStyle -> Directive[FaceForm[Red, Darker@Green]]];
{plot1, plot2}