pyvista.CubeFacesSource.shrink_factor

pyvista.CubeFacesSource.shrink_factor#

property CubeFacesSource.shrink_factor: float | None[source]#

Shrink or grow the cube’s faces.

If set, this is the factor by which to shrink or grow each face. The amount of shrinking or growth is relative to the smallest edge length of the cube, and all sides of the faces are shrunk by the same (constant) value.

Note

  • A value of 1.0 has no effect.

  • Values between 0.0 and 1.0 will shrink the faces.

  • Values greater than 1.0 will grow the faces.

This has a similar effect to using shrink().

Examples

>>> import pyvista as pv
>>> cube_faces_source = pv.CubeFacesSource(
...     x_length=3, y_length=2, z_length=1, shrink_factor=0.8
... )
>>> output = cube_faces_source.output
>>> output.plot(show_edges=True, line_width=10)
../../../_images/pyvista-CubeFacesSource-shrink_factor-1_00_00.png

Note how all edges are shrunk by the same (constant) amount in terms of absolute distance. Compare this to shrink() where the amount of shrinkage is relative to the size of the faces.

>>> exploded = pv.merge(output).shrink(0.8)
>>> exploded.plot(show_edges=True, line_width=10)
../../../_images/pyvista-CubeFacesSource-shrink_factor-1_01_00.png