mindsponge.common.invert_point

mindsponge.common.invert_point(transformed_point, rotation, translation, extra_dims=0, stack=False, use_numpy=False)[源代码]

刚体变换组变换对点坐标的逆变换,即apply_to_point的逆变换。 用旋转矩阵 \((xx, xy, xz, yx, yy, yz, zx, zy, zz)\) 的转置矩阵和平移向量 \((x, y, z)\) translation对坐标做旋转平移变化。 首先对初始坐标作平移变化,再将旋转矩阵 rotation 的转置矩阵与 rot_point 相乘得到最后坐标。

\[rot_point = transformed_point - translation result = rotation^t \cdot rot_point\]

其中向量的减法、转置与乘法具体过程可以参阅 vecs_subinvert_rotsrots_mul_vecs 等api。

参数:
  • transformed_point (Tuple) - 输入的初始坐标, \((x, y, z)\) ,其中x, y, z均为Tensor,且shape相同。

  • rotation (Tuple) - 旋转矩阵, \((xx, xy, xz, yx, yy, yz, zx, zy, zz)\) ,且xx, xy等均为Tensor且shape相同。

  • translation (Tuple) - 平移向量, \((x, y, z)\), 其中x, y, z均为Tensor,且shape相同。

  • extra_dims (int) - 控制进行几层拓展。默认值:0。

  • stack (bool) - 控制是否进行入栈操作。默认值:False。

  • use_numpy (bool) - 控制是否使用numpy。默认值:False。

返回:

Tuple,旋转平移后的坐标,长度为3。

支持平台:

Ascend GPU

样例:

>>> 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))