quaternion QML Value Type
Ein Quaternion-Typ hat Skalar-, x-, y- und z-Attribute. Mehr...
Detaillierte Beschreibung
Ein Typ quaternion
hat die Attribute scalar
, x
, y
und z
.
Um einen quaternion
Wert zu erstellen, geben Sie ihn als "scalar,x,y,z" String an, oder definieren Sie die Komponenten einzeln, oder setzen Sie ihn mit der Funktion Qt.quaternion() zusammen.
Der Quaternion-Typ hat die folgenden idempotenten Funktionen, die in QML aufgerufen werden können:
Funktion Signatur | Beschreibung | Beispiel |
---|---|---|
real dotProduct(quaternion andere) | Liefert das skalare reelle Ergebnis des Punktprodukts von this quaternion mit dem other quaternion | |
quaternion times(quaternion andere) | Gibt das Quaternion-Ergebnis der Multiplikation von this quaternion mit dem other quaternion zurück, was der Anwendung der beiden Drehungen entspricht | |
vector3d times(vector3d vector) | Gibt das vector3d-Ergebnis der Drehung von vector mit this quaternion zurück | |
quaternion times(real factor) | Gibt das Quaternion-Ergebnis der Multiplikation von this quaternion mit dem Skalar zurück factor | var a = Qt.quaternion(1,2,3,4); var b = 4.48; var c = a.times(b); console.log(c.toString()); // QQuaternion(4.48, 8.96, 13.44, 17.92) |
quaternion plus(quaternion other) | Gibt das Quaternion-Ergebnis der Addition von this quaternion mit dem other quaternion zurück | |
quaternion minus(quaternion andere) | Gibt das Quaternion-Ergebnis der Subtraktion von other quaternion von this quaternion zurück | |
quaternion normalisiert() | Gibt die normalisierte Einheitsform von this quaternion zurück | var a = Qt.quaternion(1,2,3,4); var b = a.normalized(); console.log(b.toString()); // QQuaternion(0.182574, 0.365148, 0.547723, 0.730297) |
quaternion invertiert() | Gibt die Inverse von this quaternion zurück | var a = Qt.quaternion(0.5,0.5,0.5,-0.5); var b = a.inverted(); console.log(b.toString()); // QQuaternion(0.5, -0.5, -0.5, 0.5) |
quaternion konjugiert() | Gibt die Konjugierte von this quaternion zurück | var a = Qt.quaternion(1,2,3,4); var b = a.conjugated() console.log(b.toString()); // QQuaternion(1, -2, -3, -4) |
real length() | Gibt den skalaren reellen Wert der Länge von this quaternion zurück | var a = Qt.quaternion(1,2,3,4); var b = a.length(); console.log(b.toString()); // 5.477225575051661 |
vector3d toEulerAngles() | Gibt die Euler-Winkel von vector3d (in Grad) zurück, die dem Quaternion this entsprechen | var a = Qt.quaternion(0.933012,0.25,-0.25,0.066987); var b = a.toEulerAngles(); console.log(b.toString()); // QVector3D(30, -30, -4.28846e-05) |
vector4d toVector4d() | Gibt das Ergebnis der Umwandlung von this quaternion in einen vector4d zurück | var a = Qt.quaternion(1,2,3,4); var b = a.toVector4d(); console.log(b.toString()); // QVector4D(2, 3, 4, 1) |
bool fuzzyEquals(quaternion other, real epsilon) | Gibt true zurück, wenn das Quaternion this annähernd gleich dem Quaternion other ist. Die Annäherung ist wahr, wenn jedes Attribut von this innerhalb von epsilon von other liegt. Beachten Sie, dass epsilon ein optionales Argument ist, der Standardwert epsilon ist 0,00001. |
Eigenschaften des Typs quaternion
haben Qt.quaternion(1, 0, 0, 0)
als Standardwert.
Dieser Wertetyp wird durch den QtQuick Import bereitgestellt.
Siehe auch QML-Wertetypen.
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.