QVector3D x(1.0f, 2.0f, 3.0f); // creates a QVector3D with values (1.0, 2.0, 3.0)
QVector3D a(1.0f, 2.0f, 3.0f); QVector3D b(4.0f, 5.0f, 6.0f); QVector3D c = a + b; // creates a QVector3D with values (5.0, 7.0, 9.0)
QVector3D x(1.0f, 2.0f, 3.0f); QVector3D normalized = x.normalized(); // creates a QVector3D with values (0.267, 0.535, 0.802)
QVector3D a(1.0f, 2.0f, 3.0f); QVector3D b(4.0f, 5.0f, 6.0f); QVector3D crossProduct = QVector3D::crossProduct(a, b); // creates a QVector3D with values (-3.0, 6.0, -3.0)The QVector3D class is part of the Qt Core module, so the package library needed is Qt.