From 4946cdb6adbc1bca1305e062a8da0ce2f0112b16 Mon Sep 17 00:00:00 2001 From: Tom Stewart <38680667+thomascent@users.noreply.github.com> Date: Thu, 19 May 2022 11:25:07 +0900 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Leo <35804463+Yuki-cpp@users.noreply.github.com> --- gl_depth_sim/include/gl_depth_sim/camera_properties.h | 4 ++-- gl_depth_sim/src/gl_depth_sim/sim_depth_camera.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gl_depth_sim/include/gl_depth_sim/camera_properties.h b/gl_depth_sim/include/gl_depth_sim/camera_properties.h index 76637e3..aa09a1a 100644 --- a/gl_depth_sim/include/gl_depth_sim/camera_properties.h +++ b/gl_depth_sim/include/gl_depth_sim/camera_properties.h @@ -8,9 +8,9 @@ namespace gl_depth_sim struct CameraProperties { - enum ProjectionType { Perspective = 0, Orthographic = 1 }; + enum class ProjectionType { Perspective, Orthographic }; - ProjectionType projection = Perspective; + ProjectionType projection = ProjectionType::Perspective; int width, height; float fx, fy; diff --git a/gl_depth_sim/src/gl_depth_sim/sim_depth_camera.cpp b/gl_depth_sim/src/gl_depth_sim/sim_depth_camera.cpp index 1ca27a2..4782c7f 100644 --- a/gl_depth_sim/src/gl_depth_sim/sim_depth_camera.cpp +++ b/gl_depth_sim/src/gl_depth_sim/sim_depth_camera.cpp @@ -30,7 +30,7 @@ static Eigen::Matrix4d createProjectionMatrix(const gl_depth_sim::CameraProperti { Eigen::Matrix4d m (Eigen::Matrix4d::Identity()); // Organized by column - if(camera.projection == gl_depth_sim::CameraProperties::Perspective) + if(camera.projection == gl_depth_sim::CameraProperties::ProjectionType::Perspective) { m(0,0) = 2.0 * camera.fx / camera.width; m(1,1) = 2.0 * camera.fy / camera.height; @@ -130,7 +130,7 @@ gl_depth_sim::DepthImage gl_depth_sim::SimDepthCamera::render(const Eigen::Isome { if (depth != 0.0f) { - if(camera_.projection == gl_depth_sim::CameraProperties::Perspective) + if(camera_.projection == gl_depth_sim::CameraProperties::ProjectionType::Perspective) { depth = zf_zn / (depth * (zf_minus_zn) + camera_.z_near); }