Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

PR

Just a small problem.

I can fix it online!

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindsponge.common.apply_to_point

View Source On Gitee
mindsponge.common.apply_to_point(rotation, translation, point, extra_dims=0)[source]

Rotate and translate the input coordinates.

rot_point=rotationpointresult=rot_point+translation

For specific multiplication and addition procedures, refer to the rots_mul_vecs and vecs_add apis.

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

  • translation (Tuple) – Translation vector [(x,y,z)], where x,y,z are Tensor and have the same shape.

  • point (Tensor) – Initial coordinate values [(x,y,z)], where x,y,z are Tensor and have the same shape.

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

Returns

Tuple, the result of the coordinate transformation. Length is 3.

Supported Platforms:

Ascend GPU

Examples

>>> import numpy as np
>>> from mindsponge.common.geometry import apply_to_point
>>> from mindspore.common import Tensor
>>> from mindspore import dtype as mstype
>>> np.random.seed(1)
>>> rotation = []
>>> for i in range(9):
...     rotation.append(Tensor(np.random.rand(4),dtype=mstype.float32))
>>> translation = []
>>> for i in range(3):
...     translation.append(Tensor(np.random.rand(4),dtype=mstype.float32))
>>> point = []
>>> for i in range(3):
...     point.append(Tensor(np.random.rand(4),dtype=mstype.float32))
>>> out = apply_to_point(rotation, translation, point)
>>> print(out)
(Tensor(shape=[4], dtype=Float32, value= [ 1.02389336e+00,  1.12493467e+00,  2.54357845e-01,  1.25249946e+00]),
Tensor(shape=[4], dtype=Float32, value= [ 9.84841168e-01,  5.20081401e-01,  6.43978953e-01,  6.15328550e-01]),
Tensor(shape=[4], dtype=Float32, value= [ 8.62860143e-01,  9.11733627e-01,  1.09284782e+00,  1.44202101e+00]))