From a40a2090e4c2b25b165e62d0c5c3d53ceed7c138 Mon Sep 17 00:00:00 2001 From: GeorgH93 Date: Fri, 21 May 2021 18:55:11 +0200 Subject: [PATCH] Add GetFovX and GetFovY to CameraIntrinsic --- openVulkanoCpp/Math/CameraIntrinsic.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/openVulkanoCpp/Math/CameraIntrinsic.hpp b/openVulkanoCpp/Math/CameraIntrinsic.hpp index 207296d..bda2036 100644 --- a/openVulkanoCpp/Math/CameraIntrinsic.hpp +++ b/openVulkanoCpp/Math/CameraIntrinsic.hpp @@ -78,6 +78,16 @@ namespace openVulkanoCpp::Math return Fy() / Fx(); } + [[nodiscard]] float GetFovX(float imageWidth) const + { + return 2 * atanf(imageWidth * 0.5f / Fx()); + } + + [[nodiscard]] float GetFovY(float imageHeight) const + { + return 2 * atanf(imageHeight * 0.5f / Fy()); + } + [[nodiscard]] Math::Vector3f ProjectTo3D(Math::Vector2i pixelCoordinates, float depth) const { return ProjectTo3D(Math::Vector2f(pixelCoordinates), depth);