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);

Trigonometric Functions
cos
Operation: Returns the cosine of an angle specified in radians Supported Data types: float float cos(float number) Example: cos(1); Returns 0.5403 cos returns a value between 0 and 1 to raise the value multiply cos by a number float $a = 10 * cos(1); // Result: 5.403023 // to lower the value divide cos by a number float $a = cos(1) / 10 ;// Result: 0.0540302 //
cosd
Operation: Returns the cosine of an angle specified in degrees Supported Data types: float float cosd(float number) Example: cosd(45) Returns 0.707
sin
Operation: Returns the sine of an angle specified in radians Supported Data types: float float sin(float number) Example: float $pi = 3.1415927; sin($pi/2); Returns 1. float $frequency = 2; float $amplitude = 2; float $offset = 2; Ball.translateY = (sin(Ball.translateX * $frequency) * $amplitude) + $offset;
sind
Operation: Returns the sine of an angle specified in degrees Supported Data types: float float sind(float number) Example: sin(90) Returns 1
tan
Operation: Returns the tangent of an angle specified in radians Supported Data types: float float tan(float number) Example: tan(1) Returns 1.557
tand
Operation: Returns the tangent of an angle specified in degrees Supported Data types: float float tand(float number) Example: tan(45) Returns roughly 1, the tangent of 45 degrees.
acos
Operation: Returns the radian value of the arc cosine of a number. The arc cosine is the angle whose cosine is the specified number. The returned value is from 0 to pi. Supported Data types: float float acos(float number) number is the cosine of the angle, and must be from -1 to 1. Example: acos(1) Returns 0
acosd
Operation: Returns the degree value of the arc cosine of a number. The arc cosine is the angle whose cosine is the specified number. The returned value is from 0 to 180. Supported Data types: float float acosd(float number) number is the arc cosine of the angle, and must be from -1 to 1. Example: acosd(-0.5) Returns 120 degrees acosd(1) returns 0 degrees
asin
Operation: Returns the radian value of the arc sine of a number. The arc sine is the angle whose sine is the specified number. The returned value is from -pi/2 to pi/2 Supported Data types: float float asin(float number) number is the arc sine of the angle, and must be from -1 to 1. Example: asin(0.5) Returns .525 radians
asind
Operation: Returns the degree value of the arc sine of a number. The arc sine is the angle whose sine is the specified number. The returned value is from -90 to 90. Supported Data types: float float asind(float number) number is the sine of the angle, and must be from -1 to 1. Example: asind(0.5) Returns 30 degrees
atan
Operation: Returns the radian value of the arc tangent of a number. The arc tangent is the angle whose tangent is the specified number. The returned value is from -pi/2 to pi/2. Supported Data types: float float atan(float number) Example: atan(1) Returns .785
atand
Operation: Returns the degree value of the arc tangent of a number. The arc tangent is the angle whose tangent is the specified number. The returned value is from -90 to 90. Supported Data types: float float atand(float number) Example: atand(1) returns 45 degrees
atand2
Operation: Returns the radian value of the arc tangent of specified X and Y coordinates. The arc tangent is the angle from the X-axis to a line passing through the origin and a point with coordinates X,Y. The returned angle is in radians, from -pi to pi, excluding -pi. Supported Data types: float float atan2(float Y, float X ) X is the X coordinate of the point. Y is the Y coordinate of the point. Example: atan2(1,1) Returns .785 radians
atand2d
Operation: Returns the degree value of the arc tangent of specified X and Y coordinates. The arc tangent is the angle from the X-axis to a line passing through the origin and a point with coordinates X,Y. The returned angle is in degrees, from -180 to 180, excluding -180. Supported Data types: float float atan2d(float Y, float X ) X is the X coordinate of the point. Y is the Y coordinate of the point. Example: atan2d(1,1) Returns 45 degrees
hypot
Operation: Returns the magnitude of two-dimensional vector from the origin to a point with coordinates X, Y Supported Data types: float float hypot(float Y, float X ) X is the X coordinate of the point. Y is the Y coordinate of the point. Example: hypot(3,4) Returns 5