vector4d QML Value Type

Ein Typ vector4d hat die Attribute x, y, z und w. Mehr...

Detaillierte Beschreibung

Ein Typ vector4d hat die Attribute x, y, z und w, ansonsten entspricht er dem Typ vector3d.

Eigenschaften des Typs vector4d haben standardmäßig einen Nullvektor. Dieser hat x, y,z und w auf 0 gesetzt.

Weitere Informationen finden Sie in der Dokumentation zum Typ vector3d.

Um einen vector4d Wert zu erstellen, geben Sie ihn als "x,y,z,w" String an, oder definieren Sie die Komponenten einzeln, oder setzen Sie ihn mit der Funktion Qt.vector4d() zusammen.

Der Typ vector4d hat die folgenden idempotenten Funktionen, die in QML aufgerufen werden können:

Funktion SignaturBeschreibungBeispiel
real PunktProdukt(vector4d andere)Liefert das skalare reelle Ergebnis des Punktprodukts von this vector4d mit other vector4d
var a = Qt.vector4d(1,2,3,4);
var b = Qt.vector4d(5,6,7,8);
var c = a.dotProduct(b);
console.log(c); // 70
vector4d times(matrix4x4 matrix)Gibt das vector4d-Ergebnis der Transformation von this vector4d mit der 4x4 matrix zurück, wobei die Matrix nach dem Vektor angewendet wird
var a = Qt.vector4d(1,2,3,4);
var b = Qt.matrix4x4(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
var c = a.times(b);
console.log(c.toString()); // QVector4D(120, 130, 140, 150)
vector4d times(vector4d other)Gibt das vector4d-Ergebnis der Multiplikation von this vector4d mit dem other vector4d zurück
var a = Qt.vector4d(1,2,3,4);
var b = Qt.vector4d(5,6,7,8);
var c = a.times(b);
console.log(c.toString()); // QVector4D(5, 12, 21, 32)
vector4d times(real factor)Liefert das vector4d-Ergebnis der Multiplikation von this vector4d mit dem Skalar factor
var a = Qt.vector4d(1,2,3,4);
var b = 4.48;
var c = a.times(b);
console.log(c.toString()); // QVector3D(4.48, 8.96,
                                        13.44, 17.92)
vector4d plus(vector4d other)Gibt das vector4d-Ergebnis der Addition von this vector4d mit dem other vector4d zurück
var a = Qt.vector4d(1,2,3,4);
var b = Qt.vector4d(5,6,7,8);
var c = a.plus(b);
console.log(c.toString()); // QVector4D(6, 8, 10, 12)
vector4d minus(vector4d andere)Gibt das vector4d-Ergebnis der Subtraktion von other vector4d von this vector4d zurück
var a = Qt.vector4d(1,2,3,4);
var b = Qt.vector4d(5,6,7,8);
var c = a.minus(b);
console.log(c.toString()); // QVector4D(-4, -4, -4, -4)
vector4d normalisiert()Gibt die normalisierte Form von this vector zurück
var a = Qt.vector4d(1,2,3,4);
var b = a.normalized();
console.log(b.toString());
// QVector4D(0.182574, 0.365148, 0.547723, 0.730297)
real length()Gibt den skalaren reellen Wert der Länge von this vector3d zurück
var a = Qt.vector4d(1,2,3,4);
var b = a.length();
console.log(b.toString()); // 5.477225575051661
vector2d toVector2d()Gibt das Ergebnis der Konvertierung von this vector4d in einen vector2d zurück
var a = Qt.vector4d(1,2,3,4);
var b = a.toVector2d();
console.log(b.toString()); // QVector2D(1, 2)
vector3d toVector3d()Liefert das vector3d-Ergebnis der Konvertierung von this vector4d in einen vector3d
var a = Qt.vector4d(1,2,3,4);
var b = a.toVector3d();
console.log(b.toString()); // QVector3D(1, 2, 3)
bool fuzzyEquals(vector4d other, real epsilon)Gibt true zurück, wenn this vector4d ungefähr gleich dem other vector4d 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.
var a = Qt.vector4d(1,2,3,4);
var b = Qt.vector4d(1.0001, 1.9998, 2.0001, 3.9999);
var c = a.fuzzyEquals(b);        // default epsilon
var d = a.fuzzyEquals(b, 0.005); // supplied epsilon
console.log(c + " " + d); // false true

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.