Atan

From SA-MP Wiki

Jump to: navigation, search

atan

Image:Farm-Fresh text lowercase.png Note: This function name starts with a lowercase letter.


Description:

Get the inversed value of an arc tangent in radians.


Parameters:
(Float:value)
Float:valuethe input in arc tangents.


Return Values:

The radiant of the angle in radians.


Example Usage:

//This function returns radiants. Because most SA-MP functions use degrees, it is advised to convert them using the formula: result = atan (param) * 180 / PI
 
public OnGameModeInit()
{
	new Float:param, Float:result;
	param = 1.0;
	result = atan(param) * 180 / 3.14159265; //1 radian equals 180 degrees. 3.14... is used to define PI.
	printf ("The arc tangent of %f is %f degrees\n", param, result );
	return 0;
}

Related Functions

The following functions may be useful, as they are related to this function in one way or another.

  • floatsin: Get the sine from a specific angle.
  • floatcos: Get the cosine from a specific angle.
  • floattan: Get the tangent from a specific angle.

Template:Atan2