#include <iostream>
#include <cmath>

float screen_to_angle(const float pixel_dist, const float screen_width, const float fov)
{
	return atanf(pixel_dist / -((screen_width / 2.F) / tanf(fov / 2.F)));
}

float ratio_at_dist(const float dist, const float fov1, const float fov2)
{
	const auto ang1 = screen_to_angle(dist, 1920, fov1 * 3.1415926 / 180.F);
	const auto ang2 = screen_to_angle(dist, 1920, fov2 * 3.1415926 / 180.F);
	
	return ang1 / ang2;
}

int main()
{
	std::cout << "Ratio at 5px from center: ";
	std::cout << ratio_at_dist(5.F, 51.F, 103.F) << std::endl;
	
	std::cout << "Ratio at 960px from center: ";
	std::cout << ratio_at_dist(960.F, 51.F, 103.F) << std::endl;
	
	return 0;
}