feat: added Math.OneMinus method

This commit is contained in:
Syntriax 2025-05-03 22:16:14 +03:00
parent 4bfe98852c
commit 1366a417f1
2 changed files with 10 additions and 0 deletions

View File

@ -30,6 +30,13 @@ public static class Math
/// </summary>
public const float DegreeToRadian = PI / 180f;
/// <summary>
/// Gets one minus of given <see cref="T"/>.
/// </summary>
/// <param name="value">The value <see cref="T"/>.</param>
/// <returns>One minus of given <see cref="T"/>.</returns>
public static T OneMinus<T>(T value) where T : INumber<T> => T.One - value;
/// <summary>
/// Adds two <see cref="T"/>s.
/// </summary>

View File

@ -5,6 +5,9 @@ namespace Syntriax.Engine.Core;
public static class MathExtensions
{
/// <inheritdoc cref="Math.OneMinus{T}(T)" />
public static T OneMinus<T>(this T value) where T : INumber<T> => Math.OneMinus(value);
/// <inheritdoc cref="Math.Add{T}(T, T)" />
public static T Add<T>(this T left, T value) where T : INumber<T> => Math.Add(left, value);