Auf dieser Seite

vector4d QML Value Type

Ein Typ „vector4d“ verfügt über die Attribute x, y, z und w. Mehr...

Import Statement: import QtQuick

Ausführliche Beschreibung

Ein Typ vom Typ „ vector4d “ verfügt über die Attribute „ x “, „ y “, „ z “ und „ w “; ansonsten ähnelt er dem Typ „ vector3d “.

Eigenschaften vom Typ „ vector4d “ haben standardmäßig einen Nullvektor. Dabei sind die Attribute „ 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“-Zeichenkette an, definieren Sie die Komponenten einzeln oder setzen Sie ihn mit der Funktion `Qt.vector4d()` zusammen.

Der Typ `vector4d` verfügt über die folgenden idempotenten Funktionen, die in QML aufgerufen werden können:

FunktionssignaturBeschreibungBeispiel
real dotProduct(vector4d other)Gibt das skalare reelle Ergebnis des Skalarprodukts des Vektors „ this “ vom Typ „vector4d“ mit dem Vektor „ other “ vom Typ „vector4d“ zurück
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 des this en 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 des vector4d „ this “ mit dem vector4d „ other “ 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)Gibt das vector4d-Ergebnis der Multiplikation des vector4d „ this “ mit dem Skalar zurück 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 other)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 normalized()Gibt die normierte 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 des Vektors „ this “ zurück. vector3d
var a = Qt.vector4d(1,2,3,4);
var b = a.length();
console.log(b.toString()); // 5.477225575051661
vector2d toVector2d()Gibt das vector2d-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()Gibt das vector3d-Ergebnis der Konvertierung von ` this ` vector4d in einen vector3d zurück
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 der „ this “-Vektor4d annähernd gleich dem „ other “-Vektor4d ist. Die Annäherung gilt als erfüllt, wenn jedes Attribut von „ this “ innerhalb von „ epsilon “ von „ other “ liegt. Beachten Sie, dass „ epsilon “ ein optionales Argument ist; der Standardwert für „ 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 Werttyp wird durch den Import „ QtQuick “ bereitgestellt.

Siehe auch QML-Werttypen.

© 2026 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.