Difference between revisions of "LlAcos"

From Second Life Wiki
Jump to navigation Jump to search
m
m (added comment to the example script to make more clear which range the function and the given example have (i.e. not the same))
Line 9: Line 9:
|spec
|spec
|caveats
|caveats
|examples=<lsl>// Touch the object with this script in it to see the arccosine of random numbers!
|examples=
<lsl>
// please do pay attention that this example does not cover
//  the full possible range for the float llAcos can take.
//
//  function range: [-1.0, 0.0]
//  range in this example [-1.0, 1.0)
 
 
default
default
{
{
     touch_start(integer num)
     touch_start(integer num_detected)
     {
     {
         float r = llFrand(2) - 1.0;
         float random = llFrand(2.0) - 1.0;
         llOwnerSay("The arccosine of " + (string)r + " is " + (string)llAcos(r));
 
         llOwnerSay("The arccosine of " + (string)random + " is " + (string)llAcos(random));
     }
     }
}</lsl>
}
</lsl>
|helpers|related
|helpers|related
|also_functions=
|also_functions=

Revision as of 08:21, 1 November 2012

Summary

Function: float llAcos( float val );

Returns a float that is the arccosine in radians of val

• float val must fall in the range [-1.0, 1.0]

The returned value is in the range [0.0, PI][1]

Examples

<lsl> // please do pay attention that this example does not cover // the full possible range for the float llAcos can take. // // function range: [-1.0, 0.0] // range in this example [-1.0, 1.0)


default {

   touch_start(integer num_detected)
   {
       float random = llFrand(2.0) - 1.0;
       llOwnerSay("The arccosine of " + (string)random + " is " + (string)llAcos(random));
   }

}

</lsl>

See Also

Functions

• llSin llAsin sine & inverse Sine
• llCos cosine
• llTan llAtan2 tangent & inverse tangent

Articles

•  "Wikipedia logo"Inverse trigonometric function

Deep Notes

Search JIRA for related Issues

Footnotes

  1. ^ The ranges in this article are written in Interval Notation.

Signature

function float llAcos( float val );