QVector3D v1(1.0, 2.0, 3.0); QVector3D v2 = v1.normalized(); // v2 is now (0.267, 0.534, 0.801)
QVector3D v1(0.0, 0.0, 0.0); QVector3D v2 = v1.normalized(); // results in (NaN, NaN, NaN)In this example, a vector with all components equal to zero is normalized. Because the magnitude of the original vector is zero, the result of the normalized() method is a vector with components that are not a number (NaN). As mentioned earlier, QVector3D is a class in the Qt package library. Specifically, it is part of the QtCore module, which is one of the core modules in the Qt library.