@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
11 lines (9 loc) • 341 B
JavaScript
/**
* @see https://en.wikipedia.org/wiki/Focal_length
* @param {number} focal_length (in mm)
* @param {number} [sensor_width] Width of camera sensor (in mm)
* @returns {number} in Radians
*/
export function focal_length_to_fov(focal_length, sensor_width = 35) {
return 2 * Math.atan(sensor_width / (2 * focal_length));
}