Camera.copy

Contents

Camera.copy#

Camera.copy() → Camera[source]#

Return a deep copy of the camera.

Returns:
pyvista.Camera

Deep copy of the camera.

Examples#

Download Python source code | Download Jupyter notebook

Create a camera and check that its copy holds the same transformation matrix until the original is changed.

>>> import pyvista as pv
>>> import numpy as np
>>> camera = pv.Camera()
>>> camera.model_transform_matrix = np.array(
...     [
...         [1.0, 0.0, 0.0, 0.0],
...         [0.0, 1.0, 0.0, 0.0],
...         [0.0, 0.0, 1.0, 0.0],
...         [0.0, 0.0, 0.0, 1.0],
...     ]
... )
>>> copied_camera = camera.copy()
>>> copied_camera == camera
True
>>> camera.model_transform_matrix = np.array(
...     [
...         [1.0, 0.0, 0.0, 0.0],
...         [0.0, 1.0, 0.0, 0.0],
...         [0.0, 0.0, 1.0, 0.0],
...         [0.0, 0.0, 0.0, 0.5],
...     ]
... )
>>> copied_camera == camera
False