// Initialize the vectors ofVec3f vec1(1, 2, 3); ofVec3f vec2(4, 5, 6); // Calculate the dot product float dotProduct = vec1.dot(vec2); // Print the result cout << "The dot product is: " << dotProduct << endl;
// Initialize the vector ofVec3f vec(1, 2, 3); // Normalize the vector vec.normalize(); // Print the normalized vector cout << "The normalized vector is: " << vec << endl; // Calculate the dot product with itself float dotProduct = vec.dot(vec); // Print the dot product value cout << "The dot product with itself is: " << dotProduct << endl;In this example, we are initializing a 3D vector using the ofVec3f class and normalizing it using the normalize function. We then print the normalized vector and calculate its dot product with itself using the dot function. The output will be the normalized vector and the dot product value. Package library: OpenFrameworks (ofVec3f)