porespy.beta.gyroid#

porespy.beta.gyroid(shape, method='schoen', skew=0.5, phi=0.5)#

Generate a boolean image of a triply periodic minimal surface (TPMS).

One full period of the selected surface is mapped onto a cubic domain of shape voxels per side. The surface field is thresholded to produce a solid phase, with the band centre and half-width controlled by skew and phi respectively.

Parameters:
  • shape (int) – Number of voxels along each side of the cubic output array. The output shape is (shape, shape, shape).

  • method (str, optional) – The TPMS geometry to generate. Options are:

  • skew (float, optional) – Centre of the isovalue band used for thresholding the TPMS field. Shifting this value moves the solid phase toward higher or lower field values, effectively skewing which region of the surface is selected. Default is 0.5.

  • phi (float, optional) – Half-width of the isovalue band. Voxels are set to True where skew - phi < v < skew + phi. Larger values produce a thicker solid phase and lower porosity. Default is 0.5.

Returns:

im – A 3-D boolean array of shape (shape, shape, shape) where True indicates the solid phase defined by the TPMS level set.

Return type:

ndarray of bool

Notes

The TPMS field v is evaluated on a regular grid spanning \([0, 2\pi]\) in each direction (one full unit cell). The solid phase is the set of voxels satisfying \(\text{skew} - \phi < v < \text{skew} + \phi\).

Examples

Generate a 100-voxel gyroid image:

>>> import porespy as ps
>>> im = gyroid(shape=100, method='schoen', phi=0.5)
>>> im.shape
(100, 100, 100)