You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.
This shows you the differences between two versions of the page.
functions:llacos [2014-05-15 05:18 SLT] sei [Function: llAcos] aka arccosine |
functions:llacos [2015-09-22 11:59 SLT] (current) sei Style |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | $nav | ||
===== Function: llAcos ===== | ===== Function: llAcos ===== | ||
Line 12: | Line 13: | ||
Number whose inverse cosine is to be found. | Number whose inverse cosine is to be found. | ||
- | ===== Result ===== | + | ===== Return value ===== |
- | [[types/Float]] number with the angle in radians that is the inverse cosine of the argument. | + | $lty[Float] number with the angle in radians that is the inverse cosine of the argument. |
===== Notes ===== | ===== Notes ===== | ||
- | * The range of **arg** must be between -1 and 1, because the cosine of any angle can't be outside that range. | + | * The range of $prm[arg] must be between -1 and 1, because the cosine of any angle can't be outside that range. |
- | * The result is always between 0 and [[constants/PI]], or **NaN** (Not a Number) if the argument is out of range. | + | * The result is always between 0 and $lct[PI], or $nan if the argument is out of the valid range. |
===== Short examples ===== | ===== Short examples ===== | ||
Line 29: | Line 30: | ||
angle = llAcos(-1); // Sets angle to PI, because the cosine of PI is -1. | angle = llAcos(-1); // Sets angle to PI, because the cosine of PI is -1. | ||
angle = llAcos(0.31); // Sets angle to approximately 1.255603 (the cosine of that is 0.31) | angle = llAcos(0.31); // Sets angle to approximately 1.255603 (the cosine of that is 0.31) | ||
- | angle = llAcos(2); // Sets angle to NaN (Not a Number) because there's no number whose cosine is 2. | + | |
+ | angle = llAcos(2); // Under Mono, sets angle to NaN (Not a Number), | ||
+ | // because there's no number whose cosine is 2. | ||
+ | // Crashes with a math error under LSO. | ||
</code> | </code> | ||
===== Complete examples ===== | ===== Complete examples ===== | ||
- | A [[types/rotation]] can be expressed by an axis and an angle. This example illustrates how to use **llAcos** to obtain the angle component of a rotation, assumed it's normalized (most LSL functions return normalized rotations). If the rotation is not guaranteed to be normalized, use [[llRot2Angle]] instead. | + | A $lty[rotation] can be expressed by an axis and an angle. This example illustrates how to use $fn[llAcos] to obtain the angle component of a rotation, assumed it's normalized (most LSL functions return normalized rotations). If the rotation is not guaranteed to be normalized, use $lfn[llRot2Angle] instead. |
<file lsl2 llAcos-example.lsl> | <file lsl2 llAcos-example.lsl> | ||
Line 49: | Line 53: | ||
===== See also ===== | ===== See also ===== | ||
- | === Related trigonometric functions === | + | * $lfn[llCos] calculates the cosine of the argument. |
- | * [[llCos]] | + | * $lfn[llAsin] calculates the inverse sine of the argument. |
- | + | * $lfn[llSin] calculates the sine of the argument. | |
- | === Other trigonometric functions === | + | * $lfn[llAtan2] calculates the angle of a 2D vector. |
- | * [[llAsin]] | + | * $lfn[llTan] calculates the tangent of the argument. |
- | * [[llSin]] | + | * Other $lfn[math/] functions. |
- | * [[llAtan2]] | + | |
- | * [[llTan]] | + | |