Transform.reflect

Transform.reflect#

Transform.reflect(
*normal: float | VectorLikeFloat,
point: VectorLikeFloat | None = None,
multiply_mode: Literal['pre', 'post'] | None = None,
) → Transform[source]#

Compose a reflection matrix.

Create a reflection matrix and compose() it with the current transformation matrix according to pre-multiply or post-multiply semantics.

Internally, the matrix is stored in the matrix_list.

Parameters:
*normalfloat | VectorLikeFloat

Normal direction for reflection. May be a single vector (one arg) or unpacked vector (three args).

pointVectorLikeFloat, optional

Point to reflect about. By default, the object’s point is used, but this can be overridden. If set, two additional transformations are composed and added to the matrix_list:

multiply_mode‘pre’ | ‘post’, optional

Multiplication mode to use when composing the matrix. By default, the object’s multiply_mode is used, but this can be overridden. Set this to 'pre' for pre-multiplication or 'post' for post-multiplication.

Examples#

Download Python source code | Download Jupyter notebook

Compose a reflection matrix.

>>> import pyvista as pv
>>> transform = pv.Transform()
>>> _ = transform.reflect(0, 0, 1)
>>> transform.matrix
array([[ 1.,  0.,  0.,  0.],
       [ 0.,  1.,  0.,  0.],
       [ 0.,  0., -1.,  0.],
       [ 0.,  0.,  0.,  1.]])

Compose a second reflection matrix.

>>> _ = transform.reflect((1, 0, 0))
>>> transform.matrix
array([[-1.,  0.,  0.,  0.],
       [ 0.,  1.,  0.,  0.],
       [ 0.,  0., -1.,  0.],
       [ 0.,  0.,  0.,  1.]])

See Also#

flip_x, flip_y, flip_z

Convenience methods for reflecting about the x-, y-, or z-axis.

pyvista.DataObjectFilters.reflect

Reflect a mesh.

reflection, has_reflection

Get info about the transform’s reflection component.