Rotation matrix
beignet.apply_rotation_matrix
apply_rotation_matrix(input, rotation, inverse=False)
Rotates vectors in three-dimensional space using rotation matrices.
Note
This function interprets the rotation of the original frame to the final frame as either a projection, where it maps the components of vectors from the final frame to the original frame, or as a physical rotation, integrating the vectors into the original frame during the rotation process. Consequently, the vector components are maintained in the original frame’s perspective both before and after the rotation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input
|
(Tensor, shape(..., 3))
|
Each vector represents a vector in three-dimensional space. The number of rotation matrices and number of vectors must follow standard broadcasting rules: either one of them equals unity or they both equal each other. |
required |
rotation
|
(Tensor, shape(..., 3, 3))
|
Rotation matrices. |
required |
inverse
|
bool
|
If |
False
|
Returns:
Name | Type | Description |
---|---|---|
rotated_vectors |
(Tensor, shape(..., 3))
|
Rotated vectors. |
Source code in src/beignet/_apply_rotation_matrix.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
beignet.compose_rotation_matrix
compose_rotation_matrix(input, other)
Compose rotation matrices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input
|
Tensor, shape=(..., 3, 3)
|
Rotation matrices. |
required |
other
|
Tensor, shape=(..., 3, 3)
|
Rotation matrices. |
required |
Returns:
Name | Type | Description |
---|---|---|
output |
Tensor, shape=(..., 3, 3)
|
Composed rotation matrices. |
Source code in src/beignet/_compose_rotation_matrix.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
beignet.invert_rotation_matrix
invert_rotation_matrix(input)
Invert rotation matrices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input
|
(Tensor, shape(..., 3, 3))
|
Rotation matrices. |
required |
Returns:
Name | Type | Description |
---|---|---|
inverted_rotation_matrices |
(Tensor, shape(..., 3, 3))
|
Inverted rotation matrices. |
Source code in src/beignet/_invert_rotation_matrix.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
beignet.random_rotation_matrix
random_rotation_matrix(size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False)
Generate random rotation matrices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
size
|
int
|
Output size. |
required |
generator
|
Generator
|
Psuedo-random number generator. Default, |
None
|
out
|
Tensor
|
Output tensor. Default, |
None
|
dtype
|
dtype
|
Type of the returned tensor. Default, global default. |
None
|
layout
|
layout
|
Layout of the returned tensor. Default, |
strided
|
device
|
device
|
Device of the returned tensor. Default, current device for the default tensor type. |
None
|
requires_grad
|
bool
|
Whether autograd records operations on the returned tensor. Default,
|
False
|
pin_memory
|
bool
|
If |
False
|
Returns:
Name | Type | Description |
---|---|---|
random_rotation_matrices |
(Tensor, shape(..., 3, 3))
|
Random rotation matrices. |
Source code in src/beignet/_random_rotation_matrix.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
beignet.rotation_matrix_identity
rotation_matrix_identity(size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False)
Identity rotation matrices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
size
|
int
|
Output size. |
required |
out
|
Tensor
|
Output tensor. Default, |
None
|
dtype
|
dtype
|
Type of the returned tensor. Default, global default. |
None
|
layout
|
layout
|
Layout of the returned tensor. Default, |
strided
|
device
|
device
|
Device of the returned tensor. Default, current device for the default tensor type. |
None
|
requires_grad
|
bool
|
Whether autograd records operations on the returned tensor. Default,
|
False
|
Returns:
Name | Type | Description |
---|---|---|
identity_rotation_matrices |
(Tensor, shape(size, 3, 3))
|
Identity rotation matrices. |
Source code in src/beignet/_rotation_matrix_identity.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
beignet.rotation_matrix_magnitude
rotation_matrix_magnitude(input)
Rotation matrix magnitudes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input
|
(Tensor, shape(..., 3, 3))
|
Rotation matrices. |
required |
Returns:
Name | Type | Description |
---|---|---|
rotation_matrix_magnitudes |
(Tensor, shape(...))
|
Angles in radians. Magnitudes will be in the range :math: |
Source code in src/beignet/_rotation_matrix_magnitude.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
beignet.rotation_matrix_mean
rotation_matrix_mean(input, weight=None)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input
|
Tensor, shape=(..., 3, 3)
|
Rotation matrices. |
required |
weight
|
Tensor, shape=(..., 4)
|
Relative importance of rotation matrices. |
None
|
Returns:
Name | Type | Description |
---|---|---|
output |
Tensor, shape=(..., 3, 3)
|
|
Source code in src/beignet/_rotation_matrix_mean.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
beignet.rotation_matrix_to_euler_angle
rotation_matrix_to_euler_angle(input, axes, degrees=False)
Convert rotation matrices to Euler angles.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input
|
(Tensor, shape(..., 3, 3))
|
Rotation matrices. |
required |
axes
|
str
|
Axes. 1-3 characters belonging to the set {‘X’, ‘Y’, ‘Z’} for intrinsic rotations, or {‘x’, ‘y’, ‘z’} for extrinsic rotations. Extrinsic and intrinsic rotations cannot be mixed. |
required |
degrees
|
bool
|
If |
False
|
Returns:
Name | Type | Description |
---|---|---|
euler_angles |
(Tensor, shape(..., 3))
|
Euler angles. The returned Euler angles are in the range:
|
Source code in src/beignet/_rotation_matrix_to_euler_angle.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
beignet.rotation_matrix_to_quaternion
rotation_matrix_to_quaternion(input, canonical=False)
Convert rotation matrices to rotation quaternions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input
|
Tensor, shape=(..., 3, 3)
|
Rotation matrices. |
required |
canonical
|
bool
|
Whether to map the redundant double cover of rotation space to a unique
canonical single cover. If |
False
|
Returns:
Name | Type | Description |
---|---|---|
output |
Tensor, shape=(..., 4)
|
Rotation quaternion. |
Source code in src/beignet/_rotation_matrix_to_quaternion.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
|
beignet.rotation_matrix_to_rotation_vector
rotation_matrix_to_rotation_vector(input, degrees=False)
Convert rotation matrices to rotation vectors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input
|
Tensor, shape=(..., 3, 3)
|
Rotation matrices. |
required |
degrees
|
bool
|
If |
False
|
Returns:
Name | Type | Description |
---|---|---|
output |
Tensor, shape=(..., 3)
|
Rotation vectors. |
Source code in src/beignet/_rotation_matrix_to_rotation_vector.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|