Angle Of View

Hello
How can I recover the value og the "Angle Of View "of one camera using Maya mel ????
Thanks

QUOTE(xabi @ 03/29/06, 04:36 AM) [snapback]232647[/snapback]
Hello
How can I recover the value og the "Angle Of View "of one camera using Maya mel ????
Thanks

CODE
float $focal = getAttr "cameraShape1.focalLength";
float $aperture = getAttr "cameraShape1.horizontalFilmAperture";
float $fov = (0.5 * $aperture) / ($focal * 0.03937);
$fov = 2.0 * atan ($fov);
$fov = 57.29578 * $fov;

regds

o.S.k

Tank you!!
But what represent 0.03937?

QUOTE(xabi @ 03/29/06, 05:11 AM) [snapback]232650[/snapback]
Tank you!!
But what represent 0.03937?

Hi

Readn Maya Docs dude

Angle of view (focal length)

so u will get info whts tht

regds

o.S,.k

If someone is interested in and optical an mathematical explanation of this formula (beside the fact that I don't understand your 0.03937 value), the same guy posted the question on a french maya forum (mayalounge.com), and I wrote an explanation of the principle.
Unfortunately, this is, of course, in french. Maybe if I have the time, I'll translate it and post it here.

If someone is interested in reading my explanation, here is the link :
http://www.mayalounge.com/forum/viewtopic.php?t=4665

kurianos, can u explain what ur 0.03937 means please ?

Its basic trionometry. Focal length is the height of the triangle while aperture is the width (you can divide the tiangle into two to get thet nice 90 degree corner for the nice classic pythagoras)

Now the code above is taken directly form inside the bowels of maya. So its the same thing maya uses can be found in AEcameraTemplate.mel the fist proc thereof to be exact AEcalculateFOV So one does not realy need to know where it comes form. Its is how the AE template knows how to do it and its courtesy of alias eingeneers (who in all likelyhood dont make flaws on this , because quite franlkly everybody thet went trough primary shool should knwo all but the 0.03937)

As for the value 0.03937 is to convert millimeters into inches. Se aperture is measured in inches (old tradition), while focal length is measured in millimeters. Now one millimeter is 0.03937 inches! (wich just goes to show its done by americans because i would have convertted inches to millimeters instead)

in all sanity the last line should be $fov = rad_to_deg($fov); instead of a conversion factor sice rad to deg uses WAY more precicion than that.

Adedemdum comment: the 0.03937 is not a bad approx since the exact value is 1/25.4 length of inches is defined nowdays by meters . (one more resont to cancel the measuring system, since it nolonger can carry itself but relies on the other sytem for reference) Alsi the reason why it would be better to convert inches to cm as you get a more accurate calc with less effort.

Hi

Yes Joojaa ..this code is taken from Maya...

and ur detilas will help us a lot

its realy cool

ur a unbelivabal person

thx a lot

regds

o.S.k

Thx Jooja.
The inchs to mm conversion, yes, I understand it now.