# Converting from 2D coordinates in image plane to 3D, use of focal length in gnomonic projection

I'm currently using libgnomonic to perform a gnonominc projection. I cannot find a derivation of the used formulas. But they don't seem to be particularly involved and there's a specific bit I'd like to understand.

More specifically this function, has a conversion from 2D to 3D that doesn't quite convince me, I'll report the specific bit for convenience:

 /* Compute pixel position in 3d-frame */
lgPvi[0] = lgFocal;
lgPvi[1] = lgPixel * ( lgrPointX - lgrSightX );
lgPvi[2] = lgPixel * ( lgrPointY - lgrSightY );


Also I don't know if this is relevant but they compute a focal length from aperture angle, the computation is :

lg_Real_s( 2.0 ) * tan( lgApper / lg_Real_s( 2.0 ) ) / lgrWidth

Which is actually the inverse of a focal length, unless I'm wrong.

In few words if we have a point in the image plane of coordinates $$(x,y)$$ the 3D point, still in the plane, is constructed with a mapping:

$$(x,y) \to (x,y,f)$$

Where $$f$$ is the focal length, this would be the case if the used projection were orthographic, but the is explicitly said that the projection used is perspective, there fore to me the correct conversion should be

$$(x,y) \to (fx,fy,f)$$

Details:

The function perform a transformation between pixel coordinates from perspective projection to (azimuth,elevation) in a equirectangular image.

All the math should be trivial trigonometry.

But anyway since the function works I only want to know one thing:

Why isn't the focal length used to rescale the $$(x,y)$$ pixel coordinates?