This information is for Vicon Shogun 1.7. For up-to-date help, see the latest Shogun documentation.

Vicon Shogun banner

Description

Returns the arc cosine (aka inverse cosine) of an input

Arc cosine is the inverse function for cosine. That is, given a value for val in the domain [-1.0, 1.0], it returns an angle acos(val) in degrees.

To illustrate, picture the unit circle (a circle of radius 1.0 centered about the origin). If you imagine a unit vector rotating inside of the unit circle, the x-coordinate of the endpoint of the vector is the acos function argument val. The angle that the vector makes with the positive x-axis is the function output acos(val).

Because, as the vector rotates inside the circle, the x-coordinate of the vector must always be within the unit circle, the input argument to acos (aka val) must always be within [-1.0, 1.0]. Also, as cos(t) is doubly valued for t in [0, 360], the acos function is restricted to the first two quadrants. This means that the unit vector rotating inside the unit circle is assumed to have a positive or 0 y-coordinate, therefore acos(val) always returns a value in [0.0, 180.0].

Functional area

Math

Command syntax

Syntax

acos value

Arguments

NameTypeRequiredComments
valuefloatyesThe domain of arc cosine is [-1.0, 1.0]. Values of val outside of this domain are not meaningful to the function acos.

Flags

None

Return value

float

For an input argument val in [-1.0, 1.0], returns a floating point angle (degrees) in the range [0.0, 180.0].

For input arguments val in the ranges: (1.0, Inf], [-Inf, -1.0) and NaN, acos(val) returns NaN.

Examples

float $t;
float $acos_of_t;
float $cos_of_acos_of_t;
// acos(0) is 90 degrees because cos(90 degrees) = 0
$t = 0.0;
$acos_of_t = acos($t);
$cos_of_acos_of_t = cos($acos_of_t);
print("t, acos(t), cos(acos(t)) = " + string($t) + ", " + string($acos_of_t) + ", " + string($cos_of_acos_of_t));
// 1.1 is not a meaningful input into acos and returns NaN
// (-1.#IND00)
$t = 1.1;
$acos_of_t = acos($t);
$cos_of_acos_of_t = cos($acos_of_t);
print("t, acos(t), cos(acos(t)) = " + string($t) + ", " + string($acos_of_t) + ", " + string($cos_of_acos_of_t));

Additional info

Related commands