$nav ===== Function: llAcos ===== float llAcos(float arg) Return the inverse cosine of the argument, in radians. The inverse cosine (also known as arccosine) is the angle whose cosine is the given argument. ===== Parameters ===== === arg === Number whose inverse cosine is to be found. ===== Return value ===== $lty[Float] number with the angle in radians that is the inverse cosine of the argument. ===== Notes ===== * 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 $lct[PI], or $nan if the argument is out of the valid range. ===== Short examples ===== float angle; angle = llAcos(1); // Sets angle to 0, because the cosine of 0 is 1. angle = llAcos(0); // Sets angle to PI_BY_TWO, because the cosine of PI/2 is 0. 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(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. ===== Complete examples ===== 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. default { state_entry() { rotation rot = llGetLocalRot(); llOwnerSay("The angle of rotation of this prim is " + (string)(2*llAcos(rot.s)) + " radians."); } } ===== See also ===== * $lfn[llCos] calculates the cosine of the argument. * $lfn[llAsin] calculates the inverse sine of the argument. * $lfn[llSin] calculates the sine of the argument. * $lfn[llAtan2] calculates the angle of a 2D vector. * $lfn[llTan] calculates the tangent of the argument. * Other $lfn[math/] functions.