10 #include <gtest/gtest.h>    13 #include <Eigen/Dense>    17 #if defined(USE_GLM_GROUND_TRUTH)    18 #define GLM_ENABLE_EXPERIMENTAL    19 #include <glm/gtc/matrix_transform.hpp>      20 #include <glm/gtc/type_ptr.hpp>      21 #include <glm/gtx/string_cast.hpp>    22 #include <glm/mat4x4.hpp>      23 #include <glm/vec3.hpp>      24 #include <glm/vec4.hpp>      27 TEST(OpenGL, perspectiveMatrix)
    29     float zmin = 0.1f, zmax = 100.0f;
    30     float fovy_deg = 45.0f;
    31     size_t view_w = 640, view_h = 480;
    43 #if defined(USE_GLM_GROUND_TRUTH)    44     glm::mat4 Projection = glm::perspective(
    51         "[1.810660 0.000000 0.000000 0.000000;"    52         "0.000000 2.414213 0.000000 0.000000;"    53         "0.000000 0.000000 -1.002002 -1.000000;"    54         "0.000000 0.000000 -0.200200 0.000000"    66     float left = -4.0f, right = 6.0f;
    67     float top = 10.0f, bottom = -2.0f;
    68     float zmin = 0.1f, zmax = 100.0f;
    75 #if defined(USE_GLM_GROUND_TRUTH)    76     glm::mat4 Projection = glm::ortho(left, right, bottom, top, zmin, zmax);
    82         "[0.200000 0.000000 0.000000 0.000000;"    83         "0.000000 0.166667 0.000000 0.000000;"    84         "0.000000 0.000000 -0.020020 0.000000;"    85         "-0.200000 -0.666667 -1.002002 1.000000" 
std::string to_string(T v)
Just like std::to_string(), but with an overloaded version for std::string arguments. 
 
TEST(OpenGL, perspectiveMatrix)
 
void computeProjectionMatrix(float zmin, float zmax)
Uses is_projective , vw,vh, etc. 
 
constexpr double DEG2RAD(const double x)
Degrees to radians. 
 
bool fromMatlabStringFormat(const std::string &s, mrpt::optional_ref< std::ostream > dump_errors_here=std::nullopt)
Reads a matrix from a string in Matlab-like format, for example: "[1 0 2; 0 4 -1]" The string must st...
 
Rendering state related to the projection and model-view matrices. 
 
void computeOrthoProjectionMatrix(float left, float right, float bottom, float top, float znear, float zfar)
Especial case for custom parameters of Orthographic projection. 
 
size_t viewport_width
In pixels. 
 
double FOV
Vertical FOV in degrees. 
 
mrpt::math::CMatrixFloat44 p_matrix
Projection matrix, computed by renderNormalScene() from all the parameters above. ...
 
EXPECT_NEAR(out.cam_params.rightCameraPose.x, 0.1194, 0.005)
 
bool is_projective
true: projective, false: ortho