.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/TPMS/cylindrical_rotated.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_TPMS_cylindrical_rotated.py: Rotated cylindrical gyroid ========================== A cylindrical gyroid whose local grid is rotated by 45 degrees about :math:`z` with a :class:`scipy.spatial.transform.Rotation`. .. GENERATED FROM PYTHON SOURCE LINES 8-41 .. code-block:: Python from functools import partial import numpy as np import pyvista as pv from scipy.spatial.transform import Rotation from microgen import CylindricalTpms from microgen.shape.surface_functions import gyroid def rotated_gyroid( x: np.ndarray, y: np.ndarray, z: np.ndarray, grid_rotation: Rotation, ) -> np.ndarray: x_rot, y_rot, z_rot = grid_rotation.apply(np.stack([x, y, z], axis=-1)).T return gyroid(x=x_rot, y=y_rot, z=z_rot) grid_rotation = Rotation.from_euler("z", 45, degrees=True) geometry = CylindricalTpms( surface_function=partial(rotated_gyroid, grid_rotation=grid_rotation), offset=0.5, cell_size=(1, 1, 1), repeat_cell=(1, 0, 1), radius=1, resolution=20, ) sheet = geometry.sheet .. GENERATED FROM PYTHON SOURCE LINES 42-48 .. code-block:: Python plotter = pv.Plotter() plotter.add_mesh(sheet, smooth_shading=True, color="#ef7d2d") plotter.view_xy() plotter.enable_parallel_projection() plotter.show_axes() plotter.show() .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/TPMS/images/sphx_glr_cylindrical_rotated_001.png :alt: cylindrical rotated :srcset: /examples/TPMS/images/sphx_glr_cylindrical_rotated_001.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: /home/runner/work/microgen/microgen/docs/examples/TPMS/images/sphx_glr_cylindrical_rotated_001.vtksz .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.422 seconds) .. _sphx_glr_download_examples_TPMS_cylindrical_rotated.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: cylindrical_rotated.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: cylindrical_rotated.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: cylindrical_rotated.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_