Add initial project files (excluding ignored content)
This commit is contained in:
27
Maths/Maths.cpp
Normal file
27
Maths/Maths.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
// Maths.cpp : Définit les fonctions de la bibliothèque statique.
|
||||
//
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#include "Maths.hpp"
|
||||
#include <cmath>
|
||||
|
||||
double Maths::DegreesToRadians(double degrees) {
|
||||
return degrees * M_PI / 180.0;
|
||||
}
|
||||
|
||||
// Convertit des radians en degrés
|
||||
double Maths::RadiansToDegrees(double radians) {
|
||||
return radians * 180.0 / M_PI;
|
||||
}
|
||||
|
||||
double Maths::CompensateHorizontalFOV(double baseHorizontalFOVDeg, double baseAspectRatio, double targetAspectRatio) {
|
||||
double baseFOVRad = DegreesToRadians(baseHorizontalFOVDeg);
|
||||
// Step 1 : FOV vertical from horizontal FOV
|
||||
double verticalFOVRad = 2.0 * std::atan(std::tan(baseFOVRad / 2.0) / baseAspectRatio);
|
||||
// Step 2 : New horizontal FOV for target aspect ratio
|
||||
double newFOVRad = 2.0 * std::atan(std::tan(verticalFOVRad / 2.0) * targetAspectRatio);
|
||||
|
||||
return RadiansToDegrees(newFOVRad);
|
||||
}
|
||||
Reference in New Issue
Block a user