p5.js | atan() Function
The atan() function in p5.js is used to calculate the inverse of tan() or arc tangent of a value ranging in between -Infinity to Infinity (exclusive) and gives result in the range of -π/2 to π/2.
Parameters: This function accepts a parameter “P” which is a value ranging from -1 to 1 and whose arc tangent is calculated.
Return Value: It returns the arc tangent of a value and its range is in between -π/2 to π/2.
Below program illustrates the atan() function in p5.js:
Example: This example uses atan() function to get arc tangent of a value.