Apr 6 2010

Simple Camera Trig (I can never remeber this stuff)

I can never remember this stuff, Lukas was nice enough to give me a hand so i figure i would put it up here. maybe

so the question was how to figure out the width of an image plane based from it’s distance to the camera and the horizontal FOV of the camera.

this is what we came up with.

--maxscript code
w = (tan(cam.fov/2)*(distance cam.pos plane.pos)) * 2

the second question is how do we derive the distance between the camera and the plane based on the width… (good to figure out how much to zoom out if you want a camera to frame a bounding box :D)

--maxscript code
d = (plane.width/2)/(tan(cam.fov/2))