-
-
Save adeak/bd52795e21b06e47e32afaf64bc602f1 to your computer and use it in GitHub Desktop.
octahedron in a cube for Kevin's grandma
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
import pyvista as pv | |
cube = pv.Cube() | |
# too lazy to define the octahedron manually from cube.cell_centers() | |
octahedron = cube.cell_centers().delaunay_3d().extract_surface() | |
points = (cube + octahedron).glyph(geom=pv.Sphere(radius=0.05)) | |
plotter = pv.Plotter() | |
plotter.theme.smooth_shading = True | |
# cube lines | |
plotter.add_mesh(cube.extract_all_edges(), render_lines_as_tubes=True, | |
line_width=5, color='black') | |
# octahedron surface | |
plotter.add_mesh(octahedron, color='darkgreen', opacity=0.5, show_edges=True) | |
# balls for points | |
plotter.add_mesh(points, render_points_as_spheres=True, color='silver') | |
# some prettification | |
plotter.set_background('lightgreen', 'lemonchiffon') | |
plotter.enable_terrain_style() | |
plotter.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: