MathF.Atan2() Method in C# with Examples
MathF.Atan2(Single, Single) Method is used to return the angle whose tangent is the quotient of two specified numbers. Basically, it returns an angle θ (measured in radian) whose value lies between -π and π. This is a counterclockwise angle lies between the positive x-axis, and the point (x, y).
Syntax: public static float Atan2 (float y, float x);
Parameters:
y: The y coordinate of a point of type System.Single.
x: The x coordinate of a point System.Single.
Return Value: This method returns the angle Θ of type System.Single.
Note: An angle, θ(measured in radians), such that -π ≤ θ ≤ π, and tan(θ) = value1 / value2, where (value1, value2) are the points in the cartesian plane. There are two conditions for the return values:
- When the points lies in the Cartesian plane
- When the points lies on the boundaries of the quadrants
Example 1:
// C# program to demonstrate the // MathF.Atan2(Single, Single) Method using System; class Geeks { // Main method public static void Main() { // using MathF.Atan2(Single, Single) Method // and converting result into degree Console.Write(MathF.Atan2(10f, 10f) * (180 / MathF.PI)); } } |
45
Example 2:
// C# program to demonstrate the // MathF.Atan2(Single, Single) Method using System; class Geeks { // Main method public static void Main() { // using MathF.Atan2(Single, Single) Method // and converting result into degree Console.Write(MathF.Atan2(0f, -7f) * (180 / MathF.PI)); } } |
180
Recommended Posts:
- MathF.Min() Method in C# with Examples
- MathF.Max() Method in C# with Examples
- MathF.Cos() Method in C# with Examples
- MathF.Pow() Method in C# with Examples
- MathF.Exp() Method in C# with Examples
- MathF.Log() Method in C# with Examples
- MathF.Abs() Method in C# with Examples
- MathF.Tan() Method in C# with Examples
- MathF.Sin() Method in C# with Examples
- C# | Object.GetTypeCode() Method with Examples
- C# | Object.GetHashCode() Method with Examples
- C# | Char.GetHashCode() Method with Examples
- C# | Char.GetTypeCode() Method with Examples
- Type.FindInterfaces() Method in C# with Examples
- Type.FindMembers() Method in C# with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



