acos()

acos()#

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

Examples#

def setup():
    a = py5.PI
    c = py5.cos(a)
    a_c = py5.acos(c)
    # prints "3.1415927 : -1.0 : 3.14159261"
    py5.println(round(a, 8), ':', round(c, 8), ':', round(a_c, 8))
def setup():
    a = py5.PI + py5.PI/4
    c = py5.cos(a)
    a_c = py5.acos(c)
    # prints "3.92699087 : -0.70710674 : 2.35619443"
    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.

Signatures#

acos(
    value: Union[float, npt.ArrayLike]  # value in the range of -1 to 1 whose arc cosine is to be returned
) -> Union[float, npt.NDArray]

Updated on March 06, 2023 02:49:26am UTC