C++ (Qt)QVector3D v0, v1;..float a1 = QVector3D::dotProduct(v0, v1) / (v0.length() * v1.length()); float a2 = QVector3D::dotProduct(v0, v1) / v0.length(); float a3 = QVector3D::dotProduct(v0, v1) / v0.lengthSquared(); QVector v2 = v0 * a3;QVector v3 = v1 - v2;