From cade01d0a4f67df909a437acbc1551025c2c7601 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Tue, 10 Sep 2024 23:58:53 +0900 Subject: [PATCH] Add capsule as an example of a simple geometry (#313) --- examples/capsule.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/capsule.py diff --git a/examples/capsule.py b/examples/capsule.py new file mode 100644 index 00000000..f208fc7e --- /dev/null +++ b/examples/capsule.py @@ -0,0 +1,31 @@ +r""" +Capsule geometry example +------------------------- + +Capsule geometry example. + +""" + +# sphinx_gallery_thumbnail_number = 3 # noqa:ERA001 + +from __future__ import annotations + +import pyvista as pv + +import skgmsh as sg + +edge_source = pv.Capsule(resolution=10) +edge_source.merge(pv.PolyData(edge_source.points), merge_points=True, inplace=True) +edge_source.plot(show_edges=True, color="white") + +# %% +# Create a 3D mesh from the edge source. + +alg = sg.Delaunay3D(edge_source) +alg.mesh.shrink(0.9).plot(show_edges=True, color="white") + +# %% +# Change the cell size of the mesh. + +alg.cell_size = 0.25 +alg.mesh.plot(show_edges=True, color="white")