acos()#

The inverse of cos(), returns the arc cosine of a value.

Examples#

1def setup():
2    a = py5.PI
3    c = py5.cos(a)
4    a_c = py5.acos(c)
5    # prints "3.1415927 : -1.0 : 3.14159261"
6    py5.println(round(a, 8), ':', round(c, 8), ':', round(a_c, 8))
1def setup():
2    a = py5.PI + py5.PI/4
3    c = py5.cos(a)
4    a_c = py5.acos(c)
5    # prints "3.92699087 : -0.70710674 : 2.35619443"
6    py5.println(round(a, 8), ':', round(c, 8), ':', round(a_c, 8))

Description#

The inverse of cos(), returns the arc cosine of a value. This function expects the values in the range of -1 to 1 and values are returned in the range 0 to PI.

This function makes a call to the numpy acos() function.

Syntax#

acos(value: Union[float, npt.ArrayLike]) -> Union[float, npt.NDArray]

Parameters#

  • value: Union[float, npt.ArrayLike] - value in the range of -1 to 1 whose arc cosine is to be returned

Updated on February 26, 2022 13:22:44pm UTC