Skip to content

fov calculating python script

Dr. Jaska requested to merge drjaska/fov-calc into master

Python script which reads fov from arg and calculates real horizontal and vertical fovs with it, aspect ratio and zoomfactor can also be specified.

usage:

misc/tools/fov-calc.py -h
usage: fov-calc.py [-h] fov [horizontalAspectRatio] [verticalAspectRatio] [viewzoom]

Process in-game fov cvars to horizontal and vertical degrees.

positional arguments:
  fov                   in-game fov cvar, degrees of hfov with 4:3 resolution, required field
  horizontalAspectRatio
                        Horizontal num of the aspect ratio, for 16:9 that is 16, default: 16
  verticalAspectRatio   Vertical num of the aspect ratio, for 16:9 that is 9, default: 9
  viewzoom              Zoom amount, default: 1 / no zoom

options:
  -h, --help            show this help message and exit
misc/tools/fov-calc.py
usage: fov-calc.py [-h] fov [horizontalAspectRatio] [verticalAspectRatio] [viewzoom]
fov-calc.py: error: the following arguments are required: fov
misc/tools/fov-calc.py 100
100.0 degrees of hfov with 4:3 resolution (unstretched without black bars) actually gives:
Horizontal FOV = 115.6335562269028
Vertical   FOV = 83.58165703059892
misc/tools/fov-calc.py 100 4 3
100.0 degrees of hfov with 4:3 resolution (unstretched without black bars) actually gives:
Horizontal FOV = 100.0
Vertical   FOV = 83.58165703059892
misc/tools/fov-calc.py 100 16 9
100.0 degrees of hfov with 4:3 resolution (unstretched without black bars) actually gives:
Horizontal FOV = 115.6335562269028
Vertical   FOV = 83.58165703059892
misc/tools/fov-calc.py 100 16 9 5
100.0 degrees of hfov with 4:3 resolution (unstretched without black bars) actually gives:
Horizontal FOV = 35.260612962011486
Vertical   FOV = 20.27062100948884
misc/tools/fov-calc.py 90 16 9
90.0 degrees of hfov with 4:3 resolution (unstretched without black bars) actually gives:
Horizontal FOV = 106.26020470831195
Vertical   FOV = 73.73979529168804
misc/tools/fov-calc.py 90 32 9
90.0 degrees of hfov with 4:3 resolution (unstretched without black bars) actually gives:
Horizontal FOV = 138.88790956083307
Vertical   FOV = 73.73979529168804
Edited by Dr. Jaska

Merge request reports