GLM数据结构输出到控制台
----------
#include <iomanip> #include <iostream> #include <string> #include <sstream> #include <locale> #include <codecvt> #include <limits> // #include <glm/glm.hpp> #include <glm/ext.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> #include <glm/gtx/string_cast.hpp> #include <glm/gtx/io.hpp> // using namespace std::literals; //----------------------------------------------------------------------------------- static void printGLM(glm::dvec3 aveVec3) { std::cout << std::setprecision(20) << aveVec3[0] << " " << aveVec3[1] << " " << aveVec3[2] << std::endl; } //----------------------------------------------------------------------------------- static void printGLM(glm::dmat3 covarMat3) { std::cout << std::setprecision(20) << covarMat3[0][0] << " " << covarMat3[1][0] << " " << covarMat3[2][0] << std::endl; std::cout << std::setprecision(20) << covarMat3[0][1] << " " << covarMat3[1][1] << " " << covarMat3[2][1] << std::endl; std::cout << std::setprecision(20) << covarMat3[0][2] << " " << covarMat3[1][2] << " " << covarMat3[2][2] << std::endl; } static void printGLM(glm::dmat4 covarMat4) { std::cout << std::setprecision(20) << covarMat4[0][0] << " " << covarMat4[1][0] << " " << covarMat4[2][0] << " " << covarMat4[3][0] << std::endl; std::cout << std::setprecision(20) << covarMat4[0][1] << " " << covarMat4[1][1] << " " << covarMat4[2][1] << " " << covarMat4[3][1] << std::endl; std::cout << std::setprecision(20) << covarMat4[0][2] << " " << covarMat4[1][2] << " " << covarMat4[2][2] << " " << covarMat4[3][2] << std::endl; std::cout << std::setprecision(20) << covarMat4[0][3] << " " << covarMat4[1][3] << " " << covarMat4[2][3] << " " << covarMat4[3][3] << std::endl; }
----------
应用方式1
glm::dvec3 aveVec3; glm::dmat3 covarMat3; OBBbox::compute3DCovariance(vertexList, aveVec3, covarMat3); std::cout << "aveVec3: " << std::endl; printGLM(aveVec3); std::cout << "covarMat3: " << std::endl; printGLM(covarMat3);
----------------
应用方式2
glm::dvec3 aveVec3; glm::dmat3 covarMat3; OBBbox::compute3DCovariance(vertexList, aveVec3, covarMat3); std::cout << "aveVec3: " << std::endl << glm::io::precision(20) << glm::io::width(25) << aveVec3 << std::endl; std::cout << "covarMat3: " << std::endl << glm::io::precision(20) << glm::io::width(25) << covarMat3 << std::endl;
----------------
应用方式3
glm::dvec3 aveVec3; glm::dmat3 covarMat3; OBBbox::compute3DCovariance(vertexList, aveVec3, covarMat3); std::cout << "aveVec3: " << glm::to_string(aveVec3) << std::endl; std::cout << "covarMat3: " << glm::to_string(covarMat3) << std::endl;
---------------