Sur cette page

vector4d QML Value Type

Un type vector4d possède des attributs x, y, z et w. Plus d'informations...

Description détaillée

Un type vector4d possède les attributs x, y, z et w, sinon il est similaire au type vector3d.

Les propriétés de type vector4d ont un vecteur nul par défaut. Les attributs x, y,z et w sont définis sur 0.

Voir la documentation sur le type vector3d pour plus d'informations.

Pour créer une valeur vector4d, spécifiez-la sous la forme d'une chaîne "x,y,z,w", ou définissez les composants individuellement, ou composez-la avec la fonction Qt.vector4d().

Le type vector4d possède les fonctions idempotentes suivantes qui peuvent être invoquées en QML :

Signature de la fonctionDescription de la fonctionExemple
real dotProduct(vector4d other)Renvoie le résultat réel scalaire du produit point de this vector4d avec 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)Renvoie le résultat de la transformation du this vector4d avec le 4x4 matrix en appliquant la matrice après le vecteur.
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)Renvoie le résultat de la multiplication de this vector4d avec other vector4d.
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)Renvoie le résultat de la multiplication de this vector4d avec le scalaire 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)Renvoie le résultat vectoriel4d de l'addition de this vector4d avec other vector4d
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)Renvoie le résultat de la soustraction de other vector4d à this vector4d.
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()Renvoie la forme normalisée de this vector
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()Renvoie la valeur réelle scalaire de la longueur de this vector3d
var a = Qt.vector4d(1,2,3,4);
var b = a.length();
console.log(b.toString()); // 5.477225575051661
vector2d toVector2d()Renvoie le résultat vector2d de la conversion de this vector4d en vector2d
var a = Qt.vector4d(1,2,3,4);
var b = a.toVector2d();
console.log(b.toString()); // QVector2D(1, 2)
vector3d toVector3d()Renvoie le résultat vectoriel3d de la conversion de this vector4d en 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)Retourne vrai si this vector4d est approximativement égal à other vector4d. L'approximation sera vraie si chaque attribut de this se trouve à l'intérieur de epsilon de other. Notez que epsilon est un argument facultatif, la valeur par défaut de epsilon est 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

Ce type de valeur est fourni par l'importation QtQuick.

Voir également les types de valeurs QML.

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