ktk.geometry.translate#
- translate(coordinates, /, translations)[source]#
Translate a series of coordinates.
- Parameters:
coordinates – Array_like of shape (N, …): the coordinates to translate.
translations – Array_like of shape (N, 3) or (N, 4): the translation on each axe (x, y, z).
- Returns:
Array_like of shape (N, …): the translated coordinates.
- Return type:
np.ndarray
See also
ktk.geometry.rotate
,ktk.geometry.scale
,ktk.geometry.create_transforms
,ktk.geometry.matmul
Examples
Translate the point (1, 0, 0) by (x, 1, 0), for x in [0, 1, 2, 3, 4]:
>>> import kineticstoolkit.lab as ktk >>> t = np.array([[0, 1, 0], [1, 1, 0], [2, 1, 0], [3, 1, 0], [4, 1, 0]]) >>> ktk.geometry.translate([[1, 0, 0, 1]], t) array([[1., 1., 0., 1.], [2., 1., 0., 1.], [3., 1., 0., 1.], [4., 1., 0., 1.], [5., 1., 0., 1.]])