vector3d QML Value Type
une valeur avec les attributs x, y et z. Plus d'informations...
Description détaillée
Le type vector3d fait référence à une valeur dotée des attributs x, y et z.
Les propriétés de type vector3d ont un vecteur nul par défaut. Les attributs x, y et z sont définis sur 0.
Pour créer une valeur vector3d, spécifiez-la sous la forme d'une chaîne "x,y,z" :
Rotation { angle: 60; axis: "0,1,0" }
ou avec la fonction Qt.vector3d() :
Rotation { angle: 60; axis: Qt.vector3d(0, 1, 0) }
ou sous forme de composants distincts x, y, et z:
Rotation { angle: 60; axis.x: 0; axis.y: 1; axis.z: 0 }
Chaque attribut d'une valeur vector3d est stocké en interne sous la forme d'un nombre à virgule flottante en simple précision (float).
Lors de l'intégration avec C++, il convient de noter que toute valeur QVector3D transmise à QML à partir de C++ est automatiquement convertie en valeur vector3d, et vice-versa.
Le type vector3d possède les fonctions idempotentes suivantes qui peuvent être invoquées en QML :
| Signature de la fonction | Description de la fonction | Exemple |
|---|---|---|
| vector3d crossProduct(vector3d other) | Renvoie le résultat vector3d du produit croisé de this vector3d avec other vector3d | |
| real dotProduct(vector3d other) | Renvoie le résultat scalaire réel du produit point de this vector3d avec other vector3d | |
| vector3d times(matrix4x4 matrix) | Renvoie le résultat vectoriel3d de la transformation de this vector3d avec la matrice 4x4 matrix avec la matrice appliquée après le vecteur | |
| vector3d times(vector3d other) | Renvoie le résultat vectoriel3d de la multiplication de this vector3d avec other vector3d | |
| vector3d times(real factor) | Renvoie le résultat vector3d de la multiplication de this vector3d avec le scalaire factor | var a = Qt.vector3d(1,2,3); var b = 4.48; var c = a.times(b); console.log(c.toString()); // QVector3D(4.48, 8.96, 13.44) |
| vector3d plus(vector3d other) | Renvoie le résultat vectoriel3d de l'addition de this vector3d avec other vector3d | |
| vector3d minus(vector3d other) | Renvoie le résultat vectoriel3d de la soustraction de other vector3d à this vector3d | |
| vector3d normalized() | Renvoie la forme normalisée de this vector | var a = Qt.vector3d(1,2,3); var b = a.normalized(); console.log(b.toString()); // QVector3D(0.267261, 0.534522, 0.801784) |
| real length() | Renvoie la valeur réelle scalaire de la longueur de this vector3d | var a = Qt.vector3d(1,2,3); var b = a.length(); console.log(b.toString()); // 3.7416573867739413 |
| vector2d toVector2d() | Renvoie le résultat vector2d de la conversion de this vector3d en vector2d | var a = Qt.vector3d(1,2,3); var b = a.toVector2d(); console.log(b.toString()); // QVector2D(1, 2) |
| vector4d toVector4d() | Renvoie le résultat vectoriel4d de la conversion de this vector3d en vector4d | var a = Qt.vector3d(1,2,3); var b = a.toVector4d(); console.log(b.toString()); // QVector4D(1, 2, 3, 0) |
| bool fuzzyEquals(vector3d other, real epsilon) | Retourne vrai si this vector3d est approximativement égal à other vector3d. 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. |
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.