#includeusing namespace Eigen; // create a 3D Vector Vector3d v(1.0, 0.0, 2.0); // add two vectors Vector3d u(0.5, -1.0, 1.5); Vector3d w = v + u; // get the norm of a vector double norm = v.norm();
#includeIn this example, we create a 3D vector `v` using the GLM library. We also create another vector `u` and add it to `v` to get `w`. Finally, we normalize `v` to get `normV`. Package/Library: 1. Eigen - A C++ template library for linear algebra 2. GLM - OpenGL Mathematics, a C++ mathematics library for graphics programmingusing namespace glm; // create a 3D vector vec3 v(1.0f, 0.0f, 2.0f); // add two vectors vec3 u(0.5f, -1.0f, 1.5f); vec3 w = v + u; // normalize a vector vec3 normV = normalize(v);