mindsponge.common.rigids_from_3_points

View Source On Gitee
mindsponge.common.rigids_from_3_points(point_on_neg_x_axis, origin, point_on_xy_plane)[source]

Gram-Schmidt process. Create rigids representation of 3 points local coordination system, point on negative x axis A, origin point O and point on x-y plane P.

First calculate the coordinations of vector \(\vec AO\) and \(\vec OP\). Then use rots_from_two_vecs get the rotation matrix.

Distance between origin point O and the origin point of global coordinate system is the translations of rigid.

Finally return the rotations and translations of rigid.

Reference:

Jumper et al. (2021) Suppl. Alg. 21 ‘Gram-Schmidt process’.

\[\begin{split}\begin{split} &\vec v_1 = \vec x_3 - \vec x_2 \\ &\vec v_2 = \vec x_1 - \vec x_2 \\ &\vec e_1 = \vec v_1 / ||\vec v_1|| \\ &\vec u_2 = \vec v_2 - \vec e_1(\vec e_1^T\vec v_2) \\ &\vec e_2 = \vec u_2 / ||\vec u_2|| \\ &\vec e_3 = \vec e_1 \times \vec e_2 \\ &rotation = (\vec e_1, \vec e_2, \vec e_3) \\ &translation = (\vec x_2) \\ \end{split}\end{split}\]
Parameters
  • point_on_neg_x_axis (tuple) – point on negative x axis A, length is 3. Data type is constant or Tensor with same shape.

  • origin (tuple) – origin point O, length is 3. Data type is constant or Tensor with same shape.

  • point_on_xy_plane (tuple) – point on x-y plane P, length is 3. Data type is constant or Tensor with same shape.

Returns

tuple(rots, trans), rigid, length is 2. Include rots \((xx, xy, xz, yx, yy, yz, zx, zy, zz)\)

and trans \((x, y, z)\) . Data type is constant or Tensor with same shape.

Supported Platforms:

Ascend GPU

Examples

>>> import mindsponge
>>> A = (1, 2, 3)
>>> O = (4, 6, 8)
>>> P = (5, 8, 11)
>>> ans = mindsponge.common.rigids_from_3_points(A, O, P)
>>> print(ans)
((0.4242640686695021, -0.808290367995452, 0.40824828617045156, 0.5656854248926695,
 -0.1154700520346678, -0.8164965723409039, 0.7071067811158369, 0.5773502639261153,
 0.4082482861704521), (4,6,8))