How do I define a periodic region?
r = N @ ImplicitRegion[
Sin[x Pi] > 0 || Sin[y Pi] > 0,
{{x, 0, 9}, {y, 0, 9}}
]
RegionPlot @ r
r3 = N @ ImplicitRegion[
Sin[x Pi] > 0 || Sin[y Pi] > 0 || Sin[z Pi] > 0,
{{x, 0, 9}, {y, 0, 9}, {z, 0, 9}}
]
RegionPlot3D[r3, PlotStyle -> [email protected]]
So you can play with translation and scaling with:
Sin[2 x Pi] > 0 || Sin[.5 (y + 1) Pi] > 0
Here is an idea based on graphics primitives instead of mathematical inequalities.
columnWidth = 1;
regionSize = 10;
holes = Table[
Rectangle[{x, y}, {x + columnWidth, y + columnWidth}],
{x, columnWidth, regionSize, 2 columnWidth},
{y, columnWidth, regionSize, 2 columnWidth}
];
holes // Graphics
Now we subtract these squares from a larger square that covers all of the area:
RegionDifference[
Rectangle[{0, 0}, {regionSize + columnWidth, regionSize + columnWidth}],
RegionUnion[holes]
] // RegionPlot
A bit late, but here's how the Mod[]
version should have been implemented:
ir = ImplicitRegion[! (1 < Mod[x, 2] < 2 && 1 < Mod[y, 2] < 2), {{x, 0, 9}, {y, 0, 9}}];
RegionPlot[ir]
A 3D version, just like in Kuba's answer:
ir3 = ImplicitRegion[! (1 < Mod[x, 2] < 2 && 1 < Mod[y, 2] < 2 && 1 < Mod[z, 2] < 2),
{{x, 0, 9}, {y, 0, 9}, {z, 0, 9}}];
RegionPlot3D[ir3, PlotStyle -> Opacity[.5]]
It's probably worth pointing out that I plan on using this region as the domain specification of a
ParametricPlot3D
.
In such a case, it is often more efficient to do preprocessing with (Boundary)DiscretizeRegion[]
before using it as a plotting region.