Mel - Maya Embedded Language

<HOME>   <PREVIOUS>   <NEXT>

Functions

Limit       Exponential       Trigometric       Vector       Conversion       Random   

Maya has many built in functions that can be used to obtain information. To use a function typically you would use it in an assignment statement like:

     $myBall=funtionName(send it something);

Vector Functions
angle
Operation: Returns the radian angle between two vectors Supported Data types: vector. Returns float float angle( vector vector1, vector vector2) Example: angle(<<2,-1,1>>,<<1,1,2>>) Returns 1.0472 radians, which equals 60 degrees.
cross
Operation: Returns the cross product of two vectors Supported Data types: vector vector cross(vector vector1, vector vector2) Example: cross(<<1,2,-2>>,<<3,0,1>>) Returns <<2, -7, -6>>
dot
Operation: Returns the floating point dot product of two vectors. The dot product takes two vectors as arguments and returns a scalar value Supported Data types: vector. Returns float float dot(vector vector1, vector vector2) Example: dot(<<1,2,-2>>,<<3,0,1>>) Returns 1. The dot product of this example is (1 * 3) + (2*0) + (-2*1), which equals 1
mag
Operation: Returns the magnitude of a vector. This is the length of the vector. Supported Data types: Vector. Returns float float mag(vector vector) Example: mag(<<7,8,9>>) Returns 13.928 This is the same as Sqrt( 72 + 62 + 92); Returns 13.928
rot
Operation: Returns a vector that represents the position of a point after it's rotated a specified number of radians about a specified axis. Rotation is counter-clockwise as viewed downward from the axis end position. Supported Data types: vector, float vector rot(vector point, vector axis, float angle ) point is the position of a point in the world coordinate system. axis is the axis around which the point rotates. The axis is a line that passes through the origin and the specified axis position. angle is the number of radians the point rotates. Example: rot(<<3,3,0>>,<<1,0,0>>,0.5) Returns <<3, 2.633, 1.438>> This is a vector representing the position of point <<3,3,0>> after rotating it 0.5 radians around the axis represented by <<1,0,0>>
unit
Operation: Returns the unit vector corresponding to a vector. The unit vector has the same direction as the specified vector, but with a magnitude of 1 Supported Data types: vector vector unit( vector vector) Example: unit(<<1,1,1>>) Returns <<0.577, 0.577, 0.577>>