mindsponge.common.invert_point

View Source On Gitee
mindsponge.common.invert_point(transformed_point, rotation, translation, extra_dims=0, stack=False, use_numpy=False)[source]

The inverse transformation of a rigid body group transformation with respect to a point coordinate, that is, the inverse transformation of apply to point Make rotational translation changes on coordinates with the transpose of the rotation matrix \((xx, xy, xz, yx, yy, yz, zx, zy, zz)\) and the translation vector \((x, y, z)\) translation.

First, the initial coordinates are translated, and then the transpose of the rotation matrix is multiplied by rot_point to get the final coordinates.

\[\begin{split}\begin{split} &rot\_point = transformed\_point - translation \\ &result = rotation^T * rot\_point \\ \end{split}\end{split}\]

The specific procedures of vector subtraction, transpose and multiplication can be referred to the api of vecs_sub, invert_rots, rots_mul_vecs etc.

Parameters
  • transformed_point (Tuple) – The initial coordinates of the input have shape \((x, y, z)\), where x, y and z are Tensor and have the same shape.

  • rotation (Tuple) – The rotation matrix. shape is \((xx, xy, xz, yx, yy, yz, zx, zy, zz)\), and xx and xy have the same shape.

  • translation (Tuple) – The translation vector shape is \((x, y, z)\), where x, y and z are Tensor and have the same shape.

  • extra_dims (int) – Control whether to expand dims. Default: 0.

  • stack (bool) – Control whether to transform to tuple. Default: False.

  • use_numpy (bool) – Control whether to use numpy. Default: False.

Returns

Tuple, the transformed coordinate of invert point.Length is 3.

Supported Platforms:

Ascend GPU

Examples

>>> from mindsponge.common.geometry import invert_point
>>> from mindspore.common import Tensor
>>> from mindspore import dtype as mstype
>>> transformed_point = (1, 2, 3)
>>> rotation = (1, 2, 3, 4, 5, 6, 7, 8, 9)
>>> translation = (1, 0.5, -1)
>>> output= invert_point(transformed_point, rotation, translation)
>>> print(output)
(Tensor(shape=[], dtype=Float32, value = 34), Tensor(shape=[], dtype=Float32, value = 39.5),
 Tensor(shape=[], dtype=Float32, value = 45))