Skip to content

Instantly share code, notes, and snippets.

@taikomatsu
Created October 9, 2017 04:54
Show Gist options
  • Save taikomatsu/503a43470ba811bfcc04b949136fe5e1 to your computer and use it in GitHub Desktop.
Save taikomatsu/503a43470ba811bfcc04b949136fe5e1 to your computer and use it in GitHub Desktop.
Convert AOV from Focal Length / Focal Length from AOV (Maya)
# Mayaで諸事情によりカメラスケール使えなかった時用に調べて書いた
# degreeとmmで計算してます
import math
def focal_to_aov(focal, aperture):
'''
focal: focal length
aperture: horizontal aperture (mm)
'''
return math.degrees(2.0*math.atan((aperture*0.5)/focal))
def aov_to_focal(aov, aperture):
'''
aov: angle of view (degree)
aperture: horizontal aperture (mm)
'''
return 1.0/(math.tan(math.radians(aov*0.5))/aperture)*0.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment