Created
February 2, 2018 21:35
-
-
Save n1ckfg/12783f64f84ef2bb326ff88ae4b1f6c1 to your computer and use it in GitHub Desktop.
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
float getVFov(float hFov, float w, float h) { | |
float hFovRad = hFov * PI / 180; | |
float vFovRad = 2 * atan(tan(hFovRad/2) * h/w); | |
return ceil(vFovRad * 180 / PI); | |
} | |
void setup() { | |
println("horizontal FOV 90 -> " + getVFov(90, 16, 9) + " vertical FOV (16:9)"); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment