Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C#: Expose asinh, acosh and atanh in Mathf #81229

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,36 @@ public static double Acos(double s)
return Math.Acos(s);
}

/// <summary>
/// Returns the hyperbolic arc (also called inverse) cosine of <paramref name="s"/> in radians.
/// Use it to get the angle from an angle's cosine in hyperbolic space if
/// <paramref name="s"/> is larger or equal to 1.
/// </summary>
/// <param name="s">The input hyperbolic cosine value.</param>
/// <returns>
/// An angle that would result in the given hyperbolic cosine value.
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Acosh(float s)
{
return MathF.Acosh(s);
}

/// <summary>
/// Returns the hyperbolic arc (also called inverse) cosine of <paramref name="s"/> in radians.
/// Use it to get the angle from an angle's cosine in hyperbolic space if
/// <paramref name="s"/> is larger or equal to 1.
/// </summary>
/// <param name="s">The input hyperbolic cosine value.</param>
/// <returns>
/// An angle that would result in the given hyperbolic cosine value.
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double Acosh(double s)
{
return Math.Acosh(s);
}

/// <summary>
/// Returns the arc sine of <paramref name="s"/> in radians.
/// Use to get the angle of sine <paramref name="s"/>.
Expand Down Expand Up @@ -131,6 +161,36 @@ public static double Asin(double s)
return Math.Asin(s);
}

/// <summary>
/// Returns the hyperbolic arc (also called inverse) sine of <paramref name="s"/> in radians.
/// Use it to get the angle from an angle's sine in hyperbolic space if
/// <paramref name="s"/> is larger or equal to 1.
/// </summary>
/// <param name="s">The input hyperbolic sine value.</param>
/// <returns>
/// An angle that would result in the given hyperbolic sine value.
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Asinh(float s)
{
return MathF.Asinh(s);
}

/// <summary>
/// Returns the hyperbolic arc (also called inverse) sine of <paramref name="s"/> in radians.
/// Use it to get the angle from an angle's sine in hyperbolic space if
/// <paramref name="s"/> is larger or equal to 1.
/// </summary>
/// <param name="s">The input hyperbolic sine value.</param>
/// <returns>
/// An angle that would result in the given hyperbolic sine value.
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double Asinh(double s)
{
return Math.Asinh(s);
}

/// <summary>
/// Returns the arc tangent of <paramref name="s"/> in radians.
/// Use to get the angle of tangent <paramref name="s"/>.
Expand Down Expand Up @@ -201,6 +261,36 @@ public static double Atan2(double y, double x)
return Math.Atan2(y, x);
}

/// <summary>
/// Returns the hyperbolic arc (also called inverse) tangent of <paramref name="s"/> in radians.
/// Use it to get the angle from an angle's tangent in hyperbolic space if
/// <paramref name="s"/> is between -1 and 1 (non-inclusive).
/// </summary>
/// <param name="s">The input hyperbolic tangent value.</param>
/// <returns>
/// An angle that would result in the given hyperbolic tangent value.
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Atanh(float s)
{
return MathF.Atanh(s);
}

/// <summary>
/// Returns the hyperbolic arc (also called inverse) tangent of <paramref name="s"/> in radians.
/// Use it to get the angle from an angle's tangent in hyperbolic space if
/// <paramref name="s"/> is between -1 and 1 (non-inclusive).
/// </summary>
/// <param name="s">The input hyperbolic tangent value.</param>
/// <returns>
/// An angle that would result in the given hyperbolic tangent value.
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double Atanh(double s)
{
return Math.Atanh(s);
}

/// <summary>
/// Rounds <paramref name="s"/> upward (towards positive infinity).
/// </summary>
Expand Down