Created
October 9, 2017 04:54
-
-
Save taikomatsu/503a43470ba811bfcc04b949136fe5e1 to your computer and use it in GitHub Desktop.
Convert AOV from Focal Length / Focal Length from AOV (Maya)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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