Skip to content

Commit 43868c3

Browse files
committed
Added Floor/Round/CeilingToInt methods.
1 parent c2c5cd0 commit 43868c3

5 files changed

Lines changed: 56 additions & 2 deletions

File tree

sources/Maths/Maths/PublicAPI/net10.0/PublicAPI.Unshipped.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,14 +1372,15 @@ static Silk.NET.Maths.Vector2D.BitDecrement<TSelf>(Silk.NET.Maths.Vector2D<TSelf
13721372
static Silk.NET.Maths.Vector2D.BitIncrement<TSelf>(Silk.NET.Maths.Vector2D<TSelf> x) -> Silk.NET.Maths.Vector2D<TSelf>
13731373
static Silk.NET.Maths.Vector2D.Cbrt<TSelf>(Silk.NET.Maths.Vector2D<TSelf> x) -> Silk.NET.Maths.Vector2D<TSelf>
13741374
static Silk.NET.Maths.Vector2D.Ceiling<TSelf>(Silk.NET.Maths.Vector2D<TSelf> x) -> Silk.NET.Maths.Vector2D<TSelf>
1375+
static Silk.NET.Maths.Vector2D.CeilingToInt<T>(Silk.NET.Maths.Vector2D<T> vector) -> Silk.NET.Maths.Vector2D<int>
13751376
static Silk.NET.Maths.Vector2D.Clamp<TSelf>(Silk.NET.Maths.Vector2D<TSelf> value, Silk.NET.Maths.Vector2D<TSelf> min, Silk.NET.Maths.Vector2D<TSelf> max) -> Silk.NET.Maths.Vector2D<TSelf>
13761377
static Silk.NET.Maths.Vector2D.Clamp<TSelf>(Silk.NET.Maths.Vector2D<TSelf> value, TSelf min, TSelf max) -> Silk.NET.Maths.Vector2D<TSelf>
13771378
static Silk.NET.Maths.Vector2D.CopySign<TSelf>(Silk.NET.Maths.Vector2D<TSelf> value, Silk.NET.Maths.Vector2D<TSelf> sign) -> Silk.NET.Maths.Vector2D<TSelf>
13781379
static Silk.NET.Maths.Vector2D.CopySign<TSelf>(Silk.NET.Maths.Vector2D<TSelf> value, TSelf sign) -> Silk.NET.Maths.Vector2D<TSelf>
13791380
static Silk.NET.Maths.Vector2D.Cos<TSelf>(Silk.NET.Maths.Vector2D<TSelf> x) -> Silk.NET.Maths.Vector2D<TSelf>
13801381
static Silk.NET.Maths.Vector2D.Cosh<TSelf>(Silk.NET.Maths.Vector2D<TSelf> x) -> Silk.NET.Maths.Vector2D<TSelf>
13811382
static Silk.NET.Maths.Vector2D.CosPi<TSelf>(Silk.NET.Maths.Vector2D<TSelf> x) -> Silk.NET.Maths.Vector2D<TSelf>
1382-
static Silk.NET.Maths.Vector2D.Cross<T>(this Silk.NET.Maths.Vector2D<T> left, Silk.NET.Maths.Vector2D<T> right) -> T
1383+
static Silk.NET.Maths.Vector2D.Cross<T>(Silk.NET.Maths.Vector2D<T> left, Silk.NET.Maths.Vector2D<T> right) -> T
13831384
static Silk.NET.Maths.Vector2D.Deconstruct<T>(this Silk.NET.Maths.Vector2D<T> vector, out T x, out T y) -> void
13841385
static Silk.NET.Maths.Vector2D.DegreesToRadians<TSelf>(Silk.NET.Maths.Vector2D<TSelf> degrees) -> Silk.NET.Maths.Vector2D<TSelf>
13851386
static Silk.NET.Maths.Vector2D.Distance<T>(Silk.NET.Maths.Vector2D<T> value1, Silk.NET.Maths.Vector2D<T> value2) -> T
@@ -1393,6 +1394,7 @@ static Silk.NET.Maths.Vector2D.Exp2M1<TSelf>(Silk.NET.Maths.Vector2D<TSelf> x) -
13931394
static Silk.NET.Maths.Vector2D.Exp<TSelf>(Silk.NET.Maths.Vector2D<TSelf> x) -> Silk.NET.Maths.Vector2D<TSelf>
13941395
static Silk.NET.Maths.Vector2D.ExpM1<TSelf>(Silk.NET.Maths.Vector2D<TSelf> x) -> Silk.NET.Maths.Vector2D<TSelf>
13951396
static Silk.NET.Maths.Vector2D.Floor<TSelf>(Silk.NET.Maths.Vector2D<TSelf> x) -> Silk.NET.Maths.Vector2D<TSelf>
1397+
static Silk.NET.Maths.Vector2D.FloorToInt<T>(Silk.NET.Maths.Vector2D<T> vector) -> Silk.NET.Maths.Vector2D<int>
13961398
static Silk.NET.Maths.Vector2D.FusedMultiplyAdd<TSelf>(Silk.NET.Maths.Vector2D<TSelf> left, Silk.NET.Maths.Vector2D<TSelf> right, Silk.NET.Maths.Vector2D<TSelf> addend) -> Silk.NET.Maths.Vector2D<TSelf>
13971399
static Silk.NET.Maths.Vector2D.FusedMultiplyAdd<TSelf>(Silk.NET.Maths.Vector2D<TSelf> left, Silk.NET.Maths.Vector2D<TSelf> right, TSelf addend) -> Silk.NET.Maths.Vector2D<TSelf>
13981400
static Silk.NET.Maths.Vector2D.FusedMultiplyAdd<TSelf>(Silk.NET.Maths.Vector2D<TSelf> left, TSelf right, Silk.NET.Maths.Vector2D<TSelf> addend) -> Silk.NET.Maths.Vector2D<TSelf>
@@ -1447,6 +1449,7 @@ static Silk.NET.Maths.Vector2D.Round<TSelf>(Silk.NET.Maths.Vector2D<TSelf> x) ->
14471449
static Silk.NET.Maths.Vector2D.Round<TSelf>(Silk.NET.Maths.Vector2D<TSelf> x, int digits) -> Silk.NET.Maths.Vector2D<TSelf>
14481450
static Silk.NET.Maths.Vector2D.Round<TSelf>(Silk.NET.Maths.Vector2D<TSelf> x, int digits, System.MidpointRounding mode) -> Silk.NET.Maths.Vector2D<TSelf>
14491451
static Silk.NET.Maths.Vector2D.Round<TSelf>(Silk.NET.Maths.Vector2D<TSelf> x, System.MidpointRounding mode) -> Silk.NET.Maths.Vector2D<TSelf>
1452+
static Silk.NET.Maths.Vector2D.RoundToInt<T>(Silk.NET.Maths.Vector2D<T> vector) -> Silk.NET.Maths.Vector2D<int>
14501453
static Silk.NET.Maths.Vector2D.ScaleB<TSelf>(Silk.NET.Maths.Vector2D<TSelf> x, int n) -> Silk.NET.Maths.Vector2D<TSelf>
14511454
static Silk.NET.Maths.Vector2D.ScaleB<TSelf>(Silk.NET.Maths.Vector2D<TSelf> x, Silk.NET.Maths.Vector2D<int> n) -> Silk.NET.Maths.Vector2D<TSelf>
14521455
static Silk.NET.Maths.Vector2D.Sign<TSelf>(Silk.NET.Maths.Vector2D<TSelf> value) -> Silk.NET.Maths.Vector2D<int>
@@ -1553,6 +1556,7 @@ static Silk.NET.Maths.Vector3D.BitDecrement<TSelf>(Silk.NET.Maths.Vector3D<TSelf
15531556
static Silk.NET.Maths.Vector3D.BitIncrement<TSelf>(Silk.NET.Maths.Vector3D<TSelf> x) -> Silk.NET.Maths.Vector3D<TSelf>
15541557
static Silk.NET.Maths.Vector3D.Cbrt<TSelf>(Silk.NET.Maths.Vector3D<TSelf> x) -> Silk.NET.Maths.Vector3D<TSelf>
15551558
static Silk.NET.Maths.Vector3D.Ceiling<TSelf>(Silk.NET.Maths.Vector3D<TSelf> x) -> Silk.NET.Maths.Vector3D<TSelf>
1559+
static Silk.NET.Maths.Vector3D.CeilingToInt<T>(Silk.NET.Maths.Vector3D<T> vector) -> Silk.NET.Maths.Vector3D<int>
15561560
static Silk.NET.Maths.Vector3D.Clamp<TSelf>(Silk.NET.Maths.Vector3D<TSelf> value, Silk.NET.Maths.Vector3D<TSelf> min, Silk.NET.Maths.Vector3D<TSelf> max) -> Silk.NET.Maths.Vector3D<TSelf>
15571561
static Silk.NET.Maths.Vector3D.Clamp<TSelf>(Silk.NET.Maths.Vector3D<TSelf> value, TSelf min, TSelf max) -> Silk.NET.Maths.Vector3D<TSelf>
15581562
static Silk.NET.Maths.Vector3D.CopySign<TSelf>(Silk.NET.Maths.Vector3D<TSelf> value, Silk.NET.Maths.Vector3D<TSelf> sign) -> Silk.NET.Maths.Vector3D<TSelf>
@@ -1574,6 +1578,7 @@ static Silk.NET.Maths.Vector3D.Exp2M1<TSelf>(Silk.NET.Maths.Vector3D<TSelf> x) -
15741578
static Silk.NET.Maths.Vector3D.Exp<TSelf>(Silk.NET.Maths.Vector3D<TSelf> x) -> Silk.NET.Maths.Vector3D<TSelf>
15751579
static Silk.NET.Maths.Vector3D.ExpM1<TSelf>(Silk.NET.Maths.Vector3D<TSelf> x) -> Silk.NET.Maths.Vector3D<TSelf>
15761580
static Silk.NET.Maths.Vector3D.Floor<TSelf>(Silk.NET.Maths.Vector3D<TSelf> x) -> Silk.NET.Maths.Vector3D<TSelf>
1581+
static Silk.NET.Maths.Vector3D.FloorToInt<T>(Silk.NET.Maths.Vector3D<T> vector) -> Silk.NET.Maths.Vector3D<int>
15771582
static Silk.NET.Maths.Vector3D.FusedMultiplyAdd<TSelf>(Silk.NET.Maths.Vector3D<TSelf> left, Silk.NET.Maths.Vector3D<TSelf> right, Silk.NET.Maths.Vector3D<TSelf> addend) -> Silk.NET.Maths.Vector3D<TSelf>
15781583
static Silk.NET.Maths.Vector3D.FusedMultiplyAdd<TSelf>(Silk.NET.Maths.Vector3D<TSelf> left, Silk.NET.Maths.Vector3D<TSelf> right, TSelf addend) -> Silk.NET.Maths.Vector3D<TSelf>
15791584
static Silk.NET.Maths.Vector3D.FusedMultiplyAdd<TSelf>(Silk.NET.Maths.Vector3D<TSelf> left, TSelf right, Silk.NET.Maths.Vector3D<TSelf> addend) -> Silk.NET.Maths.Vector3D<TSelf>
@@ -1628,6 +1633,7 @@ static Silk.NET.Maths.Vector3D.Round<TSelf>(Silk.NET.Maths.Vector3D<TSelf> x) ->
16281633
static Silk.NET.Maths.Vector3D.Round<TSelf>(Silk.NET.Maths.Vector3D<TSelf> x, int digits) -> Silk.NET.Maths.Vector3D<TSelf>
16291634
static Silk.NET.Maths.Vector3D.Round<TSelf>(Silk.NET.Maths.Vector3D<TSelf> x, int digits, System.MidpointRounding mode) -> Silk.NET.Maths.Vector3D<TSelf>
16301635
static Silk.NET.Maths.Vector3D.Round<TSelf>(Silk.NET.Maths.Vector3D<TSelf> x, System.MidpointRounding mode) -> Silk.NET.Maths.Vector3D<TSelf>
1636+
static Silk.NET.Maths.Vector3D.RoundToInt<T>(Silk.NET.Maths.Vector3D<T> vector) -> Silk.NET.Maths.Vector3D<int>
16311637
static Silk.NET.Maths.Vector3D.ScaleB<TSelf>(Silk.NET.Maths.Vector3D<TSelf> x, int n) -> Silk.NET.Maths.Vector3D<TSelf>
16321638
static Silk.NET.Maths.Vector3D.ScaleB<TSelf>(Silk.NET.Maths.Vector3D<TSelf> x, Silk.NET.Maths.Vector3D<int> n) -> Silk.NET.Maths.Vector3D<TSelf>
16331639
static Silk.NET.Maths.Vector3D.Sign<TSelf>(Silk.NET.Maths.Vector3D<TSelf> value) -> Silk.NET.Maths.Vector3D<int>
@@ -1743,6 +1749,7 @@ static Silk.NET.Maths.Vector4D.BitDecrement<TSelf>(Silk.NET.Maths.Vector4D<TSelf
17431749
static Silk.NET.Maths.Vector4D.BitIncrement<TSelf>(Silk.NET.Maths.Vector4D<TSelf> x) -> Silk.NET.Maths.Vector4D<TSelf>
17441750
static Silk.NET.Maths.Vector4D.Cbrt<TSelf>(Silk.NET.Maths.Vector4D<TSelf> x) -> Silk.NET.Maths.Vector4D<TSelf>
17451751
static Silk.NET.Maths.Vector4D.Ceiling<TSelf>(Silk.NET.Maths.Vector4D<TSelf> x) -> Silk.NET.Maths.Vector4D<TSelf>
1752+
static Silk.NET.Maths.Vector4D.CeilingToInt<T>(Silk.NET.Maths.Vector4D<T> vector) -> Silk.NET.Maths.Vector4D<int>
17461753
static Silk.NET.Maths.Vector4D.Clamp<TSelf>(Silk.NET.Maths.Vector4D<TSelf> value, Silk.NET.Maths.Vector4D<TSelf> min, Silk.NET.Maths.Vector4D<TSelf> max) -> Silk.NET.Maths.Vector4D<TSelf>
17471754
static Silk.NET.Maths.Vector4D.Clamp<TSelf>(Silk.NET.Maths.Vector4D<TSelf> value, TSelf min, TSelf max) -> Silk.NET.Maths.Vector4D<TSelf>
17481755
static Silk.NET.Maths.Vector4D.CopySign<TSelf>(Silk.NET.Maths.Vector4D<TSelf> value, Silk.NET.Maths.Vector4D<TSelf> sign) -> Silk.NET.Maths.Vector4D<TSelf>
@@ -1763,6 +1770,7 @@ static Silk.NET.Maths.Vector4D.Exp2M1<TSelf>(Silk.NET.Maths.Vector4D<TSelf> x) -
17631770
static Silk.NET.Maths.Vector4D.Exp<TSelf>(Silk.NET.Maths.Vector4D<TSelf> x) -> Silk.NET.Maths.Vector4D<TSelf>
17641771
static Silk.NET.Maths.Vector4D.ExpM1<TSelf>(Silk.NET.Maths.Vector4D<TSelf> x) -> Silk.NET.Maths.Vector4D<TSelf>
17651772
static Silk.NET.Maths.Vector4D.Floor<TSelf>(Silk.NET.Maths.Vector4D<TSelf> x) -> Silk.NET.Maths.Vector4D<TSelf>
1773+
static Silk.NET.Maths.Vector4D.FloorToInt<T>(Silk.NET.Maths.Vector4D<T> vector) -> Silk.NET.Maths.Vector4D<int>
17661774
static Silk.NET.Maths.Vector4D.FusedMultiplyAdd<TSelf>(Silk.NET.Maths.Vector4D<TSelf> left, Silk.NET.Maths.Vector4D<TSelf> right, Silk.NET.Maths.Vector4D<TSelf> addend) -> Silk.NET.Maths.Vector4D<TSelf>
17671775
static Silk.NET.Maths.Vector4D.FusedMultiplyAdd<TSelf>(Silk.NET.Maths.Vector4D<TSelf> left, Silk.NET.Maths.Vector4D<TSelf> right, TSelf addend) -> Silk.NET.Maths.Vector4D<TSelf>
17681776
static Silk.NET.Maths.Vector4D.FusedMultiplyAdd<TSelf>(Silk.NET.Maths.Vector4D<TSelf> left, TSelf right, Silk.NET.Maths.Vector4D<TSelf> addend) -> Silk.NET.Maths.Vector4D<TSelf>
@@ -1817,6 +1825,7 @@ static Silk.NET.Maths.Vector4D.Round<TSelf>(Silk.NET.Maths.Vector4D<TSelf> x) ->
18171825
static Silk.NET.Maths.Vector4D.Round<TSelf>(Silk.NET.Maths.Vector4D<TSelf> x, int digits) -> Silk.NET.Maths.Vector4D<TSelf>
18181826
static Silk.NET.Maths.Vector4D.Round<TSelf>(Silk.NET.Maths.Vector4D<TSelf> x, int digits, System.MidpointRounding mode) -> Silk.NET.Maths.Vector4D<TSelf>
18191827
static Silk.NET.Maths.Vector4D.Round<TSelf>(Silk.NET.Maths.Vector4D<TSelf> x, System.MidpointRounding mode) -> Silk.NET.Maths.Vector4D<TSelf>
1828+
static Silk.NET.Maths.Vector4D.RoundToInt<T>(Silk.NET.Maths.Vector4D<T> vector) -> Silk.NET.Maths.Vector4D<int>
18201829
static Silk.NET.Maths.Vector4D.ScaleB<TSelf>(Silk.NET.Maths.Vector4D<TSelf> x, int n) -> Silk.NET.Maths.Vector4D<TSelf>
18211830
static Silk.NET.Maths.Vector4D.ScaleB<TSelf>(Silk.NET.Maths.Vector4D<TSelf> x, Silk.NET.Maths.Vector4D<int> n) -> Silk.NET.Maths.Vector4D<TSelf>
18221831
static Silk.NET.Maths.Vector4D.Sign<TSelf>(Silk.NET.Maths.Vector4D<TSelf> value) -> Silk.NET.Maths.Vector4D<int>

sources/Maths/Maths/Vector2D.Ops.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Silk.NET.Maths
88
public static partial class Vector2D
99
{
1010
/// <summary>Computes the cross product of two vectors.</summary>
11-
public static T Cross<T>(this Vector2D<T> left, Vector2D<T> right)
11+
public static T Cross<T>(Vector2D<T> left, Vector2D<T> right)
1212
where T : INumberBase<T> =>
1313
(left.X * right.Y) - (left.Y * right.X);
1414
}

sources/Maths/Maths/Vector2D.Ops.gen.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,21 @@ public static T DistanceSquared<T>(Vector2D<T> value1, Vector2D<T> value2)
7777
return Dot(difference, difference);
7878
}
7979

80+
/// <summary>Applies <see cref="IFloatingPoint{TSelf}.Round(TSelf)"/> to each member of the vector and converts to integer.</summary>
81+
public static Vector2D<int> RoundToInt<T>(Vector2D<T> vector)
82+
where T : IFloatingPoint<T> =>
83+
Vector2D.Round(vector).AsChecked<int>();
84+
85+
/// <summary>Applies <see cref="IFloatingPoint{TSelf}.Floor(TSelf)"/> to each member of the vector and converts to integer.</summary>
86+
public static Vector2D<int> FloorToInt<T>(Vector2D<T> vector)
87+
where T : IFloatingPoint<T> =>
88+
Vector2D.Floor(vector).AsChecked<int>();
89+
90+
/// <summary>Applies <see cref="IFloatingPoint{TSelf}.Ceiling(TSelf)"/> to each member of the vector and converts to integer.</summary>
91+
public static Vector2D<int> CeilingToInt<T>(Vector2D<T> vector)
92+
where T : IFloatingPoint<T> =>
93+
Vector2D.Ceiling(vector).AsChecked<int>();
94+
8095
/// <summary>Linearly interpolates between two vectors using a scalar t-value (clamped between 0 and 1).</summary>
8196
public static Vector2D<T> LerpClamped<T>(Vector2D<T> a, Vector2D<T> b, T amount)
8297
where T : IFloatingPointIeee754<T> =>

sources/Maths/Maths/Vector3D.Ops.gen.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,21 @@ public static T DistanceSquared<T>(Vector3D<T> value1, Vector3D<T> value2)
7979
return Dot(difference, difference);
8080
}
8181

82+
/// <summary>Applies <see cref="IFloatingPoint{TSelf}.Round(TSelf)"/> to each member of the vector and converts to integer.</summary>
83+
public static Vector3D<int> RoundToInt<T>(Vector3D<T> vector)
84+
where T : IFloatingPoint<T> =>
85+
Vector3D.Round(vector).AsChecked<int>();
86+
87+
/// <summary>Applies <see cref="IFloatingPoint{TSelf}.Floor(TSelf)"/> to each member of the vector and converts to integer.</summary>
88+
public static Vector3D<int> FloorToInt<T>(Vector3D<T> vector)
89+
where T : IFloatingPoint<T> =>
90+
Vector3D.Floor(vector).AsChecked<int>();
91+
92+
/// <summary>Applies <see cref="IFloatingPoint{TSelf}.Ceiling(TSelf)"/> to each member of the vector and converts to integer.</summary>
93+
public static Vector3D<int> CeilingToInt<T>(Vector3D<T> vector)
94+
where T : IFloatingPoint<T> =>
95+
Vector3D.Ceiling(vector).AsChecked<int>();
96+
8297
/// <summary>Linearly interpolates between two vectors using a scalar t-value (clamped between 0 and 1).</summary>
8398
public static Vector3D<T> LerpClamped<T>(Vector3D<T> a, Vector3D<T> b, T amount)
8499
where T : IFloatingPointIeee754<T> =>

sources/Maths/Maths/Vector4D.Ops.gen.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,21 @@ public static T DistanceSquared<T>(Vector4D<T> value1, Vector4D<T> value2)
8181
return Dot(difference, difference);
8282
}
8383

84+
/// <summary>Applies <see cref="IFloatingPoint{TSelf}.Round(TSelf)"/> to each member of the vector and converts to integer.</summary>
85+
public static Vector4D<int> RoundToInt<T>(Vector4D<T> vector)
86+
where T : IFloatingPoint<T> =>
87+
Vector4D.Round(vector).AsChecked<int>();
88+
89+
/// <summary>Applies <see cref="IFloatingPoint{TSelf}.Floor(TSelf)"/> to each member of the vector and converts to integer.</summary>
90+
public static Vector4D<int> FloorToInt<T>(Vector4D<T> vector)
91+
where T : IFloatingPoint<T> =>
92+
Vector4D.Floor(vector).AsChecked<int>();
93+
94+
/// <summary>Applies <see cref="IFloatingPoint{TSelf}.Ceiling(TSelf)"/> to each member of the vector and converts to integer.</summary>
95+
public static Vector4D<int> CeilingToInt<T>(Vector4D<T> vector)
96+
where T : IFloatingPoint<T> =>
97+
Vector4D.Ceiling(vector).AsChecked<int>();
98+
8499
/// <summary>Linearly interpolates between two vectors using a scalar t-value (clamped between 0 and 1).</summary>
85100
public static Vector4D<T> LerpClamped<T>(Vector4D<T> a, Vector4D<T> b, T amount)
86101
where T : IFloatingPointIeee754<T> =>

0 commit comments

Comments
 (0)