ktk.geometry.mirror

Contents

ktk.geometry.mirror#

mirror(coordinates, /, axis='z')[source]#

Mirror a series of coordinates.

Parameters:
  • coordinates – ArrayLike of shape (N, …): the coordinates to mirror.

  • axis (str) – Can be either “x”, “y” or “z”. The axis to mirror through. The default is “z”.

Returns:

ArrayLike of shape (N, …): the mirrored coordinates.

Return type:

np.ndarray

Examples

Mirror the point (1, 2, 3) along the x, y and z axes respectively:

>>> import kineticstoolkit.lab as ktk
>>> import numpy as np
>>> p = np.array([[1.0, 2.0, 3.0, 1.0]])
>>> ktk.geometry.mirror(p, "x")
array([[-1., 2., 3., 1.]])
>>> ktk.geometry.mirror(p, "y")
array([[ 1., -2., 3., 1.]])
>>> ktk.geometry.mirror(p, "z")
array([[ 1., 2., -3., 1.]])