# from_align_vectors#

classmethod Rotation.from_align_vectors(other: , initial: , weights: = None, return_rmsd: bool = False, return_sensitivity: bool = False) [source]#

Return an estimated rotation to optimally align two sets of vectors.

This method wraps `align_vectors()`. See that method for further explanations of parameters and returns.

Parameters:
other

Vectors of shape `(n,)` in the other reference frame.

initial

Vectors of shape `(n,)` in the initial reference frame.

weights

Relative importance of the different vectors.

return_rmsd

Whether to return the (weighted) root mean square distance between `other` and `initial` after alignment. Default is `False`.

return_sensitivity

Whether to return the sensitivity matrix. Default is `False`.

Returns:
`estimated_rotation`

Best estimate of the rotation that transforms `initial` to `other`.

`rmsd`

Returned when `return_rmsd=True`.

`sensitivity`

Returned when `return_sensitivity=True`.

Examples

```>>> from orix.quaternion import Rotation
>>> from orix.vector import Vector3d
>>> v1 = Vector3d([[1, 0, 0], [0, 1, 0]])
>>> v2 = Vector3d([[0, -1, 0], [0, 0, 1]])
>>> r12 = Rotation.from_align_vectors(v2, v1)
>>> r12 * v1
Vector3d (2,)
[[ 0. -1.  0.]
[ 0.  0.  1.]]
>>> r21, dist = Rotation.from_align_vectors(v1, v2, return_rmsd=True)
>>> dist
0.0
>>> r21 * v2
Vector3d (2,)
[[1. 0. 0.]
[0. 1. 0.]]
```