as_components#
- RigidTransform.as_components(self)#
Gibt die Translations- und Rotationskomponenten der Transformation zurück, wobei die Rotation zuerst und dann die Translation angewendet wird.
4x4 Starrkörpertransformationsmatrizen haben die Form
[R | t] [0 | 1]
Wobei
Reine 3x3 orthonormale Rotationsmatrix undtein 3x1 Translationsvektor[tx, ty, tz]ist. Diese Funktion gibt die Rotation zurück, die dieser Rotationsmatrix entsprichtr = Rotation.from_matrix(R)und der Translationsvektort.Nehmen Sie eine Transformation
tfund einen Vektorv. Beim Anwenden der Transformation auf den Vektor ist das Ergebnis dasselbe, als ob die Transformation auf den Vektor auf folgende Weise angewendet worden wäre:tf.apply(v) == translation + rotation.apply(v)- Rückgabe:
- translationnumpy.ndarray, Form (N, 3) oder (3,)
Die Translation der Transformation.
- rotation
RotationInstanz Die Rotation der Transformation.
Beispiele
>>> from scipy.spatial.transform import RigidTransform as Tf >>> from scipy.spatial.transform import Rotation as R >>> import numpy as np
Wiederherstellen der Rotation und Translation aus einer Transformation
>>> t = np.array([2, 3, 4]) >>> r = R.from_matrix([[0, 0, 1], ... [1, 0, 0], ... [0, 1, 0]]) >>> tf = Tf.from_components(t, r) >>> tf_t, tf_r = tf.as_components() >>> tf_t array([2., 3., 4.]) >>> tf_r.as_matrix() array([[0., 0., 1.], [1., 0., 0.], [0., 1., 0.]])
Die auf einen Vektor angewendete Transformation ist äquivalent zur auf den Vektor angewendeten Rotation, gefolgt von der Translation
>>> r.apply([1, 0, 0]) array([0., 1., 0.]) >>> t + r.apply([1, 0, 0]) array([2., 4., 4.]) >>> tf.apply([1, 0, 0]) array([2., 4., 4.])