Acos
Float
ACOS (math/acos/float)
The ACOS node calculates the inverse cosine (arccos) of a given float input. It returns the angle in radians whose cosine is the input value.
Inputs
a
(float, default: 0): The input value for which to calculate the inverse cosine. The value should be between -1 and 1, inclusive.
Outputs
result
(float): The angle in radians whose cosine is the input value. The output range is between 0 and π (pi), inclusive.
Configuration
This node has no configuration options.
Usage
To use the ACOS node, follow these steps:
- Add the ACOS node to your spell.
- Connect a float value between -1 and 1 to the
a
input port. - The node will output the inverse cosine of the input value in radians through the
result
output port.
Example
Here’s an example of how to use the ACOS node in a spell:
In this example:
- The ACOS node (
acos_1
) takes an input value of 0.5 and calculates its inverse cosine. - The result is passed to the
radiansToDegrees
node (radToDeg_1
), which converts the angle from radians to degrees. - Finally, the
print
node (print_1
) outputs the angle in degrees.
The expected output would be approximately 60 degrees, as the inverse cosine of 0.5 is roughly 1.0472 radians or 60 degrees.
Best Practices and Tips
- Ensure that the input value is within the valid range of -1 to 1. Inputting values outside this range will result in NaN (Not a Number) as the output.
- Remember that the output is in radians. If you need the result in degrees, use a
radiansToDegrees
node to convert the output.
Common Issues
- If the input value is outside the range of -1 to 1, the output will be NaN. Make sure to validate or clamp the input value before connecting it to the ACOS node.
- Be mindful of the units (radians or degrees) when working with angles in your spell. Inconsistent units can lead to unexpected results.