Is there an easy way to extrude a planar 2D-mesh to a volume slice?
ring = RegionDifference[Disk[{0, 0}, 1], Disk[{0, 0}, 1/2]];
DiscretizeRegion[ring]
The thickness of the slice is assumed to be small and should have only some element layers.
Thanks!
Answer
If you want some control over the extruded mesh, under Applications in RegionProduct
, there is a nice example.
ring = RegionDifference[Disk[{0, 0}, 1], Disk[{0, 0}, 1/2]];
dr = DiscretizeRegion[ring];
pointsToMesh[data_] :=
MeshRegion[Transpose[{data}],
Line@Table[{i, i + 1}, {i, Length[data] - 1}]];
data = Table[Exp[x], {x, 0., 0.5, 0.1}];
r1 = pointsToMesh[data];
rp = RegionProduct[dr, r1];
MeshRegion[rp, PlotTheme -> "Lines"]
You can use Subdivide
in place of data
if you just want a uniform mesh like so
rUniform = pointsToMesh[Subdivide[0, 0.1, 5]]
rpUniform = RegionProduct[dr, rUniform];
MeshRegion[rpUniform, PlotTheme -> "Lines"]
Comments
Post a Comment