# Examples from pyvista.DataObjectFilters.resize
# ==============================================

# Load a mesh with asymmetric bounds and show them.
import pyvista as pv
mesh = pv.Cube(
    x_length=1.0, y_length=2.0, z_length=3.0, center=(1.0, 2.0, 3.0)
)
mesh.bounds

# Resize it to fit specific bounds.
resized = mesh.resize(bounds=[-1, 2, -3, 4, -5, 6])
resized.bounds

# Resize the mesh so its diagonal length is `4.0`. The mesh's center is unchanged.
resized = mesh.resize(length=4.0)
resized.length
resized.center

# Resize the mesh so its size is `4.0`. The mesh's center is again unchanged.
resized = mesh.resize(bounds_size=4.0)
resized.bounds_size
resized.center
resized.bounds

# Specify a different size for each axis and set the desired center.
resized = mesh.resize(bounds_size=(2.0, 1.0, 0.5), center=(1.0, 0.5, 0.25))
resized.bounds_size
resized.center

# Center the mesh at the origin and normalize its bounds to `1.0`.
resized = mesh.resize(bounds_size=1.0, center=(0.0, 0.0, 0.0))
resized.bounds

# Normalize it again, but preserve the aspect ratio. Its 1:2:3 x-y-z bounds
# ratio is preserved.
resized = mesh.resize(
    bounds_size=1.0, center=(0.0, 0.0, 0.0), preserve_aspect_ratio=True
)
resized.bounds
resized.bounds_size

# ----------------------------------------------------------------------
# Generated by sphinx-examples-as-code https://github.com/pyvista/sphinx-examples-as-code
