-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add capsule as an example of a simple geometry (#313)
- Loading branch information
1 parent
1b7b9ba
commit cade01d
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") |