vector4d QML Value Type
A vector4d type has x, y, z and w attributes. More...
Detailed Description
A vector4d type has x, y, z and w attributes, otherwise it is similar to the vector3d type.
Properties of type vector4d have a zero vector by default. This has x, y ,z and w set to 0.
See the documentation about the vector3d type for more information.
To create a vector4d value, specify it as a "x,y,z,w" string, or define the components individually, or compose it with the Qt.vector4d() function.
The vector4d type has the following idempotent functions which can be invoked in QML:
| Function Signature | Description | Example | 
|---|---|---|
| real dotProduct(vector4d other) | Returns the scalar real result of the dot product of thisvector4d with theothervector4d | |
| vector4d times(matrix4x4 matrix) | Returns the vector4d result of transforming thisvector4d with the 4x4matrixwith the matrix applied post-vector | |
| vector4d times(vector4d other) | Returns the vector4d result of multiplying thisvector4d with theothervector4d | |
| vector4d times(real factor) | Returns the vector4d result of multiplying thisvector4d with the scalarfactor | 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) | Returns the vector4d result of the addition of thisvector4d with theothervector4d | |
| vector4d minus(vector4d other) | Returns the vector4d result of the subtraction of othervector4d fromthisvector4d | |
| vector4d normalized() | Returns the normalized form of thisvector | 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() | Returns the scalar real value of the length of thisvector3d | var a = Qt.vector4d(1,2,3,4); var b = a.length(); console.log(b.toString()); // 5.477225575051661 | 
| vector2d toVector2d() | Returns the vector2d result of converting thisvector4d to a vector2d | var a = Qt.vector4d(1,2,3,4); var b = a.toVector2d(); console.log(b.toString()); // QVector2D(1, 2) | 
| vector3d toVector3d() | Returns the vector3d result of converting thisvector4d to a 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) | Returns true if thisvector4d is approximately equal to theothervector4d. The approximation will be true if each attribute ofthisis withinepsilonofother. Note thatepsilonis an optional argument, the defaultepsilonis 0.00001. | 
This value type is provided by the QtQuick import.
See also QML Value Types.
© 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.
