I'd like to calculate FOV in degrees of the default 3D Viewport (not a camera). According to this link the formula requires me to provide sensor width and focal length. Focal length can be seen in the view tab:
I don't see the value of sensor width though. Where can I find it? Or perhaps is there a way to get a value in degrees on radians straight away (perhaps from the Python code...?)
Edit
To clarify furhter, the value I'm interested in should allow me to replicate what I'm seeing in the default 3D Viewport in a separate rendering engine. For example, with OpenGL one can create a perspective matrix using following code:
glm::mat4 projection = glm::perspective(glm::radians(FOV), (float)screen_width / (float)screen_width, 0.1f, 1000.0f);
How is 3D Viewport Focal Length translating to this FOV value? For a Viewport size equal to 2115x1180 sensor width seems to be equal to 40 mm and I can generate a matching image of the default cube in OpenGL using the value of 43.60281897270362 (from math.degrees(2 * math.atan(40 /(2 * 50)))). If I resize Blender's 3D Viewport the cube generated in OpenGL and cube as seen in Blender no longer match. So what's a correct formula...?
For the reference, Viewport size can be obtained with
view = next(area for area in bpy.context.window.screen.areas if area.type == 'VIEW_3D')
window = next(view for view in view.regions if view.type == 'WINDOW')
(window.width, window.height)
Edit
To illustrate the problem further: if I resize my Blender Viewport to 1376x894 then to generate a matching image in OpenGL I need to pass down an angle of about 37.75, meaning that for constant Focal Length equal to 50 mm I have sensor width equal to about 34.19. So given these three input parameters (width=1376, height=894, focal_length=50), how do I obtain this output value of 34.19?
