How to get the horizontal fov?

While there are several ways to reconstruct position from depth, I just read an article which use the following fomular:

// input SV_POSITION as pos2d
New_pos2d = ( (pos2d.xy) * (2/screenres.xy) ) - float2(1,1);
viewSpacePos.x =  gbuffer_depth * tan( 90-HORZFOV/2 ) * New_pos2d.x;
ViewSpacePos.y = -gbuffer_depth * tan( 90-VERTFOV/2 ) * New_pos2D.y;
ViewSpacePos.z =  gbuffer_depth;

I’m wondering if there is an easy way to get the horizontal fov? Because I usually call gluPerspective to set up the frustum which only use the vertical fov.

At the projection plane you have

ytop / near = tan (fovy/2) and also
yright / near = tan (fovx/2)

From the definition of A.R., you have

yright = aspect * ytop

Algebra gives:

tan(fovx/2) = aspect * tan(fovy/2) and then

fovx = 2 * atan(aspect * tan(fovy/2))

Untested, but ought to be right.

Yes, thanks.