#include#include int main() { glm::vec3 pos(1.0f, 2.0f, 3.0f); float y = pos.y; std::cout << "y-coordinate: " << y << std::endl; return 0; }
#includeIn this example, we create a 3D vector `pos` using the Eigen library. We then extract the y-coordinate of `pos` using the `getY()` function (which is called `pos(1)` in this case). Finally, we print out the y-coordinate using `cout`. Package library: Eigen#include int main() { Eigen::Vector3f pos(1.0f, 2.0f, 3.0f); float y = pos(1); std::cout << "y-coordinate: " << y << std::endl; return 0; }