Angles and Units of Measurement


Feet and meters , Celsius and Fahrenheit, radians and degrees. If there is a way to measure something, rest assured that the human race has come up with at least 10 ways of doing it. At least we are no longer measuring distances as a day s travel on a stout pony. However, we humans have devised two ways of defining angular measurement, both of which exist within Maya: radians and degrees.

While Maya can work with either angular measurement, most MEL commands assume you are working in radians. Because the information you retrieve from a Maya scene could be in either format, it is important to know whether to convert one to another. In Chapter 9, Lighting and Rendering, we ll learn more about retrieving and modifying a user s personal preferences to discover which measurement type an artist is operating in when a script is executed. Both radians and degrees have their advantages and disadvantages when working within a program like Maya.

Artists don t like working with radians. There, it s been said. Radians do not seem to have any rationale to an artist. When an artist turns an object a 1/4 turn , he wants to look at the rotation channels and see 90 ”not 1.5707963267949 radians! Sure, once an artist realizes that 180 = , he might start to understand the system. However, degrees are just so much more what artists used to.

Programmers, on the other hand, love radians. They re clean, concise , and usually only mathematicians understand them. That, to a programmer, is the perfect type of number.

While almost every person is used to working with degrees as a unit of measurement, it is quite an awkward system. Most of the world exists in a world based on the decimal system, rather than a seemingly meaningless measurement system where 1 = 360, or more plainly, one rotation is equal to 360 . While those of us living in countries that use feet and inches are used to seemingly arbitrary measurements, it is best, whenever possible, to work in both radians and metric measurements. It is much easier and cleaner to convert whatever unit of measurement the end user is working in to a standard in software as a single step, than it is to create multiple evaluations of formulae based on user settings

An important thing when doing this is to be a considerate programmer and return any information to the user in the format in which he is working. Sometimes, it is even necessary to evaluate commands in different ways, such as the creation of certain types of cameras and lights, which can have attributes containing angular information. Not doing so can result in errors. More on bulletproofing your scripts in these situations in Chapter 5, The Script File.




The MEL Companion
The MEL Companion: Maya Scripting for 3D Artists (Charles River Media Graphics)
ISBN: 1584502754
EAN: 2147483647
Year: 2003
Pages: 101

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net