From 5e7515fd8e5e014b18b9c2c2c8115f1f850eb6b6 Mon Sep 17 00:00:00 2001 From: Alexander Fabisch Date: Thu, 28 Sep 2023 11:05:58 +0200 Subject: [PATCH] Link quaternion and rotor functions --- pytransform3d/rotations/_quaternion_operations.py | 12 ++++++++++++ pytransform3d/rotations/_rotors.py | 15 ++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/pytransform3d/rotations/_quaternion_operations.py b/pytransform3d/rotations/_quaternion_operations.py index 89b358bf6..b6c2b96a6 100644 --- a/pytransform3d/rotations/_quaternion_operations.py +++ b/pytransform3d/rotations/_quaternion_operations.py @@ -102,6 +102,10 @@ def concatenate_quaternions(q1, q2): ------- q12 : array-like, shape (4,) Quaternion that represents the concatenated rotation q1 * q2 + + See Also + -------- + concatenate_rotors : Concatenate rotors, which is the same operation. """ q1 = check_quaternion(q1, unit=False) q2 = check_quaternion(q2, unit=False) @@ -128,6 +132,10 @@ def q_prod_vector(q, v): ------- w : array-like, shape (3,) 3d vector + + See Also + -------- + rotor_apply : The same operation with a different name. """ q = check_quaternion(q) t = 2 * np.cross(q[1:], v) @@ -150,6 +158,10 @@ def q_conj(q): ------- q_c : array-like, shape (4,) Conjugate (w, -x, -y, -z) + + See Also + -------- + rotor_reverse : Reverse of a rotor, which is the same operation. """ q = check_quaternion(q) return np.array([q[0], -q[1], -q[2], -q[3]]) diff --git a/pytransform3d/rotations/_rotors.py b/pytransform3d/rotations/_rotors.py index 5489496f9..bb1786b95 100644 --- a/pytransform3d/rotations/_rotors.py +++ b/pytransform3d/rotations/_rotors.py @@ -87,6 +87,10 @@ def rotor_reverse(rotor): ------- reverse_rotor : array, shape (4,) Reverse of the rotor: (a, b_yz, b_zx, b_xy) + + See Also + -------- + q_conj : Quaternion conjugate, which is the same operation. """ rotor = check_rotor(rotor) return np.hstack(((rotor[0],), -rotor[1:])) @@ -111,6 +115,11 @@ def concatenate_rotors(rotor1, rotor2): ------- rotor : array, shape (4,) rotor1 applied to rotor2: (a, b_yz, b_zx, b_xy) + + See Also + -------- + concatenate_quaternions : Concatenate quaternions, which is the same + operation. """ rotor1 = check_rotor(rotor1) rotor2 = check_rotor(rotor2) @@ -118,7 +127,7 @@ def concatenate_rotors(rotor1, rotor2): def rotor_apply(rotor, v): - r"""Compute rotation matrix from rotor. + r"""Apply rotor to vector. .. math:: @@ -136,6 +145,10 @@ def rotor_apply(rotor, v): ------- v : array, shape (3,) Rotated vector + + See Also + -------- + q_prod_vector : The same operation with a different name. """ rotor = check_rotor(rotor) return q_prod_vector(rotor, v)