Skip to content

Commit

Permalink
Add capsule as an example of a simple geometry (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkoyama010 authored Sep 10, 2024
1 parent 1b7b9ba commit cade01d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions examples/capsule.py
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")

0 comments on commit cade01d

Please sign in to comment.