From 09e674c61db686760b8ac4fd661fcd0b53d6f2c2 Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Mon, 30 Jun 2025 16:19:44 -0700 Subject: [PATCH 01/19] Snapshot. --- sources/Maths/Maths/Vector2F.cs | 257 +------------- sources/Maths/Maths/Vector2F.gen.cs | 525 +++++++++++++++++++++++++-- sources/Maths/Maths/Vector2I.cs | 87 ----- sources/Maths/Maths/Vector2I.gen.cs | 229 ++++++++---- sources/Maths/Maths/Vector3F.gen.cs | 529 +++++++++++++++++++++++++-- sources/Maths/Maths/Vector3I.cs | 102 ------ sources/Maths/Maths/Vector3I.gen.cs | 233 ++++++++---- sources/Maths/Maths/Vector4F.gen.cs | 533 ++++++++++++++++++++++++++-- sources/Maths/Maths/Vector4I.cs | 106 ------ sources/Maths/Maths/Vector4I.gen.cs | 237 +++++++++---- 10 files changed, 1993 insertions(+), 845 deletions(-) diff --git a/sources/Maths/Maths/Vector2F.cs b/sources/Maths/Maths/Vector2F.cs index 843f180af2..70db4099f6 100644 --- a/sources/Maths/Maths/Vector2F.cs +++ b/sources/Maths/Maths/Vector2F.cs @@ -16,72 +16,9 @@ namespace Silk.NET.Maths /// A structure representing a 2D floating-point vector. internal partial struct Vector2F { - /// Returns a vector with the component-wise maximum of this and another vector. - public Vector2F Max(Vector2F other) => - new(T.Max(X, other.X), T.Max(Y, other.Y)); - - /// Returns a vector with the component-wise maximum of two vectors. - public static Vector2F Max(Vector2F left, Vector2F right) => - new(T.Max(left.X, right.X), T.Max(left.Y, right.Y)); - - /// Returns a vector with the component-wise maximum of this vector and a scalar. - public Vector2F Max(T scalar) => - new(T.Max(X, scalar), T.Max(Y, scalar)); - - /// Returns a vector with the component-wise maximum of a vector and a scalar. - public static Vector2F Max(Vector2F vector, T scalar) => - new(T.Max(vector.X, scalar), T.Max(vector.Y, scalar)); - - /// Returns a vector with the component-wise minimum of this and another vector. - public Vector2F Min(Vector2F other) => - new(T.Min(X, other.X), T.Min(Y, other.Y)); - - /// Returns a vector with the component-wise minimum of two vectors. - public static Vector2F Min(Vector2F left, Vector2F right) => - new(T.Min(left.X, right.X), T.Min(left.Y, right.Y)); - - /// Returns a vector with the component-wise minimum of this vector and a scalar. - public Vector2F Min(T scalar) => - new(T.Min(X, scalar), T.Min(Y, scalar)); - - /// Returns a vector with the component-wise minimum of a vector and a scalar. - public static Vector2F Min(Vector2F vector, T scalar) => - new(T.Min(vector.X, scalar), T.Min(vector.Y, scalar)); - - /// Clamps this vector's components between the corresponding Min and Max vectors. - public Vector2F Clamp(Vector2F min, Vector2F max) => - new(T.Clamp(X, min.X, max.X), T.Clamp(Y, min.Y, max.Y)); - - /// Clamps the components of a vector between the corresponding Min and Max vectors. - public static Vector2F Clamp(Vector2F vector, Vector2F min, Vector2F max) => - new(T.Clamp(vector.X, min.X, max.X), T.Clamp(vector.Y, min.Y, max.Y)); - - /// Clamps this vector's components between the Min and Max scalar values. - public Vector2F Clamp(T min, T max) => - new(T.Clamp(X, min, max), T.Clamp(Y, min, max)); - - /// Clamps the components of a vector between the Min and Max scalar values. - public static Vector2F Clamp(Vector2F vector, T min, T max) => - new(T.Clamp(vector.X, min, max), T.Clamp(vector.Y, min, max)); - - /// Returns a vector with the absolute value of each component of this vector. - public Vector2F Abs() => new(T.Abs(X), T.Abs(Y)); - - /// Returns a vector with the absolute value of each component of the specified vector. - public static Vector2F Abs(Vector2F vector) => - new(T.Abs(vector.X), T.Abs(vector.Y)); - - /// Linearly interpolates between two vectors using a scalar t-value. - public static Vector2F Lerp(Vector2F a, Vector2F b, T t) => - new(a.X + (b.X - a.X) * t, a.Y + (b.Y - a.Y) * t); - - /// Linearly interpolates between two vectors using a vector t-value. - public static Vector2F Lerp(Vector2F a, Vector2F b, Vector2F t) => - new(a.X + (b.X - a.X) * t.X, a.Y + (b.Y - a.Y) * t.Y); - /// Linearly interpolates between two vectors using a scalar t-value (clamped between 0 and 1). public static Vector2F LerpClamped(Vector2F a, Vector2F b, T t) => - Lerp(a, b, T.Clamp(t, T.Zero, T.One)); + Vector2F.Lerp(a, b, T.Clamp(t, T.Zero, T.One)); /// Linearly interpolates between two vectors using a vector t-value (clamped between 0 and 1). public static Vector2F LerpClamped(Vector2F a, Vector2F b, Vector2F t) => @@ -90,29 +27,6 @@ public static Vector2F LerpClamped(Vector2F a, Vector2F b, Vector2F a.Y + (b.Y - a.Y) * T.Clamp(t.Y, T.Zero, T.One) ); - /// Returns a vector where each component is the sign of the original vector's component. - public Vector2F Sign() => new(T.CreateChecked(T.Sign(X)), T.CreateChecked(T.Sign(Y))); - - /// Returns a vector where each component is the sign of the input vector's component. - public static Vector2F Sign(Vector2F vector) => - new(T.CreateChecked(T.Sign(vector.X)), T.CreateChecked(T.Sign(vector.Y))); - - /// Copies the sign of each component from another vector to this vector's components. - public Vector2F CopySign(Vector2F signSource) => - new(T.CopySign(X, signSource.X), T.CopySign(Y, signSource.Y)); - - /// Copies the sign of each component from another vector to a new vector. - public static Vector2F CopySign(Vector2F value, Vector2F signSource) => - new(T.CopySign(value.X, signSource.X), T.CopySign(value.Y, signSource.Y)); - - /// Copies the sign of a scalar onto each component of this vector. - public Vector2F CopySign(T signScalar) => - new(T.CopySign(X, signScalar), T.CopySign(Y, signScalar)); - - /// Copies the sign of a scalar onto each component of a new vector. - public static Vector2F CopySign(Vector2F value, T signScalar) => - new(T.CopySign(value.X, signScalar), T.CopySign(value.Y, signScalar)); - // Casts /// Explicitly casts a to a . @@ -124,68 +38,6 @@ public static explicit operator System.Numerics.Vector2(Vector2F v) => new(Convert.ToSingle(v.X), Convert.ToSingle(v.Y)); // IFloatingPointIeee754 - public static Vector2F Sqrt(Vector2F x) => - new(T.Sqrt(x.X), T.Sqrt(x.Y)); - - public static Vector2F Acosh(Vector2F x) => - new(T.Acosh(x.X), T.Acosh(x.Y)); - - public static Vector2F Asinh(Vector2F x) => - new(T.Asinh(x.X), T.Asinh(x.Y)); - - public static Vector2F Atanh(Vector2F x) => - new(T.Atanh(x.X), T.Atanh(x.Y)); - - public static Vector2F Cosh(Vector2F x) => - new(T.Cosh(x.X), T.Cosh(x.Y)); - - public static Vector2F Sinh(Vector2F x) => - new(T.Sinh(x.X), T.Sinh(x.Y)); - - public static Vector2F Tanh(Vector2F x) => - new(T.Tanh(x.X), T.Tanh(x.Y)); - - public static Vector2F Acos(Vector2F x) => - new(T.Acos(x.X), T.Acos(x.Y)); - - public static Vector2F AcosPi(Vector2F x) => - new(T.AcosPi(x.X), T.AcosPi(x.Y)); - - public static Vector2F Asin(Vector2F x) => - new(T.Asin(x.X), T.Asin(x.Y)); - - public static Vector2F AsinPi(Vector2F x) => - new(T.AsinPi(x.X), T.AsinPi(x.Y)); - - public static Vector2F Atan(Vector2F x) => - new(T.Atan(x.X), T.Atan(x.Y)); - - public static Vector2F AtanPi(Vector2F x) => - new(T.AtanPi(x.X), T.AtanPi(x.Y)); - - public static Vector2F Cos(Vector2F x) => - new(T.Cos(x.X), T.Cos(x.Y)); - - public static Vector2F CosPi(Vector2F x) => - new(T.CosPi(x.X), T.CosPi(x.Y)); - - public static Vector2F Sin(Vector2F x) => - new(T.Sin(x.X), T.Sin(x.Y)); - - public static Vector2F SinPi(Vector2F x) => - new(T.SinPi(x.X), T.SinPi(x.Y)); - - public static Vector2F Tan(Vector2F x) => - new(T.Tan(x.X), T.Tan(x.Y)); - - public static Vector2F TanPi(Vector2F x) => - new(T.TanPi(x.X), T.TanPi(x.Y)); - - public static Vector2F DegreesToRadians(Vector2F degrees) => - new(T.DegreesToRadians(degrees.X), T.DegreesToRadians(degrees.Y)); - - public static Vector2F RadiansToDegrees(Vector2F radians) => - new(T.RadiansToDegrees(radians.X), T.RadiansToDegrees(radians.Y)); public static (Vector2F Sin, Vector2F Cos) SinCos(Vector2F x) => (new(T.Sin(x.X), T.Sin(x.Y)), new(T.Cos(x.X), T.Cos(x.Y))); @@ -193,98 +45,6 @@ public static (Vector2F Sin, Vector2F Cos) SinCos(Vector2F x) => public static (Vector2F SinPi, Vector2F CosPi) SinCosPi(Vector2F x) => (new(T.SinPi(x.X), T.SinPi(x.Y)), new(T.CosPi(x.X), T.CosPi(x.Y))); - public static Vector2F Log(Vector2F x) => - new(T.Log(x.X), T.Log(x.Y)); - - public static Vector2F Log(Vector2F x, Vector2F newBase) => - new(T.Log(x.X, newBase.X), T.Log(x.Y, newBase.Y)); - - public static Vector2F Log(Vector2F x, T newBase) => - new(T.Log(x.X, newBase), T.Log(x.Y, newBase)); - - public static Vector2F LogP1(Vector2F x) => - new(T.LogP1(x.X), T.LogP1(x.Y)); - - // TODO: Static Log2 - - public static Vector2F Log2P1(Vector2F x) => - new(T.Log2P1(x.X), T.Log2P1(x.Y)); - - public static Vector2F Log10(Vector2F x) => - new(T.Log10(x.X), T.Log10(x.Y)); - - public static Vector2F Log10P1(Vector2F x) => - new(T.Log10P1(x.X), T.Log10P1(x.Y)); - - public static Vector2F Exp(Vector2F x) => - new(T.Exp(x.X), T.Exp(x.Y)); - - public static Vector2F ExpM1(Vector2F x) => - new(T.ExpM1(x.X), T.ExpM1(x.Y)); - - public static Vector2F Exp2(Vector2F x) => - new(T.Exp2(x.X), T.Exp2(x.Y)); - - public static Vector2F Exp2M1(Vector2F x) => - new(T.Exp2M1(x.X), T.Exp2M1(x.Y)); - - public static Vector2F Exp10(Vector2F x) => - new(T.Exp10(x.X), T.Exp10(x.Y)); - - public static Vector2F Exp10M1(Vector2F x) => - new(T.Exp10M1(x.X), T.Exp10M1(x.Y)); - - public static Vector2F Pow(Vector2F x, Vector2F y) => - new(T.Pow(x.X, y.X), T.Pow(x.Y, y.Y)); - - public static Vector2F Pow(Vector2F x, T y) => - new(T.Pow(x.X, y), T.Pow(x.Y, y)); - - public static Vector2F Cbrt(Vector2F x) => - new(T.Cbrt(x.X), T.Cbrt(x.Y)); - - public static Vector2F Hypot(Vector2F x, Vector2F y) => - new(T.Hypot(x.X, y.X), T.Hypot(x.Y, y.Y)); - - public static Vector2F Hypot(Vector2F x, T y) => - new(T.Hypot(x.X, y), T.Hypot(x.Y, y)); - - public static Vector2F RootN(Vector2F x, int n) => - new(T.RootN(x.X, n), T.RootN(x.Y, n)); - - public static Vector2F Round(Vector2F x) => - new(T.Round(x.X), T.Round(x.Y)); - - public static Vector2F Round(Vector2F x, int digits) => - new(T.Round(x.X, digits), T.Round(x.Y, digits)); - - public static Vector2F Round(Vector2F x, MidpointRounding mode) => - new(T.Round(x.X, mode), T.Round(x.Y, mode)); - - public static Vector2F Round(Vector2F x, int digits, MidpointRounding mode) => - new(T.Round(x.X, digits, mode), T.Round(x.Y, digits, mode)); - - public static Vector2F Truncate(Vector2F x) => - new(T.Truncate(x.X), T.Truncate(x.Y)); - - public static Vector2F Atan2(Vector2F y, Vector2F x) => - new(T.Atan2(y.X, x.X), T.Atan2(y.Y, x.Y)); - - public static Vector2F Atan2Pi(Vector2F y, Vector2F x) => - new(T.Atan2Pi(y.X, x.X), T.Atan2Pi(y.Y, x.Y)); - - public static Vector2F Atan2(Vector2F y, T x) => - new(T.Atan2(y.X, x), T.Atan2(y.Y, x)); - - public static Vector2F Atan2Pi(Vector2F y, T x) => - new(T.Atan2Pi(y.X, x), T.Atan2Pi(y.Y, x)); - - public static Vector2F BitDecrement(Vector2F x) => - new(T.BitDecrement(x.X), T.BitDecrement(x.Y)); - - public static Vector2F BitIncrement(Vector2F x) => - new(T.BitIncrement(x.X), T.BitIncrement(x.Y)); - public static Vector2F FusedMultiplyAdd(Vector2F left, Vector2F right, Vector2F addend) => new(T.FusedMultiplyAdd(left.X, right.X, addend.X), T.FusedMultiplyAdd(left.Y, right.Y, addend.Y)); @@ -296,21 +56,6 @@ public static Vector2F FusedMultiplyAdd(Vector2F left, T right, Vector2F FusedMultiplyAdd(Vector2F left, T right, T addend) => new(T.FusedMultiplyAdd(left.X, right, addend), T.FusedMultiplyAdd(left.Y, right, addend)); - - public static Vector2F ReciprocalEstimate(Vector2F x) => - new(T.ReciprocalEstimate(x.X), T.ReciprocalEstimate(x.Y)); - - public static Vector2F ReciprocalSqrtEstimate(Vector2F x) => - new(T.ReciprocalSqrtEstimate(x.X), T.ReciprocalSqrtEstimate(x.Y)); - - public static Vector2I ILogB(Vector2F x) => - new(T.ILogB(x.X), T.ILogB(x.Y)); - - public static Vector2F ScaleB(Vector2F x, Vector2I n) => - new(T.ScaleB(x.X, n.X), T.ScaleB(x.Y, n.Y)); - - public static Vector2F ScaleB(Vector2F x, int n) => - new(T.ScaleB(x.X, n), T.ScaleB(x.Y, n)); } static partial class Vector2F diff --git a/sources/Maths/Maths/Vector2F.gen.cs b/sources/Maths/Maths/Vector2F.gen.cs index b7c5cfc47f..66d80f2855 100644 --- a/sources/Maths/Maths/Vector2F.gen.cs +++ b/sources/Maths/Maths/Vector2F.gen.cs @@ -40,16 +40,16 @@ public Vector2F(ReadOnlySpan values) } /// Gets a vector whose 2 elements are equal to one. - public static Vector2F One => new(Scalar.One); + public static Vector2F One => new(T.One); /// Returns a vector whose 2 elements are equal to zero. public static Vector2F Zero => default; /// Gets the vector (1, 0). - public static Vector2F UnitX => new(Scalar.One, Scalar.Zero); + public static Vector2F UnitX => new(T.One, T.Zero); /// Gets the vector (0, 1). - public static Vector2F UnitY => new(Scalar.Zero, Scalar.One); + public static Vector2F UnitY => new(T.Zero, T.One); /// Gets the squared length of the vector (dot product with itself). public T LengthSquared => Vector2F.Dot(this, this); @@ -302,44 +302,61 @@ static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IForm /// public override int GetHashCode() => HashCode.Combine(X, Y); + /// Desconstructs a vector into its components. + /// The X component. + /// The Y component. + public void Deconstruct(out T x, out T y) + { + x = X; + y = Y; + } + + /// Implicitly casts a to a . + public static implicit operator Vector2F((T X, T Y) v) => + new(v.X, v.Y); + + /// Implicitly casts a to a . + public static implicit operator (T X, T Y)(Vector2F v) => + (v.X, v.Y); + public static Vector2F operator +(Vector2F vector) => vector; public static Vector2F operator -(Vector2F vector) => - new Vector2F(-vector.X, -vector.Y); + new(-vector.X, -vector.Y); public static Vector2F operator +(Vector2F left, Vector2F right) => - new Vector2F(left.X + right.X, left.Y + right.Y); + new(left.X + right.X, left.Y + right.Y); public static Vector2F operator -(Vector2F left, Vector2F right) => - new Vector2F(left.X - right.X, left.Y - right.Y); + new(left.X - right.X, left.Y - right.Y); public static Vector2F operator *(Vector2F left, Vector2F right) => - new Vector2F(left.X * right.X, left.Y * right.Y); + new(left.X * right.X, left.Y * right.Y); public static Vector2F operator /(Vector2F left, Vector2F right) => - new Vector2F(left.X / right.X, left.Y / right.Y); + new(left.X / right.X, left.Y / right.Y); public static Vector2F operator %(Vector2F left, Vector2F right) => - new Vector2F(left.X % right.X, left.Y % right.Y); + new(left.X % right.X, left.Y % right.Y); public static Vector2F operator +(Vector2F vector, T scalar) => - new Vector2F(vector.X + scalar, vector.Y + scalar); + new(vector.X + scalar, vector.Y + scalar); public static Vector2F operator -(Vector2F vector, T scalar) => - new Vector2F(vector.X - scalar, vector.Y - scalar); + new(vector.X - scalar, vector.Y - scalar); public static Vector2F operator *(Vector2F vector, T scalar) => - new Vector2F(vector.X * scalar, vector.Y * scalar); + new(vector.X * scalar, vector.Y * scalar); public static Vector2F operator *(T scalar, Vector2F vector) => - new Vector2F(scalar * vector.X, scalar * vector.Y); + new(scalar * vector.X, scalar * vector.Y); public static Vector2F operator /(Vector2F vector, T scalar) => - new Vector2F(vector.X / scalar, vector.Y / scalar); + new(vector.X / scalar, vector.Y / scalar); public static Vector2F operator %(Vector2F vector, T scalar) => - new Vector2F(vector.X % scalar, vector.Y % scalar); + new(vector.X % scalar, vector.Y % scalar); } @@ -371,56 +388,504 @@ public static Vector2F Normalize(this Vector2F vector) return length != T.Zero ? vector / length : Vector2F.Zero; } + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2I Sign(this Vector2F value) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Sign(value.X), TSelf.Sign(value.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F Max(this Vector2F x, Vector2F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Max(x.X, y.X), TSelf.Max(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector2F Max(this Vector2F x, TSelf y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Max(x.X, y), TSelf.Max(x.Y, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F MaxNumber(this Vector2F x, Vector2F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MaxNumber(x.X, y.X), TSelf.MaxNumber(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector2F MaxNumber(this Vector2F x, TSelf y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MaxNumber(x.X, y), TSelf.MaxNumber(x.Y, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F Min(this Vector2F x, Vector2F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Min(x.X, y.X), TSelf.Min(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector2F Min(this Vector2F x, TSelf y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Min(x.X, y), TSelf.Min(x.Y, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F MinNumber(this Vector2F x, Vector2F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MinNumber(x.X, y.X), TSelf.MinNumber(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector2F MinNumber(this Vector2F x, TSelf y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MinNumber(x.X, y), TSelf.MinNumber(x.Y, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F Clamp(this Vector2F value, Vector2F min, Vector2F max) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Clamp(value.X, min.X, max.X), TSelf.Clamp(value.Y, min.Y, max.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + /// A single value provided for . + public static Vector2F Clamp(this Vector2F value, TSelf min, TSelf max) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Clamp(value.X, min, max), TSelf.Clamp(value.Y, min, max)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F CopySign(this Vector2F value, Vector2F sign) + where TSelf : IFloatingPointIeee754 => + new(TSelf.CopySign(value.X, sign.X), TSelf.CopySign(value.Y, sign.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector2F CopySign(this Vector2F value, TSelf sign) + where TSelf : IFloatingPointIeee754 => + new(TSelf.CopySign(value.X, sign), TSelf.CopySign(value.Y, sign)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Abs(this Vector2F value) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Abs(value.X), TSelf.Abs(value.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F MaxMagnitude(this Vector2F x, Vector2F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MaxMagnitude(x.X, y.X), TSelf.MaxMagnitude(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F MaxMagnitudeNumber(this Vector2F x, Vector2F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MaxMagnitudeNumber(x.X, y.X), TSelf.MaxMagnitudeNumber(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F MinMagnitude(this Vector2F x, Vector2F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MinMagnitude(x.X, y.X), TSelf.MinMagnitude(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F MinMagnitudeNumber(this Vector2F x, Vector2F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MinMagnitudeNumber(x.X, y.X), TSelf.MinMagnitudeNumber(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Ceiling(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Ceiling(x.X), TSelf.Ceiling(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Floor(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Floor(x.X), TSelf.Floor(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Round(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Round(x.X), TSelf.Round(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + /// A single value provided for . + public static Vector2F Round(this Vector2F x, int digits, MidpointRounding mode) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Round(x.X, digits, mode), TSelf.Round(x.Y, digits, mode)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Truncate(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Truncate(x.X), TSelf.Truncate(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F Atan2(this Vector2F y, Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Atan2(y.X, x.X), TSelf.Atan2(y.Y, x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F Atan2Pi(this Vector2F y, Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Atan2Pi(y.X, x.X), TSelf.Atan2Pi(y.Y, x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector2F Lerp(this Vector2F value1, Vector2F value2, TSelf amount) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Lerp(value1.X, value2.X, amount), TSelf.Lerp(value1.Y, value2.Y, amount)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F BitDecrement(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.BitDecrement(x.X), TSelf.BitDecrement(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F BitIncrement(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.BitIncrement(x.X), TSelf.BitIncrement(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F FusedMultiplyAdd(this Vector2F left, Vector2F right, Vector2F addend) + where TSelf : IFloatingPointIeee754 => + new(TSelf.FusedMultiplyAdd(left.X, right.X, addend.X), TSelf.FusedMultiplyAdd(left.Y, right.Y, addend.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + /// A single value provided for . + public static Vector2F FusedMultiplyAdd(this Vector2F left, TSelf right, TSelf addend) + where TSelf : IFloatingPointIeee754 => + new(TSelf.FusedMultiplyAdd(left.X, right, addend), TSelf.FusedMultiplyAdd(left.Y, right, addend)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F Ieee754Remainder(this Vector2F left, Vector2F right) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Ieee754Remainder(left.X, right.X), TSelf.Ieee754Remainder(left.Y, right.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector2F Ieee754Remainder(this Vector2F left, TSelf right) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Ieee754Remainder(left.X, right), TSelf.Ieee754Remainder(left.Y, right)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2I ILogB(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.ILogB(x.X), TSelf.ILogB(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F ReciprocalEstimate(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.ReciprocalEstimate(x.X), TSelf.ReciprocalEstimate(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F ReciprocalSqrtEstimate(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.ReciprocalSqrtEstimate(x.X), TSelf.ReciprocalSqrtEstimate(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F ScaleB(this Vector2F x, Vector2I n) + where TSelf : IFloatingPointIeee754 => + new(TSelf.ScaleB(x.X, n.X), TSelf.ScaleB(x.Y, n.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector2F ScaleB(this Vector2F x, int n) + where TSelf : IFloatingPointIeee754 => + new(TSelf.ScaleB(x.X, n), TSelf.ScaleB(x.Y, n)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F Pow(this Vector2F x, Vector2F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Pow(x.X, y.X), TSelf.Pow(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector2F Pow(this Vector2F x, TSelf y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Pow(x.X, y), TSelf.Pow(x.Y, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Cbrt(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Cbrt(x.X), TSelf.Cbrt(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Sqrt(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Sqrt(x.X), TSelf.Sqrt(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector2F RootN(this Vector2F x, int n) + where TSelf : IFloatingPointIeee754 => + new(TSelf.RootN(x.X, n), TSelf.RootN(x.Y, n)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F RootN(this Vector2F x, Vector2I n) + where TSelf : IFloatingPointIeee754 => + new(TSelf.RootN(x.X, n.X), TSelf.RootN(x.Y, n.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2F Hypot(this Vector2F x, Vector2F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Hypot(x.X, y.X), TSelf.Hypot(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector2F Log(this Vector2F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Log(x.X), TSelf.Log(x.Y)); - public static Vector2F Log(this Vector2F x, Vector2F newBase) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.Log(x.X, newBase.X), TSelf.Log(x.Y, newBase.Y)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector2F Log(this Vector2F x, TSelf newBase) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Log(x.X, newBase), TSelf.Log(x.Y, newBase)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector2F LogP1(this Vector2F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.LogP1(x.X), TSelf.LogP1(x.Y)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector2F Log2(this Vector2F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Log2(x.X), TSelf.Log2(x.Y)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector2F Log2P1(this Vector2F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Log2P1(x.X), TSelf.Log2P1(x.Y)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector2F Log10(this Vector2F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Log10(x.X), TSelf.Log10(x.Y)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector2F Log10P1(this Vector2F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Log10P1(x.X), TSelf.Log10P1(x.Y)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector2F Exp(this Vector2F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Exp(x.X), TSelf.Exp(x.Y)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector2F ExpM1(this Vector2F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.ExpM1(x.X), TSelf.ExpM1(x.Y)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector2F Exp2(this Vector2F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Exp2(x.X), TSelf.Exp2(x.Y)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector2F Exp2M1(this Vector2F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Exp2M1(x.X), TSelf.Exp2M1(x.Y)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector2F Exp10(this Vector2F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Exp10(x.X), TSelf.Exp10(x.Y)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector2F Exp10M1(this Vector2F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Exp10M1(x.X), TSelf.Exp10M1(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Acos(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Acos(x.X), TSelf.Acos(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F AcosPi(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.AcosPi(x.X), TSelf.AcosPi(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Asin(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Asin(x.X), TSelf.Asin(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F AsinPi(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.AsinPi(x.X), TSelf.AsinPi(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Atan(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Atan(x.X), TSelf.Atan(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F AtanPi(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.AtanPi(x.X), TSelf.AtanPi(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Cos(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Cos(x.X), TSelf.Cos(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F CosPi(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.CosPi(x.X), TSelf.CosPi(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Sin(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Sin(x.X), TSelf.Sin(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F SinPi(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.SinPi(x.X), TSelf.SinPi(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Tan(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Tan(x.X), TSelf.Tan(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F TanPi(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.TanPi(x.X), TSelf.TanPi(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F DegreesToRadians(this Vector2F degrees) + where TSelf : IFloatingPointIeee754 => + new(TSelf.DegreesToRadians(degrees.X), TSelf.DegreesToRadians(degrees.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F RadiansToDegrees(this Vector2F radians) + where TSelf : IFloatingPointIeee754 => + new(TSelf.RadiansToDegrees(radians.X), TSelf.RadiansToDegrees(radians.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Acosh(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Acosh(x.X), TSelf.Acosh(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Asinh(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Asinh(x.X), TSelf.Asinh(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Atanh(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Atanh(x.X), TSelf.Atanh(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Cosh(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Cosh(x.X), TSelf.Cosh(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Sinh(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Sinh(x.X), TSelf.Sinh(x.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2F Tanh(this Vector2F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Tanh(x.X), TSelf.Tanh(x.Y)); } } diff --git a/sources/Maths/Maths/Vector2I.cs b/sources/Maths/Maths/Vector2I.cs index fceb7b5b44..88adc7cb6e 100644 --- a/sources/Maths/Maths/Vector2I.cs +++ b/sources/Maths/Maths/Vector2I.cs @@ -20,84 +20,6 @@ internal partial struct Vector2I /// Computes the cross product of two vectors. public static T Cross(Vector2I left, Vector2I right) => (left.X * right.Y) - (left.Y * right.X); - /// Returns a vector with the component-wise maximum of this and another vector. - public Vector2I Max(Vector2I other) => - new Vector2I(T.Max(X, other.X), T.Max(Y, other.Y)); - - /// Returns a vector with the component-wise maximum of two vectors. - public static Vector2I Max(Vector2I left, Vector2I right) => - new Vector2I(T.Max(left.X, right.X), T.Max(left.Y, right.Y)); - - /// Returns a vector with the component-wise maximum of this vector and a scalar. - public Vector2I Max(T scalar) => - new Vector2I(T.Max(X, scalar), T.Max(Y, scalar)); - - /// Returns a vector with the component-wise maximum of a vector and a scalar. - public static Vector2I Max(Vector2I vector, T scalar) => - new Vector2I(T.Max(vector.X, scalar), T.Max(vector.Y, scalar)); - - /// Returns a vector with the component-wise minimum of this and another vector. - public Vector2I Min(Vector2I other) => - new Vector2I(T.Min(X, other.X), T.Min(Y, other.Y)); - - /// Returns a vector with the component-wise minimum of two vectors. - public static Vector2I Min(Vector2I left, Vector2I right) => - new Vector2I(T.Min(left.X, right.X), T.Min(left.Y, right.Y)); - - /// Returns a vector with the component-wise minimum of this vector and a scalar. - public Vector2I Min(T scalar) => - new Vector2I(T.Min(X, scalar), T.Min(Y, scalar)); - - /// Returns a vector with the component-wise minimum of a vector and a scalar. - public static Vector2I Min(Vector2I vector, T scalar) => - new Vector2I(T.Min(vector.X, scalar), T.Min(vector.Y, scalar)); - - /// Clamps this vector's components between the corresponding Min and Max vectors. - public Vector2I Clamp(Vector2I min, Vector2I max) => - new Vector2I(T.Clamp(X, min.X, max.X), T.Clamp(Y, min.Y, max.Y)); - - /// Clamps the components of a vector between the corresponding Min and Max vectors. - public static Vector2I Clamp(Vector2I vector, Vector2I min, Vector2I max) => - new Vector2I(T.Clamp(vector.X, min.X, max.X), T.Clamp(vector.Y, min.Y, max.Y)); - - /// Clamps this vector's components between the Min and Max scalar values. - public Vector2I Clamp(T min, T max) => - new Vector2I(T.Clamp(X, min, max), T.Clamp(Y, min, max)); - - /// Clamps the components of a vector between the Min and Max scalar values. - public static Vector2I Clamp(Vector2I vector, T min, T max) => - new Vector2I(T.Clamp(vector.X, min, max), T.Clamp(vector.Y, min, max)); - - /// Returns a vector with the absolute value of each component of this vector. - public Vector2I Abs() => new Vector2I(T.Abs(X), T.Abs(Y)); - - /// Returns a vector with the absolute value of each component of the specified vector. - public static Vector2I Abs(Vector2I vector) => - new Vector2I(T.Abs(vector.X), T.Abs(vector.Y)); - - /// Returns a vector where each component is the sign of the original vector's component. - public Vector2I Sign() => new Vector2I(T.CreateChecked(T.Sign(X)), T.CreateChecked(T.Sign(Y))); - - /// Returns a vector where each component is the sign of the input vector's component. - public static Vector2I Sign(Vector2I vector) => - new Vector2I(T.CreateChecked(T.Sign(vector.X)), T.CreateChecked(T.Sign(vector.Y))); - - /// Copies the sign of each component from another vector to this vector's components. - public Vector2I CopySign(Vector2I signSource) => - new Vector2I(T.CopySign(X, signSource.X), T.CopySign(Y, signSource.Y)); - - /// Copies the sign of each component from another vector to a new vector. - public static Vector2I CopySign(Vector2I value, Vector2I signSource) => - new Vector2I(T.CopySign(value.X, signSource.X), T.CopySign(value.Y, signSource.Y)); - - /// Copies the sign of a scalar onto each component of this vector. - public Vector2I CopySign(T signScalar) => - new Vector2I(T.CopySign(X, signScalar), T.CopySign(Y, signScalar)); - - /// Copies the sign of a scalar onto each component of a new vector. - public static Vector2I CopySign(Vector2I value, T signScalar) => - new Vector2I(T.CopySign(value.X, signScalar), T.CopySign(value.Y, signScalar)); - // Casts /// Explicitly casts a to a . @@ -108,20 +30,11 @@ public static explicit operator Vector2I(System.Numerics.Vector2 v) => public static explicit operator System.Numerics.Vector2(Vector2I v) => new System.Numerics.Vector2(Convert.ToSingle(v.X), Convert.ToSingle(v.Y)); - // IBinaryInteger - // TODO: Verify these are actually correct - - public static Vector2I Log2(Vector2I x) => - new Vector2I(T.Log2(x.X), T.Log2(x.Y)); - public static (Vector2I Quotient, Vector2I Remainder) DivRem(Vector2I left, Vector2I right) { var (qX, rX) = T.DivRem(left.X, right.X); var (qY, rY) = T.DivRem(left.Y, right.Y); return (new Vector2I(qX, qY), new Vector2I(rX, rY)); } - - public static Vector2I PopCount(Vector2I x) => - new Vector2I(T.PopCount(x.X), T.PopCount(x.Y)); } } diff --git a/sources/Maths/Maths/Vector2I.gen.cs b/sources/Maths/Maths/Vector2I.gen.cs index afe221d779..5295369eb4 100644 --- a/sources/Maths/Maths/Vector2I.gen.cs +++ b/sources/Maths/Maths/Vector2I.gen.cs @@ -40,16 +40,16 @@ public Vector2I(ReadOnlySpan values) } /// Gets a vector whose 2 elements are equal to one. - public static Vector2I One => new(Scalar.One); + public static Vector2I One => new(T.One); /// Returns a vector whose 2 elements are equal to zero. public static Vector2I Zero => default; /// Gets the vector (1, 0). - public static Vector2I UnitX => new(Scalar.One, Scalar.Zero); + public static Vector2I UnitX => new(T.One, T.Zero); /// Gets the vector (0, 1). - public static Vector2I UnitY => new(Scalar.Zero, Scalar.One); + public static Vector2I UnitY => new(T.Zero, T.One); /// Gets a vector with all bits set for each component. public static Vector2I AllBitsSet => new Vector2I(T.AllBitsSet, T.AllBitsSet); @@ -305,44 +305,61 @@ static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IForm /// public override int GetHashCode() => HashCode.Combine(X, Y); + /// Desconstructs a vector into its components. + /// The X component. + /// The Y component. + public void Deconstruct(out T x, out T y) + { + x = X; + y = Y; + } + + /// Implicitly casts a to a . + public static implicit operator Vector2I((T X, T Y) v) => + new(v.X, v.Y); + + /// Implicitly casts a to a . + public static implicit operator (T X, T Y)(Vector2I v) => + (v.X, v.Y); + public static Vector2I operator +(Vector2I vector) => vector; public static Vector2I operator -(Vector2I vector) => - new Vector2I(-vector.X, -vector.Y); + new(-vector.X, -vector.Y); public static Vector2I operator +(Vector2I left, Vector2I right) => - new Vector2I(left.X + right.X, left.Y + right.Y); + new(left.X + right.X, left.Y + right.Y); public static Vector2I operator -(Vector2I left, Vector2I right) => - new Vector2I(left.X - right.X, left.Y - right.Y); + new(left.X - right.X, left.Y - right.Y); public static Vector2I operator *(Vector2I left, Vector2I right) => - new Vector2I(left.X * right.X, left.Y * right.Y); + new(left.X * right.X, left.Y * right.Y); public static Vector2I operator /(Vector2I left, Vector2I right) => - new Vector2I(left.X / right.X, left.Y / right.Y); + new(left.X / right.X, left.Y / right.Y); public static Vector2I operator %(Vector2I left, Vector2I right) => - new Vector2I(left.X % right.X, left.Y % right.Y); + new(left.X % right.X, left.Y % right.Y); public static Vector2I operator +(Vector2I vector, T scalar) => - new Vector2I(vector.X + scalar, vector.Y + scalar); + new(vector.X + scalar, vector.Y + scalar); public static Vector2I operator -(Vector2I vector, T scalar) => - new Vector2I(vector.X - scalar, vector.Y - scalar); + new(vector.X - scalar, vector.Y - scalar); public static Vector2I operator *(Vector2I vector, T scalar) => - new Vector2I(vector.X * scalar, vector.Y * scalar); + new(vector.X * scalar, vector.Y * scalar); public static Vector2I operator *(T scalar, Vector2I vector) => - new Vector2I(scalar * vector.X, scalar * vector.Y); + new(scalar * vector.X, scalar * vector.Y); public static Vector2I operator /(Vector2I vector, T scalar) => - new Vector2I(vector.X / scalar, vector.Y / scalar); + new(vector.X / scalar, vector.Y / scalar); public static Vector2I operator %(Vector2I vector, T scalar) => - new Vector2I(vector.X % scalar, vector.Y % scalar); + new(vector.X % scalar, vector.Y % scalar); public static Vector2I operator ~(Vector2I vector) => new Vector2I(~vector.X, ~vector.Y); @@ -390,56 +407,136 @@ public static Vector2I Reflect(Vector2I vector, Vector2I normal) return vector - (normal * (dot + dot)); } - public static Vector2I Log(this Vector2I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log(x.X), TSelf.Log(x.Y)); - - public static Vector2I Log(this Vector2I x, Vector2I newBase) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log(x.X, newBase.X), TSelf.Log(x.Y, newBase.Y)); - - public static Vector2I LogP1(this Vector2I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.LogP1(x.X), TSelf.LogP1(x.Y)); - - public static Vector2I Log2(this Vector2I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log2(x.X), TSelf.Log2(x.Y)); - - public static Vector2I Log2P1(this Vector2I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log2P1(x.X), TSelf.Log2P1(x.Y)); - - public static Vector2I Log10(this Vector2I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log10(x.X), TSelf.Log10(x.Y)); - - public static Vector2I Log10P1(this Vector2I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log10P1(x.X), TSelf.Log10P1(x.Y)); - - public static Vector2I Exp(this Vector2I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.Exp(x.X), TSelf.Exp(x.Y)); - - public static Vector2I ExpM1(this Vector2I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.ExpM1(x.X), TSelf.ExpM1(x.Y)); - - public static Vector2I Exp2(this Vector2I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.Exp2(x.X), TSelf.Exp2(x.Y)); - - public static Vector2I Exp2M1(this Vector2I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.Exp2M1(x.X), TSelf.Exp2M1(x.Y)); - - public static Vector2I Exp10(this Vector2I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.Exp10(x.X), TSelf.Exp10(x.Y)); - - public static Vector2I Exp10M1(this Vector2I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.Exp10M1(x.X), TSelf.Exp10M1(x.Y)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2I Sign(this Vector2I value) + where TSelf : IBinaryInteger => + new(TSelf.Sign(value.X), TSelf.Sign(value.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2I Max(this Vector2I x, Vector2I y) + where TSelf : IBinaryInteger => + new(TSelf.Max(x.X, y.X), TSelf.Max(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector2I Max(this Vector2I x, TSelf y) + where TSelf : IBinaryInteger => + new(TSelf.Max(x.X, y), TSelf.Max(x.Y, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2I MaxNumber(this Vector2I x, Vector2I y) + where TSelf : IBinaryInteger => + new(TSelf.MaxNumber(x.X, y.X), TSelf.MaxNumber(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector2I MaxNumber(this Vector2I x, TSelf y) + where TSelf : IBinaryInteger => + new(TSelf.MaxNumber(x.X, y), TSelf.MaxNumber(x.Y, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2I Min(this Vector2I x, Vector2I y) + where TSelf : IBinaryInteger => + new(TSelf.Min(x.X, y.X), TSelf.Min(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector2I Min(this Vector2I x, TSelf y) + where TSelf : IBinaryInteger => + new(TSelf.Min(x.X, y), TSelf.Min(x.Y, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2I MinNumber(this Vector2I x, Vector2I y) + where TSelf : IBinaryInteger => + new(TSelf.MinNumber(x.X, y.X), TSelf.MinNumber(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector2I MinNumber(this Vector2I x, TSelf y) + where TSelf : IBinaryInteger => + new(TSelf.MinNumber(x.X, y), TSelf.MinNumber(x.Y, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2I Clamp(this Vector2I value, Vector2I min, Vector2I max) + where TSelf : IBinaryInteger => + new(TSelf.Clamp(value.X, min.X, max.X), TSelf.Clamp(value.Y, min.Y, max.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + /// A single value provided for . + public static Vector2I Clamp(this Vector2I value, TSelf min, TSelf max) + where TSelf : IBinaryInteger => + new(TSelf.Clamp(value.X, min, max), TSelf.Clamp(value.Y, min, max)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2I CopySign(this Vector2I value, Vector2I sign) + where TSelf : IBinaryInteger => + new(TSelf.CopySign(value.X, sign.X), TSelf.CopySign(value.Y, sign.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector2I CopySign(this Vector2I value, TSelf sign) + where TSelf : IBinaryInteger => + new(TSelf.CopySign(value.X, sign), TSelf.CopySign(value.Y, sign)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2I Abs(this Vector2I value) + where TSelf : IBinaryInteger => + new(TSelf.Abs(value.X), TSelf.Abs(value.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2I MaxMagnitude(this Vector2I x, Vector2I y) + where TSelf : IBinaryInteger => + new(TSelf.MaxMagnitude(x.X, y.X), TSelf.MaxMagnitude(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2I MaxMagnitudeNumber(this Vector2I x, Vector2I y) + where TSelf : IBinaryInteger => + new(TSelf.MaxMagnitudeNumber(x.X, y.X), TSelf.MaxMagnitudeNumber(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2I MinMagnitude(this Vector2I x, Vector2I y) + where TSelf : IBinaryInteger => + new(TSelf.MinMagnitude(x.X, y.X), TSelf.MinMagnitude(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector2I MinMagnitudeNumber(this Vector2I x, Vector2I y) + where TSelf : IBinaryInteger => + new(TSelf.MinMagnitudeNumber(x.X, y.X), TSelf.MinMagnitudeNumber(x.Y, y.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2I Log2(this Vector2I value) + where TSelf : IBinaryInteger => + new(TSelf.Log2(value.X), TSelf.Log2(value.Y)); } } diff --git a/sources/Maths/Maths/Vector3F.gen.cs b/sources/Maths/Maths/Vector3F.gen.cs index 6c9a8a9f67..2c0d24db9c 100644 --- a/sources/Maths/Maths/Vector3F.gen.cs +++ b/sources/Maths/Maths/Vector3F.gen.cs @@ -47,19 +47,19 @@ public Vector3F(ReadOnlySpan values) } /// Gets a vector whose 3 elements are equal to one. - public static Vector3F One => new(Scalar.One); + public static Vector3F One => new(T.One); /// Returns a vector whose 3 elements are equal to zero. public static Vector3F Zero => default; /// Gets the vector (1, 0, 0). - public static Vector3F UnitX => new(Scalar.One, Scalar.Zero, Scalar.Zero); + public static Vector3F UnitX => new(T.One, T.Zero, T.Zero); /// Gets the vector (0, 1, 0). - public static Vector3F UnitY => new(Scalar.Zero, Scalar.One, Scalar.Zero); + public static Vector3F UnitY => new(T.Zero, T.One, T.Zero); /// Gets the vector (0, 0, 1). - public static Vector3F UnitZ => new(Scalar.Zero, Scalar.Zero, Scalar.One); + public static Vector3F UnitZ => new(T.Zero, T.Zero, T.One); /// Gets the squared length of the vector (dot product with itself). public T LengthSquared => Vector3F.Dot(this, this); @@ -339,44 +339,63 @@ static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IForm /// public override int GetHashCode() => HashCode.Combine(X, Y, Z); + /// Desconstructs a vector into its components. + /// The X component. + /// The Y component. + /// The Z component. + public void Deconstruct(out T x, out T y, out T z) + { + x = X; + y = Y; + z = Z; + } + + /// Implicitly casts a to a . + public static implicit operator Vector3F((T X, T Y, T Z) v) => + new(v.X, v.Y, v.Z); + + /// Implicitly casts a to a . + public static implicit operator (T X, T Y, T Z)(Vector3F v) => + (v.X, v.Y, v.Z); + public static Vector3F operator +(Vector3F vector) => vector; public static Vector3F operator -(Vector3F vector) => - new Vector3F(-vector.X, -vector.Y, -vector.Z); + new(-vector.X, -vector.Y, -vector.Z); public static Vector3F operator +(Vector3F left, Vector3F right) => - new Vector3F(left.X + right.X, left.Y + right.Y, left.Z + right.Z); + new(left.X + right.X, left.Y + right.Y, left.Z + right.Z); public static Vector3F operator -(Vector3F left, Vector3F right) => - new Vector3F(left.X - right.X, left.Y - right.Y, left.Z - right.Z); + new(left.X - right.X, left.Y - right.Y, left.Z - right.Z); public static Vector3F operator *(Vector3F left, Vector3F right) => - new Vector3F(left.X * right.X, left.Y * right.Y, left.Z * right.Z); + new(left.X * right.X, left.Y * right.Y, left.Z * right.Z); public static Vector3F operator /(Vector3F left, Vector3F right) => - new Vector3F(left.X / right.X, left.Y / right.Y, left.Z / right.Z); + new(left.X / right.X, left.Y / right.Y, left.Z / right.Z); public static Vector3F operator %(Vector3F left, Vector3F right) => - new Vector3F(left.X % right.X, left.Y % right.Y, left.Z % right.Z); + new(left.X % right.X, left.Y % right.Y, left.Z % right.Z); public static Vector3F operator +(Vector3F vector, T scalar) => - new Vector3F(vector.X + scalar, vector.Y + scalar, vector.Z + scalar); + new(vector.X + scalar, vector.Y + scalar, vector.Z + scalar); public static Vector3F operator -(Vector3F vector, T scalar) => - new Vector3F(vector.X - scalar, vector.Y - scalar, vector.Z - scalar); + new(vector.X - scalar, vector.Y - scalar, vector.Z - scalar); public static Vector3F operator *(Vector3F vector, T scalar) => - new Vector3F(vector.X * scalar, vector.Y * scalar, vector.Z * scalar); + new(vector.X * scalar, vector.Y * scalar, vector.Z * scalar); public static Vector3F operator *(T scalar, Vector3F vector) => - new Vector3F(scalar * vector.X, scalar * vector.Y, scalar * vector.Z); + new(scalar * vector.X, scalar * vector.Y, scalar * vector.Z); public static Vector3F operator /(Vector3F vector, T scalar) => - new Vector3F(vector.X / scalar, vector.Y / scalar, vector.Z / scalar); + new(vector.X / scalar, vector.Y / scalar, vector.Z / scalar); public static Vector3F operator %(Vector3F vector, T scalar) => - new Vector3F(vector.X % scalar, vector.Y % scalar, vector.Z % scalar); + new(vector.X % scalar, vector.Y % scalar, vector.Z % scalar); } @@ -408,56 +427,504 @@ public static Vector3F Normalize(this Vector3F vector) return length != T.Zero ? vector / length : Vector3F.Zero; } + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3I Sign(this Vector3F value) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Sign(value.X), TSelf.Sign(value.Y), TSelf.Sign(value.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F Max(this Vector3F x, Vector3F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Max(x.X, y.X), TSelf.Max(x.Y, y.Y), TSelf.Max(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector3F Max(this Vector3F x, TSelf y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Max(x.X, y), TSelf.Max(x.Y, y), TSelf.Max(x.Z, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F MaxNumber(this Vector3F x, Vector3F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MaxNumber(x.X, y.X), TSelf.MaxNumber(x.Y, y.Y), TSelf.MaxNumber(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector3F MaxNumber(this Vector3F x, TSelf y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MaxNumber(x.X, y), TSelf.MaxNumber(x.Y, y), TSelf.MaxNumber(x.Z, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F Min(this Vector3F x, Vector3F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Min(x.X, y.X), TSelf.Min(x.Y, y.Y), TSelf.Min(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector3F Min(this Vector3F x, TSelf y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Min(x.X, y), TSelf.Min(x.Y, y), TSelf.Min(x.Z, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F MinNumber(this Vector3F x, Vector3F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MinNumber(x.X, y.X), TSelf.MinNumber(x.Y, y.Y), TSelf.MinNumber(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector3F MinNumber(this Vector3F x, TSelf y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MinNumber(x.X, y), TSelf.MinNumber(x.Y, y), TSelf.MinNumber(x.Z, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F Clamp(this Vector3F value, Vector3F min, Vector3F max) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Clamp(value.X, min.X, max.X), TSelf.Clamp(value.Y, min.Y, max.Y), TSelf.Clamp(value.Z, min.Z, max.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + /// A single value provided for . + public static Vector3F Clamp(this Vector3F value, TSelf min, TSelf max) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Clamp(value.X, min, max), TSelf.Clamp(value.Y, min, max), TSelf.Clamp(value.Z, min, max)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F CopySign(this Vector3F value, Vector3F sign) + where TSelf : IFloatingPointIeee754 => + new(TSelf.CopySign(value.X, sign.X), TSelf.CopySign(value.Y, sign.Y), TSelf.CopySign(value.Z, sign.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector3F CopySign(this Vector3F value, TSelf sign) + where TSelf : IFloatingPointIeee754 => + new(TSelf.CopySign(value.X, sign), TSelf.CopySign(value.Y, sign), TSelf.CopySign(value.Z, sign)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Abs(this Vector3F value) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Abs(value.X), TSelf.Abs(value.Y), TSelf.Abs(value.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F MaxMagnitude(this Vector3F x, Vector3F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MaxMagnitude(x.X, y.X), TSelf.MaxMagnitude(x.Y, y.Y), TSelf.MaxMagnitude(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F MaxMagnitudeNumber(this Vector3F x, Vector3F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MaxMagnitudeNumber(x.X, y.X), TSelf.MaxMagnitudeNumber(x.Y, y.Y), TSelf.MaxMagnitudeNumber(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F MinMagnitude(this Vector3F x, Vector3F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MinMagnitude(x.X, y.X), TSelf.MinMagnitude(x.Y, y.Y), TSelf.MinMagnitude(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F MinMagnitudeNumber(this Vector3F x, Vector3F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MinMagnitudeNumber(x.X, y.X), TSelf.MinMagnitudeNumber(x.Y, y.Y), TSelf.MinMagnitudeNumber(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Ceiling(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Ceiling(x.X), TSelf.Ceiling(x.Y), TSelf.Ceiling(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Floor(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Floor(x.X), TSelf.Floor(x.Y), TSelf.Floor(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Round(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Round(x.X), TSelf.Round(x.Y), TSelf.Round(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + /// A single value provided for . + public static Vector3F Round(this Vector3F x, int digits, MidpointRounding mode) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Round(x.X, digits, mode), TSelf.Round(x.Y, digits, mode), TSelf.Round(x.Z, digits, mode)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Truncate(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Truncate(x.X), TSelf.Truncate(x.Y), TSelf.Truncate(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F Atan2(this Vector3F y, Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Atan2(y.X, x.X), TSelf.Atan2(y.Y, x.Y), TSelf.Atan2(y.Z, x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F Atan2Pi(this Vector3F y, Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Atan2Pi(y.X, x.X), TSelf.Atan2Pi(y.Y, x.Y), TSelf.Atan2Pi(y.Z, x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector3F Lerp(this Vector3F value1, Vector3F value2, TSelf amount) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Lerp(value1.X, value2.X, amount), TSelf.Lerp(value1.Y, value2.Y, amount), TSelf.Lerp(value1.Z, value2.Z, amount)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F BitDecrement(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.BitDecrement(x.X), TSelf.BitDecrement(x.Y), TSelf.BitDecrement(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F BitIncrement(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.BitIncrement(x.X), TSelf.BitIncrement(x.Y), TSelf.BitIncrement(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F FusedMultiplyAdd(this Vector3F left, Vector3F right, Vector3F addend) + where TSelf : IFloatingPointIeee754 => + new(TSelf.FusedMultiplyAdd(left.X, right.X, addend.X), TSelf.FusedMultiplyAdd(left.Y, right.Y, addend.Y), TSelf.FusedMultiplyAdd(left.Z, right.Z, addend.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + /// A single value provided for . + public static Vector3F FusedMultiplyAdd(this Vector3F left, TSelf right, TSelf addend) + where TSelf : IFloatingPointIeee754 => + new(TSelf.FusedMultiplyAdd(left.X, right, addend), TSelf.FusedMultiplyAdd(left.Y, right, addend), TSelf.FusedMultiplyAdd(left.Z, right, addend)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F Ieee754Remainder(this Vector3F left, Vector3F right) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Ieee754Remainder(left.X, right.X), TSelf.Ieee754Remainder(left.Y, right.Y), TSelf.Ieee754Remainder(left.Z, right.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector3F Ieee754Remainder(this Vector3F left, TSelf right) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Ieee754Remainder(left.X, right), TSelf.Ieee754Remainder(left.Y, right), TSelf.Ieee754Remainder(left.Z, right)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3I ILogB(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.ILogB(x.X), TSelf.ILogB(x.Y), TSelf.ILogB(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F ReciprocalEstimate(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.ReciprocalEstimate(x.X), TSelf.ReciprocalEstimate(x.Y), TSelf.ReciprocalEstimate(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F ReciprocalSqrtEstimate(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.ReciprocalSqrtEstimate(x.X), TSelf.ReciprocalSqrtEstimate(x.Y), TSelf.ReciprocalSqrtEstimate(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F ScaleB(this Vector3F x, Vector3I n) + where TSelf : IFloatingPointIeee754 => + new(TSelf.ScaleB(x.X, n.X), TSelf.ScaleB(x.Y, n.Y), TSelf.ScaleB(x.Z, n.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector3F ScaleB(this Vector3F x, int n) + where TSelf : IFloatingPointIeee754 => + new(TSelf.ScaleB(x.X, n), TSelf.ScaleB(x.Y, n), TSelf.ScaleB(x.Z, n)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F Pow(this Vector3F x, Vector3F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Pow(x.X, y.X), TSelf.Pow(x.Y, y.Y), TSelf.Pow(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector3F Pow(this Vector3F x, TSelf y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Pow(x.X, y), TSelf.Pow(x.Y, y), TSelf.Pow(x.Z, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Cbrt(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Cbrt(x.X), TSelf.Cbrt(x.Y), TSelf.Cbrt(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Sqrt(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Sqrt(x.X), TSelf.Sqrt(x.Y), TSelf.Sqrt(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector3F RootN(this Vector3F x, int n) + where TSelf : IFloatingPointIeee754 => + new(TSelf.RootN(x.X, n), TSelf.RootN(x.Y, n), TSelf.RootN(x.Z, n)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F RootN(this Vector3F x, Vector3I n) + where TSelf : IFloatingPointIeee754 => + new(TSelf.RootN(x.X, n.X), TSelf.RootN(x.Y, n.Y), TSelf.RootN(x.Z, n.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3F Hypot(this Vector3F x, Vector3F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Hypot(x.X, y.X), TSelf.Hypot(x.Y, y.Y), TSelf.Hypot(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector3F Log(this Vector3F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Log(x.X), TSelf.Log(x.Y), TSelf.Log(x.Z)); - public static Vector3F Log(this Vector3F x, Vector3F newBase) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.Log(x.X, newBase.X), TSelf.Log(x.Y, newBase.Y), TSelf.Log(x.Z, newBase.Z)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector3F Log(this Vector3F x, TSelf newBase) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Log(x.X, newBase), TSelf.Log(x.Y, newBase), TSelf.Log(x.Z, newBase)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector3F LogP1(this Vector3F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.LogP1(x.X), TSelf.LogP1(x.Y), TSelf.LogP1(x.Z)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector3F Log2(this Vector3F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Log2(x.X), TSelf.Log2(x.Y), TSelf.Log2(x.Z)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector3F Log2P1(this Vector3F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Log2P1(x.X), TSelf.Log2P1(x.Y), TSelf.Log2P1(x.Z)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector3F Log10(this Vector3F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Log10(x.X), TSelf.Log10(x.Y), TSelf.Log10(x.Z)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector3F Log10P1(this Vector3F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Log10P1(x.X), TSelf.Log10P1(x.Y), TSelf.Log10P1(x.Z)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector3F Exp(this Vector3F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Exp(x.X), TSelf.Exp(x.Y), TSelf.Exp(x.Z)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector3F ExpM1(this Vector3F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.ExpM1(x.X), TSelf.ExpM1(x.Y), TSelf.ExpM1(x.Z)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector3F Exp2(this Vector3F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Exp2(x.X), TSelf.Exp2(x.Y), TSelf.Exp2(x.Z)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector3F Exp2M1(this Vector3F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Exp2M1(x.X), TSelf.Exp2M1(x.Y), TSelf.Exp2M1(x.Z)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector3F Exp10(this Vector3F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Exp10(x.X), TSelf.Exp10(x.Y), TSelf.Exp10(x.Z)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector3F Exp10M1(this Vector3F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Exp10M1(x.X), TSelf.Exp10M1(x.Y), TSelf.Exp10M1(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Acos(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Acos(x.X), TSelf.Acos(x.Y), TSelf.Acos(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F AcosPi(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.AcosPi(x.X), TSelf.AcosPi(x.Y), TSelf.AcosPi(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Asin(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Asin(x.X), TSelf.Asin(x.Y), TSelf.Asin(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F AsinPi(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.AsinPi(x.X), TSelf.AsinPi(x.Y), TSelf.AsinPi(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Atan(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Atan(x.X), TSelf.Atan(x.Y), TSelf.Atan(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F AtanPi(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.AtanPi(x.X), TSelf.AtanPi(x.Y), TSelf.AtanPi(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Cos(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Cos(x.X), TSelf.Cos(x.Y), TSelf.Cos(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F CosPi(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.CosPi(x.X), TSelf.CosPi(x.Y), TSelf.CosPi(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Sin(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Sin(x.X), TSelf.Sin(x.Y), TSelf.Sin(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F SinPi(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.SinPi(x.X), TSelf.SinPi(x.Y), TSelf.SinPi(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Tan(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Tan(x.X), TSelf.Tan(x.Y), TSelf.Tan(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F TanPi(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.TanPi(x.X), TSelf.TanPi(x.Y), TSelf.TanPi(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F DegreesToRadians(this Vector3F degrees) + where TSelf : IFloatingPointIeee754 => + new(TSelf.DegreesToRadians(degrees.X), TSelf.DegreesToRadians(degrees.Y), TSelf.DegreesToRadians(degrees.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F RadiansToDegrees(this Vector3F radians) + where TSelf : IFloatingPointIeee754 => + new(TSelf.RadiansToDegrees(radians.X), TSelf.RadiansToDegrees(radians.Y), TSelf.RadiansToDegrees(radians.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Acosh(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Acosh(x.X), TSelf.Acosh(x.Y), TSelf.Acosh(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Asinh(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Asinh(x.X), TSelf.Asinh(x.Y), TSelf.Asinh(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Atanh(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Atanh(x.X), TSelf.Atanh(x.Y), TSelf.Atanh(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Cosh(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Cosh(x.X), TSelf.Cosh(x.Y), TSelf.Cosh(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Sinh(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Sinh(x.X), TSelf.Sinh(x.Y), TSelf.Sinh(x.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3F Tanh(this Vector3F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Tanh(x.X), TSelf.Tanh(x.Y), TSelf.Tanh(x.Z)); } } diff --git a/sources/Maths/Maths/Vector3I.cs b/sources/Maths/Maths/Vector3I.cs index 167273b467..4141292c52 100644 --- a/sources/Maths/Maths/Vector3I.cs +++ b/sources/Maths/Maths/Vector3I.cs @@ -30,101 +30,6 @@ public static Vector3I Cross(Vector3I left, Vector3I right) => (left.X * right.Y) - (left.Y * right.X) ); - /// Returns a vector with the component-wise maximum of this and another vector. - public Vector3I Max(Vector3I other) => - new Vector3I(T.Max(X, other.X), T.Max(Y, other.Y), T.Max(Z, other.Z)); - - /// Returns a vector with the component-wise maximum of two vectors. - public static Vector3I Max(Vector3I left, Vector3I right) => - new Vector3I(T.Max(left.X, right.X), T.Max(left.Y, right.Y), T.Max(left.Z, right.Z)); - - /// Returns a vector with the component-wise maximum of this vector and a scalar. - public Vector3I Max(T scalar) => - new Vector3I(T.Max(X, scalar), T.Max(Y, scalar), T.Max(Z, scalar)); - - /// Returns a vector with the component-wise maximum of a vector and a scalar. - public static Vector3I Max(Vector3I vector, T scalar) => - new Vector3I(T.Max(vector.X, scalar), T.Max(vector.Y, scalar), T.Max(vector.Z, scalar)); - - /// Returns a vector with the component-wise minimum of this and another vector. - public Vector3I Min(Vector3I other) => - new Vector3I(T.Min(X, other.X), T.Min(Y, other.Y), T.Min(Z, other.Z)); - - /// Returns a vector with the component-wise minimum of two vectors. - public static Vector3I Min(Vector3I left, Vector3I right) => - new Vector3I(T.Min(left.X, right.X), T.Min(left.Y, right.Y), T.Min(left.Z, right.Z)); - - /// Returns a vector with the component-wise minimum of this vector and a scalar. - public Vector3I Min(T scalar) => - new Vector3I(T.Min(X, scalar), T.Min(Y, scalar), T.Min(Z, scalar)); - - /// Returns a vector with the component-wise minimum of a vector and a scalar. - public static Vector3I Min(Vector3I vector, T scalar) => - new Vector3I(T.Min(vector.X, scalar), T.Min(vector.Y, scalar), T.Min(vector.Z, scalar)); - - /// Clamps this vector's components between the corresponding Min and Max vectors. - public Vector3I Clamp(Vector3I min, Vector3I max) => - new Vector3I( - T.Clamp(X, min.X, max.X), - T.Clamp(Y, min.Y, max.Y), - T.Clamp(Z, min.Z, max.Z) - ); - - /// Clamps the components of a vector between the corresponding Min and Max vectors. - public static Vector3I Clamp(Vector3I vector, Vector3I min, Vector3I max) => - new Vector3I( - T.Clamp(vector.X, min.X, max.X), - T.Clamp(vector.Y, min.Y, max.Y), - T.Clamp(vector.Z, min.Z, max.Z) - ); - - /// Clamps this vector's components between the Min and Max scalar values. - public Vector3I Clamp(T min, T max) => - new Vector3I( - T.Clamp(X, min, max), - T.Clamp(Y, min, max), - T.Clamp(Z, min, max) - ); - - /// Clamps the components of a vector between the Min and Max scalar values. - public static Vector3I Clamp(Vector3I vector, T min, T max) => - new Vector3I( - T.Clamp(vector.X, min, max), - T.Clamp(vector.Y, min, max), - T.Clamp(vector.Z, min, max) - ); - - /// Returns a vector with the absolute value of each component of this vector. - public Vector3I Abs() => new Vector3I(T.Abs(X), T.Abs(Y), T.Abs(Z)); - - /// Returns a vector with the absolute value of each component of the specified vector. - public static Vector3I Abs(Vector3I vector) => - new Vector3I(T.Abs(vector.X), T.Abs(vector.Y), T.Abs(vector.Z)); - - /// Returns a vector where each component is the sign of the original vector's component. - public Vector3I Sign() => - new Vector3I(T.CreateChecked(T.Sign(X)), T.CreateChecked(T.Sign(Y)), T.CreateChecked(T.Sign(Z))); - - /// Returns a vector where each component is the sign of the input vector's component. - public static Vector3I Sign(Vector3I vector) => - new Vector3I(T.CreateChecked(T.Sign(vector.X)), T.CreateChecked(T.Sign(vector.Y)), T.CreateChecked(T.Sign(vector.Z))); - - /// Copies the sign of each component from another vector to this vector's components. - public Vector3I CopySign(Vector3I signSource) => - new Vector3I(T.CopySign(X, signSource.X), T.CopySign(Y, signSource.Y), T.CopySign(Z, signSource.Z)); - - /// Copies the sign of each component from another vector to a new vector. - public static Vector3I CopySign(Vector3I value, Vector3I signSource) => - new Vector3I(T.CopySign(value.X, signSource.X), T.CopySign(value.Y, signSource.Y), T.CopySign(value.Z, signSource.Z)); - - /// Copies the sign of a scalar onto each component of this vector. - public Vector3I CopySign(T signScalar) => - new Vector3I(T.CopySign(X, signScalar), T.CopySign(Y, signScalar), T.CopySign(Z, signScalar)); - - /// Copies the sign of a scalar onto each component of a new vector. - public static Vector3I CopySign(Vector3I value, T signScalar) => - new Vector3I(T.CopySign(value.X, signScalar), T.CopySign(value.Y, signScalar), T.CopySign(value.Z, signScalar)); - // Casts /// Explicitly casts a to a . @@ -135,10 +40,6 @@ public static explicit operator Vector3I(System.Numerics.Vector3 v) => public static explicit operator System.Numerics.Vector3(Vector3I v) => new System.Numerics.Vector3(Convert.ToSingle(v.X), Convert.ToSingle(v.Y), Convert.ToSingle(v.Z)); - // IBinaryInteger - public static Vector3I Log2(Vector3I x) => - new Vector3I(T.Log2(x.X), T.Log2(x.Y), T.Log2(x.Z)); - public static (Vector3I Quotient, Vector3I Remainder) DivRem(Vector3I left, Vector3I right) { var (qX, rX) = T.DivRem(left.X, right.X); @@ -146,8 +47,5 @@ public static (Vector3I Quotient, Vector3I Remainder) DivRem(Vector3I l var (qZ, rZ) = T.DivRem(left.Z, right.Z); return (new Vector3I(qX, qY, qZ), new Vector3I(rX, rY, rZ)); } - - public static Vector3I PopCount(Vector3I x) => - new Vector3I(T.PopCount(x.X), T.PopCount(x.Y), T.PopCount(x.Z)); } } diff --git a/sources/Maths/Maths/Vector3I.gen.cs b/sources/Maths/Maths/Vector3I.gen.cs index 05bb368e10..197cb262d2 100644 --- a/sources/Maths/Maths/Vector3I.gen.cs +++ b/sources/Maths/Maths/Vector3I.gen.cs @@ -47,19 +47,19 @@ public Vector3I(ReadOnlySpan values) } /// Gets a vector whose 3 elements are equal to one. - public static Vector3I One => new(Scalar.One); + public static Vector3I One => new(T.One); /// Returns a vector whose 3 elements are equal to zero. public static Vector3I Zero => default; /// Gets the vector (1, 0, 0). - public static Vector3I UnitX => new(Scalar.One, Scalar.Zero, Scalar.Zero); + public static Vector3I UnitX => new(T.One, T.Zero, T.Zero); /// Gets the vector (0, 1, 0). - public static Vector3I UnitY => new(Scalar.Zero, Scalar.One, Scalar.Zero); + public static Vector3I UnitY => new(T.Zero, T.One, T.Zero); /// Gets the vector (0, 0, 1). - public static Vector3I UnitZ => new(Scalar.Zero, Scalar.Zero, Scalar.One); + public static Vector3I UnitZ => new(T.Zero, T.Zero, T.One); /// Gets a vector with all bits set for each component. public static Vector3I AllBitsSet => new Vector3I(T.AllBitsSet, T.AllBitsSet, T.AllBitsSet); @@ -342,44 +342,63 @@ static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IForm /// public override int GetHashCode() => HashCode.Combine(X, Y, Z); + /// Desconstructs a vector into its components. + /// The X component. + /// The Y component. + /// The Z component. + public void Deconstruct(out T x, out T y, out T z) + { + x = X; + y = Y; + z = Z; + } + + /// Implicitly casts a to a . + public static implicit operator Vector3I((T X, T Y, T Z) v) => + new(v.X, v.Y, v.Z); + + /// Implicitly casts a to a . + public static implicit operator (T X, T Y, T Z)(Vector3I v) => + (v.X, v.Y, v.Z); + public static Vector3I operator +(Vector3I vector) => vector; public static Vector3I operator -(Vector3I vector) => - new Vector3I(-vector.X, -vector.Y, -vector.Z); + new(-vector.X, -vector.Y, -vector.Z); public static Vector3I operator +(Vector3I left, Vector3I right) => - new Vector3I(left.X + right.X, left.Y + right.Y, left.Z + right.Z); + new(left.X + right.X, left.Y + right.Y, left.Z + right.Z); public static Vector3I operator -(Vector3I left, Vector3I right) => - new Vector3I(left.X - right.X, left.Y - right.Y, left.Z - right.Z); + new(left.X - right.X, left.Y - right.Y, left.Z - right.Z); public static Vector3I operator *(Vector3I left, Vector3I right) => - new Vector3I(left.X * right.X, left.Y * right.Y, left.Z * right.Z); + new(left.X * right.X, left.Y * right.Y, left.Z * right.Z); public static Vector3I operator /(Vector3I left, Vector3I right) => - new Vector3I(left.X / right.X, left.Y / right.Y, left.Z / right.Z); + new(left.X / right.X, left.Y / right.Y, left.Z / right.Z); public static Vector3I operator %(Vector3I left, Vector3I right) => - new Vector3I(left.X % right.X, left.Y % right.Y, left.Z % right.Z); + new(left.X % right.X, left.Y % right.Y, left.Z % right.Z); public static Vector3I operator +(Vector3I vector, T scalar) => - new Vector3I(vector.X + scalar, vector.Y + scalar, vector.Z + scalar); + new(vector.X + scalar, vector.Y + scalar, vector.Z + scalar); public static Vector3I operator -(Vector3I vector, T scalar) => - new Vector3I(vector.X - scalar, vector.Y - scalar, vector.Z - scalar); + new(vector.X - scalar, vector.Y - scalar, vector.Z - scalar); public static Vector3I operator *(Vector3I vector, T scalar) => - new Vector3I(vector.X * scalar, vector.Y * scalar, vector.Z * scalar); + new(vector.X * scalar, vector.Y * scalar, vector.Z * scalar); public static Vector3I operator *(T scalar, Vector3I vector) => - new Vector3I(scalar * vector.X, scalar * vector.Y, scalar * vector.Z); + new(scalar * vector.X, scalar * vector.Y, scalar * vector.Z); public static Vector3I operator /(Vector3I vector, T scalar) => - new Vector3I(vector.X / scalar, vector.Y / scalar, vector.Z / scalar); + new(vector.X / scalar, vector.Y / scalar, vector.Z / scalar); public static Vector3I operator %(Vector3I vector, T scalar) => - new Vector3I(vector.X % scalar, vector.Y % scalar, vector.Z % scalar); + new(vector.X % scalar, vector.Y % scalar, vector.Z % scalar); public static Vector3I operator ~(Vector3I vector) => new Vector3I(~vector.X, ~vector.Y, ~vector.Z); @@ -427,56 +446,136 @@ public static Vector3I Reflect(Vector3I vector, Vector3I normal) return vector - (normal * (dot + dot)); } - public static Vector3I Log(this Vector3I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log(x.X), TSelf.Log(x.Y), TSelf.Log(x.Z)); - - public static Vector3I Log(this Vector3I x, Vector3I newBase) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log(x.X, newBase.X), TSelf.Log(x.Y, newBase.Y), TSelf.Log(x.Z, newBase.Z)); - - public static Vector3I LogP1(this Vector3I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.LogP1(x.X), TSelf.LogP1(x.Y), TSelf.LogP1(x.Z)); - - public static Vector3I Log2(this Vector3I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log2(x.X), TSelf.Log2(x.Y), TSelf.Log2(x.Z)); - - public static Vector3I Log2P1(this Vector3I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log2P1(x.X), TSelf.Log2P1(x.Y), TSelf.Log2P1(x.Z)); - - public static Vector3I Log10(this Vector3I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log10(x.X), TSelf.Log10(x.Y), TSelf.Log10(x.Z)); - - public static Vector3I Log10P1(this Vector3I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log10P1(x.X), TSelf.Log10P1(x.Y), TSelf.Log10P1(x.Z)); - - public static Vector3I Exp(this Vector3I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.Exp(x.X), TSelf.Exp(x.Y), TSelf.Exp(x.Z)); - - public static Vector3I ExpM1(this Vector3I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.ExpM1(x.X), TSelf.ExpM1(x.Y), TSelf.ExpM1(x.Z)); - - public static Vector3I Exp2(this Vector3I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.Exp2(x.X), TSelf.Exp2(x.Y), TSelf.Exp2(x.Z)); - - public static Vector3I Exp2M1(this Vector3I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.Exp2M1(x.X), TSelf.Exp2M1(x.Y), TSelf.Exp2M1(x.Z)); - - public static Vector3I Exp10(this Vector3I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.Exp10(x.X), TSelf.Exp10(x.Y), TSelf.Exp10(x.Z)); - - public static Vector3I Exp10M1(this Vector3I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.Exp10M1(x.X), TSelf.Exp10M1(x.Y), TSelf.Exp10M1(x.Z)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3I Sign(this Vector3I value) + where TSelf : IBinaryInteger => + new(TSelf.Sign(value.X), TSelf.Sign(value.Y), TSelf.Sign(value.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3I Max(this Vector3I x, Vector3I y) + where TSelf : IBinaryInteger => + new(TSelf.Max(x.X, y.X), TSelf.Max(x.Y, y.Y), TSelf.Max(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector3I Max(this Vector3I x, TSelf y) + where TSelf : IBinaryInteger => + new(TSelf.Max(x.X, y), TSelf.Max(x.Y, y), TSelf.Max(x.Z, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3I MaxNumber(this Vector3I x, Vector3I y) + where TSelf : IBinaryInteger => + new(TSelf.MaxNumber(x.X, y.X), TSelf.MaxNumber(x.Y, y.Y), TSelf.MaxNumber(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector3I MaxNumber(this Vector3I x, TSelf y) + where TSelf : IBinaryInteger => + new(TSelf.MaxNumber(x.X, y), TSelf.MaxNumber(x.Y, y), TSelf.MaxNumber(x.Z, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3I Min(this Vector3I x, Vector3I y) + where TSelf : IBinaryInteger => + new(TSelf.Min(x.X, y.X), TSelf.Min(x.Y, y.Y), TSelf.Min(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector3I Min(this Vector3I x, TSelf y) + where TSelf : IBinaryInteger => + new(TSelf.Min(x.X, y), TSelf.Min(x.Y, y), TSelf.Min(x.Z, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3I MinNumber(this Vector3I x, Vector3I y) + where TSelf : IBinaryInteger => + new(TSelf.MinNumber(x.X, y.X), TSelf.MinNumber(x.Y, y.Y), TSelf.MinNumber(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector3I MinNumber(this Vector3I x, TSelf y) + where TSelf : IBinaryInteger => + new(TSelf.MinNumber(x.X, y), TSelf.MinNumber(x.Y, y), TSelf.MinNumber(x.Z, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3I Clamp(this Vector3I value, Vector3I min, Vector3I max) + where TSelf : IBinaryInteger => + new(TSelf.Clamp(value.X, min.X, max.X), TSelf.Clamp(value.Y, min.Y, max.Y), TSelf.Clamp(value.Z, min.Z, max.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + /// A single value provided for . + public static Vector3I Clamp(this Vector3I value, TSelf min, TSelf max) + where TSelf : IBinaryInteger => + new(TSelf.Clamp(value.X, min, max), TSelf.Clamp(value.Y, min, max), TSelf.Clamp(value.Z, min, max)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3I CopySign(this Vector3I value, Vector3I sign) + where TSelf : IBinaryInteger => + new(TSelf.CopySign(value.X, sign.X), TSelf.CopySign(value.Y, sign.Y), TSelf.CopySign(value.Z, sign.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector3I CopySign(this Vector3I value, TSelf sign) + where TSelf : IBinaryInteger => + new(TSelf.CopySign(value.X, sign), TSelf.CopySign(value.Y, sign), TSelf.CopySign(value.Z, sign)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3I Abs(this Vector3I value) + where TSelf : IBinaryInteger => + new(TSelf.Abs(value.X), TSelf.Abs(value.Y), TSelf.Abs(value.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3I MaxMagnitude(this Vector3I x, Vector3I y) + where TSelf : IBinaryInteger => + new(TSelf.MaxMagnitude(x.X, y.X), TSelf.MaxMagnitude(x.Y, y.Y), TSelf.MaxMagnitude(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3I MaxMagnitudeNumber(this Vector3I x, Vector3I y) + where TSelf : IBinaryInteger => + new(TSelf.MaxMagnitudeNumber(x.X, y.X), TSelf.MaxMagnitudeNumber(x.Y, y.Y), TSelf.MaxMagnitudeNumber(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3I MinMagnitude(this Vector3I x, Vector3I y) + where TSelf : IBinaryInteger => + new(TSelf.MinMagnitude(x.X, y.X), TSelf.MinMagnitude(x.Y, y.Y), TSelf.MinMagnitude(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector3I MinMagnitudeNumber(this Vector3I x, Vector3I y) + where TSelf : IBinaryInteger => + new(TSelf.MinMagnitudeNumber(x.X, y.X), TSelf.MinMagnitudeNumber(x.Y, y.Y), TSelf.MinMagnitudeNumber(x.Z, y.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3I Log2(this Vector3I value) + where TSelf : IBinaryInteger => + new(TSelf.Log2(value.X), TSelf.Log2(value.Y), TSelf.Log2(value.Z)); } } diff --git a/sources/Maths/Maths/Vector4F.gen.cs b/sources/Maths/Maths/Vector4F.gen.cs index be1a8e23ed..cd0dd8a87d 100644 --- a/sources/Maths/Maths/Vector4F.gen.cs +++ b/sources/Maths/Maths/Vector4F.gen.cs @@ -54,22 +54,22 @@ public Vector4F(ReadOnlySpan values) } /// Gets a vector whose 4 elements are equal to one. - public static Vector4F One => new(Scalar.One); + public static Vector4F One => new(T.One); /// Returns a vector whose 4 elements are equal to zero. public static Vector4F Zero => default; /// Gets the vector (1, 0, 0, 0). - public static Vector4F UnitX => new(Scalar.One, Scalar.Zero, Scalar.Zero, Scalar.Zero); + public static Vector4F UnitX => new(T.One, T.Zero, T.Zero, T.Zero); /// Gets the vector (0, 1, 0, 0). - public static Vector4F UnitY => new(Scalar.Zero, Scalar.One, Scalar.Zero, Scalar.Zero); + public static Vector4F UnitY => new(T.Zero, T.One, T.Zero, T.Zero); /// Gets the vector (0, 0, 1, 0). - public static Vector4F UnitZ => new(Scalar.Zero, Scalar.Zero, Scalar.One, Scalar.Zero); + public static Vector4F UnitZ => new(T.Zero, T.Zero, T.One, T.Zero); /// Gets the vector (0, 0, 0, 1). - public static Vector4F UnitW => new(Scalar.Zero, Scalar.Zero, Scalar.Zero, Scalar.One); + public static Vector4F UnitW => new(T.Zero, T.Zero, T.Zero, T.One); /// Gets the squared length of the vector (dot product with itself). public T LengthSquared => Vector4F.Dot(this, this); @@ -376,44 +376,65 @@ static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IForm /// public override int GetHashCode() => HashCode.Combine(X, Y, Z, W); + /// Desconstructs a vector into its components. + /// The X component. + /// The Y component. + /// The Z component. + /// The W component. + public void Deconstruct(out T x, out T y, out T z, out T w) + { + x = X; + y = Y; + z = Z; + w = W; + } + + /// Implicitly casts a to a . + public static implicit operator Vector4F((T X, T Y, T Z, T W) v) => + new(v.X, v.Y, v.Z, v.W); + + /// Implicitly casts a to a . + public static implicit operator (T X, T Y, T Z, T W)(Vector4F v) => + (v.X, v.Y, v.Z, v.W); + public static Vector4F operator +(Vector4F vector) => vector; public static Vector4F operator -(Vector4F vector) => - new Vector4F(-vector.X, -vector.Y, -vector.Z, -vector.W); + new(-vector.X, -vector.Y, -vector.Z, -vector.W); public static Vector4F operator +(Vector4F left, Vector4F right) => - new Vector4F(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W); + new(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W); public static Vector4F operator -(Vector4F left, Vector4F right) => - new Vector4F(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W); + new(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W); public static Vector4F operator *(Vector4F left, Vector4F right) => - new Vector4F(left.X * right.X, left.Y * right.Y, left.Z * right.Z, left.W * right.W); + new(left.X * right.X, left.Y * right.Y, left.Z * right.Z, left.W * right.W); public static Vector4F operator /(Vector4F left, Vector4F right) => - new Vector4F(left.X / right.X, left.Y / right.Y, left.Z / right.Z, left.W / right.W); + new(left.X / right.X, left.Y / right.Y, left.Z / right.Z, left.W / right.W); public static Vector4F operator %(Vector4F left, Vector4F right) => - new Vector4F(left.X % right.X, left.Y % right.Y, left.Z % right.Z, left.W % right.W); + new(left.X % right.X, left.Y % right.Y, left.Z % right.Z, left.W % right.W); public static Vector4F operator +(Vector4F vector, T scalar) => - new Vector4F(vector.X + scalar, vector.Y + scalar, vector.Z + scalar, vector.W + scalar); + new(vector.X + scalar, vector.Y + scalar, vector.Z + scalar, vector.W + scalar); public static Vector4F operator -(Vector4F vector, T scalar) => - new Vector4F(vector.X - scalar, vector.Y - scalar, vector.Z - scalar, vector.W - scalar); + new(vector.X - scalar, vector.Y - scalar, vector.Z - scalar, vector.W - scalar); public static Vector4F operator *(Vector4F vector, T scalar) => - new Vector4F(vector.X * scalar, vector.Y * scalar, vector.Z * scalar, vector.W * scalar); + new(vector.X * scalar, vector.Y * scalar, vector.Z * scalar, vector.W * scalar); public static Vector4F operator *(T scalar, Vector4F vector) => - new Vector4F(scalar * vector.X, scalar * vector.Y, scalar * vector.Z, scalar * vector.W); + new(scalar * vector.X, scalar * vector.Y, scalar * vector.Z, scalar * vector.W); public static Vector4F operator /(Vector4F vector, T scalar) => - new Vector4F(vector.X / scalar, vector.Y / scalar, vector.Z / scalar, vector.W / scalar); + new(vector.X / scalar, vector.Y / scalar, vector.Z / scalar, vector.W / scalar); public static Vector4F operator %(Vector4F vector, T scalar) => - new Vector4F(vector.X % scalar, vector.Y % scalar, vector.Z % scalar, vector.W % scalar); + new(vector.X % scalar, vector.Y % scalar, vector.Z % scalar, vector.W % scalar); } @@ -445,56 +466,504 @@ public static Vector4F Normalize(this Vector4F vector) return length != T.Zero ? vector / length : Vector4F.Zero; } + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4I Sign(this Vector4F value) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Sign(value.X), TSelf.Sign(value.Y), TSelf.Sign(value.Z), TSelf.Sign(value.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F Max(this Vector4F x, Vector4F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Max(x.X, y.X), TSelf.Max(x.Y, y.Y), TSelf.Max(x.Z, y.Z), TSelf.Max(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector4F Max(this Vector4F x, TSelf y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Max(x.X, y), TSelf.Max(x.Y, y), TSelf.Max(x.Z, y), TSelf.Max(x.W, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F MaxNumber(this Vector4F x, Vector4F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MaxNumber(x.X, y.X), TSelf.MaxNumber(x.Y, y.Y), TSelf.MaxNumber(x.Z, y.Z), TSelf.MaxNumber(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector4F MaxNumber(this Vector4F x, TSelf y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MaxNumber(x.X, y), TSelf.MaxNumber(x.Y, y), TSelf.MaxNumber(x.Z, y), TSelf.MaxNumber(x.W, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F Min(this Vector4F x, Vector4F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Min(x.X, y.X), TSelf.Min(x.Y, y.Y), TSelf.Min(x.Z, y.Z), TSelf.Min(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector4F Min(this Vector4F x, TSelf y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Min(x.X, y), TSelf.Min(x.Y, y), TSelf.Min(x.Z, y), TSelf.Min(x.W, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F MinNumber(this Vector4F x, Vector4F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MinNumber(x.X, y.X), TSelf.MinNumber(x.Y, y.Y), TSelf.MinNumber(x.Z, y.Z), TSelf.MinNumber(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector4F MinNumber(this Vector4F x, TSelf y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MinNumber(x.X, y), TSelf.MinNumber(x.Y, y), TSelf.MinNumber(x.Z, y), TSelf.MinNumber(x.W, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F Clamp(this Vector4F value, Vector4F min, Vector4F max) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Clamp(value.X, min.X, max.X), TSelf.Clamp(value.Y, min.Y, max.Y), TSelf.Clamp(value.Z, min.Z, max.Z), TSelf.Clamp(value.W, min.W, max.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + /// A single value provided for . + public static Vector4F Clamp(this Vector4F value, TSelf min, TSelf max) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Clamp(value.X, min, max), TSelf.Clamp(value.Y, min, max), TSelf.Clamp(value.Z, min, max), TSelf.Clamp(value.W, min, max)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F CopySign(this Vector4F value, Vector4F sign) + where TSelf : IFloatingPointIeee754 => + new(TSelf.CopySign(value.X, sign.X), TSelf.CopySign(value.Y, sign.Y), TSelf.CopySign(value.Z, sign.Z), TSelf.CopySign(value.W, sign.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector4F CopySign(this Vector4F value, TSelf sign) + where TSelf : IFloatingPointIeee754 => + new(TSelf.CopySign(value.X, sign), TSelf.CopySign(value.Y, sign), TSelf.CopySign(value.Z, sign), TSelf.CopySign(value.W, sign)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Abs(this Vector4F value) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Abs(value.X), TSelf.Abs(value.Y), TSelf.Abs(value.Z), TSelf.Abs(value.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F MaxMagnitude(this Vector4F x, Vector4F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MaxMagnitude(x.X, y.X), TSelf.MaxMagnitude(x.Y, y.Y), TSelf.MaxMagnitude(x.Z, y.Z), TSelf.MaxMagnitude(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F MaxMagnitudeNumber(this Vector4F x, Vector4F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MaxMagnitudeNumber(x.X, y.X), TSelf.MaxMagnitudeNumber(x.Y, y.Y), TSelf.MaxMagnitudeNumber(x.Z, y.Z), TSelf.MaxMagnitudeNumber(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F MinMagnitude(this Vector4F x, Vector4F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MinMagnitude(x.X, y.X), TSelf.MinMagnitude(x.Y, y.Y), TSelf.MinMagnitude(x.Z, y.Z), TSelf.MinMagnitude(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F MinMagnitudeNumber(this Vector4F x, Vector4F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.MinMagnitudeNumber(x.X, y.X), TSelf.MinMagnitudeNumber(x.Y, y.Y), TSelf.MinMagnitudeNumber(x.Z, y.Z), TSelf.MinMagnitudeNumber(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Ceiling(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Ceiling(x.X), TSelf.Ceiling(x.Y), TSelf.Ceiling(x.Z), TSelf.Ceiling(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Floor(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Floor(x.X), TSelf.Floor(x.Y), TSelf.Floor(x.Z), TSelf.Floor(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Round(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Round(x.X), TSelf.Round(x.Y), TSelf.Round(x.Z), TSelf.Round(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + /// A single value provided for . + public static Vector4F Round(this Vector4F x, int digits, MidpointRounding mode) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Round(x.X, digits, mode), TSelf.Round(x.Y, digits, mode), TSelf.Round(x.Z, digits, mode), TSelf.Round(x.W, digits, mode)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Truncate(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Truncate(x.X), TSelf.Truncate(x.Y), TSelf.Truncate(x.Z), TSelf.Truncate(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F Atan2(this Vector4F y, Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Atan2(y.X, x.X), TSelf.Atan2(y.Y, x.Y), TSelf.Atan2(y.Z, x.Z), TSelf.Atan2(y.W, x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F Atan2Pi(this Vector4F y, Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Atan2Pi(y.X, x.X), TSelf.Atan2Pi(y.Y, x.Y), TSelf.Atan2Pi(y.Z, x.Z), TSelf.Atan2Pi(y.W, x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector4F Lerp(this Vector4F value1, Vector4F value2, TSelf amount) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Lerp(value1.X, value2.X, amount), TSelf.Lerp(value1.Y, value2.Y, amount), TSelf.Lerp(value1.Z, value2.Z, amount), TSelf.Lerp(value1.W, value2.W, amount)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F BitDecrement(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.BitDecrement(x.X), TSelf.BitDecrement(x.Y), TSelf.BitDecrement(x.Z), TSelf.BitDecrement(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F BitIncrement(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.BitIncrement(x.X), TSelf.BitIncrement(x.Y), TSelf.BitIncrement(x.Z), TSelf.BitIncrement(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F FusedMultiplyAdd(this Vector4F left, Vector4F right, Vector4F addend) + where TSelf : IFloatingPointIeee754 => + new(TSelf.FusedMultiplyAdd(left.X, right.X, addend.X), TSelf.FusedMultiplyAdd(left.Y, right.Y, addend.Y), TSelf.FusedMultiplyAdd(left.Z, right.Z, addend.Z), TSelf.FusedMultiplyAdd(left.W, right.W, addend.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + /// A single value provided for . + public static Vector4F FusedMultiplyAdd(this Vector4F left, TSelf right, TSelf addend) + where TSelf : IFloatingPointIeee754 => + new(TSelf.FusedMultiplyAdd(left.X, right, addend), TSelf.FusedMultiplyAdd(left.Y, right, addend), TSelf.FusedMultiplyAdd(left.Z, right, addend), TSelf.FusedMultiplyAdd(left.W, right, addend)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F Ieee754Remainder(this Vector4F left, Vector4F right) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Ieee754Remainder(left.X, right.X), TSelf.Ieee754Remainder(left.Y, right.Y), TSelf.Ieee754Remainder(left.Z, right.Z), TSelf.Ieee754Remainder(left.W, right.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector4F Ieee754Remainder(this Vector4F left, TSelf right) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Ieee754Remainder(left.X, right), TSelf.Ieee754Remainder(left.Y, right), TSelf.Ieee754Remainder(left.Z, right), TSelf.Ieee754Remainder(left.W, right)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4I ILogB(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.ILogB(x.X), TSelf.ILogB(x.Y), TSelf.ILogB(x.Z), TSelf.ILogB(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F ReciprocalEstimate(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.ReciprocalEstimate(x.X), TSelf.ReciprocalEstimate(x.Y), TSelf.ReciprocalEstimate(x.Z), TSelf.ReciprocalEstimate(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F ReciprocalSqrtEstimate(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.ReciprocalSqrtEstimate(x.X), TSelf.ReciprocalSqrtEstimate(x.Y), TSelf.ReciprocalSqrtEstimate(x.Z), TSelf.ReciprocalSqrtEstimate(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F ScaleB(this Vector4F x, Vector4I n) + where TSelf : IFloatingPointIeee754 => + new(TSelf.ScaleB(x.X, n.X), TSelf.ScaleB(x.Y, n.Y), TSelf.ScaleB(x.Z, n.Z), TSelf.ScaleB(x.W, n.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector4F ScaleB(this Vector4F x, int n) + where TSelf : IFloatingPointIeee754 => + new(TSelf.ScaleB(x.X, n), TSelf.ScaleB(x.Y, n), TSelf.ScaleB(x.Z, n), TSelf.ScaleB(x.W, n)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F Pow(this Vector4F x, Vector4F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Pow(x.X, y.X), TSelf.Pow(x.Y, y.Y), TSelf.Pow(x.Z, y.Z), TSelf.Pow(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector4F Pow(this Vector4F x, TSelf y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Pow(x.X, y), TSelf.Pow(x.Y, y), TSelf.Pow(x.Z, y), TSelf.Pow(x.W, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Cbrt(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Cbrt(x.X), TSelf.Cbrt(x.Y), TSelf.Cbrt(x.Z), TSelf.Cbrt(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Sqrt(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Sqrt(x.X), TSelf.Sqrt(x.Y), TSelf.Sqrt(x.Z), TSelf.Sqrt(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector4F RootN(this Vector4F x, int n) + where TSelf : IFloatingPointIeee754 => + new(TSelf.RootN(x.X, n), TSelf.RootN(x.Y, n), TSelf.RootN(x.Z, n), TSelf.RootN(x.W, n)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F RootN(this Vector4F x, Vector4I n) + where TSelf : IFloatingPointIeee754 => + new(TSelf.RootN(x.X, n.X), TSelf.RootN(x.Y, n.Y), TSelf.RootN(x.Z, n.Z), TSelf.RootN(x.W, n.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4F Hypot(this Vector4F x, Vector4F y) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Hypot(x.X, y.X), TSelf.Hypot(x.Y, y.Y), TSelf.Hypot(x.Z, y.Z), TSelf.Hypot(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector4F Log(this Vector4F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Log(x.X), TSelf.Log(x.Y), TSelf.Log(x.Z), TSelf.Log(x.W)); - public static Vector4F Log(this Vector4F x, Vector4F newBase) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.Log(x.X, newBase.X), TSelf.Log(x.Y, newBase.Y), TSelf.Log(x.Z, newBase.Z), TSelf.Log(x.W, newBase.W)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector4F Log(this Vector4F x, TSelf newBase) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Log(x.X, newBase), TSelf.Log(x.Y, newBase), TSelf.Log(x.Z, newBase), TSelf.Log(x.W, newBase)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector4F LogP1(this Vector4F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.LogP1(x.X), TSelf.LogP1(x.Y), TSelf.LogP1(x.Z), TSelf.LogP1(x.W)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector4F Log2(this Vector4F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Log2(x.X), TSelf.Log2(x.Y), TSelf.Log2(x.Z), TSelf.Log2(x.W)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector4F Log2P1(this Vector4F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Log2P1(x.X), TSelf.Log2P1(x.Y), TSelf.Log2P1(x.Z), TSelf.Log2P1(x.W)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector4F Log10(this Vector4F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Log10(x.X), TSelf.Log10(x.Y), TSelf.Log10(x.Z), TSelf.Log10(x.W)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector4F Log10P1(this Vector4F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Log10P1(x.X), TSelf.Log10P1(x.Y), TSelf.Log10P1(x.Z), TSelf.Log10P1(x.W)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector4F Exp(this Vector4F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Exp(x.X), TSelf.Exp(x.Y), TSelf.Exp(x.Z), TSelf.Exp(x.W)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector4F ExpM1(this Vector4F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.ExpM1(x.X), TSelf.ExpM1(x.Y), TSelf.ExpM1(x.Z), TSelf.ExpM1(x.W)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector4F Exp2(this Vector4F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Exp2(x.X), TSelf.Exp2(x.Y), TSelf.Exp2(x.Z), TSelf.Exp2(x.W)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector4F Exp2M1(this Vector4F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Exp2M1(x.X), TSelf.Exp2M1(x.Y), TSelf.Exp2M1(x.Z), TSelf.Exp2M1(x.W)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector4F Exp10(this Vector4F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Exp10(x.X), TSelf.Exp10(x.Y), TSelf.Exp10(x.Z), TSelf.Exp10(x.W)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static Vector4F Exp10M1(this Vector4F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => + where TSelf : IFloatingPointIeee754 => new(TSelf.Exp10M1(x.X), TSelf.Exp10M1(x.Y), TSelf.Exp10M1(x.Z), TSelf.Exp10M1(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Acos(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Acos(x.X), TSelf.Acos(x.Y), TSelf.Acos(x.Z), TSelf.Acos(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F AcosPi(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.AcosPi(x.X), TSelf.AcosPi(x.Y), TSelf.AcosPi(x.Z), TSelf.AcosPi(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Asin(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Asin(x.X), TSelf.Asin(x.Y), TSelf.Asin(x.Z), TSelf.Asin(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F AsinPi(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.AsinPi(x.X), TSelf.AsinPi(x.Y), TSelf.AsinPi(x.Z), TSelf.AsinPi(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Atan(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Atan(x.X), TSelf.Atan(x.Y), TSelf.Atan(x.Z), TSelf.Atan(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F AtanPi(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.AtanPi(x.X), TSelf.AtanPi(x.Y), TSelf.AtanPi(x.Z), TSelf.AtanPi(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Cos(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Cos(x.X), TSelf.Cos(x.Y), TSelf.Cos(x.Z), TSelf.Cos(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F CosPi(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.CosPi(x.X), TSelf.CosPi(x.Y), TSelf.CosPi(x.Z), TSelf.CosPi(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Sin(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Sin(x.X), TSelf.Sin(x.Y), TSelf.Sin(x.Z), TSelf.Sin(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F SinPi(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.SinPi(x.X), TSelf.SinPi(x.Y), TSelf.SinPi(x.Z), TSelf.SinPi(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Tan(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Tan(x.X), TSelf.Tan(x.Y), TSelf.Tan(x.Z), TSelf.Tan(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F TanPi(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.TanPi(x.X), TSelf.TanPi(x.Y), TSelf.TanPi(x.Z), TSelf.TanPi(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F DegreesToRadians(this Vector4F degrees) + where TSelf : IFloatingPointIeee754 => + new(TSelf.DegreesToRadians(degrees.X), TSelf.DegreesToRadians(degrees.Y), TSelf.DegreesToRadians(degrees.Z), TSelf.DegreesToRadians(degrees.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F RadiansToDegrees(this Vector4F radians) + where TSelf : IFloatingPointIeee754 => + new(TSelf.RadiansToDegrees(radians.X), TSelf.RadiansToDegrees(radians.Y), TSelf.RadiansToDegrees(radians.Z), TSelf.RadiansToDegrees(radians.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Acosh(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Acosh(x.X), TSelf.Acosh(x.Y), TSelf.Acosh(x.Z), TSelf.Acosh(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Asinh(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Asinh(x.X), TSelf.Asinh(x.Y), TSelf.Asinh(x.Z), TSelf.Asinh(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Atanh(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Atanh(x.X), TSelf.Atanh(x.Y), TSelf.Atanh(x.Z), TSelf.Atanh(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Cosh(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Cosh(x.X), TSelf.Cosh(x.Y), TSelf.Cosh(x.Z), TSelf.Cosh(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Sinh(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Sinh(x.X), TSelf.Sinh(x.Y), TSelf.Sinh(x.Z), TSelf.Sinh(x.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4F Tanh(this Vector4F x) + where TSelf : IFloatingPointIeee754 => + new(TSelf.Tanh(x.X), TSelf.Tanh(x.Y), TSelf.Tanh(x.Z), TSelf.Tanh(x.W)); } } diff --git a/sources/Maths/Maths/Vector4I.cs b/sources/Maths/Maths/Vector4I.cs index 16c3e21720..3b7442adbc 100644 --- a/sources/Maths/Maths/Vector4I.cs +++ b/sources/Maths/Maths/Vector4I.cs @@ -13,105 +13,6 @@ namespace Silk.NET.Maths /// A structure representing a 4D integer vector. internal partial struct Vector4I { - /// Returns a vector with the component-wise maximum of this and another vector. - public Vector4I Max(Vector4I other) => - new Vector4I(T.Max(X, other.X), T.Max(Y, other.Y), T.Max(Z, other.Z), T.Max(W, other.W)); - - /// Returns a vector with the component-wise maximum of two vectors. - public static Vector4I Max(Vector4I left, Vector4I right) => - new Vector4I(T.Max(left.X, right.X), T.Max(left.Y, right.Y), T.Max(left.Z, right.Z), T.Max(left.W, right.W)); - - /// Returns a vector with the component-wise maximum of this vector and a scalar. - public Vector4I Max(T scalar) => - new Vector4I(T.Max(X, scalar), T.Max(Y, scalar), T.Max(Z, scalar), T.Max(W, scalar)); - - /// Returns a vector with the component-wise maximum of a vector and a scalar. - public static Vector4I Max(Vector4I vector, T scalar) => - new Vector4I(T.Max(vector.X, scalar), T.Max(vector.Y, scalar), T.Max(vector.Z, scalar), T.Max(vector.W, scalar)); - - /// Returns a vector with the component-wise minimum of this and another vector. - public Vector4I Min(Vector4I other) => - new Vector4I(T.Min(X, other.X), T.Min(Y, other.Y), T.Min(Z, other.Z), T.Min(W, other.W)); - - /// Returns a vector with the component-wise minimum of two vectors. - public static Vector4I Min(Vector4I left, Vector4I right) => - new Vector4I(T.Min(left.X, right.X), T.Min(left.Y, right.Y), T.Min(left.Z, right.Z), T.Min(left.W, right.W)); - - /// Returns a vector with the component-wise minimum of this vector and a scalar. - public Vector4I Min(T scalar) => - new Vector4I(T.Min(X, scalar), T.Min(Y, scalar), T.Min(Z, scalar), T.Min(W, scalar)); - - /// Returns a vector with the component-wise minimum of a vector and a scalar. - public static Vector4I Min(Vector4I vector, T scalar) => - new Vector4I(T.Min(vector.X, scalar), T.Min(vector.Y, scalar), T.Min(vector.Z, scalar), T.Min(vector.W, scalar)); - - /// Clamps this vector's components between the corresponding Min and Max vectors. - public Vector4I Clamp(Vector4I min, Vector4I max) => - new Vector4I( - T.Clamp(X, min.X, max.X), - T.Clamp(Y, min.Y, max.Y), - T.Clamp(Z, min.Z, max.Z), - T.Clamp(W, min.W, max.W) - ); - - /// Clamps the components of a vector between the corresponding Min and Max vectors. - public static Vector4I Clamp(Vector4I vector, Vector4I min, Vector4I max) => - new Vector4I( - T.Clamp(vector.X, min.X, max.X), - T.Clamp(vector.Y, min.Y, max.Y), - T.Clamp(vector.Z, min.Z, max.Z), - T.Clamp(vector.W, min.W, max.W) - ); - - /// Clamps this vector's components between the Min and Max scalar values. - public Vector4I Clamp(T min, T max) => - new Vector4I( - T.Clamp(X, min, max), - T.Clamp(Y, min, max), - T.Clamp(Z, min, max), - T.Clamp(W, min, max) - ); - - /// Clamps the components of a vector between the Min and Max scalar values. - public static Vector4I Clamp(Vector4I vector, T min, T max) => - new Vector4I( - T.Clamp(vector.X, min, max), - T.Clamp(vector.Y, min, max), - T.Clamp(vector.Z, min, max), - T.Clamp(vector.W, min, max) - ); - - /// Returns a vector with the absolute value of each component of this vector. - public Vector4I Abs() => new Vector4I(T.Abs(X), T.Abs(Y), T.Abs(Z), T.Abs(W)); - - /// Returns a vector with the absolute value of each component of the specified vector. - public static Vector4I Abs(Vector4I vector) => - new Vector4I(T.Abs(vector.X), T.Abs(vector.Y), T.Abs(vector.Z), T.Abs(vector.W)); - - /// Returns a vector where each component is the sign of the original vector's component. - public Vector4I Sign() => - new Vector4I(T.CreateChecked(T.Sign(X)), T.CreateChecked(T.Sign(Y)), T.CreateChecked(T.Sign(Z)), T.CreateChecked(T.Sign(W))); - - /// Returns a vector where each component is the sign of the input vector's component. - public static Vector4I Sign(Vector4I vector) => - new Vector4I(T.CreateChecked(T.Sign(vector.X)), T.CreateChecked(T.Sign(vector.Y)), T.CreateChecked(T.Sign(vector.Z)), T.CreateChecked(T.Sign(vector.W))); - - /// Copies the sign of each component from another vector to this vector's components. - public Vector4I CopySign(Vector4I signSource) => - new Vector4I(T.CopySign(X, signSource.X), T.CopySign(Y, signSource.Y), T.CopySign(Z, signSource.Z), T.CopySign(W, signSource.W)); - - /// Copies the sign of each component from another vector to a new vector. - public static Vector4I CopySign(Vector4I value, Vector4I signSource) => - new Vector4I(T.CopySign(value.X, signSource.X), T.CopySign(value.Y, signSource.Y), T.CopySign(value.Z, signSource.Z), T.CopySign(value.W, signSource.W)); - - /// Copies the sign of a scalar onto each component of this vector. - public Vector4I CopySign(T signScalar) => - new Vector4I(T.CopySign(X, signScalar), T.CopySign(Y, signScalar), T.CopySign(Z, signScalar), T.CopySign(W, signScalar)); - - /// Copies the sign of a scalar onto each component of a new vector. - public static Vector4I CopySign(Vector4I value, T signScalar) => - new Vector4I(T.CopySign(value.X, signScalar), T.CopySign(value.Y, signScalar), T.CopySign(value.Z, signScalar), T.CopySign(value.W, signScalar)); - // Casts /// Explicitly casts a System.Numerics.Vector4 to a Vector4I. @@ -122,10 +23,6 @@ public static explicit operator Vector4I(System.Numerics.Vector4 v) => public static explicit operator System.Numerics.Vector4(Vector4I v) => new System.Numerics.Vector4(Convert.ToSingle(v.X), Convert.ToSingle(v.Y), Convert.ToSingle(v.Z), Convert.ToSingle(v.W)); - // IBinaryInteger - public static Vector4I Log2(Vector4I x) => - new Vector4I(T.Log2(x.X), T.Log2(x.Y), T.Log2(x.Z), T.Log2(x.W)); - public static (Vector4I Quotient, Vector4I Remainder) DivRem(Vector4I left, Vector4I right) { var (qX, rX) = T.DivRem(left.X, right.X); @@ -134,8 +31,5 @@ public static (Vector4I Quotient, Vector4I Remainder) DivRem(Vector4I l var (qW, rW) = T.DivRem(left.W, right.W); return (new Vector4I(qX, qY, qZ, qW), new Vector4I(rX, rY, rZ, rW)); } - - public static Vector4I PopCount(Vector4I x) => - new Vector4I(T.PopCount(x.X), T.PopCount(x.Y), T.PopCount(x.Z), T.PopCount(x.W)); } } diff --git a/sources/Maths/Maths/Vector4I.gen.cs b/sources/Maths/Maths/Vector4I.gen.cs index 04eb7ca61c..b87494d968 100644 --- a/sources/Maths/Maths/Vector4I.gen.cs +++ b/sources/Maths/Maths/Vector4I.gen.cs @@ -54,22 +54,22 @@ public Vector4I(ReadOnlySpan values) } /// Gets a vector whose 4 elements are equal to one. - public static Vector4I One => new(Scalar.One); + public static Vector4I One => new(T.One); /// Returns a vector whose 4 elements are equal to zero. public static Vector4I Zero => default; /// Gets the vector (1, 0, 0, 0). - public static Vector4I UnitX => new(Scalar.One, Scalar.Zero, Scalar.Zero, Scalar.Zero); + public static Vector4I UnitX => new(T.One, T.Zero, T.Zero, T.Zero); /// Gets the vector (0, 1, 0, 0). - public static Vector4I UnitY => new(Scalar.Zero, Scalar.One, Scalar.Zero, Scalar.Zero); + public static Vector4I UnitY => new(T.Zero, T.One, T.Zero, T.Zero); /// Gets the vector (0, 0, 1, 0). - public static Vector4I UnitZ => new(Scalar.Zero, Scalar.Zero, Scalar.One, Scalar.Zero); + public static Vector4I UnitZ => new(T.Zero, T.Zero, T.One, T.Zero); /// Gets the vector (0, 0, 0, 1). - public static Vector4I UnitW => new(Scalar.Zero, Scalar.Zero, Scalar.Zero, Scalar.One); + public static Vector4I UnitW => new(T.Zero, T.Zero, T.Zero, T.One); /// Gets a vector with all bits set for each component. public static Vector4I AllBitsSet => new Vector4I(T.AllBitsSet, T.AllBitsSet, T.AllBitsSet, T.AllBitsSet); @@ -379,44 +379,65 @@ static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IForm /// public override int GetHashCode() => HashCode.Combine(X, Y, Z, W); + /// Desconstructs a vector into its components. + /// The X component. + /// The Y component. + /// The Z component. + /// The W component. + public void Deconstruct(out T x, out T y, out T z, out T w) + { + x = X; + y = Y; + z = Z; + w = W; + } + + /// Implicitly casts a to a . + public static implicit operator Vector4I((T X, T Y, T Z, T W) v) => + new(v.X, v.Y, v.Z, v.W); + + /// Implicitly casts a to a . + public static implicit operator (T X, T Y, T Z, T W)(Vector4I v) => + (v.X, v.Y, v.Z, v.W); + public static Vector4I operator +(Vector4I vector) => vector; public static Vector4I operator -(Vector4I vector) => - new Vector4I(-vector.X, -vector.Y, -vector.Z, -vector.W); + new(-vector.X, -vector.Y, -vector.Z, -vector.W); public static Vector4I operator +(Vector4I left, Vector4I right) => - new Vector4I(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W); + new(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W); public static Vector4I operator -(Vector4I left, Vector4I right) => - new Vector4I(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W); + new(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W); public static Vector4I operator *(Vector4I left, Vector4I right) => - new Vector4I(left.X * right.X, left.Y * right.Y, left.Z * right.Z, left.W * right.W); + new(left.X * right.X, left.Y * right.Y, left.Z * right.Z, left.W * right.W); public static Vector4I operator /(Vector4I left, Vector4I right) => - new Vector4I(left.X / right.X, left.Y / right.Y, left.Z / right.Z, left.W / right.W); + new(left.X / right.X, left.Y / right.Y, left.Z / right.Z, left.W / right.W); public static Vector4I operator %(Vector4I left, Vector4I right) => - new Vector4I(left.X % right.X, left.Y % right.Y, left.Z % right.Z, left.W % right.W); + new(left.X % right.X, left.Y % right.Y, left.Z % right.Z, left.W % right.W); public static Vector4I operator +(Vector4I vector, T scalar) => - new Vector4I(vector.X + scalar, vector.Y + scalar, vector.Z + scalar, vector.W + scalar); + new(vector.X + scalar, vector.Y + scalar, vector.Z + scalar, vector.W + scalar); public static Vector4I operator -(Vector4I vector, T scalar) => - new Vector4I(vector.X - scalar, vector.Y - scalar, vector.Z - scalar, vector.W - scalar); + new(vector.X - scalar, vector.Y - scalar, vector.Z - scalar, vector.W - scalar); public static Vector4I operator *(Vector4I vector, T scalar) => - new Vector4I(vector.X * scalar, vector.Y * scalar, vector.Z * scalar, vector.W * scalar); + new(vector.X * scalar, vector.Y * scalar, vector.Z * scalar, vector.W * scalar); public static Vector4I operator *(T scalar, Vector4I vector) => - new Vector4I(scalar * vector.X, scalar * vector.Y, scalar * vector.Z, scalar * vector.W); + new(scalar * vector.X, scalar * vector.Y, scalar * vector.Z, scalar * vector.W); public static Vector4I operator /(Vector4I vector, T scalar) => - new Vector4I(vector.X / scalar, vector.Y / scalar, vector.Z / scalar, vector.W / scalar); + new(vector.X / scalar, vector.Y / scalar, vector.Z / scalar, vector.W / scalar); public static Vector4I operator %(Vector4I vector, T scalar) => - new Vector4I(vector.X % scalar, vector.Y % scalar, vector.Z % scalar, vector.W % scalar); + new(vector.X % scalar, vector.Y % scalar, vector.Z % scalar, vector.W % scalar); public static Vector4I operator ~(Vector4I vector) => new Vector4I(~vector.X, ~vector.Y, ~vector.Z, ~vector.W); @@ -464,56 +485,136 @@ public static Vector4I Reflect(Vector4I vector, Vector4I normal) return vector - (normal * (dot + dot)); } - public static Vector4I Log(this Vector4I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log(x.X), TSelf.Log(x.Y), TSelf.Log(x.Z), TSelf.Log(x.W)); - - public static Vector4I Log(this Vector4I x, Vector4I newBase) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log(x.X, newBase.X), TSelf.Log(x.Y, newBase.Y), TSelf.Log(x.Z, newBase.Z), TSelf.Log(x.W, newBase.W)); - - public static Vector4I LogP1(this Vector4I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.LogP1(x.X), TSelf.LogP1(x.Y), TSelf.LogP1(x.Z), TSelf.LogP1(x.W)); - - public static Vector4I Log2(this Vector4I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log2(x.X), TSelf.Log2(x.Y), TSelf.Log2(x.Z), TSelf.Log2(x.W)); - - public static Vector4I Log2P1(this Vector4I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log2P1(x.X), TSelf.Log2P1(x.Y), TSelf.Log2P1(x.Z), TSelf.Log2P1(x.W)); - - public static Vector4I Log10(this Vector4I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log10(x.X), TSelf.Log10(x.Y), TSelf.Log10(x.Z), TSelf.Log10(x.W)); - - public static Vector4I Log10P1(this Vector4I x) - where TSelf : IBinaryInteger, ILogarithmicFunctions => - new(TSelf.Log10P1(x.X), TSelf.Log10P1(x.Y), TSelf.Log10P1(x.Z), TSelf.Log10P1(x.W)); - - public static Vector4I Exp(this Vector4I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.Exp(x.X), TSelf.Exp(x.Y), TSelf.Exp(x.Z), TSelf.Exp(x.W)); - - public static Vector4I ExpM1(this Vector4I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.ExpM1(x.X), TSelf.ExpM1(x.Y), TSelf.ExpM1(x.Z), TSelf.ExpM1(x.W)); - - public static Vector4I Exp2(this Vector4I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.Exp2(x.X), TSelf.Exp2(x.Y), TSelf.Exp2(x.Z), TSelf.Exp2(x.W)); - - public static Vector4I Exp2M1(this Vector4I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.Exp2M1(x.X), TSelf.Exp2M1(x.Y), TSelf.Exp2M1(x.Z), TSelf.Exp2M1(x.W)); - - public static Vector4I Exp10(this Vector4I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.Exp10(x.X), TSelf.Exp10(x.Y), TSelf.Exp10(x.Z), TSelf.Exp10(x.W)); - - public static Vector4I Exp10M1(this Vector4I x) - where TSelf : IBinaryInteger, IExponentialFunctions => - new(TSelf.Exp10M1(x.X), TSelf.Exp10M1(x.Y), TSelf.Exp10M1(x.Z), TSelf.Exp10M1(x.W)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4I Sign(this Vector4I value) + where TSelf : IBinaryInteger => + new(TSelf.Sign(value.X), TSelf.Sign(value.Y), TSelf.Sign(value.Z), TSelf.Sign(value.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4I Max(this Vector4I x, Vector4I y) + where TSelf : IBinaryInteger => + new(TSelf.Max(x.X, y.X), TSelf.Max(x.Y, y.Y), TSelf.Max(x.Z, y.Z), TSelf.Max(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector4I Max(this Vector4I x, TSelf y) + where TSelf : IBinaryInteger => + new(TSelf.Max(x.X, y), TSelf.Max(x.Y, y), TSelf.Max(x.Z, y), TSelf.Max(x.W, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4I MaxNumber(this Vector4I x, Vector4I y) + where TSelf : IBinaryInteger => + new(TSelf.MaxNumber(x.X, y.X), TSelf.MaxNumber(x.Y, y.Y), TSelf.MaxNumber(x.Z, y.Z), TSelf.MaxNumber(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector4I MaxNumber(this Vector4I x, TSelf y) + where TSelf : IBinaryInteger => + new(TSelf.MaxNumber(x.X, y), TSelf.MaxNumber(x.Y, y), TSelf.MaxNumber(x.Z, y), TSelf.MaxNumber(x.W, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4I Min(this Vector4I x, Vector4I y) + where TSelf : IBinaryInteger => + new(TSelf.Min(x.X, y.X), TSelf.Min(x.Y, y.Y), TSelf.Min(x.Z, y.Z), TSelf.Min(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector4I Min(this Vector4I x, TSelf y) + where TSelf : IBinaryInteger => + new(TSelf.Min(x.X, y), TSelf.Min(x.Y, y), TSelf.Min(x.Z, y), TSelf.Min(x.W, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4I MinNumber(this Vector4I x, Vector4I y) + where TSelf : IBinaryInteger => + new(TSelf.MinNumber(x.X, y.X), TSelf.MinNumber(x.Y, y.Y), TSelf.MinNumber(x.Z, y.Z), TSelf.MinNumber(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector4I MinNumber(this Vector4I x, TSelf y) + where TSelf : IBinaryInteger => + new(TSelf.MinNumber(x.X, y), TSelf.MinNumber(x.Y, y), TSelf.MinNumber(x.Z, y), TSelf.MinNumber(x.W, y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4I Clamp(this Vector4I value, Vector4I min, Vector4I max) + where TSelf : IBinaryInteger => + new(TSelf.Clamp(value.X, min.X, max.X), TSelf.Clamp(value.Y, min.Y, max.Y), TSelf.Clamp(value.Z, min.Z, max.Z), TSelf.Clamp(value.W, min.W, max.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + /// A single value provided for . + public static Vector4I Clamp(this Vector4I value, TSelf min, TSelf max) + where TSelf : IBinaryInteger => + new(TSelf.Clamp(value.X, min, max), TSelf.Clamp(value.Y, min, max), TSelf.Clamp(value.Z, min, max), TSelf.Clamp(value.W, min, max)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4I CopySign(this Vector4I value, Vector4I sign) + where TSelf : IBinaryInteger => + new(TSelf.CopySign(value.X, sign.X), TSelf.CopySign(value.Y, sign.Y), TSelf.CopySign(value.Z, sign.Z), TSelf.CopySign(value.W, sign.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A single value provided for . + public static Vector4I CopySign(this Vector4I value, TSelf sign) + where TSelf : IBinaryInteger => + new(TSelf.CopySign(value.X, sign), TSelf.CopySign(value.Y, sign), TSelf.CopySign(value.Z, sign), TSelf.CopySign(value.W, sign)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4I Abs(this Vector4I value) + where TSelf : IBinaryInteger => + new(TSelf.Abs(value.X), TSelf.Abs(value.Y), TSelf.Abs(value.Z), TSelf.Abs(value.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4I MaxMagnitude(this Vector4I x, Vector4I y) + where TSelf : IBinaryInteger => + new(TSelf.MaxMagnitude(x.X, y.X), TSelf.MaxMagnitude(x.Y, y.Y), TSelf.MaxMagnitude(x.Z, y.Z), TSelf.MaxMagnitude(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4I MaxMagnitudeNumber(this Vector4I x, Vector4I y) + where TSelf : IBinaryInteger => + new(TSelf.MaxMagnitudeNumber(x.X, y.X), TSelf.MaxMagnitudeNumber(x.Y, y.Y), TSelf.MaxMagnitudeNumber(x.Z, y.Z), TSelf.MaxMagnitudeNumber(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4I MinMagnitude(this Vector4I x, Vector4I y) + where TSelf : IBinaryInteger => + new(TSelf.MinMagnitude(x.X, y.X), TSelf.MinMagnitude(x.Y, y.Y), TSelf.MinMagnitude(x.Z, y.Z), TSelf.MinMagnitude(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . + public static Vector4I MinMagnitudeNumber(this Vector4I x, Vector4I y) + where TSelf : IBinaryInteger => + new(TSelf.MinMagnitudeNumber(x.X, y.X), TSelf.MinMagnitudeNumber(x.Y, y.Y), TSelf.MinMagnitudeNumber(x.Z, y.Z), TSelf.MinMagnitudeNumber(x.W, y.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4I Log2(this Vector4I value) + where TSelf : IBinaryInteger => + new(TSelf.Log2(value.X), TSelf.Log2(value.Y), TSelf.Log2(value.Z), TSelf.Log2(value.W)); } } From 070c6f57e06d066169e8cf2701652febde62f44e Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Mon, 30 Jun 2025 16:56:01 -0700 Subject: [PATCH 02/19] Replace generated I/F types with D types. --- sources/Maths/Maths/Box3D.cs | 5 +- sources/Maths/Maths/Legacy/Vector2D.Ops.cs | 288 -------- sources/Maths/Maths/Legacy/Vector2D.cs | 356 ---------- sources/Maths/Maths/Legacy/Vector3D.Ops.cs | 299 --------- sources/Maths/Maths/Legacy/Vector3D.cs | 383 ----------- sources/Maths/Maths/Legacy/Vector4D.Ops.cs | 357 ---------- sources/Maths/Maths/Legacy/Vector4D.cs | 417 ------------ .../{Matrix2x2F.gen.cs => Matrix2X2.gen.cs} | 40 +- .../{Matrix2x3F.gen.cs => Matrix2X3.gen.cs} | 40 +- .../{Matrix2x4F.gen.cs => Matrix2X4.gen.cs} | 42 +- sources/Maths/Maths/Matrix2x2I.gen.cs | 122 ---- sources/Maths/Maths/Matrix2x3I.gen.cs | 134 ---- sources/Maths/Maths/Matrix2x4I.gen.cs | 152 ----- .../{Matrix3x2F.gen.cs => Matrix3X2.gen.cs} | 42 +- .../{Matrix3x3F.gen.cs => Matrix3X3.gen.cs} | 46 +- .../{Matrix3x4F.gen.cs => Matrix3X4.gen.cs} | 46 +- sources/Maths/Maths/Matrix3x2I.gen.cs | 144 ---- sources/Maths/Maths/Matrix3x3I.gen.cs | 171 ----- sources/Maths/Maths/Matrix3x4I.gen.cs | 187 ------ .../{Matrix4x2F.gen.cs => Matrix4X2.gen.cs} | 46 +- .../{Matrix4x3F.gen.cs => Matrix4X3.gen.cs} | 48 +- sources/Maths/Maths/Matrix4x2I.gen.cs | 173 ----- sources/Maths/Maths/Matrix4x3I.gen.cs | 198 ------ sources/Maths/Maths/Matrix4x4F.gen.cs | 240 ------- sources/Maths/Maths/Matrix4x4I.gen.cs | 231 ------- .../{Matrix5x4F.gen.cs => Matrix5X4.gen.cs} | 42 +- sources/Maths/Maths/Matrix5x4I.gen.cs | 206 ------ sources/Maths/Maths/Vector2D.cs | 78 +++ .../{Vector2F.gen.cs => Vector2D.gen.cs} | 429 ++++++------ sources/Maths/Maths/Vector2F.cs | 67 -- sources/Maths/Maths/Vector2I.cs | 40 -- sources/Maths/Maths/Vector2I.gen.cs | 542 --------------- .../Maths/Maths/{Vector3I.cs => Vector3D.cs} | 24 +- .../{Vector3F.gen.cs => Vector3D.gen.cs} | 435 ++++++------ sources/Maths/Maths/Vector3I.gen.cs | 581 ---------------- .../Maths/Maths/{Vector4I.cs => Vector4D.cs} | 16 +- .../{Vector4F.gen.cs => Vector4D.gen.cs} | 441 +++++++------ sources/Maths/Maths/Vector4I.gen.cs | 620 ------------------ 38 files changed, 966 insertions(+), 6762 deletions(-) delete mode 100644 sources/Maths/Maths/Legacy/Vector2D.Ops.cs delete mode 100644 sources/Maths/Maths/Legacy/Vector2D.cs delete mode 100644 sources/Maths/Maths/Legacy/Vector3D.Ops.cs delete mode 100644 sources/Maths/Maths/Legacy/Vector3D.cs delete mode 100644 sources/Maths/Maths/Legacy/Vector4D.Ops.cs delete mode 100644 sources/Maths/Maths/Legacy/Vector4D.cs rename sources/Maths/Maths/{Matrix2x2F.gen.cs => Matrix2X2.gen.cs} (77%) rename sources/Maths/Maths/{Matrix2x3F.gen.cs => Matrix2X3.gen.cs} (79%) rename sources/Maths/Maths/{Matrix2x4F.gen.cs => Matrix2X4.gen.cs} (81%) delete mode 100644 sources/Maths/Maths/Matrix2x2I.gen.cs delete mode 100644 sources/Maths/Maths/Matrix2x3I.gen.cs delete mode 100644 sources/Maths/Maths/Matrix2x4I.gen.cs rename sources/Maths/Maths/{Matrix3x2F.gen.cs => Matrix3X2.gen.cs} (79%) rename sources/Maths/Maths/{Matrix3x3F.gen.cs => Matrix3X3.gen.cs} (81%) rename sources/Maths/Maths/{Matrix3x4F.gen.cs => Matrix3X4.gen.cs} (83%) delete mode 100644 sources/Maths/Maths/Matrix3x2I.gen.cs delete mode 100644 sources/Maths/Maths/Matrix3x3I.gen.cs delete mode 100644 sources/Maths/Maths/Matrix3x4I.gen.cs rename sources/Maths/Maths/{Matrix4x2F.gen.cs => Matrix4X2.gen.cs} (81%) rename sources/Maths/Maths/{Matrix4x3F.gen.cs => Matrix4X3.gen.cs} (83%) delete mode 100644 sources/Maths/Maths/Matrix4x2I.gen.cs delete mode 100644 sources/Maths/Maths/Matrix4x3I.gen.cs delete mode 100644 sources/Maths/Maths/Matrix4x4F.gen.cs delete mode 100644 sources/Maths/Maths/Matrix4x4I.gen.cs rename sources/Maths/Maths/{Matrix5x4F.gen.cs => Matrix5X4.gen.cs} (86%) delete mode 100644 sources/Maths/Maths/Matrix5x4I.gen.cs create mode 100644 sources/Maths/Maths/Vector2D.cs rename sources/Maths/Maths/{Vector2F.gen.cs => Vector2D.gen.cs} (73%) delete mode 100644 sources/Maths/Maths/Vector2F.cs delete mode 100644 sources/Maths/Maths/Vector2I.cs delete mode 100644 sources/Maths/Maths/Vector2I.gen.cs rename sources/Maths/Maths/{Vector3I.cs => Vector3D.cs} (69%) rename sources/Maths/Maths/{Vector3F.gen.cs => Vector3D.gen.cs} (75%) delete mode 100644 sources/Maths/Maths/Vector3I.gen.cs rename sources/Maths/Maths/{Vector4I.cs => Vector4D.cs} (69%) rename sources/Maths/Maths/{Vector4F.gen.cs => Vector4D.gen.cs} (76%) delete mode 100644 sources/Maths/Maths/Vector4I.gen.cs diff --git a/sources/Maths/Maths/Box3D.cs b/sources/Maths/Maths/Box3D.cs index 36c4ab815c..48812a2039 100644 --- a/sources/Maths/Maths/Box3D.cs +++ b/sources/Maths/Maths/Box3D.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -157,7 +158,7 @@ public Box3D GetScaled(Vector3D scale, Vector3D anchor) /// The anchor. /// The calculated box. public Box3D GetScaled(Vector3D scale, Vector3D anchor) - where TScale : unmanaged, IFormattable, IEquatable, IComparable + where TScale : INumberBase { var convertedAnchor = anchor.As(); var min = (scale * (Min.As() - convertedAnchor)) + convertedAnchor; @@ -226,4 +227,4 @@ public Box3D As() where TOther : unmanaged, IFormattable, IEquat return new(Min.As(), Max.As()); } } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Legacy/Vector2D.Ops.cs b/sources/Maths/Maths/Legacy/Vector2D.Ops.cs deleted file mode 100644 index df68ebed3b..0000000000 --- a/sources/Maths/Maths/Legacy/Vector2D.Ops.cs +++ /dev/null @@ -1,288 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Runtime.CompilerServices; - -namespace Silk.NET.Maths -{ - /// - /// Methods for working with - /// - public static class Vector2D - { - /// Returns a vector whose elements are the absolute values of each of the specified vector's elements. - /// A vector. - /// The absolute value vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Abs(Vector2D value) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new(Scalar.Abs(value.X), Scalar.Abs(value.Y)); - - /// Adds two vectors together. - /// The first vector to add. - /// The second vector to add. - /// The summed vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Add(Vector2D left, Vector2D right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new(Scalar.Add(left.X, right.X), Scalar.Add(left.Y, right.Y)); - - /// Restricts a vector between a minimum and a maximum value. - /// The vector to restrict. - /// The minimum value. - /// The maximum value. - /// The restricted vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Clamp(Vector2D value1, Vector2D min, Vector2D max) - where T : unmanaged, IFormattable, IEquatable, IComparable - // We must follow HLSL behavior in the case user specified min value is bigger than max value. - => Min(Max(value1, min), max); - - /// Computes the Euclidean distance between the two given points. - /// The first point. - /// The second point. - /// The distance. - [MethodImpl((MethodImplOptions) 768)] - public static T Distance(Vector2D value1, Vector2D value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => Scalar.Sqrt(DistanceSquared(value1, value2)); - - /// Returns the Euclidean distance squared between two specified points. - /// The first point. - /// The second point. - /// The distance squared. - [MethodImpl((MethodImplOptions) 768)] - public static T DistanceSquared(Vector2D value1, Vector2D value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - var difference = value1 - value2; - return Dot(difference, difference); - } - - /// Divides the first vector by the second. - /// The first vector. - /// The second vector. - /// The vector resulting from the division. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Divide(Vector2D left, Vector2D right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new(Scalar.Divide(left.X, right.X), Scalar.Divide(left.Y, right.Y)); - - /// Divides the specified vector by a specified scalar value. - /// The vector. - /// The scalar value. - /// The vector that results from the division. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Divide(Vector2D left, T divisor) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new(Scalar.Divide(left.X, divisor), Scalar.Divide(left.Y, divisor)); - - /// Returns the dot product of two vectors. - /// The first vector. - /// The second vector. - /// The dot product. - [MethodImpl((MethodImplOptions) 768)] - public static T Dot(Vector2D value1, Vector2D value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => Scalar.Add(Scalar.Multiply(value1.X, value2.X), Scalar.Multiply(value1.Y, value2.Y)); - - /// Linearly interpolates between two vectors based on the given weighting. - /// The first source vector. - /// The second source vector. - /// Value between 0 and 1 indicating the weight of the second source vector. - /// The interpolated vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Lerp(Vector2D value1, Vector2D value2, T amount) - where T : unmanaged, IFormattable, IEquatable, IComparable - => (value1 * Scalar.Subtract(Scalar.One, amount)) + (value2 * amount); - - /// Returns a vector whose elements are the maximum of each of the pairs of elements in the two source vectors - /// The first source vector - /// The second source vector - /// The maximized vector - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Max(Vector2D value1, Vector2D value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new(Scalar.Max(value1.X, value2.X), Scalar.Max(value1.Y, value2.Y)); - - /// Returns a vector whose elements are the minimum of each of the pairs of elements in the two source vectors. - /// The first source vector. - /// The second source vector. - /// The minimized vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Min(Vector2D value1, Vector2D value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new(Scalar.Min(value1.X, value2.X), Scalar.Min(value1.Y, value2.Y)); - - /// Multiplies two vectors together. - /// The first source vector. - /// The second source vector. - /// The product vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Multiply(Vector2D left, Vector2D right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new(Scalar.Multiply(left.X, right.X), Scalar.Multiply(left.Y, right.Y)); - - /// Multiplies a vector by the given scalar. - /// The source vector. - /// The scalar value. - /// The scaled vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Multiply(Vector2D left, T right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new(Scalar.Multiply(left.X, right), Scalar.Multiply(left.Y, right)); - - /// Multiplies a vector by the given scalar. - /// The scalar value. - /// The source vector. - /// The scaled vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Multiply(T left, Vector2D right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new(Scalar.Multiply(left, right.X), Scalar.Multiply(left, right.Y)); - - /// Negates a given vector. - /// The source vector. - /// The negated vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Negate(Vector2D value) - where T : unmanaged, IFormattable, IEquatable, IComparable - => -value; - - /// Returns a vector with the same direction as the given vector, but with a length of 1. - /// The vector to normalize. - /// The normalized vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Normalize(Vector2D value) - where T : unmanaged, IFormattable, IEquatable, IComparable - => value / value.Length; - - /// Returns the reflection of a vector off a surface that has the specified normal. - /// The source vector. - /// The normal of the surface being reflected off. - /// The reflected vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Reflect(Vector2D vector, Vector2D normal) - where T : unmanaged, IFormattable, IEquatable, IComparable - => vector - Scalar.Multiply(Scalar.Two, Dot(vector, normal)) * normal; - - /// Returns a vector whose elements are the square root of each of the source vector's elements. - /// The source vector. - /// The square root vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D SquareRoot(Vector2D value) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new(Scalar.Sqrt(value.X), Scalar.Sqrt(value.Y)); - - /// Subtracts the second vector from the first. - /// The first source vector. - /// The second source vector. - /// The difference vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Subtract(Vector2D left, Vector2D right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => left - right; - - /// Transforms a vector by the given matrix. - /// The source vector. - /// The transformation matrix. - /// The transformed vector. - public static Vector2D Transform(Vector2D position, Matrix4X4 matrix) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new( - Scalar.Add(Scalar.Add(Scalar.Multiply(position.X, matrix.M11), Scalar.Multiply(position.Y, matrix.M21)), matrix.M41), - Scalar.Add(Scalar.Add(Scalar.Multiply(position.X, matrix.M12), Scalar.Multiply(position.Y, matrix.M22)), matrix.M42) - ); - } - - /// Transforms a vector normal by the given matrix. - /// The source vector. - /// The transformation matrix. - /// The transformed vector. - public static Vector2D TransformNormal(Vector2D normal, Matrix4X4 matrix) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new( - Scalar.Add(Scalar.Multiply(normal.X, matrix.M11), Scalar.Multiply(normal.Y, matrix.M21)), - Scalar.Add(Scalar.Multiply(normal.X, matrix.M12), Scalar.Multiply(normal.Y, matrix.M22))); - } - - /// Transforms a vector by the given Quaternion rotation value. - /// The source vector to be rotated. - /// The rotation to apply. - /// The transformed vector. - public static Vector2D Transform(Vector2D value, Legacy.Quaternion rotation) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - T x2 = Scalar.Add(rotation.X, rotation.X); - T y2 = Scalar.Add(rotation.Y, rotation.Y); - T z2 = Scalar.Add(rotation.Z, rotation.Z); - - T wz2 = Scalar.Multiply(rotation.W, z2); - T xx2 = Scalar.Multiply(rotation.X, x2); - T xy2 = Scalar.Multiply(rotation.X, y2); - T yy2 = Scalar.Multiply(rotation.Y, y2); - T zz2 = Scalar.Multiply(rotation.Z, z2); - - return new( - Scalar.Add(Scalar.Multiply(value.X, Scalar.Subtract(Scalar.Subtract(Scalar.One, yy2), zz2)), Scalar.Multiply(value.Y, Scalar.Subtract(xy2, wz2))), - Scalar.Add(Scalar.Multiply(value.X, Scalar.Add(xy2, wz2)), Scalar.Multiply(value.Y, Scalar.Subtract(Scalar.Subtract(Scalar.One, xx2), zz2))) - ); - } - - /// Transforms a vector by the given matrix. - /// The source vector. - /// The transformation matrix. - /// The transformed vector. - public static Vector2D Transform(Vector2D position, Matrix3X2 matrix) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new( - Scalar.Add(Scalar.Add(Scalar.Multiply(position.X, matrix.M11), Scalar.Multiply(position.Y, matrix.M21)), matrix.M31), - Scalar.Add(Scalar.Add(Scalar.Multiply(position.X, matrix.M12), Scalar.Multiply(position.Y, matrix.M22)), matrix.M32) - ); - } - - /// Transforms a vector normal by the given matrix. - /// The source vector. - /// The transformation matrix. - /// The transformed vector. - public static Vector2D TransformNormal(Vector2D normal, Matrix3X2 matrix) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new( - Scalar.Add(Scalar.Multiply(normal.X, matrix.M11), Scalar.Multiply(normal.Y, matrix.M21)), - Scalar.Add(Scalar.Multiply(normal.X, matrix.M12), Scalar.Multiply(normal.Y, matrix.M22)) - ); - } - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Multiply(Vector2D value1, Matrix2X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => value1 * value2; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Multiply(Vector2D value1, Matrix2X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => value1 * value2; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Multiply(Vector2D value1, Matrix2X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => value1 * value2; - } -} diff --git a/sources/Maths/Maths/Legacy/Vector2D.cs b/sources/Maths/Maths/Legacy/Vector2D.cs deleted file mode 100644 index cb5b5fabdb..0000000000 --- a/sources/Maths/Maths/Legacy/Vector2D.cs +++ /dev/null @@ -1,356 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Globalization; -using System.Runtime.CompilerServices; -using System.Runtime.Serialization; -using System.Text; - -namespace Silk.NET.Maths -{ - /// A structure encapsulating two values and provides hardware accelerated methods. - [Serializable] - [DataContract] - public struct Vector2D - : IEquatable>, IFormattable - where T : unmanaged, IFormattable, IEquatable, IComparable - { - /// The X component of the vector. - [DataMember] - public T X; - - /// The Y component of the vector. - [DataMember] - public T Y; - - /// Creates a new object whose two elements have the same value. - /// The value to assign to both elements. - public Vector2D(T value) => (X, Y) = (value, value); - - /// Creates a vector whose elements have the specified values. - /// The value to assign to the field. - /// The value to assign to the field. - public Vector2D(T x, T y) => (X, Y) = (x, y); - - /// Gets a vector whose 2 elements are equal to one. - public static Vector2D One => new(Scalar.One); - - /// Gets the vector (1,0). - public static Vector2D UnitX => new(Scalar.One, Scalar.Zero); - - /// Gets the vector (0,1). - public static Vector2D UnitY => new(Scalar.Zero, Scalar.One); - - /// Returns a vector whose 2 elements are equal to zero. - public static Vector2D Zero => default; - - /// - /// Indexer for the components of this vector. - /// - /// The component to select. Zero based. - public T this[int i] - { - get - { - static void VerifyBounds(int i) - { - static void ThrowHelper() => throw new IndexOutOfRangeException(); - - if (i > 1 || i < 0) - ThrowHelper(); - } - - VerifyBounds(i); - return Unsafe.Add(ref X, i); - } - } - - /// Copies the elements of the vector to a specified array. - /// The destination array. - /// is null - /// The number of elements in the current instance is greater than in the array. - /// is multidimensional. - /// must have at least two elements. The method copies the vector's elements starting at index 0. - [MethodImpl((MethodImplOptions) 768)] - public readonly void CopyTo(T[]? array) => CopyTo(array, 0); - - /// Copies the elements of the vector to a specified array starting at a specified index position. - /// The destination array. - /// The index at which to copy the first element of the vector. - /// is null - /// The number of elements in the current instance is greater than in the array. - /// is less then zero. - /// is greater then or equal to the array length. - /// is multidimensional. - /// array must have a sufficient number of elements to accommodate the two vector elements. In other words, elements index and index + 1 must already exist in array. - [MethodImpl((MethodImplOptions) 768)] - public readonly void CopyTo(T[]? array, int index) - { - if (array is null) - { - throw new NullReferenceException("Object reference not set to an instance of an object."); - } - - if ((index < 0) || (index >= array.Length)) - { - throw new ArgumentOutOfRangeException(nameof(index), "Specified argument was out of the range of valid values."); - } - - if ((array.Length - index) < 2) - { - throw new ArgumentException("Value does not fall within the expected range."); - } - - array[index] = X; - array[index + 1] = Y; - } - - /// Returns a boolean indicating whether the given is equal to this instance. - /// The to compare this instance to. - /// True if the other is equal to this instance; False otherwise. - public readonly bool Equals(Vector2D other) => this == other; - - /// Returns a boolean indicating whether the given Object is equal to this instance. - /// The Object to compare against. - /// True if the Object is equal to this Vector2D; False otherwise. - [MethodImpl((MethodImplOptions) 768)] - public override readonly bool Equals(object? obj) => (obj is Vector2D other) && Equals(other); - - /// Returns the hash code for this instance. - /// The hash code. - public override readonly int GetHashCode() => HashCode.Combine(X, Y); - - /// Returns the length of the vector. - /// The vector's length. - public T Length - { - [MethodImpl((MethodImplOptions) 768)] - get => Scalar.Sqrt(LengthSquared); - } - - /// Returns the length of the vector squared. This operation is cheaper than Length(). - /// The vector's length squared. - public readonly T LengthSquared - { - [MethodImpl((MethodImplOptions) 768)] - get => Vector2D.Dot(this, this); - } - - /// Adds two vectors together. - /// The first source vector. - /// The second source vector. - /// The summed vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D operator +(Vector2D left, Vector2D right) - => new(Scalar.Add(left.X, right.X), Scalar.Add(left.Y, right.Y)); - - /// Divides the first vector by the second. - /// The first source vector. - /// The second source vector. - /// The vector resulting from the division. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D operator /(Vector2D left, Vector2D right) - => new(Scalar.Divide(left.X, right.X), Scalar.Divide(left.Y, right.Y)); - - /// Divides the vector by the given scalar. - /// The source vector. - /// The scalar value. - /// The result of the division. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D operator /(Vector2D value1, T value2) - => new(Scalar.Divide(value1.X, value2), Scalar.Divide(value1.Y, value2)); - - /// Returns a boolean indicating whether the two given vectors are equal. - /// The first vector to compare. - /// The second vector to compare. - /// True if the vectors are equal; False otherwise. - [MethodImpl((MethodImplOptions) 768)] - public static bool operator ==(Vector2D left, Vector2D right) - => Scalar.Equal(left.X, right.X) && Scalar.Equal(left.Y, right.Y); - - /// Returns a boolean indicating whether the two given vectors are not equal. - /// The first vector to compare. - /// The second vector to compare. - /// True if the vectors are not equal; False if they are equal. - [MethodImpl((MethodImplOptions) 768)] - public static bool operator !=(Vector2D left, Vector2D right) => !(left == right); - - /// Multiplies two vectors together. - /// The first source vector. - /// The second source vector. - /// The product vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D operator *(Vector2D left, Vector2D right) - => new(Scalar.Multiply(left.X, right.X), Scalar.Multiply(left.Y, right.Y)); - - /// Multiplies a vector by the given scalar. - /// The source vector. - /// The scalar value. - /// The scaled vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D operator *(Vector2D left, T right) - => new(Scalar.Multiply(left.X, right), Scalar.Multiply(left.Y, right)); - - /// Multiplies a vector by the given scalar. - /// The scalar value. - /// The source vector. - /// The scaled vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D operator *(T left, Vector2D right) => right * left; - - /// Subtracts the second vector from the first. - /// The first source vector. - /// The second source vector. - /// The difference vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D operator -(Vector2D left, Vector2D right) - => new(Scalar.Subtract(left.X, right.X), Scalar.Subtract(left.Y, right.Y)); - - /// Negates a given vector. - /// The source vector. - /// The negated vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D operator -(Vector2D value) => Zero - value; - - /// Returns a String representing this instance. - /// The string representation. - public override readonly string ToString() => ToString("G", CultureInfo.CurrentCulture); - - /// Returns a String representing this instance, using the specified format to format individual elements. - /// The format of individual elements. - /// The string representation. - public readonly string ToString(string? format) => ToString(format, CultureInfo.CurrentCulture); - - /// Returns a String representing this instance, using the specified format to format individual elements and the given IFormatProvider. - /// The format of individual elements. - /// The format provider to use when formatting elements. - /// The string representation. - public readonly string ToString(string? format, IFormatProvider? formatProvider) - { - StringBuilder sb = new(); - string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; - sb.Append('<'); - sb.Append(X.ToString(format, formatProvider)); - sb.Append(separator); - sb.Append(' '); - sb.Append(Y.ToString(format, formatProvider)); - sb.Append('>'); - return sb.ToString(); - } - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector2D(Vector2D from) - => new(Scalar.As(from.X), Scalar.As(from.Y)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector2D(Vector2D from) - => new(Scalar.As(from.X), Scalar.As(from.Y)); - - /// - /// Converts a into - /// - /// The source vector - /// The vector - public static explicit operator System.Numerics.Vector2(Vector2D from) - => new(Scalar.As(from.X), Scalar.As(from.Y)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector2D(Vector2D from) - => new(Scalar.As(from.X), Scalar.As(from.Y)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector2D(Vector2D from) - => new(Scalar.As(from.X), Scalar.As(from.Y)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector2D(Vector2D from) - => new(Scalar.As(from.X), Scalar.As(from.Y)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector2D(Vector2D from) - => new(Scalar.As(from.X), Scalar.As(from.Y)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector2D(Vector2D from) - => new(Scalar.As(from.X), Scalar.As(from.Y)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector2D(Vector2D from) - => new(Scalar.As(from.X), Scalar.As(from.Y)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector2D(Vector2D from) - => new(Scalar.As(from.X), Scalar.As(from.Y)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector2D(Vector2D from) - => new(Scalar.As(from.X), Scalar.As(from.Y)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector2D(Vector2D from) - => new(Scalar.As(from.X), Scalar.As(from.Y)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector2D(Vector2D from) - => new(Scalar.As(from.X), Scalar.As(from.Y)); - - /// - /// Returns this vector casted to - /// - /// The type to cast to - /// The casted vector - public Vector2D As() where TOther : unmanaged, IFormattable, IEquatable, IComparable - { - return new(Scalar.As(X), Scalar.As(Y)); - } - } -} diff --git a/sources/Maths/Maths/Legacy/Vector3D.Ops.cs b/sources/Maths/Maths/Legacy/Vector3D.Ops.cs deleted file mode 100644 index 618c53b805..0000000000 --- a/sources/Maths/Maths/Legacy/Vector3D.Ops.cs +++ /dev/null @@ -1,299 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Runtime.CompilerServices; - -namespace Silk.NET.Maths -{ - /// - /// Methods for working with - /// - public static class Vector3D - { - - /// Returns a vector whose elements are the absolute values of each of the source vector's elements. - /// The source vector. - /// The absolute value vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Abs(Vector3D value) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new(Scalar.Abs(value.X), Scalar.Abs(value.Y), Scalar.Abs(value.Z)); - - /// Adds two vectors together. - /// The first source vector. - /// The second source vector. - /// The summed vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Add(Vector3D left, Vector3D right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => left + right; - - /// Restricts a vector between a min and max value. - /// The source vector. - /// The minimum value. - /// The maximum value. - /// The restricted vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Clamp(Vector3D value1, Vector3D min, Vector3D max) - where T : unmanaged, IFormattable, IEquatable, IComparable - // We must follow HLSL behavior in the case user specified min value is bigger than max value. - => Min(Max(value1, min), max); - - /// Computes the cross product of two vectors. - /// The first vector. - /// The second vector. - /// The cross product. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Cross(Vector3D vector1, Vector3D vector2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new( - Scalar.Subtract(Scalar.Multiply(vector1.Y, vector2.Z), - Scalar.Multiply(vector1.Z, vector2.Y)), - Scalar.Subtract(Scalar.Multiply(vector1.Z, vector2.X), - Scalar.Multiply(vector1.X, vector2.Z)), - Scalar.Subtract(Scalar.Multiply(vector1.X, vector2.Y), - Scalar.Multiply(vector1.Y, vector2.X))); - - /// Returns the Euclidean distance between the two given points. - /// The first point. - /// The second point. - /// The distance. - [MethodImpl((MethodImplOptions) 768)] - public static T Distance(Vector3D value1, Vector3D value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => Scalar.Sqrt(DistanceSquared(value1, value2)); - - /// Returns the Euclidean distance squared between the two given points. - /// The first point. - /// The second point. - /// The distance squared. - [MethodImpl((MethodImplOptions) 768)] - public static T DistanceSquared(Vector3D value1, Vector3D value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - var difference = value1 - value2; - return Dot(difference, difference); - } - - /// Divides the first vector by the second. - /// The first source vector. - /// The second source vector. - /// The vector resulting from the division. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Divide(Vector3D left, Vector3D right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => left / right; - - /// Divides the vector by the given scalar. - /// The source vector. - /// The scalar value. - /// The result of the division. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Divide(Vector3D left, T divisor) - where T : unmanaged, IFormattable, IEquatable, IComparable - => left / divisor; - - /// Returns the dot product of two vectors. - /// The first vector. - /// The second vector. - /// The dot product. - [MethodImpl((MethodImplOptions) 768)] - public static T Dot(Vector3D vector1, Vector3D vector2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => Scalar.Add( - Scalar.Add(Scalar.Multiply(vector1.X, vector2.X), - Scalar.Multiply(vector1.Y, vector2.Y)), - Scalar.Multiply(vector1.Z, vector2.Z)); - - /// Linearly interpolates between two vectors based on the given weighting. - /// The first source vector. - /// The second source vector. - /// Value between 0 and 1 indicating the weight of the second source vector. - /// The interpolated vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Lerp(Vector3D value1, Vector3D value2, T amount) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return (value1 * Scalar.Subtract(Scalar.One, amount) + (value2 * amount)); - } - - /// Returns a vector whose elements are the maximum of each of the pairs of elements in the two source vectors. - /// The first source vector. - /// The second source vector. - /// The maximized vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Max(Vector3D value1, Vector3D value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new(Scalar.Max(value1.X, value2.X), Scalar.Max(value1.Y, value2.Y), - Scalar.Max(value1.Z, value2.Z)); - - /// Returns a vector whose elements are the minimum of each of the pairs of elements in the two source vectors. - /// The first source vector. - /// The second source vector. - /// The minimized vector. - public static Vector3D Min(Vector3D value1, Vector3D value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new(Scalar.Min(value1.X, value2.X), Scalar.Min(value1.Y, value2.Y), - Scalar.Min(value1.Z, value2.Z)); - - /// Multiplies two vectors together. - /// The first source vector. - /// The second source vector. - /// The product vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Multiply(Vector3D left, Vector3D right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => left * right; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Multiply(Vector3D value1, Matrix3X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => value1 * value2; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Multiply(Vector3D value1, Matrix3X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => value1 * value2; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Multiply(Vector3D value1, Matrix3X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => value1 * value2; - - /// Multiplies a vector by the given scalar. - /// The source vector. - /// The scalar value. - /// The scaled vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Multiply(Vector3D left, T right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => left * right; - - /// Multiplies a vector by the given scalar. - /// The scalar value. - /// The source vector. - /// The scaled vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Multiply(T left, Vector3D right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => left * right; - - /// Negates a given vector. - /// The source vector. - /// The negated vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Negate(Vector3D value) - where T : unmanaged, IFormattable, IEquatable, IComparable - => -value; - - /// Returns a vector with the same direction as the given vector, but with a length of 1. - /// The vector to normalize. - /// The normalized vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Normalize(Vector3D value) - where T : unmanaged, IFormattable, IEquatable, IComparable - => value / value.Length; - - /// Returns the reflection of a vector off a surface that has the specified normal. - /// The source vector. - /// The normal of the surface being reflected off. - /// The reflected vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Reflect(Vector3D vector, Vector3D normal) - where T : unmanaged, IFormattable, IEquatable, IComparable - => vector - (Scalar.Multiply(Scalar.Two, Dot(vector, normal)) * normal); - - /// Returns a vector whose elements are the square root of each of the source vector's elements. - /// The source vector. - /// The square root vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D SquareRoot(Vector3D value) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new(Scalar.Sqrt(value.X), Scalar.Sqrt(value.Y), Scalar.Sqrt(value.Z)); - - /// Subtracts the second vector from the first. - /// The first source vector. - /// The second source vector. - /// The difference vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Subtract(Vector3D left, Vector3D right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => left - right; - - - /// Transforms a vector by the given matrix. - /// The source vector. - /// The transformation matrix. - /// The transformed vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Transform(Vector3D position, Matrix4X4 matrix) // TODO: Matrix4X3 - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new( - Scalar.Add(Scalar.Add(Scalar.Add(Scalar.Multiply(position.X, matrix.M11), Scalar.Multiply(position.Y, matrix.M21)), Scalar.Multiply(position.Z, matrix.M31)), matrix.M41), - Scalar.Add(Scalar.Add(Scalar.Add(Scalar.Multiply(position.X, matrix.M12), Scalar.Multiply(position.Y, matrix.M22)), Scalar.Multiply(position.Z, matrix.M32)), matrix.M42), - Scalar.Add(Scalar.Add(Scalar.Add(Scalar.Multiply(position.X, matrix.M13), Scalar.Multiply(position.Y, matrix.M23)), Scalar.Multiply(position.Z, matrix.M33)), matrix.M43) - ); - } - - /// Transforms a vector by the given Quaternion rotation value. - /// The source vector to be rotated. - /// The rotation to apply. - /// The transformed vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Transform(Vector3D value, Legacy.Quaternion rotation) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - T x2 = Scalar.Add(rotation.X, rotation.X); - T y2 = Scalar.Add(rotation.Y, rotation.Y); - T z2 = Scalar.Add(rotation.Z, rotation.Z); - - T wx2 = Scalar.Multiply(rotation.W, x2); - T wy2 = Scalar.Multiply(rotation.W, y2); - T wz2 = Scalar.Multiply(rotation.W, z2); - T xx2 = Scalar.Multiply(rotation.X, x2); - T xy2 = Scalar.Multiply(rotation.X, y2); - T xz2 = Scalar.Multiply(rotation.X, z2); - T yy2 = Scalar.Multiply(rotation.Y, y2); - T yz2 = Scalar.Multiply(rotation.Y, z2); - T zz2 = Scalar.Multiply(rotation.Z, z2); - - // TODO: Vectorize - return new( - Scalar.Add(Scalar.Add(Scalar.Multiply(value.X, Scalar.Subtract(Scalar.Subtract(Scalar.One, yy2), zz2)), Scalar.Multiply(value.Y, Scalar.Subtract(xy2, wz2))), Scalar.Multiply(value.Z, Scalar.Add(xz2, wy2))), - Scalar.Add(Scalar.Add(Scalar.Multiply(value.X, Scalar.Add(xy2, wz2)), Scalar.Multiply(value.Y, Scalar.Subtract(Scalar.Subtract(Scalar.One, xx2), zz2))), Scalar.Multiply(value.Z, Scalar.Subtract(yz2, wx2))), - Scalar.Add(Scalar.Add(Scalar.Multiply(value.X, Scalar.Subtract(xz2, wy2)), Scalar.Multiply(value.Y, Scalar.Add(yz2, wx2))), Scalar.Multiply(value.Z, Scalar.Subtract(Scalar.Subtract(Scalar.One, xx2), yy2))) - ); - } - - - - /// Transforms a vector normal by the given matrix. - /// The source vector. - /// The transformation matrix. - /// The transformed vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D TransformNormal(Vector3D normal, Matrix4X4 matrix) // TODO: Matrix3X3 - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new( - Scalar.Add(Scalar.Add(Scalar.Multiply(normal.X, matrix.M11), Scalar.Multiply(normal.Y, matrix.M21)), Scalar.Multiply(normal.Z, matrix.M31)), - Scalar.Add(Scalar.Add(Scalar.Multiply(normal.X, matrix.M12), Scalar.Multiply(normal.Y, matrix.M22)), Scalar.Multiply(normal.Z, matrix.M32)), - Scalar.Add(Scalar.Add(Scalar.Multiply(normal.X, matrix.M13), Scalar.Multiply(normal.Y, matrix.M23)), Scalar.Multiply(normal.Z, matrix.M33)) - ); - } - } -} diff --git a/sources/Maths/Maths/Legacy/Vector3D.cs b/sources/Maths/Maths/Legacy/Vector3D.cs deleted file mode 100644 index 486057d3f7..0000000000 --- a/sources/Maths/Maths/Legacy/Vector3D.cs +++ /dev/null @@ -1,383 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Globalization; -using System.Runtime.CompilerServices; -using System.Runtime.Serialization; -using System.Text; - -namespace Silk.NET.Maths -{ - /// A structure encapsulating three values and provides hardware accelerated methods. - [Serializable] - [DataContract] - public struct Vector3D - : IEquatable>, IFormattable - where T : unmanaged, IFormattable, IEquatable, IComparable - { - /// The X component of the vector. - [DataMember] - public T X; - - /// The Y component of the vector. - [DataMember] - public T Y; - - /// The Z component of the vector. - [DataMember] - public T Z; - - /// Constructs a vector whose elements are all the single specified value. - /// The element to fill the vector with. - public Vector3D(T value) => (X, Y, Z) = (value, value, value); - - /// Constructs a from the given and a third value. - /// The Vector to extract X and Y components from. - /// The Z component. - public Vector3D(Vector2D value, T z) => (X, Y, Z) = (value.X, value.Y, z); - - /// Constructs a vector with the given individual elements. - /// The X component. - /// The Y component. - /// The Z component. - public Vector3D(T x, T y, T z) => (X, Y, Z) = (x, y, z); - - /// Returns the vector (0,0,0). - public static Vector3D Zero => default; - - /// Returns the vector (1,1,1). - public static Vector3D One => new(Scalar.One); - - /// Returns the vector (1,0,0). - public static Vector3D UnitX => new(Scalar.One, Scalar.Zero, Scalar.Zero); - - /// Returns the vector (0,1,0). - public static Vector3D UnitY => new(Scalar.Zero, Scalar.One, Scalar.Zero); - - /// Returns the vector (0,0,1). - public static Vector3D UnitZ => new(Scalar.Zero, Scalar.Zero, Scalar.One); - - /// - /// Indexer for the components of this vector. - /// - /// The component to select. Zero based. - public T this[int i] - { - get - { - static void VerifyBounds(int i) - { - static void ThrowHelper() => throw new IndexOutOfRangeException(); - - if (i > 2 || i < 0) - ThrowHelper(); - } - - VerifyBounds(i); - return Unsafe.Add(ref X, i); - } - } - - /// Adds two vectors together. - /// The first source vector. - /// The second source vector. - /// The summed vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D operator +(Vector3D left, Vector3D right) - => new(Scalar.Add(left.X, right.X), Scalar.Add(left.Y, right.Y), Scalar.Add(left.Z, right.Z)); - - /// Divides the first vector by the second. - /// The first source vector. - /// The second source vector. - /// The vector resulting from the division. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D operator /(Vector3D left, Vector3D right) - => new(Scalar.Divide(left.X, right.X), Scalar.Divide(left.Y, right.Y), - Scalar.Divide(left.Z, right.Z)); - - /// Divides the vector by the given scalar. - /// The source vector. - /// The scalar value. - /// The result of the division. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D operator /(Vector3D value1, T value2) - => new(Scalar.Divide(value1.X, value2), Scalar.Divide(value1.Y, value2), - Scalar.Divide(value1.Z, value2)); - - /// Returns a boolean indicating whether the two given vectors are equal. - /// The first vector to compare. - /// The second vector to compare. - /// True if the vectors are equal; False otherwise. - [MethodImpl((MethodImplOptions) 768)] - public static bool operator ==(Vector3D left, Vector3D right) - => Scalar.Equal(left.X, right.X) - && Scalar.Equal(left.Y, right.Y) - && Scalar.Equal(left.Z, right.Z); - - /// Returns a boolean indicating whether the two given vectors are not equal. - /// The first vector to compare. - /// The second vector to compare. - /// True if the vectors are not equal; False if they are equal. - [MethodImpl((MethodImplOptions) 768)] - public static bool operator !=(Vector3D left, Vector3D right) => !(left == right); - - /// Multiplies two vectors together. - /// The first source vector. - /// The second source vector. - /// The product vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D operator *(Vector3D left, Vector3D right) - => new(Scalar.Multiply(left.X, right.X), Scalar.Multiply(left.Y, right.Y), - Scalar.Multiply(left.Z, right.Z)); - - /// Multiplies a vector by the given scalar. - /// The source vector. - /// The scalar value. - /// The scaled vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D operator *(Vector3D left, T right) - => new(Scalar.Multiply(left.X, right), Scalar.Multiply(left.Y, right), - Scalar.Multiply(left.Z, right)); - - /// Multiplies a vector by the given scalar. - /// The scalar value. - /// The source vector. - /// The scaled vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D operator *(T left, Vector3D right) - => right * left; - - /// Subtracts the second vector from the first. - /// The first source vector. - /// The second source vector. - /// The difference vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D operator -(Vector3D left, Vector3D right) - => new(Scalar.Subtract(left.X, right.X), Scalar.Subtract(left.Y, right.Y), - Scalar.Subtract(left.Z, right.Z)); - - /// Negates a given vector. - /// The source vector. - /// The negated vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D operator -(Vector3D value) - => Zero - value; - - /// Copies the contents of the vector into the given array. - [MethodImpl((MethodImplOptions) 768)] - public readonly void CopyTo(T[]? array) - => CopyTo(array, 0); - - /// Copies the contents of the vector into the given array, starting from index. - /// If array is null. - /// If array is multidimensional. - /// If index is greater than end of the array or index is less than zero. - /// If number of elements in source vector is greater than those available in destination array. - [MethodImpl((MethodImplOptions) 768)] - public readonly void CopyTo(T[]? array, int index) - { - if (array is null) - { - throw new NullReferenceException("Object reference not set to an instance of an object."); - } - - if ((index < 0) || (index >= array.Length)) - { - throw new ArgumentOutOfRangeException(nameof(index), "Specified argument was out of the range of valid values."); - } - - if ((array.Length - index) < 3) - { - throw new ArgumentException("Value does not fall within the expected range."); - } - - array[index] = X; - array[index + 1] = Y; - array[index + 2] = Z; - } - - /// Returns a boolean indicating whether the given Object is equal to this instance. - /// The Object to compare against. - /// True if the Object is equal to this Vector3D; False otherwise. - [MethodImpl((MethodImplOptions) 768)] - public override readonly bool Equals(object? obj) - { - return (obj is Vector3D other) && Equals(other); - } - - /// Returns a boolean indicating whether the given is equal to this instance. - /// The to compare this instance to. - /// True if the other is equal to this instance; False otherwise. - public readonly bool Equals(Vector3D other) - { - return this == other; - } - - /// Returns the hash code for this instance. - /// The hash code. - public override readonly int GetHashCode() - { - return HashCode.Combine(X, Y, Z); - } - - /// Returns the length of the vector. - /// The vector's length. - public T Length - { - [MethodImpl((MethodImplOptions) 768)] - get => Scalar.Sqrt(LengthSquared); - } - - /// Returns the length of the vector squared. This operation is cheaper than Length(). - /// The vector's length squared. - public T LengthSquared - { - [MethodImpl((MethodImplOptions) 768)] - get => Vector3D.Dot(this, this); - } - - /// Returns a String representing this instance. - /// The string representation. - public override readonly string ToString() => ToString("G", CultureInfo.CurrentCulture); - - /// Returns a String representing this instance, using the specified format to format individual elements. - /// The format of individual elements. - /// The string representation. - public readonly string ToString(string? format) => ToString(format, CultureInfo.CurrentCulture); - - /// Returns a String representing this instance, using the specified format to format individual elements and the given IFormatProvider. - /// The format of individual elements. - /// The format provider to use when formatting elements. - /// The string representation. - public readonly string ToString(string? format, IFormatProvider? formatProvider) - { - StringBuilder sb = new(); - string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; - sb.Append('<'); - sb.Append(X.ToString(format, formatProvider)); - sb.Append(separator); - sb.Append(' '); - sb.Append(Y.ToString(format, formatProvider)); - sb.Append(separator); - sb.Append(' '); - sb.Append(Z.ToString(format, formatProvider)); - sb.Append('>'); - return sb.ToString(); - } - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector3D(Vector3D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector3D(Vector3D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z)); - - /// - /// Converts a into - /// - /// The source vector - /// The vector - public static explicit operator System.Numerics.Vector3(Vector3D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector3D(Vector3D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector3D(Vector3D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector3D(Vector3D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector3D(Vector3D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector3D(Vector3D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector3D(Vector3D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector3D(Vector3D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector3D(Vector3D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector3D(Vector3D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector3D(Vector3D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z)); - - /// - /// Returns this vector casted to - /// - /// The type to cast to - /// The casted vector - public Vector3D As() where TOther : unmanaged, IFormattable, IEquatable, IComparable - { - return new(Scalar.As(X), Scalar.As(Y), Scalar.As(Z)); - } - } -} diff --git a/sources/Maths/Maths/Legacy/Vector4D.Ops.cs b/sources/Maths/Maths/Legacy/Vector4D.Ops.cs deleted file mode 100644 index b86726fc19..0000000000 --- a/sources/Maths/Maths/Legacy/Vector4D.Ops.cs +++ /dev/null @@ -1,357 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Runtime.CompilerServices; - -namespace Silk.NET.Maths -{ - /// - /// Methods for working with - /// - public static class Vector4D - { - /// Returns a vector whose elements are the absolute values of each of the source vector's elements. - /// The source vector. - /// The absolute value vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Abs(Vector4D value) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new( - Scalar.Abs(value.X), - Scalar.Abs(value.Y), - Scalar.Abs(value.Z), - Scalar.Abs(value.W) - ); - - /// Adds two vectors together. - /// The first source vector. - /// The second source vector. - /// The summed vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Add(Vector4D left, Vector4D right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => left + right; - - /// Restricts a vector between a min and max value. - /// The source vector. - /// The minimum value. - /// The maximum value. - /// The restricted vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Clamp(Vector4D value1, Vector4D min, Vector4D max) - where T : unmanaged, IFormattable, IEquatable, IComparable - // We must follow HLSL behavior in the case user specified min value is bigger than max value. - => Min(Max(value1, min), max); - - /// Returns the Euclidean distance between the two given points. - /// The first point. - /// The second point. - /// The distance. - [MethodImpl((MethodImplOptions) 768)] - public static T Distance(Vector4D value1, Vector4D value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => Scalar.Sqrt(DistanceSquared(value1, value2)); - - /// Returns the Euclidean distance squared between the two given points. - /// The first point. - /// The second point. - /// The distance squared. - [MethodImpl((MethodImplOptions) 768)] - public static T DistanceSquared(Vector4D value1, Vector4D value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - var difference = value1 - value2; - return Dot(difference, difference); - } - - /// Divides the first vector by the second. - /// The first source vector. - /// The second source vector. - /// The vector resulting from the division. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Divide(Vector4D left, Vector4D right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => left / right; - - /// Divides the vector by the given scalar. - /// The source vector. - /// The scalar value. - /// The result of the division. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Divide(Vector4D left, T divisor) - where T : unmanaged, IFormattable, IEquatable, IComparable - => left / divisor; - - /// Returns the dot product of two vectors. - /// The first vector. - /// The second vector. - /// The dot product. - [MethodImpl((MethodImplOptions) 768)] - public static T Dot(Vector4D vector1, Vector4D vector2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => Scalar.Add( - Scalar.Add( - Scalar.Add(Scalar.Multiply(vector1.X, vector2.X), - Scalar.Multiply(vector1.Y, vector2.Y)), Scalar.Multiply(vector1.Z, vector2.Z)), - Scalar.Multiply(vector1.W, vector2.W)); - - /// Linearly interpolates between two vectors based on the given weighting. - /// The first source vector. - /// The second source vector. - /// Value between 0 and 1 indicating the weight of the second source vector. - /// The interpolated vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Lerp(Vector4D value1, Vector4D value2, T amount) - where T : unmanaged, IFormattable, IEquatable, IComparable - => (value1 * Scalar.Subtract(Scalar.One, amount)) + (value2 * amount); - - /// Returns a vector whose elements are the maximum of each of the pairs of elements in the two source vectors. - /// The first source vector. - /// The second source vector. - /// The maximized vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Max(Vector4D value1, Vector4D value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new(Scalar.Max(value1.X, value2.X), Scalar.Max(value1.Y, value2.Y), - Scalar.Max(value1.Z, value2.Z), Scalar.Max(value1.W, value2.W)); - - /// Returns a vector whose elements are the minimum of each of the pairs of elements in the two source vectors. - /// The first source vector. - /// The second source vector. - /// The minimized vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Min(Vector4D value1, Vector4D value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => new(Scalar.Min(value1.X, value2.X), Scalar.Min(value1.Y, value2.Y), - Scalar.Min(value1.Z, value2.Z), Scalar.Min(value1.W, value2.W)); - - /// Multiplies two vectors together. - /// The first source vector. - /// The second source vector. - /// The product vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Multiply(Vector4D left, Vector4D right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => left * right; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Multiply(Vector4D value1, Matrix4X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => value1 * value2; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Multiply(Vector4D value1, Matrix4X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => value1 * value2; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Multiply(Vector4D value1, Matrix4X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => value1 * value2; - - /// Multiplies a vector by the given scalar. - /// The source vector. - /// The scalar value. - /// The scaled vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Multiply(Vector4D left, T right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => left * right; - - /// Multiplies a vector by the given scalar. - /// The scalar value. - /// The source vector. - /// The scaled vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Multiply(T left, Vector4D right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => left * right; - - /// Negates a given vector. - /// The source vector. - /// The negated vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Negate(Vector4D value) - where T : unmanaged, IFormattable, IEquatable, IComparable - => -value; - - /// Returns a vector with the same direction as the given vector, but with a length of 1. - /// The vector to normalize. - /// The normalized vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Normalize(Vector4D vector) - where T : unmanaged, IFormattable, IEquatable, IComparable - => vector / vector.Length; - - /// Returns a vector whose elements are the square root of each of the source vector's elements. - /// The source vector. - /// The square root vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D SquareRoot(Vector4D value) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new(Scalar.Sqrt(value.X), Scalar.Sqrt(value.Y), Scalar.Sqrt(value.Z), - Scalar.Sqrt(value.W)); - } - - /// Subtracts the second vector from the first. - /// The first source vector. - /// The second source vector. - /// The difference vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Subtract(Vector4D left, Vector4D right) - where T : unmanaged, IFormattable, IEquatable, IComparable - => left - right; - - /// Transforms a vector by the given matrix. - /// The source vector. - /// The transformation matrix. - /// The transformed vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Transform(Vector2D position, Matrix4X4 matrix) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new( - Scalar.Add(Scalar.Add(Scalar.Multiply(position.X, matrix.M11), Scalar.Multiply(position.Y, matrix.M21)), matrix.M41), - Scalar.Add(Scalar.Add(Scalar.Multiply(position.X, matrix.M12), Scalar.Multiply(position.Y, matrix.M22)), matrix.M42), - Scalar.Add(Scalar.Add(Scalar.Multiply(position.X, matrix.M13), Scalar.Multiply(position.Y, matrix.M23)), matrix.M43), - Scalar.Add(Scalar.Add(Scalar.Multiply(position.X, matrix.M14), Scalar.Multiply(position.Y, matrix.M24)), matrix.M44) - ); - } - - /// Transforms a vector by the given Quaternion rotation value. - /// The source vector to be rotated. - /// The rotation to apply. - /// The transformed vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Transform(Vector2D value, Silk.NET.Maths.Legacy.Quaternion rotation) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - T x2 = Scalar.Add(rotation.X, rotation.X); - T y2 = Scalar.Add(rotation.Y, rotation.Y); - T z2 = Scalar.Add(rotation.Z, rotation.Z); - - T wx2 = Scalar.Multiply(rotation.W, x2); - T wy2 = Scalar.Multiply(rotation.W, y2); - T wz2 = Scalar.Multiply(rotation.W, z2); - T xx2 = Scalar.Multiply(rotation.X, x2); - T xy2 = Scalar.Multiply(rotation.X, y2); - T xz2 = Scalar.Multiply(rotation.X, z2); - T yy2 = Scalar.Multiply(rotation.Y, y2); - T yz2 = Scalar.Multiply(rotation.Y, z2); - T zz2 = Scalar.Multiply(rotation.Z, z2); - - return new( - Scalar.Add(Scalar.Multiply(value.X, Scalar.Subtract(Scalar.Subtract(Scalar.One, yy2), zz2)), Scalar.Multiply(value.Y, Scalar.Subtract(xy2, wz2))), - Scalar.Add(Scalar.Multiply(value.X, Scalar.Add(xy2, wz2)), Scalar.Multiply(value.Y, Scalar.Subtract(Scalar.Subtract(Scalar.One, xx2), zz2))), - Scalar.Add(Scalar.Multiply(value.X, Scalar.Subtract(xz2, wy2)), Scalar.Multiply(value.Y, Scalar.Add(yz2, wx2))), - Scalar.One - ); - } - - /// Transforms a vector by the given matrix. - /// The source vector. - /// The transformation matrix. - /// The transformed vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Transform(Vector3D position, Matrix4X4 matrix) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new( - Scalar.Add(Scalar.Add(Scalar.Add(Scalar.Multiply(position.X, matrix.M11), Scalar.Multiply(position.Y, matrix.M21)), Scalar.Multiply(position.Z, matrix.M31)), matrix.M41), - Scalar.Add(Scalar.Add(Scalar.Add(Scalar.Multiply(position.X, matrix.M12), Scalar.Multiply(position.Y, matrix.M22)), Scalar.Multiply(position.Z, matrix.M32)), matrix.M42), - Scalar.Add(Scalar.Add(Scalar.Add(Scalar.Multiply(position.X, matrix.M13), Scalar.Multiply(position.Y, matrix.M23)), Scalar.Multiply(position.Z, matrix.M33)), matrix.M43), - Scalar.Add(Scalar.Add(Scalar.Add(Scalar.Multiply(position.X, matrix.M14), Scalar.Multiply(position.Y, matrix.M24)), Scalar.Multiply(position.Z, matrix.M34)), matrix.M44) - ); - } - - /// Transforms a vector by the given Quaternion rotation value. - /// The source vector to be rotated. - /// The rotation to apply. - /// The transformed vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Transform(Vector3D value, Legacy.Quaternion rotation) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - T x2 = Scalar.Add(rotation.X, rotation.X); - T y2 = Scalar.Add(rotation.Y, rotation.Y); - T z2 = Scalar.Add(rotation.Z, rotation.Z); - - T wx2 = Scalar.Multiply(rotation.W, x2); - T wy2 = Scalar.Multiply(rotation.W, y2); - T wz2 = Scalar.Multiply(rotation.W, z2); - T xx2 = Scalar.Multiply(rotation.X, x2); - T xy2 = Scalar.Multiply(rotation.X, y2); - T xz2 = Scalar.Multiply(rotation.X, z2); - T yy2 = Scalar.Multiply(rotation.Y, y2); - T yz2 = Scalar.Multiply(rotation.Y, z2); - T zz2 = Scalar.Multiply(rotation.Z, z2); - - return new( - Scalar.Add(Scalar.Add(Scalar.Multiply(value.X, Scalar.Subtract(Scalar.Subtract(Scalar.One, yy2), zz2)), Scalar.Multiply(value.Y, Scalar.Subtract(xy2, wz2))), Scalar.Multiply(value.Z, Scalar.Add(xz2, wy2))), - Scalar.Add(Scalar.Add(Scalar.Multiply(value.X, Scalar.Add(xy2, wz2)), Scalar.Multiply(value.Y, Scalar.Subtract(Scalar.Subtract(Scalar.One, xx2), zz2))), Scalar.Multiply(value.Z, Scalar.Subtract(yz2, wx2))), - Scalar.Add(Scalar.Add(Scalar.Multiply(value.X, Scalar.Subtract(xz2, wy2)), Scalar.Multiply(value.Y, Scalar.Add(yz2, wx2))), Scalar.Multiply(value.Z, Scalar.Subtract(Scalar.Subtract(Scalar.One, xx2), yy2))), - Scalar.One - ); - } - - /// Transforms a vector by the given matrix. - /// The source vector. - /// The transformation matrix. - /// The transformed vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Transform(Vector4D vector, Matrix4X4 matrix) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new( - Scalar.Add(Scalar.Add(Scalar.Add(Scalar.Multiply(vector.X, matrix.M11), Scalar.Multiply(vector.Y, matrix.M21)), Scalar.Multiply(vector.Z, matrix.M31)), Scalar.Multiply(vector.W, matrix.M41)), - Scalar.Add(Scalar.Add(Scalar.Add(Scalar.Multiply(vector.X, matrix.M12), Scalar.Multiply(vector.Y, matrix.M22)), Scalar.Multiply(vector.Z, matrix.M32)), Scalar.Multiply(vector.W, matrix.M42)), - Scalar.Add(Scalar.Add(Scalar.Add(Scalar.Multiply(vector.X, matrix.M13), Scalar.Multiply(vector.Y, matrix.M23)), Scalar.Multiply(vector.Z, matrix.M33)), Scalar.Multiply(vector.W, matrix.M43)), - Scalar.Add(Scalar.Add(Scalar.Add(Scalar.Multiply(vector.X, matrix.M14), Scalar.Multiply(vector.Y, matrix.M24)), Scalar.Multiply(vector.Z, matrix.M34)), Scalar.Multiply(vector.W, matrix.M44)) - ); - } - - /// Transforms a vector by the given Quaternion rotation value. - /// The source vector to be rotated. - /// The rotation to apply. - /// The transformed vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Transform(Vector4D value, Legacy.Quaternion rotation) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - T x2 = Scalar.Add(rotation.X, rotation.X); - T y2 = Scalar.Add(rotation.Y, rotation.Y); - T z2 = Scalar.Add(rotation.Z, rotation.Z); - - T wx2 = Scalar.Multiply(rotation.W, x2); - T wy2 = Scalar.Multiply(rotation.W, y2); - T wz2 = Scalar.Multiply(rotation.W, z2); - T xx2 = Scalar.Multiply(rotation.X, x2); - T xy2 = Scalar.Multiply(rotation.X, y2); - T xz2 = Scalar.Multiply(rotation.X, z2); - T yy2 = Scalar.Multiply(rotation.Y, y2); - T yz2 = Scalar.Multiply(rotation.Y, z2); - T zz2 = Scalar.Multiply(rotation.Z, z2); - - return new( - Scalar.Add(Scalar.Add(Scalar.Multiply(value.X, Scalar.Subtract(Scalar.Subtract(Scalar.One, yy2), zz2)), Scalar.Multiply(value.Y, Scalar.Subtract(xy2, wz2))), Scalar.Multiply(value.Z, Scalar.Add(xz2, wy2))), - Scalar.Add(Scalar.Add(Scalar.Multiply(value.X, Scalar.Add(xy2, wz2)), Scalar.Multiply(value.Y, Scalar.Subtract(Scalar.Subtract(Scalar.One, xx2), zz2))), Scalar.Multiply(value.Z, Scalar.Subtract(yz2, wx2))), - Scalar.Add(Scalar.Add(Scalar.Multiply(value.X, Scalar.Subtract(xz2, wy2)), Scalar.Multiply(value.Y, Scalar.Add(yz2, wx2))), Scalar.Multiply(value.Z, Scalar.Subtract(Scalar.Subtract(Scalar.One, xx2), yy2))), - value.W - ); - } - } -} diff --git a/sources/Maths/Maths/Legacy/Vector4D.cs b/sources/Maths/Maths/Legacy/Vector4D.cs deleted file mode 100644 index 3722ecde42..0000000000 --- a/sources/Maths/Maths/Legacy/Vector4D.cs +++ /dev/null @@ -1,417 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Globalization; -using System.Runtime.CompilerServices; -using System.Runtime.Serialization; -using System.Text; - -namespace Silk.NET.Maths -{ - /// A structure encapsulating four single precision floating point values and provides hardware accelerated methods. - [Serializable] - [DataContract] - public struct Vector4D - : IEquatable>, IFormattable - where T : unmanaged, IFormattable, IEquatable, IComparable - { - /// The X component of the vector. - [DataMember] - public T X; - - /// The Y component of the vector. - [DataMember] - public T Y; - - /// The Z component of the vector. - [DataMember] - public T Z; - - /// The W component of the vector. - [DataMember] - public T W; - - /// - /// Indexer for the components of this vector. - /// - /// The component to select. Zero based. - public T this[int i] - { - get - { - static void VerifyBounds(int i) - { - static void ThrowHelper() => throw new IndexOutOfRangeException(); - - if (i > 3 || i < 0) - ThrowHelper(); - } - - VerifyBounds(i); - return Unsafe.Add(ref X, i); - } - } - - /// Constructs a vector whose elements are all the single specified value. - /// The element to fill the vector with. - public Vector4D(T value) => (X, Y, Z, W) = (value, value, value, value); - - /// Constructs a from the given and a Z and W component. - /// The vector to use as the X and Y components. - /// The Z component. - /// The W component. - public Vector4D(Vector2D value, T z, T w) => (X, Y, Z, W) = (value.X, value.Y, z, w); - - /// Constructs a from the given and a W component. - /// The vector to use as the X, Y, and Z components. - /// The W component. - public Vector4D(Vector3D value, T w) => (X, Y, Z, W) = (value.X, value.Y, value.Z, w); - - /// Constructs a vector with the given individual elements. - /// W component. - /// X component. - /// Y component. - /// Z component. - public Vector4D(T x, T y, T z, T w) => (X, Y, Z, W) = (x, y, z, w); - - /// Returns the vector (0,0,0,0). - public static Vector4D Zero => default; - - /// Returns the vector (1,1,1,1). - public static Vector4D One => new(Scalar.One); - - /// Returns the vector (1,0,0,0). - public static Vector4D UnitX => new(Scalar.One, Scalar.Zero, Scalar.Zero, Scalar.Zero); - - /// Returns the vector (0,1,0,0). - public static Vector4D UnitY => new(Scalar.Zero, Scalar.One, Scalar.Zero, Scalar.Zero); - - /// Returns the vector (0,0,1,0). - public static Vector4D UnitZ => new(Scalar.Zero, Scalar.Zero, Scalar.One, Scalar.Zero); - - /// Returns the vector (0,0,0,1). - public static Vector4D UnitW => new(Scalar.Zero, Scalar.Zero, Scalar.Zero, Scalar.One); - - /// Adds two vectors together. - /// The first source vector. - /// The second source vector. - /// The summed vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D operator +(Vector4D left, Vector4D right) - => new(Scalar.Add(left.X, right.X), Scalar.Add(left.Y, right.Y), Scalar.Add(left.Z, right.Z), - Scalar.Add(left.W, right.W)); - - /// Divides the first vector by the second. - /// The first source vector. - /// The second source vector. - /// The vector resulting from the division. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D operator /(Vector4D left, Vector4D right) - => new(Scalar.Divide(left.X, right.X), Scalar.Divide(left.Y, right.Y), Scalar.Divide(left.Z, right.Z), - Scalar.Divide(left.W, right.W)); - - /// Divides the vector by the given scalar. - /// The source vector. - /// The scalar value. - /// The result of the division. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D operator /(Vector4D value1, T value2) - => new(Scalar.Divide(value1.X, value2), Scalar.Divide(value1.Y, value2), - Scalar.Divide(value1.Z, value2), Scalar.Divide(value1.W, value2)); - - /// Returns a boolean indicating whether the two given vectors are equal. - /// The first vector to compare. - /// The second vector to compare. - /// True if the vectors are equal; False otherwise. - [MethodImpl((MethodImplOptions) 768)] - public static bool operator ==(Vector4D left, Vector4D right) - => Scalar.Equal(left.X, right.X) - && Scalar.Equal(left.Y, right.Y) - && Scalar.Equal(left.Z, right.Z) - && Scalar.Equal(left.W, right.W); - - /// Returns a boolean indicating whether the two given vectors are not equal. - /// The first vector to compare. - /// The second vector to compare. - /// True if the vectors are not equal; False if they are equal. - [MethodImpl((MethodImplOptions) 768)] - public static bool operator !=(Vector4D left, Vector4D right) - => !(left == right); - - /// Multiplies two vectors together. - /// The first source vector. - /// The second source vector. - /// The product vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D operator *(Vector4D left, Vector4D right) - => new(Scalar.Multiply(left.X, right.X), Scalar.Multiply(left.Y, right.Y), - Scalar.Multiply(left.Z, right.Z), Scalar.Multiply(left.W, right.W)); - - /// Multiplies a vector by the given scalar. - /// The source vector. - /// The scalar value. - /// The scaled vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D operator *(Vector4D left, T right) - => new(Scalar.Multiply(left.X, right), Scalar.Multiply(left.Y, right), - Scalar.Multiply(left.Z, right), Scalar.Multiply(left.W, right)); - - /// Multiplies a vector by the given scalar. - /// The scalar value. - /// The source vector. - /// The scaled vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D operator *(T left, Vector4D right) - => right * left; - - /// Subtracts the second vector from the first. - /// The first source vector. - /// The second source vector. - /// The difference vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D operator -(Vector4D left, Vector4D right) - => new(Scalar.Subtract(left.X, right.X), Scalar.Subtract(left.Y, right.Y), - Scalar.Subtract(left.Z, right.Z), Scalar.Subtract(left.W, right.W)); - - /// Negates a given vector. - /// The source vector. - /// The negated vector. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D operator -(Vector4D value) => Zero - value; - - /// Copies the contents of the vector into the given array. - [MethodImpl((MethodImplOptions) 768)] - public readonly void CopyTo(T[]? array) - => CopyTo(array, 0); - - /// Copies the contents of the vector into the given array, starting from index. - /// If array is null. - /// If array is multidimensional. - /// If index is greater than end of the array or index is less than zero. - /// If number of elements in source vector is greater than those available in destination array. - [MethodImpl((MethodImplOptions) 768)] - public readonly void CopyTo(T[]? array, int index) - { - if (array is null) - { - throw new NullReferenceException("Object reference not set to an instance of an object."); - } - - if ((index < 0) || (index >= array.Length)) - { - throw new ArgumentOutOfRangeException(nameof(index), "Specified argument was out of the range of valid values."); - } - - if ((array.Length - index) < 4) - { - throw new ArgumentException("Value does not fall within the expected range."); - } - - array[index] = X; - array[index + 1] = Y; - array[index + 2] = Z; - array[index + 3] = W; - } - - /// Returns a boolean indicating whether the given is equal to this instance. - /// The to compare this instance to. - /// True if the other is equal to this instance; False otherwise. - public readonly bool Equals(Vector4D other) - => this == other; - - /// Returns a boolean indicating whether the given Object is equal to this instance. - /// The Object to compare against. - /// True if the Object is equal to this Vector4D; False otherwise. - [MethodImpl((MethodImplOptions) 768)] - public override readonly bool Equals(object? obj) - => (obj is Vector4D other) && Equals(other); - - /// Returns the hash code for this instance. - /// The hash code. - public override readonly int GetHashCode() - => HashCode.Combine(X, Y, Z, W); - - /// Returns the length of the vector. This operation is cheaper than Length(). - /// The vector's length. - public T Length - { - [MethodImpl((MethodImplOptions) 768)] - get => Scalar.Sqrt(LengthSquared); - } - - /// Returns the length of the vector squared. - /// The vector's length squared. - public T LengthSquared - { - [MethodImpl((MethodImplOptions) 768)] - get => Vector4D.Dot(this, this); - } - - /// Returns a String representing this instance. - /// The string representation. - public override readonly string ToString() - { - return ToString("G", CultureInfo.CurrentCulture); - } - - /// Returns a String representing this instance, using the specified format to format individual elements. - /// The format of individual elements. - /// The string representation. - public readonly string ToString(string? format) - { - return ToString(format, CultureInfo.CurrentCulture); - } - - /// Returns a String representing this instance, using the specified format to format individual elements - /// and the given IFormatProvider. - /// The format of individual elements. - /// The format provider to use when formatting elements. - /// The string representation. - public readonly string ToString(string? format, IFormatProvider? formatProvider) - { - StringBuilder sb = new(); - string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; - sb.Append('<'); - sb.Append(X.ToString(format, formatProvider)); - sb.Append(separator); - sb.Append(' '); - sb.Append(Y.ToString(format, formatProvider)); - sb.Append(separator); - sb.Append(' '); - sb.Append(Z.ToString(format, formatProvider)); - sb.Append(separator); - sb.Append(' '); - sb.Append(W.ToString(format, formatProvider)); - sb.Append('>'); - return sb.ToString(); - } - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector4D(Vector4D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector4D(Vector4D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into - /// - /// The source vector - /// The vector - public static explicit operator System.Numerics.Vector4(Vector4D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector4D(Vector4D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector4D(Vector4D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector4D(Vector4D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector4D(Vector4D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector4D(Vector4D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector4D(Vector4D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector4D(Vector4D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector4D(Vector4D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector4D(Vector4D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Vector4D(Vector4D from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Returns this vector casted to - /// - /// The type to cast to - /// The casted vector - public Vector4D As() where TOther : unmanaged, IFormattable, IEquatable, IComparable - { - return new(Scalar.As(X), Scalar.As(Y), Scalar.As(Z), Scalar.As(W)); - } - } -} diff --git a/sources/Maths/Maths/Matrix2x2F.gen.cs b/sources/Maths/Maths/Matrix2X2.gen.cs similarity index 77% rename from sources/Maths/Maths/Matrix2x2F.gen.cs rename to sources/Maths/Maths/Matrix2X2.gen.cs index 0d43a43ed1..fb351734b6 100644 --- a/sources/Maths/Maths/Matrix2x2F.gen.cs +++ b/sources/Maths/Maths/Matrix2X2.gen.cs @@ -3,28 +3,28 @@ namespace Silk.NET.Maths using System.Diagnostics.CodeAnalysis; using System.Numerics; - partial struct Matrix2x2F : - IEquatable> - where T : IFloatingPointIeee754 + public partial struct Matrix2X2 : + IEquatable> + where T : INumberBase { /// The multiplicative identity matrix of size 2x2. - public static readonly Matrix2x2F Identity = new( + public static readonly Matrix2X2 Identity = new( new(T.MultiplicativeIdentity, T.Zero), new(T.Zero, T.MultiplicativeIdentity)); /// The 1st row of the matrix represented as a vector. - public Vector2F Row1; + public Vector2D Row1; /// The 2nd row of the matrix represented as a vector. - public Vector2F Row2; + public Vector2D Row2; /// - /// Constructs a from the given rows. + /// Constructs a from the given rows. /// - public Matrix2x2F(Vector2F row1, Vector2F row2) => (Row1, Row2) = (row1, row2); + public Matrix2X2(Vector2D row1, Vector2D row2) => (Row1, Row2) = (row1, row2); [UnscopedRef] - public ref Vector2F this[int row] + public ref Vector2D this[int row] { get { @@ -60,16 +60,16 @@ public ref Vector2F this[int row] public ref T M22 => ref Row2.Y; /// - public override bool Equals(object? obj) => obj is Matrix2x2F other && Equals(other); + public override bool Equals(object? obj) => obj is Matrix2X2 other && Equals(other); /// - public bool Equals(Matrix2x2F other) => this == other; + public bool Equals(Matrix2X2 other) => this == other; /// public override int GetHashCode() => HashCode.Combine(Row1, Row2); /// Computes the transpose of the matrix. - public Matrix2x2F Transpose() => + public Matrix2X2 Transpose() => new(new(M11, M21), new(M12, M22)); @@ -77,7 +77,7 @@ public Matrix2x2F Transpose() => /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix2x2F left, Matrix2x2F right) => + public static bool operator ==(Matrix2X2 left, Matrix2X2 right) => left.Row1 == right.Row1 && left.Row2 == right.Row2; @@ -85,13 +85,13 @@ public Matrix2x2F Transpose() => /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix2x2F left, Matrix2x2F right) => !(left == right); + public static bool operator !=(Matrix2X2 left, Matrix2X2 right) => !(left == right); /// Adds two matrices together. /// The first source matrix. /// The second source matrix. /// The result of the addition. - public static Matrix2x2F operator +(Matrix2x2F left, Matrix2x2F right) => + public static Matrix2X2 operator +(Matrix2X2 left, Matrix2X2 right) => new(left.Row1 + right.Row1, left.Row2 + right.Row2); @@ -99,14 +99,14 @@ public Matrix2x2F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the subtraction. - public static Matrix2x2F operator -(Matrix2x2F left, Matrix2x2F right) => + public static Matrix2X2 operator -(Matrix2X2 left, Matrix2X2 right) => new(left.Row1 - right.Row1, left.Row2 - right.Row2); /// Returns a new matrix with the negated elements of the given matrix. /// The source matrix. /// The negated matrix. - public static Matrix2x2F operator -(Matrix2x2F value) => + public static Matrix2X2 operator -(Matrix2X2 value) => new(-value.Row1, -value.Row2); @@ -114,14 +114,14 @@ public Matrix2x2F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix2x2F operator *(Matrix2x2F left, Matrix2x2F right) => + public static Matrix2X2 operator *(Matrix2X2 left, Matrix2X2 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2, left.M21 * right.Row1 + left.M22 * right.Row2); } - static partial class Matrix2x2F + public static partial class Matrix2X2 { - public static Matrix2x2F Lerp(Matrix2x2F value1, Matrix2x2F value2, T amount) + public static Matrix2X2 Lerp(Matrix2X2 value1, Matrix2X2 value2, T amount) where T : IFloatingPointIeee754 => new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount)), new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount))); diff --git a/sources/Maths/Maths/Matrix2x3F.gen.cs b/sources/Maths/Maths/Matrix2X3.gen.cs similarity index 79% rename from sources/Maths/Maths/Matrix2x3F.gen.cs rename to sources/Maths/Maths/Matrix2X3.gen.cs index 9c946035c6..2039da3a7d 100644 --- a/sources/Maths/Maths/Matrix2x3F.gen.cs +++ b/sources/Maths/Maths/Matrix2X3.gen.cs @@ -3,23 +3,23 @@ namespace Silk.NET.Maths using System.Diagnostics.CodeAnalysis; using System.Numerics; - partial struct Matrix2x3F : - IEquatable> - where T : IFloatingPointIeee754 + public partial struct Matrix2X3 : + IEquatable> + where T : INumberBase { /// The 1st row of the matrix represented as a vector. - public Vector3F Row1; + public Vector3D Row1; /// The 2nd row of the matrix represented as a vector. - public Vector3F Row2; + public Vector3D Row2; /// - /// Constructs a from the given rows. + /// Constructs a from the given rows. /// - public Matrix2x3F(Vector3F row1, Vector3F row2) => (Row1, Row2) = (row1, row2); + public Matrix2X3(Vector3D row1, Vector3D row2) => (Row1, Row2) = (row1, row2); [UnscopedRef] - public ref Vector3F this[int row] + public ref Vector3D this[int row] { get { @@ -63,16 +63,16 @@ public ref Vector3F this[int row] public ref T M23 => ref Row2.Z; /// - public override bool Equals(object? obj) => obj is Matrix2x3F other && Equals(other); + public override bool Equals(object? obj) => obj is Matrix2X3 other && Equals(other); /// - public bool Equals(Matrix2x3F other) => this == other; + public bool Equals(Matrix2X3 other) => this == other; /// public override int GetHashCode() => HashCode.Combine(Row1, Row2); /// Computes the transpose of the matrix. - public Matrix3x2F Transpose() => + public Matrix3X2 Transpose() => new(new(M11, M21), new(M12, M22), new(M13, M23)); @@ -81,7 +81,7 @@ public Matrix3x2F Transpose() => /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix2x3F left, Matrix2x3F right) => + public static bool operator ==(Matrix2X3 left, Matrix2X3 right) => left.Row1 == right.Row1 && left.Row2 == right.Row2; @@ -89,13 +89,13 @@ public Matrix3x2F Transpose() => /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix2x3F left, Matrix2x3F right) => !(left == right); + public static bool operator !=(Matrix2X3 left, Matrix2X3 right) => !(left == right); /// Adds two matrices together. /// The first source matrix. /// The second source matrix. /// The result of the addition. - public static Matrix2x3F operator +(Matrix2x3F left, Matrix2x3F right) => + public static Matrix2X3 operator +(Matrix2X3 left, Matrix2X3 right) => new(left.Row1 + right.Row1, left.Row2 + right.Row2); @@ -103,14 +103,14 @@ public Matrix3x2F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the subtraction. - public static Matrix2x3F operator -(Matrix2x3F left, Matrix2x3F right) => + public static Matrix2X3 operator -(Matrix2X3 left, Matrix2X3 right) => new(left.Row1 - right.Row1, left.Row2 - right.Row2); /// Returns a new matrix with the negated elements of the given matrix. /// The source matrix. /// The negated matrix. - public static Matrix2x3F operator -(Matrix2x3F value) => + public static Matrix2X3 operator -(Matrix2X3 value) => new(-value.Row1, -value.Row2); @@ -118,7 +118,7 @@ public Matrix3x2F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix2x3F operator *(Matrix2x2F left, Matrix2x3F right) => + public static Matrix2X3 operator *(Matrix2X2 left, Matrix2X3 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2, left.M21 * right.Row1 + left.M22 * right.Row2); @@ -126,14 +126,14 @@ public Matrix3x2F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix2x2F operator *(Matrix2x3F left, Matrix3x2F right) => + public static Matrix2X2 operator *(Matrix2X3 left, Matrix3X2 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3); } - static partial class Matrix2x3F + public static partial class Matrix2X3 { - public static Matrix2x3F Lerp(Matrix2x3F value1, Matrix2x3F value2, T amount) + public static Matrix2X3 Lerp(Matrix2X3 value1, Matrix2X3 value2, T amount) where T : IFloatingPointIeee754 => new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount), T.Lerp(value1.M13, value2.M13, amount)), new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount), T.Lerp(value1.M23, value2.M23, amount))); diff --git a/sources/Maths/Maths/Matrix2x4F.gen.cs b/sources/Maths/Maths/Matrix2X4.gen.cs similarity index 81% rename from sources/Maths/Maths/Matrix2x4F.gen.cs rename to sources/Maths/Maths/Matrix2X4.gen.cs index b4d4f8c6f0..10496deda3 100644 --- a/sources/Maths/Maths/Matrix2x4F.gen.cs +++ b/sources/Maths/Maths/Matrix2X4.gen.cs @@ -3,23 +3,23 @@ namespace Silk.NET.Maths using System.Diagnostics.CodeAnalysis; using System.Numerics; - partial struct Matrix2x4F : - IEquatable> - where T : IFloatingPointIeee754 + public partial struct Matrix2X4 : + IEquatable> + where T : INumberBase { /// The 1st row of the matrix represented as a vector. - public Vector4F Row1; + public Vector4D Row1; /// The 2nd row of the matrix represented as a vector. - public Vector4F Row2; + public Vector4D Row2; /// - /// Constructs a from the given rows. + /// Constructs a from the given rows. /// - public Matrix2x4F(Vector4F row1, Vector4F row2) => (Row1, Row2) = (row1, row2); + public Matrix2X4(Vector4D row1, Vector4D row2) => (Row1, Row2) = (row1, row2); [UnscopedRef] - public ref Vector4F this[int row] + public ref Vector4D this[int row] { get { @@ -71,16 +71,16 @@ public ref Vector4F this[int row] public ref T M24 => ref Row2.W; /// - public override bool Equals(object? obj) => obj is Matrix2x4F other && Equals(other); + public override bool Equals(object? obj) => obj is Matrix2X4 other && Equals(other); /// - public bool Equals(Matrix2x4F other) => this == other; + public bool Equals(Matrix2X4 other) => this == other; /// public override int GetHashCode() => HashCode.Combine(Row1, Row2); /// Computes the transpose of the matrix. - public Matrix4x2F Transpose() => + public Matrix4X2 Transpose() => new(new(M11, M21), new(M12, M22), new(M13, M23), @@ -90,7 +90,7 @@ public Matrix4x2F Transpose() => /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix2x4F left, Matrix2x4F right) => + public static bool operator ==(Matrix2X4 left, Matrix2X4 right) => left.Row1 == right.Row1 && left.Row2 == right.Row2; @@ -98,13 +98,13 @@ public Matrix4x2F Transpose() => /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix2x4F left, Matrix2x4F right) => !(left == right); + public static bool operator !=(Matrix2X4 left, Matrix2X4 right) => !(left == right); /// Adds two matrices together. /// The first source matrix. /// The second source matrix. /// The result of the addition. - public static Matrix2x4F operator +(Matrix2x4F left, Matrix2x4F right) => + public static Matrix2X4 operator +(Matrix2X4 left, Matrix2X4 right) => new(left.Row1 + right.Row1, left.Row2 + right.Row2); @@ -112,14 +112,14 @@ public Matrix4x2F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the subtraction. - public static Matrix2x4F operator -(Matrix2x4F left, Matrix2x4F right) => + public static Matrix2X4 operator -(Matrix2X4 left, Matrix2X4 right) => new(left.Row1 - right.Row1, left.Row2 - right.Row2); /// Returns a new matrix with the negated elements of the given matrix. /// The source matrix. /// The negated matrix. - public static Matrix2x4F operator -(Matrix2x4F value) => + public static Matrix2X4 operator -(Matrix2X4 value) => new(-value.Row1, -value.Row2); @@ -127,7 +127,7 @@ public Matrix4x2F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix2x4F operator *(Matrix2x2F left, Matrix2x4F right) => + public static Matrix2X4 operator *(Matrix2X2 left, Matrix2X4 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2, left.M21 * right.Row1 + left.M22 * right.Row2); @@ -135,7 +135,7 @@ public Matrix4x2F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix2x2F operator *(Matrix2x4F left, Matrix4x2F right) => + public static Matrix2X2 operator *(Matrix2X4 left, Matrix4X2 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4); @@ -143,15 +143,15 @@ public Matrix4x2F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix3x4F operator *(Matrix3x2F left, Matrix2x4F right) => + public static Matrix3X4 operator *(Matrix3X2 left, Matrix2X4 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2, left.M21 * right.Row1 + left.M22 * right.Row2, left.M31 * right.Row1 + left.M32 * right.Row2); } - static partial class Matrix2x4F + public static partial class Matrix2X4 { - public static Matrix2x4F Lerp(Matrix2x4F value1, Matrix2x4F value2, T amount) + public static Matrix2X4 Lerp(Matrix2X4 value1, Matrix2X4 value2, T amount) where T : IFloatingPointIeee754 => new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount), T.Lerp(value1.M13, value2.M13, amount), T.Lerp(value1.M14, value2.M14, amount)), new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount), T.Lerp(value1.M23, value2.M23, amount), T.Lerp(value1.M24, value2.M24, amount))); diff --git a/sources/Maths/Maths/Matrix2x2I.gen.cs b/sources/Maths/Maths/Matrix2x2I.gen.cs deleted file mode 100644 index 662608b49d..0000000000 --- a/sources/Maths/Maths/Matrix2x2I.gen.cs +++ /dev/null @@ -1,122 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix2x2I : - IEquatable> - where T : IBinaryInteger - { - /// The multiplicative identity matrix of size 2x2. - public static readonly Matrix2x2I Identity = new( - new(T.MultiplicativeIdentity, T.Zero), - new(T.Zero, T.MultiplicativeIdentity)); - - /// The 1st row of the matrix represented as a vector. - public Vector2I Row1; - - /// The 2nd row of the matrix represented as a vector. - public Vector2I Row2; - - /// - /// Constructs a from the given rows. - /// - public Matrix2x2I(Vector2I row1, Vector2I row2) => (Row1, Row2) = (row1, row2); - - [UnscopedRef] - public ref Vector2I this[int row] - { - get - { - switch (row) - { - case 0: - return ref Row1; - case 1: - return ref Row2; - } - - throw new ArgumentOutOfRangeException(nameof(row)); - } - } - - [UnscopedRef] - public ref T this[int row, int column] => ref this[row][column]; - - /// Gets the element in the 1st row and 1st column of the matrix. - [UnscopedRef] - public ref T M11 => ref Row1.X; - - /// Gets the element in the 1st row and 2nd column of the matrix. - [UnscopedRef] - public ref T M12 => ref Row1.Y; - - /// Gets the element in the 2nd row and 1st column of the matrix. - [UnscopedRef] - public ref T M21 => ref Row2.X; - - /// Gets the element in the 2nd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M22 => ref Row2.Y; - - /// - public override bool Equals(object? obj) => obj is Matrix2x2I other && Equals(other); - - /// - public bool Equals(Matrix2x2I other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2); - - /// Computes the transpose of the matrix. - public Matrix2x2I Transpose() => - new(new(M11, M21), - new(M12, M22)); - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix2x2I left, Matrix2x2I right) => - left.Row1 == right.Row1 && - left.Row2 == right.Row2; - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix2x2I left, Matrix2x2I right) => !(left == right); - - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The result of the addition. - public static Matrix2x2I operator +(Matrix2x2I left, Matrix2x2I right) => - new(left.Row1 + right.Row1, - left.Row2 + right.Row2); - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static Matrix2x2I operator -(Matrix2x2I left, Matrix2x2I right) => - new(left.Row1 - right.Row1, - left.Row2 - right.Row2); - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static Matrix2x2I operator -(Matrix2x2I value) => - new(-value.Row1, - -value.Row2); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix2x2I operator *(Matrix2x2I left, Matrix2x2I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2, - left.M21 * right.Row1 + left.M22 * right.Row2); - } - -} diff --git a/sources/Maths/Maths/Matrix2x3I.gen.cs b/sources/Maths/Maths/Matrix2x3I.gen.cs deleted file mode 100644 index 03431eaac6..0000000000 --- a/sources/Maths/Maths/Matrix2x3I.gen.cs +++ /dev/null @@ -1,134 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix2x3I : - IEquatable> - where T : IBinaryInteger - { - /// The 1st row of the matrix represented as a vector. - public Vector3I Row1; - - /// The 2nd row of the matrix represented as a vector. - public Vector3I Row2; - - /// - /// Constructs a from the given rows. - /// - public Matrix2x3I(Vector3I row1, Vector3I row2) => (Row1, Row2) = (row1, row2); - - [UnscopedRef] - public ref Vector3I this[int row] - { - get - { - switch (row) - { - case 0: - return ref Row1; - case 1: - return ref Row2; - } - - throw new ArgumentOutOfRangeException(nameof(row)); - } - } - - [UnscopedRef] - public ref T this[int row, int column] => ref this[row][column]; - - /// Gets the element in the 1st row and 1st column of the matrix. - [UnscopedRef] - public ref T M11 => ref Row1.X; - - /// Gets the element in the 1st row and 2nd column of the matrix. - [UnscopedRef] - public ref T M12 => ref Row1.Y; - - /// Gets the element in the 1st row and 3rd column of the matrix. - [UnscopedRef] - public ref T M13 => ref Row1.Z; - - /// Gets the element in the 2nd row and 1st column of the matrix. - [UnscopedRef] - public ref T M21 => ref Row2.X; - - /// Gets the element in the 2nd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M22 => ref Row2.Y; - - /// Gets the element in the 2nd row and 3rd column of the matrix. - [UnscopedRef] - public ref T M23 => ref Row2.Z; - - /// - public override bool Equals(object? obj) => obj is Matrix2x3I other && Equals(other); - - /// - public bool Equals(Matrix2x3I other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2); - - /// Computes the transpose of the matrix. - public Matrix3x2I Transpose() => - new(new(M11, M21), - new(M12, M22), - new(M13, M23)); - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix2x3I left, Matrix2x3I right) => - left.Row1 == right.Row1 && - left.Row2 == right.Row2; - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix2x3I left, Matrix2x3I right) => !(left == right); - - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The result of the addition. - public static Matrix2x3I operator +(Matrix2x3I left, Matrix2x3I right) => - new(left.Row1 + right.Row1, - left.Row2 + right.Row2); - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static Matrix2x3I operator -(Matrix2x3I left, Matrix2x3I right) => - new(left.Row1 - right.Row1, - left.Row2 - right.Row2); - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static Matrix2x3I operator -(Matrix2x3I value) => - new(-value.Row1, - -value.Row2); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix2x3I operator *(Matrix2x2I left, Matrix2x3I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2, - left.M21 * right.Row1 + left.M22 * right.Row2); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix2x2I operator *(Matrix2x3I left, Matrix3x2I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3); - } - -} diff --git a/sources/Maths/Maths/Matrix2x4I.gen.cs b/sources/Maths/Maths/Matrix2x4I.gen.cs deleted file mode 100644 index e116d0b528..0000000000 --- a/sources/Maths/Maths/Matrix2x4I.gen.cs +++ /dev/null @@ -1,152 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix2x4I : - IEquatable> - where T : IBinaryInteger - { - /// The 1st row of the matrix represented as a vector. - public Vector4I Row1; - - /// The 2nd row of the matrix represented as a vector. - public Vector4I Row2; - - /// - /// Constructs a from the given rows. - /// - public Matrix2x4I(Vector4I row1, Vector4I row2) => (Row1, Row2) = (row1, row2); - - [UnscopedRef] - public ref Vector4I this[int row] - { - get - { - switch (row) - { - case 0: - return ref Row1; - case 1: - return ref Row2; - } - - throw new ArgumentOutOfRangeException(nameof(row)); - } - } - - [UnscopedRef] - public ref T this[int row, int column] => ref this[row][column]; - - /// Gets the element in the 1st row and 1st column of the matrix. - [UnscopedRef] - public ref T M11 => ref Row1.X; - - /// Gets the element in the 1st row and 2nd column of the matrix. - [UnscopedRef] - public ref T M12 => ref Row1.Y; - - /// Gets the element in the 1st row and 3rd column of the matrix. - [UnscopedRef] - public ref T M13 => ref Row1.Z; - - /// Gets the element in the 1st row and 4th column of the matrix. - [UnscopedRef] - public ref T M14 => ref Row1.W; - - /// Gets the element in the 2nd row and 1st column of the matrix. - [UnscopedRef] - public ref T M21 => ref Row2.X; - - /// Gets the element in the 2nd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M22 => ref Row2.Y; - - /// Gets the element in the 2nd row and 3rd column of the matrix. - [UnscopedRef] - public ref T M23 => ref Row2.Z; - - /// Gets the element in the 2nd row and 4th column of the matrix. - [UnscopedRef] - public ref T M24 => ref Row2.W; - - /// - public override bool Equals(object? obj) => obj is Matrix2x4I other && Equals(other); - - /// - public bool Equals(Matrix2x4I other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2); - - /// Computes the transpose of the matrix. - public Matrix4x2I Transpose() => - new(new(M11, M21), - new(M12, M22), - new(M13, M23), - new(M14, M24)); - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix2x4I left, Matrix2x4I right) => - left.Row1 == right.Row1 && - left.Row2 == right.Row2; - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix2x4I left, Matrix2x4I right) => !(left == right); - - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The result of the addition. - public static Matrix2x4I operator +(Matrix2x4I left, Matrix2x4I right) => - new(left.Row1 + right.Row1, - left.Row2 + right.Row2); - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static Matrix2x4I operator -(Matrix2x4I left, Matrix2x4I right) => - new(left.Row1 - right.Row1, - left.Row2 - right.Row2); - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static Matrix2x4I operator -(Matrix2x4I value) => - new(-value.Row1, - -value.Row2); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix2x4I operator *(Matrix2x2I left, Matrix2x4I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2, - left.M21 * right.Row1 + left.M22 * right.Row2); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix2x2I operator *(Matrix2x4I left, Matrix4x2I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix3x4I operator *(Matrix3x2I left, Matrix2x4I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2, - left.M21 * right.Row1 + left.M22 * right.Row2, - left.M31 * right.Row1 + left.M32 * right.Row2); - } - -} diff --git a/sources/Maths/Maths/Matrix3x2F.gen.cs b/sources/Maths/Maths/Matrix3X2.gen.cs similarity index 79% rename from sources/Maths/Maths/Matrix3x2F.gen.cs rename to sources/Maths/Maths/Matrix3X2.gen.cs index fa7209a596..bde0ebf4e0 100644 --- a/sources/Maths/Maths/Matrix3x2F.gen.cs +++ b/sources/Maths/Maths/Matrix3X2.gen.cs @@ -3,26 +3,26 @@ namespace Silk.NET.Maths using System.Diagnostics.CodeAnalysis; using System.Numerics; - partial struct Matrix3x2F : - IEquatable> - where T : IFloatingPointIeee754 + public partial struct Matrix3X2 : + IEquatable> + where T : INumberBase { /// The 1st row of the matrix represented as a vector. - public Vector2F Row1; + public Vector2D Row1; /// The 2nd row of the matrix represented as a vector. - public Vector2F Row2; + public Vector2D Row2; /// The 3rd row of the matrix represented as a vector. - public Vector2F Row3; + public Vector2D Row3; /// - /// Constructs a from the given rows. + /// Constructs a from the given rows. /// - public Matrix3x2F(Vector2F row1, Vector2F row2, Vector2F row3) => (Row1, Row2, Row3) = (row1, row2, row3); + public Matrix3X2(Vector2D row1, Vector2D row2, Vector2D row3) => (Row1, Row2, Row3) = (row1, row2, row3); [UnscopedRef] - public ref Vector2F this[int row] + public ref Vector2D this[int row] { get { @@ -68,16 +68,16 @@ public ref Vector2F this[int row] public ref T M32 => ref Row3.Y; /// - public override bool Equals(object? obj) => obj is Matrix3x2F other && Equals(other); + public override bool Equals(object? obj) => obj is Matrix3X2 other && Equals(other); /// - public bool Equals(Matrix3x2F other) => this == other; + public bool Equals(Matrix3X2 other) => this == other; /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); /// Computes the transpose of the matrix. - public Matrix2x3F Transpose() => + public Matrix2X3 Transpose() => new(new(M11, M21, M31), new(M12, M22, M32)); @@ -85,7 +85,7 @@ public Matrix2x3F Transpose() => /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix3x2F left, Matrix3x2F right) => + public static bool operator ==(Matrix3X2 left, Matrix3X2 right) => left.Row1 == right.Row1 && left.Row2 == right.Row2 && left.Row3 == right.Row3; @@ -94,13 +94,13 @@ public Matrix2x3F Transpose() => /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix3x2F left, Matrix3x2F right) => !(left == right); + public static bool operator !=(Matrix3X2 left, Matrix3X2 right) => !(left == right); /// Adds two matrices together. /// The first source matrix. /// The second source matrix. /// The result of the addition. - public static Matrix3x2F operator +(Matrix3x2F left, Matrix3x2F right) => + public static Matrix3X2 operator +(Matrix3X2 left, Matrix3X2 right) => new(left.Row1 + right.Row1, left.Row2 + right.Row2, left.Row3 + right.Row3); @@ -109,7 +109,7 @@ public Matrix2x3F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the subtraction. - public static Matrix3x2F operator -(Matrix3x2F left, Matrix3x2F right) => + public static Matrix3X2 operator -(Matrix3X2 left, Matrix3X2 right) => new(left.Row1 - right.Row1, left.Row2 - right.Row2, left.Row3 - right.Row3); @@ -117,7 +117,7 @@ public Matrix2x3F Transpose() => /// Returns a new matrix with the negated elements of the given matrix. /// The source matrix. /// The negated matrix. - public static Matrix3x2F operator -(Matrix3x2F value) => + public static Matrix3X2 operator -(Matrix3X2 value) => new(-value.Row1, -value.Row2, -value.Row3); @@ -126,7 +126,7 @@ public Matrix2x3F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix3x2F operator *(Matrix3x2F left, Matrix2x2F right) => + public static Matrix3X2 operator *(Matrix3X2 left, Matrix2X2 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2, left.M21 * right.Row1 + left.M22 * right.Row2, left.M31 * right.Row1 + left.M32 * right.Row2); @@ -135,15 +135,15 @@ public Matrix2x3F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix3x3F operator *(Matrix3x2F left, Matrix2x3F right) => + public static Matrix3X3 operator *(Matrix3X2 left, Matrix2X3 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2, left.M21 * right.Row1 + left.M22 * right.Row2, left.M31 * right.Row1 + left.M32 * right.Row2); } - static partial class Matrix3x2F + public static partial class Matrix3X2 { - public static Matrix3x2F Lerp(Matrix3x2F value1, Matrix3x2F value2, T amount) + public static Matrix3X2 Lerp(Matrix3X2 value1, Matrix3X2 value2, T amount) where T : IFloatingPointIeee754 => new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount)), new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount)), diff --git a/sources/Maths/Maths/Matrix3x3F.gen.cs b/sources/Maths/Maths/Matrix3X3.gen.cs similarity index 81% rename from sources/Maths/Maths/Matrix3x3F.gen.cs rename to sources/Maths/Maths/Matrix3X3.gen.cs index 2c94325eb2..df79a5c810 100644 --- a/sources/Maths/Maths/Matrix3x3F.gen.cs +++ b/sources/Maths/Maths/Matrix3X3.gen.cs @@ -3,32 +3,32 @@ namespace Silk.NET.Maths using System.Diagnostics.CodeAnalysis; using System.Numerics; - partial struct Matrix3x3F : - IEquatable> - where T : IFloatingPointIeee754 + public partial struct Matrix3X3 : + IEquatable> + where T : INumberBase { /// The multiplicative identity matrix of size 3x3. - public static readonly Matrix3x3F Identity = new( + public static readonly Matrix3X3 Identity = new( new(T.MultiplicativeIdentity, T.Zero, T.Zero), new(T.Zero, T.MultiplicativeIdentity, T.Zero), new(T.Zero, T.Zero, T.MultiplicativeIdentity)); /// The 1st row of the matrix represented as a vector. - public Vector3F Row1; + public Vector3D Row1; /// The 2nd row of the matrix represented as a vector. - public Vector3F Row2; + public Vector3D Row2; /// The 3rd row of the matrix represented as a vector. - public Vector3F Row3; + public Vector3D Row3; /// - /// Constructs a from the given rows. + /// Constructs a from the given rows. /// - public Matrix3x3F(Vector3F row1, Vector3F row2, Vector3F row3) => (Row1, Row2, Row3) = (row1, row2, row3); + public Matrix3X3(Vector3D row1, Vector3D row2, Vector3D row3) => (Row1, Row2, Row3) = (row1, row2, row3); [UnscopedRef] - public ref Vector3F this[int row] + public ref Vector3D this[int row] { get { @@ -86,16 +86,16 @@ public ref Vector3F this[int row] public ref T M33 => ref Row3.Z; /// - public override bool Equals(object? obj) => obj is Matrix3x3F other && Equals(other); + public override bool Equals(object? obj) => obj is Matrix3X3 other && Equals(other); /// - public bool Equals(Matrix3x3F other) => this == other; + public bool Equals(Matrix3X3 other) => this == other; /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); /// Computes the transpose of the matrix. - public Matrix3x3F Transpose() => + public Matrix3X3 Transpose() => new(new(M11, M21, M31), new(M12, M22, M32), new(M13, M23, M33)); @@ -104,7 +104,7 @@ public Matrix3x3F Transpose() => /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix3x3F left, Matrix3x3F right) => + public static bool operator ==(Matrix3X3 left, Matrix3X3 right) => left.Row1 == right.Row1 && left.Row2 == right.Row2 && left.Row3 == right.Row3; @@ -113,13 +113,13 @@ public Matrix3x3F Transpose() => /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix3x3F left, Matrix3x3F right) => !(left == right); + public static bool operator !=(Matrix3X3 left, Matrix3X3 right) => !(left == right); /// Adds two matrices together. /// The first source matrix. /// The second source matrix. /// The result of the addition. - public static Matrix3x3F operator +(Matrix3x3F left, Matrix3x3F right) => + public static Matrix3X3 operator +(Matrix3X3 left, Matrix3X3 right) => new(left.Row1 + right.Row1, left.Row2 + right.Row2, left.Row3 + right.Row3); @@ -128,7 +128,7 @@ public Matrix3x3F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the subtraction. - public static Matrix3x3F operator -(Matrix3x3F left, Matrix3x3F right) => + public static Matrix3X3 operator -(Matrix3X3 left, Matrix3X3 right) => new(left.Row1 - right.Row1, left.Row2 - right.Row2, left.Row3 - right.Row3); @@ -136,7 +136,7 @@ public Matrix3x3F Transpose() => /// Returns a new matrix with the negated elements of the given matrix. /// The source matrix. /// The negated matrix. - public static Matrix3x3F operator -(Matrix3x3F value) => + public static Matrix3X3 operator -(Matrix3X3 value) => new(-value.Row1, -value.Row2, -value.Row3); @@ -145,7 +145,7 @@ public Matrix3x3F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix2x3F operator *(Matrix2x3F left, Matrix3x3F right) => + public static Matrix2X3 operator *(Matrix2X3 left, Matrix3X3 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3); @@ -153,7 +153,7 @@ public Matrix3x3F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix3x2F operator *(Matrix3x3F left, Matrix3x2F right) => + public static Matrix3X2 operator *(Matrix3X3 left, Matrix3X2 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3); @@ -162,15 +162,15 @@ public Matrix3x3F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix3x3F operator *(Matrix3x3F left, Matrix3x3F right) => + public static Matrix3X3 operator *(Matrix3X3 left, Matrix3X3 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3); } - static partial class Matrix3x3F + public static partial class Matrix3X3 { - public static Matrix3x3F Lerp(Matrix3x3F value1, Matrix3x3F value2, T amount) + public static Matrix3X3 Lerp(Matrix3X3 value1, Matrix3X3 value2, T amount) where T : IFloatingPointIeee754 => new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount), T.Lerp(value1.M13, value2.M13, amount)), new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount), T.Lerp(value1.M23, value2.M23, amount)), diff --git a/sources/Maths/Maths/Matrix3x4F.gen.cs b/sources/Maths/Maths/Matrix3X4.gen.cs similarity index 83% rename from sources/Maths/Maths/Matrix3x4F.gen.cs rename to sources/Maths/Maths/Matrix3X4.gen.cs index 45de27a659..72a40e990d 100644 --- a/sources/Maths/Maths/Matrix3x4F.gen.cs +++ b/sources/Maths/Maths/Matrix3X4.gen.cs @@ -3,26 +3,26 @@ namespace Silk.NET.Maths using System.Diagnostics.CodeAnalysis; using System.Numerics; - partial struct Matrix3x4F : - IEquatable> - where T : IFloatingPointIeee754 + public partial struct Matrix3X4 : + IEquatable> + where T : INumberBase { /// The 1st row of the matrix represented as a vector. - public Vector4F Row1; + public Vector4D Row1; /// The 2nd row of the matrix represented as a vector. - public Vector4F Row2; + public Vector4D Row2; /// The 3rd row of the matrix represented as a vector. - public Vector4F Row3; + public Vector4D Row3; /// - /// Constructs a from the given rows. + /// Constructs a from the given rows. /// - public Matrix3x4F(Vector4F row1, Vector4F row2, Vector4F row3) => (Row1, Row2, Row3) = (row1, row2, row3); + public Matrix3X4(Vector4D row1, Vector4D row2, Vector4D row3) => (Row1, Row2, Row3) = (row1, row2, row3); [UnscopedRef] - public ref Vector4F this[int row] + public ref Vector4D this[int row] { get { @@ -92,16 +92,16 @@ public ref Vector4F this[int row] public ref T M34 => ref Row3.W; /// - public override bool Equals(object? obj) => obj is Matrix3x4F other && Equals(other); + public override bool Equals(object? obj) => obj is Matrix3X4 other && Equals(other); /// - public bool Equals(Matrix3x4F other) => this == other; + public bool Equals(Matrix3X4 other) => this == other; /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); /// Computes the transpose of the matrix. - public Matrix4x3F Transpose() => + public Matrix4X3 Transpose() => new(new(M11, M21, M31), new(M12, M22, M32), new(M13, M23, M33), @@ -111,7 +111,7 @@ public Matrix4x3F Transpose() => /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix3x4F left, Matrix3x4F right) => + public static bool operator ==(Matrix3X4 left, Matrix3X4 right) => left.Row1 == right.Row1 && left.Row2 == right.Row2 && left.Row3 == right.Row3; @@ -120,13 +120,13 @@ public Matrix4x3F Transpose() => /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix3x4F left, Matrix3x4F right) => !(left == right); + public static bool operator !=(Matrix3X4 left, Matrix3X4 right) => !(left == right); /// Adds two matrices together. /// The first source matrix. /// The second source matrix. /// The result of the addition. - public static Matrix3x4F operator +(Matrix3x4F left, Matrix3x4F right) => + public static Matrix3X4 operator +(Matrix3X4 left, Matrix3X4 right) => new(left.Row1 + right.Row1, left.Row2 + right.Row2, left.Row3 + right.Row3); @@ -135,7 +135,7 @@ public Matrix4x3F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the subtraction. - public static Matrix3x4F operator -(Matrix3x4F left, Matrix3x4F right) => + public static Matrix3X4 operator -(Matrix3X4 left, Matrix3X4 right) => new(left.Row1 - right.Row1, left.Row2 - right.Row2, left.Row3 - right.Row3); @@ -143,7 +143,7 @@ public Matrix4x3F Transpose() => /// Returns a new matrix with the negated elements of the given matrix. /// The source matrix. /// The negated matrix. - public static Matrix3x4F operator -(Matrix3x4F value) => + public static Matrix3X4 operator -(Matrix3X4 value) => new(-value.Row1, -value.Row2, -value.Row3); @@ -152,7 +152,7 @@ public Matrix4x3F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix2x4F operator *(Matrix2x3F left, Matrix3x4F right) => + public static Matrix2X4 operator *(Matrix2X3 left, Matrix3X4 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3); @@ -160,7 +160,7 @@ public Matrix4x3F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix3x4F operator *(Matrix3x3F left, Matrix3x4F right) => + public static Matrix3X4 operator *(Matrix3X3 left, Matrix3X4 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3); @@ -169,7 +169,7 @@ public Matrix4x3F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix3x2F operator *(Matrix3x4F left, Matrix4x2F right) => + public static Matrix3X2 operator *(Matrix3X4 left, Matrix4X2 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4); @@ -178,15 +178,15 @@ public Matrix4x3F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix3x3F operator *(Matrix3x4F left, Matrix4x3F right) => + public static Matrix3X3 operator *(Matrix3X4 left, Matrix4X3 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4); } - static partial class Matrix3x4F + public static partial class Matrix3X4 { - public static Matrix3x4F Lerp(Matrix3x4F value1, Matrix3x4F value2, T amount) + public static Matrix3X4 Lerp(Matrix3X4 value1, Matrix3X4 value2, T amount) where T : IFloatingPointIeee754 => new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount), T.Lerp(value1.M13, value2.M13, amount), T.Lerp(value1.M14, value2.M14, amount)), new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount), T.Lerp(value1.M23, value2.M23, amount), T.Lerp(value1.M24, value2.M24, amount)), diff --git a/sources/Maths/Maths/Matrix3x2I.gen.cs b/sources/Maths/Maths/Matrix3x2I.gen.cs deleted file mode 100644 index 868cfc9584..0000000000 --- a/sources/Maths/Maths/Matrix3x2I.gen.cs +++ /dev/null @@ -1,144 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix3x2I : - IEquatable> - where T : IBinaryInteger - { - /// The 1st row of the matrix represented as a vector. - public Vector2I Row1; - - /// The 2nd row of the matrix represented as a vector. - public Vector2I Row2; - - /// The 3rd row of the matrix represented as a vector. - public Vector2I Row3; - - /// - /// Constructs a from the given rows. - /// - public Matrix3x2I(Vector2I row1, Vector2I row2, Vector2I row3) => (Row1, Row2, Row3) = (row1, row2, row3); - - [UnscopedRef] - public ref Vector2I this[int row] - { - get - { - switch (row) - { - case 0: - return ref Row1; - case 1: - return ref Row2; - case 2: - return ref Row3; - } - - throw new ArgumentOutOfRangeException(nameof(row)); - } - } - - [UnscopedRef] - public ref T this[int row, int column] => ref this[row][column]; - - /// Gets the element in the 1st row and 1st column of the matrix. - [UnscopedRef] - public ref T M11 => ref Row1.X; - - /// Gets the element in the 1st row and 2nd column of the matrix. - [UnscopedRef] - public ref T M12 => ref Row1.Y; - - /// Gets the element in the 2nd row and 1st column of the matrix. - [UnscopedRef] - public ref T M21 => ref Row2.X; - - /// Gets the element in the 2nd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M22 => ref Row2.Y; - - /// Gets the element in the 3rd row and 1st column of the matrix. - [UnscopedRef] - public ref T M31 => ref Row3.X; - - /// Gets the element in the 3rd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M32 => ref Row3.Y; - - /// - public override bool Equals(object? obj) => obj is Matrix3x2I other && Equals(other); - - /// - public bool Equals(Matrix3x2I other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); - - /// Computes the transpose of the matrix. - public Matrix2x3I Transpose() => - new(new(M11, M21, M31), - new(M12, M22, M32)); - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix3x2I left, Matrix3x2I right) => - left.Row1 == right.Row1 && - left.Row2 == right.Row2 && - left.Row3 == right.Row3; - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix3x2I left, Matrix3x2I right) => !(left == right); - - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The result of the addition. - public static Matrix3x2I operator +(Matrix3x2I left, Matrix3x2I right) => - new(left.Row1 + right.Row1, - left.Row2 + right.Row2, - left.Row3 + right.Row3); - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static Matrix3x2I operator -(Matrix3x2I left, Matrix3x2I right) => - new(left.Row1 - right.Row1, - left.Row2 - right.Row2, - left.Row3 - right.Row3); - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static Matrix3x2I operator -(Matrix3x2I value) => - new(-value.Row1, - -value.Row2, - -value.Row3); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix3x2I operator *(Matrix3x2I left, Matrix2x2I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2, - left.M21 * right.Row1 + left.M22 * right.Row2, - left.M31 * right.Row1 + left.M32 * right.Row2); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix3x3I operator *(Matrix3x2I left, Matrix2x3I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2, - left.M21 * right.Row1 + left.M22 * right.Row2, - left.M31 * right.Row1 + left.M32 * right.Row2); - } - -} diff --git a/sources/Maths/Maths/Matrix3x3I.gen.cs b/sources/Maths/Maths/Matrix3x3I.gen.cs deleted file mode 100644 index 3cee1adfaf..0000000000 --- a/sources/Maths/Maths/Matrix3x3I.gen.cs +++ /dev/null @@ -1,171 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix3x3I : - IEquatable> - where T : IBinaryInteger - { - /// The multiplicative identity matrix of size 3x3. - public static readonly Matrix3x3I Identity = new( - new(T.MultiplicativeIdentity, T.Zero, T.Zero), - new(T.Zero, T.MultiplicativeIdentity, T.Zero), - new(T.Zero, T.Zero, T.MultiplicativeIdentity)); - - /// The 1st row of the matrix represented as a vector. - public Vector3I Row1; - - /// The 2nd row of the matrix represented as a vector. - public Vector3I Row2; - - /// The 3rd row of the matrix represented as a vector. - public Vector3I Row3; - - /// - /// Constructs a from the given rows. - /// - public Matrix3x3I(Vector3I row1, Vector3I row2, Vector3I row3) => (Row1, Row2, Row3) = (row1, row2, row3); - - [UnscopedRef] - public ref Vector3I this[int row] - { - get - { - switch (row) - { - case 0: - return ref Row1; - case 1: - return ref Row2; - case 2: - return ref Row3; - } - - throw new ArgumentOutOfRangeException(nameof(row)); - } - } - - [UnscopedRef] - public ref T this[int row, int column] => ref this[row][column]; - - /// Gets the element in the 1st row and 1st column of the matrix. - [UnscopedRef] - public ref T M11 => ref Row1.X; - - /// Gets the element in the 1st row and 2nd column of the matrix. - [UnscopedRef] - public ref T M12 => ref Row1.Y; - - /// Gets the element in the 1st row and 3rd column of the matrix. - [UnscopedRef] - public ref T M13 => ref Row1.Z; - - /// Gets the element in the 2nd row and 1st column of the matrix. - [UnscopedRef] - public ref T M21 => ref Row2.X; - - /// Gets the element in the 2nd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M22 => ref Row2.Y; - - /// Gets the element in the 2nd row and 3rd column of the matrix. - [UnscopedRef] - public ref T M23 => ref Row2.Z; - - /// Gets the element in the 3rd row and 1st column of the matrix. - [UnscopedRef] - public ref T M31 => ref Row3.X; - - /// Gets the element in the 3rd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M32 => ref Row3.Y; - - /// Gets the element in the 3rd row and 3rd column of the matrix. - [UnscopedRef] - public ref T M33 => ref Row3.Z; - - /// - public override bool Equals(object? obj) => obj is Matrix3x3I other && Equals(other); - - /// - public bool Equals(Matrix3x3I other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); - - /// Computes the transpose of the matrix. - public Matrix3x3I Transpose() => - new(new(M11, M21, M31), - new(M12, M22, M32), - new(M13, M23, M33)); - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix3x3I left, Matrix3x3I right) => - left.Row1 == right.Row1 && - left.Row2 == right.Row2 && - left.Row3 == right.Row3; - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix3x3I left, Matrix3x3I right) => !(left == right); - - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The result of the addition. - public static Matrix3x3I operator +(Matrix3x3I left, Matrix3x3I right) => - new(left.Row1 + right.Row1, - left.Row2 + right.Row2, - left.Row3 + right.Row3); - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static Matrix3x3I operator -(Matrix3x3I left, Matrix3x3I right) => - new(left.Row1 - right.Row1, - left.Row2 - right.Row2, - left.Row3 - right.Row3); - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static Matrix3x3I operator -(Matrix3x3I value) => - new(-value.Row1, - -value.Row2, - -value.Row3); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix2x3I operator *(Matrix2x3I left, Matrix3x3I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix3x2I operator *(Matrix3x3I left, Matrix3x2I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix3x3I operator *(Matrix3x3I left, Matrix3x3I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3); - } - -} diff --git a/sources/Maths/Maths/Matrix3x4I.gen.cs b/sources/Maths/Maths/Matrix3x4I.gen.cs deleted file mode 100644 index 83fba2ab2f..0000000000 --- a/sources/Maths/Maths/Matrix3x4I.gen.cs +++ /dev/null @@ -1,187 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix3x4I : - IEquatable> - where T : IBinaryInteger - { - /// The 1st row of the matrix represented as a vector. - public Vector4I Row1; - - /// The 2nd row of the matrix represented as a vector. - public Vector4I Row2; - - /// The 3rd row of the matrix represented as a vector. - public Vector4I Row3; - - /// - /// Constructs a from the given rows. - /// - public Matrix3x4I(Vector4I row1, Vector4I row2, Vector4I row3) => (Row1, Row2, Row3) = (row1, row2, row3); - - [UnscopedRef] - public ref Vector4I this[int row] - { - get - { - switch (row) - { - case 0: - return ref Row1; - case 1: - return ref Row2; - case 2: - return ref Row3; - } - - throw new ArgumentOutOfRangeException(nameof(row)); - } - } - - [UnscopedRef] - public ref T this[int row, int column] => ref this[row][column]; - - /// Gets the element in the 1st row and 1st column of the matrix. - [UnscopedRef] - public ref T M11 => ref Row1.X; - - /// Gets the element in the 1st row and 2nd column of the matrix. - [UnscopedRef] - public ref T M12 => ref Row1.Y; - - /// Gets the element in the 1st row and 3rd column of the matrix. - [UnscopedRef] - public ref T M13 => ref Row1.Z; - - /// Gets the element in the 1st row and 4th column of the matrix. - [UnscopedRef] - public ref T M14 => ref Row1.W; - - /// Gets the element in the 2nd row and 1st column of the matrix. - [UnscopedRef] - public ref T M21 => ref Row2.X; - - /// Gets the element in the 2nd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M22 => ref Row2.Y; - - /// Gets the element in the 2nd row and 3rd column of the matrix. - [UnscopedRef] - public ref T M23 => ref Row2.Z; - - /// Gets the element in the 2nd row and 4th column of the matrix. - [UnscopedRef] - public ref T M24 => ref Row2.W; - - /// Gets the element in the 3rd row and 1st column of the matrix. - [UnscopedRef] - public ref T M31 => ref Row3.X; - - /// Gets the element in the 3rd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M32 => ref Row3.Y; - - /// Gets the element in the 3rd row and 3rd column of the matrix. - [UnscopedRef] - public ref T M33 => ref Row3.Z; - - /// Gets the element in the 3rd row and 4th column of the matrix. - [UnscopedRef] - public ref T M34 => ref Row3.W; - - /// - public override bool Equals(object? obj) => obj is Matrix3x4I other && Equals(other); - - /// - public bool Equals(Matrix3x4I other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); - - /// Computes the transpose of the matrix. - public Matrix4x3I Transpose() => - new(new(M11, M21, M31), - new(M12, M22, M32), - new(M13, M23, M33), - new(M14, M24, M34)); - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix3x4I left, Matrix3x4I right) => - left.Row1 == right.Row1 && - left.Row2 == right.Row2 && - left.Row3 == right.Row3; - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix3x4I left, Matrix3x4I right) => !(left == right); - - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The result of the addition. - public static Matrix3x4I operator +(Matrix3x4I left, Matrix3x4I right) => - new(left.Row1 + right.Row1, - left.Row2 + right.Row2, - left.Row3 + right.Row3); - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static Matrix3x4I operator -(Matrix3x4I left, Matrix3x4I right) => - new(left.Row1 - right.Row1, - left.Row2 - right.Row2, - left.Row3 - right.Row3); - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static Matrix3x4I operator -(Matrix3x4I value) => - new(-value.Row1, - -value.Row2, - -value.Row3); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix2x4I operator *(Matrix2x3I left, Matrix3x4I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix3x4I operator *(Matrix3x3I left, Matrix3x4I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix3x2I operator *(Matrix3x4I left, Matrix4x2I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix3x3I operator *(Matrix3x4I left, Matrix4x3I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4); - } - -} diff --git a/sources/Maths/Maths/Matrix4x2F.gen.cs b/sources/Maths/Maths/Matrix4X2.gen.cs similarity index 81% rename from sources/Maths/Maths/Matrix4x2F.gen.cs rename to sources/Maths/Maths/Matrix4X2.gen.cs index b5d608a7e0..36b257c507 100644 --- a/sources/Maths/Maths/Matrix4x2F.gen.cs +++ b/sources/Maths/Maths/Matrix4X2.gen.cs @@ -3,29 +3,29 @@ namespace Silk.NET.Maths using System.Diagnostics.CodeAnalysis; using System.Numerics; - partial struct Matrix4x2F : - IEquatable> - where T : IFloatingPointIeee754 + public partial struct Matrix4X2 : + IEquatable> + where T : INumberBase { /// The 1st row of the matrix represented as a vector. - public Vector2F Row1; + public Vector2D Row1; /// The 2nd row of the matrix represented as a vector. - public Vector2F Row2; + public Vector2D Row2; /// The 3rd row of the matrix represented as a vector. - public Vector2F Row3; + public Vector2D Row3; /// The 4th row of the matrix represented as a vector. - public Vector2F Row4; + public Vector2D Row4; /// - /// Constructs a from the given rows. + /// Constructs a from the given rows. /// - public Matrix4x2F(Vector2F row1, Vector2F row2, Vector2F row3, Vector2F row4) => (Row1, Row2, Row3, Row4) = (row1, row2, row3, row4); + public Matrix4X2(Vector2D row1, Vector2D row2, Vector2D row3, Vector2D row4) => (Row1, Row2, Row3, Row4) = (row1, row2, row3, row4); [UnscopedRef] - public ref Vector2F this[int row] + public ref Vector2D this[int row] { get { @@ -81,16 +81,16 @@ public ref Vector2F this[int row] public ref T M42 => ref Row4.Y; /// - public override bool Equals(object? obj) => obj is Matrix4x2F other && Equals(other); + public override bool Equals(object? obj) => obj is Matrix4X2 other && Equals(other); /// - public bool Equals(Matrix4x2F other) => this == other; + public bool Equals(Matrix4X2 other) => this == other; /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); /// Computes the transpose of the matrix. - public Matrix2x4F Transpose() => + public Matrix2X4 Transpose() => new(new(M11, M21, M31, M41), new(M12, M22, M32, M42)); @@ -98,7 +98,7 @@ public Matrix2x4F Transpose() => /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix4x2F left, Matrix4x2F right) => + public static bool operator ==(Matrix4X2 left, Matrix4X2 right) => left.Row1 == right.Row1 && left.Row2 == right.Row2 && left.Row3 == right.Row3 && @@ -108,13 +108,13 @@ public Matrix2x4F Transpose() => /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix4x2F left, Matrix4x2F right) => !(left == right); + public static bool operator !=(Matrix4X2 left, Matrix4X2 right) => !(left == right); /// Adds two matrices together. /// The first source matrix. /// The second source matrix. /// The result of the addition. - public static Matrix4x2F operator +(Matrix4x2F left, Matrix4x2F right) => + public static Matrix4X2 operator +(Matrix4X2 left, Matrix4X2 right) => new(left.Row1 + right.Row1, left.Row2 + right.Row2, left.Row3 + right.Row3, @@ -124,7 +124,7 @@ public Matrix2x4F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the subtraction. - public static Matrix4x2F operator -(Matrix4x2F left, Matrix4x2F right) => + public static Matrix4X2 operator -(Matrix4X2 left, Matrix4X2 right) => new(left.Row1 - right.Row1, left.Row2 - right.Row2, left.Row3 - right.Row3, @@ -133,7 +133,7 @@ public Matrix2x4F Transpose() => /// Returns a new matrix with the negated elements of the given matrix. /// The source matrix. /// The negated matrix. - public static Matrix4x2F operator -(Matrix4x2F value) => + public static Matrix4X2 operator -(Matrix4X2 value) => new(-value.Row1, -value.Row2, -value.Row3, @@ -143,7 +143,7 @@ public Matrix2x4F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix4x2F operator *(Matrix4x2F left, Matrix2x2F right) => + public static Matrix4X2 operator *(Matrix4X2 left, Matrix2X2 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2, left.M21 * right.Row1 + left.M22 * right.Row2, left.M31 * right.Row1 + left.M32 * right.Row2, @@ -153,7 +153,7 @@ public Matrix2x4F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix4x3F operator *(Matrix4x2F left, Matrix2x3F right) => + public static Matrix4X3 operator *(Matrix4X2 left, Matrix2X3 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2, left.M21 * right.Row1 + left.M22 * right.Row2, left.M31 * right.Row1 + left.M32 * right.Row2, @@ -163,16 +163,16 @@ public Matrix2x4F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix4x4F operator *(Matrix4x2F left, Matrix2x4F right) => + public static Matrix4X4 operator *(Matrix4X2 left, Matrix2X4 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2, left.M21 * right.Row1 + left.M22 * right.Row2, left.M31 * right.Row1 + left.M32 * right.Row2, left.M41 * right.Row1 + left.M42 * right.Row2); } - static partial class Matrix4x2F + public static partial class Matrix4X2 { - public static Matrix4x2F Lerp(Matrix4x2F value1, Matrix4x2F value2, T amount) + public static Matrix4X2 Lerp(Matrix4X2 value1, Matrix4X2 value2, T amount) where T : IFloatingPointIeee754 => new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount)), new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount)), diff --git a/sources/Maths/Maths/Matrix4x3F.gen.cs b/sources/Maths/Maths/Matrix4X3.gen.cs similarity index 83% rename from sources/Maths/Maths/Matrix4x3F.gen.cs rename to sources/Maths/Maths/Matrix4X3.gen.cs index 5600ad456c..ba7647e55a 100644 --- a/sources/Maths/Maths/Matrix4x3F.gen.cs +++ b/sources/Maths/Maths/Matrix4X3.gen.cs @@ -3,29 +3,29 @@ namespace Silk.NET.Maths using System.Diagnostics.CodeAnalysis; using System.Numerics; - partial struct Matrix4x3F : - IEquatable> - where T : IFloatingPointIeee754 + public partial struct Matrix4X3 : + IEquatable> + where T : INumberBase { /// The 1st row of the matrix represented as a vector. - public Vector3F Row1; + public Vector3D Row1; /// The 2nd row of the matrix represented as a vector. - public Vector3F Row2; + public Vector3D Row2; /// The 3rd row of the matrix represented as a vector. - public Vector3F Row3; + public Vector3D Row3; /// The 4th row of the matrix represented as a vector. - public Vector3F Row4; + public Vector3D Row4; /// - /// Constructs a from the given rows. + /// Constructs a from the given rows. /// - public Matrix4x3F(Vector3F row1, Vector3F row2, Vector3F row3, Vector3F row4) => (Row1, Row2, Row3, Row4) = (row1, row2, row3, row4); + public Matrix4X3(Vector3D row1, Vector3D row2, Vector3D row3, Vector3D row4) => (Row1, Row2, Row3, Row4) = (row1, row2, row3, row4); [UnscopedRef] - public ref Vector3F this[int row] + public ref Vector3D this[int row] { get { @@ -97,16 +97,16 @@ public ref Vector3F this[int row] public ref T M43 => ref Row4.Z; /// - public override bool Equals(object? obj) => obj is Matrix4x3F other && Equals(other); + public override bool Equals(object? obj) => obj is Matrix4X3 other && Equals(other); /// - public bool Equals(Matrix4x3F other) => this == other; + public bool Equals(Matrix4X3 other) => this == other; /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); /// Computes the transpose of the matrix. - public Matrix3x4F Transpose() => + public Matrix3X4 Transpose() => new(new(M11, M21, M31, M41), new(M12, M22, M32, M42), new(M13, M23, M33, M43)); @@ -115,7 +115,7 @@ public Matrix3x4F Transpose() => /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix4x3F left, Matrix4x3F right) => + public static bool operator ==(Matrix4X3 left, Matrix4X3 right) => left.Row1 == right.Row1 && left.Row2 == right.Row2 && left.Row3 == right.Row3 && @@ -125,13 +125,13 @@ public Matrix3x4F Transpose() => /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix4x3F left, Matrix4x3F right) => !(left == right); + public static bool operator !=(Matrix4X3 left, Matrix4X3 right) => !(left == right); /// Adds two matrices together. /// The first source matrix. /// The second source matrix. /// The result of the addition. - public static Matrix4x3F operator +(Matrix4x3F left, Matrix4x3F right) => + public static Matrix4X3 operator +(Matrix4X3 left, Matrix4X3 right) => new(left.Row1 + right.Row1, left.Row2 + right.Row2, left.Row3 + right.Row3, @@ -141,7 +141,7 @@ public Matrix3x4F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the subtraction. - public static Matrix4x3F operator -(Matrix4x3F left, Matrix4x3F right) => + public static Matrix4X3 operator -(Matrix4X3 left, Matrix4X3 right) => new(left.Row1 - right.Row1, left.Row2 - right.Row2, left.Row3 - right.Row3, @@ -150,7 +150,7 @@ public Matrix3x4F Transpose() => /// Returns a new matrix with the negated elements of the given matrix. /// The source matrix. /// The negated matrix. - public static Matrix4x3F operator -(Matrix4x3F value) => + public static Matrix4X3 operator -(Matrix4X3 value) => new(-value.Row1, -value.Row2, -value.Row3, @@ -160,7 +160,7 @@ public Matrix3x4F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix2x3F operator *(Matrix2x4F left, Matrix4x3F right) => + public static Matrix2X3 operator *(Matrix2X4 left, Matrix4X3 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4); @@ -168,7 +168,7 @@ public Matrix3x4F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix4x2F operator *(Matrix4x3F left, Matrix3x2F right) => + public static Matrix4X2 operator *(Matrix4X3 left, Matrix3X2 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3, @@ -178,7 +178,7 @@ public Matrix3x4F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix4x3F operator *(Matrix4x3F left, Matrix3x3F right) => + public static Matrix4X3 operator *(Matrix4X3 left, Matrix3X3 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3, @@ -188,16 +188,16 @@ public Matrix3x4F Transpose() => /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix4x4F operator *(Matrix4x3F left, Matrix3x4F right) => + public static Matrix4X4 operator *(Matrix4X3 left, Matrix3X4 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3, left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3); } - static partial class Matrix4x3F + public static partial class Matrix4X3 { - public static Matrix4x3F Lerp(Matrix4x3F value1, Matrix4x3F value2, T amount) + public static Matrix4X3 Lerp(Matrix4X3 value1, Matrix4X3 value2, T amount) where T : IFloatingPointIeee754 => new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount), T.Lerp(value1.M13, value2.M13, amount)), new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount), T.Lerp(value1.M23, value2.M23, amount)), diff --git a/sources/Maths/Maths/Matrix4x2I.gen.cs b/sources/Maths/Maths/Matrix4x2I.gen.cs deleted file mode 100644 index a1d468858e..0000000000 --- a/sources/Maths/Maths/Matrix4x2I.gen.cs +++ /dev/null @@ -1,173 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix4x2I : - IEquatable> - where T : IBinaryInteger - { - /// The 1st row of the matrix represented as a vector. - public Vector2I Row1; - - /// The 2nd row of the matrix represented as a vector. - public Vector2I Row2; - - /// The 3rd row of the matrix represented as a vector. - public Vector2I Row3; - - /// The 4th row of the matrix represented as a vector. - public Vector2I Row4; - - /// - /// Constructs a from the given rows. - /// - public Matrix4x2I(Vector2I row1, Vector2I row2, Vector2I row3, Vector2I row4) => (Row1, Row2, Row3, Row4) = (row1, row2, row3, row4); - - [UnscopedRef] - public ref Vector2I this[int row] - { - get - { - switch (row) - { - case 0: - return ref Row1; - case 1: - return ref Row2; - case 2: - return ref Row3; - case 3: - return ref Row4; - } - - throw new ArgumentOutOfRangeException(nameof(row)); - } - } - - [UnscopedRef] - public ref T this[int row, int column] => ref this[row][column]; - - /// Gets the element in the 1st row and 1st column of the matrix. - [UnscopedRef] - public ref T M11 => ref Row1.X; - - /// Gets the element in the 1st row and 2nd column of the matrix. - [UnscopedRef] - public ref T M12 => ref Row1.Y; - - /// Gets the element in the 2nd row and 1st column of the matrix. - [UnscopedRef] - public ref T M21 => ref Row2.X; - - /// Gets the element in the 2nd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M22 => ref Row2.Y; - - /// Gets the element in the 3rd row and 1st column of the matrix. - [UnscopedRef] - public ref T M31 => ref Row3.X; - - /// Gets the element in the 3rd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M32 => ref Row3.Y; - - /// Gets the element in the 4th row and 1st column of the matrix. - [UnscopedRef] - public ref T M41 => ref Row4.X; - - /// Gets the element in the 4th row and 2nd column of the matrix. - [UnscopedRef] - public ref T M42 => ref Row4.Y; - - /// - public override bool Equals(object? obj) => obj is Matrix4x2I other && Equals(other); - - /// - public bool Equals(Matrix4x2I other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); - - /// Computes the transpose of the matrix. - public Matrix2x4I Transpose() => - new(new(M11, M21, M31, M41), - new(M12, M22, M32, M42)); - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix4x2I left, Matrix4x2I right) => - left.Row1 == right.Row1 && - left.Row2 == right.Row2 && - left.Row3 == right.Row3 && - left.Row4 == right.Row4; - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix4x2I left, Matrix4x2I right) => !(left == right); - - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The result of the addition. - public static Matrix4x2I operator +(Matrix4x2I left, Matrix4x2I right) => - new(left.Row1 + right.Row1, - left.Row2 + right.Row2, - left.Row3 + right.Row3, - left.Row4 + right.Row4); - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static Matrix4x2I operator -(Matrix4x2I left, Matrix4x2I right) => - new(left.Row1 - right.Row1, - left.Row2 - right.Row2, - left.Row3 - right.Row3, - left.Row4 - right.Row4); - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static Matrix4x2I operator -(Matrix4x2I value) => - new(-value.Row1, - -value.Row2, - -value.Row3, - -value.Row4); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix4x2I operator *(Matrix4x2I left, Matrix2x2I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2, - left.M21 * right.Row1 + left.M22 * right.Row2, - left.M31 * right.Row1 + left.M32 * right.Row2, - left.M41 * right.Row1 + left.M42 * right.Row2); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix4x3I operator *(Matrix4x2I left, Matrix2x3I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2, - left.M21 * right.Row1 + left.M22 * right.Row2, - left.M31 * right.Row1 + left.M32 * right.Row2, - left.M41 * right.Row1 + left.M42 * right.Row2); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix4x4I operator *(Matrix4x2I left, Matrix2x4I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2, - left.M21 * right.Row1 + left.M22 * right.Row2, - left.M31 * right.Row1 + left.M32 * right.Row2, - left.M41 * right.Row1 + left.M42 * right.Row2); - } - -} diff --git a/sources/Maths/Maths/Matrix4x3I.gen.cs b/sources/Maths/Maths/Matrix4x3I.gen.cs deleted file mode 100644 index 49b3576f0a..0000000000 --- a/sources/Maths/Maths/Matrix4x3I.gen.cs +++ /dev/null @@ -1,198 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix4x3I : - IEquatable> - where T : IBinaryInteger - { - /// The 1st row of the matrix represented as a vector. - public Vector3I Row1; - - /// The 2nd row of the matrix represented as a vector. - public Vector3I Row2; - - /// The 3rd row of the matrix represented as a vector. - public Vector3I Row3; - - /// The 4th row of the matrix represented as a vector. - public Vector3I Row4; - - /// - /// Constructs a from the given rows. - /// - public Matrix4x3I(Vector3I row1, Vector3I row2, Vector3I row3, Vector3I row4) => (Row1, Row2, Row3, Row4) = (row1, row2, row3, row4); - - [UnscopedRef] - public ref Vector3I this[int row] - { - get - { - switch (row) - { - case 0: - return ref Row1; - case 1: - return ref Row2; - case 2: - return ref Row3; - case 3: - return ref Row4; - } - - throw new ArgumentOutOfRangeException(nameof(row)); - } - } - - [UnscopedRef] - public ref T this[int row, int column] => ref this[row][column]; - - /// Gets the element in the 1st row and 1st column of the matrix. - [UnscopedRef] - public ref T M11 => ref Row1.X; - - /// Gets the element in the 1st row and 2nd column of the matrix. - [UnscopedRef] - public ref T M12 => ref Row1.Y; - - /// Gets the element in the 1st row and 3rd column of the matrix. - [UnscopedRef] - public ref T M13 => ref Row1.Z; - - /// Gets the element in the 2nd row and 1st column of the matrix. - [UnscopedRef] - public ref T M21 => ref Row2.X; - - /// Gets the element in the 2nd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M22 => ref Row2.Y; - - /// Gets the element in the 2nd row and 3rd column of the matrix. - [UnscopedRef] - public ref T M23 => ref Row2.Z; - - /// Gets the element in the 3rd row and 1st column of the matrix. - [UnscopedRef] - public ref T M31 => ref Row3.X; - - /// Gets the element in the 3rd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M32 => ref Row3.Y; - - /// Gets the element in the 3rd row and 3rd column of the matrix. - [UnscopedRef] - public ref T M33 => ref Row3.Z; - - /// Gets the element in the 4th row and 1st column of the matrix. - [UnscopedRef] - public ref T M41 => ref Row4.X; - - /// Gets the element in the 4th row and 2nd column of the matrix. - [UnscopedRef] - public ref T M42 => ref Row4.Y; - - /// Gets the element in the 4th row and 3rd column of the matrix. - [UnscopedRef] - public ref T M43 => ref Row4.Z; - - /// - public override bool Equals(object? obj) => obj is Matrix4x3I other && Equals(other); - - /// - public bool Equals(Matrix4x3I other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); - - /// Computes the transpose of the matrix. - public Matrix3x4I Transpose() => - new(new(M11, M21, M31, M41), - new(M12, M22, M32, M42), - new(M13, M23, M33, M43)); - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix4x3I left, Matrix4x3I right) => - left.Row1 == right.Row1 && - left.Row2 == right.Row2 && - left.Row3 == right.Row3 && - left.Row4 == right.Row4; - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix4x3I left, Matrix4x3I right) => !(left == right); - - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The result of the addition. - public static Matrix4x3I operator +(Matrix4x3I left, Matrix4x3I right) => - new(left.Row1 + right.Row1, - left.Row2 + right.Row2, - left.Row3 + right.Row3, - left.Row4 + right.Row4); - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static Matrix4x3I operator -(Matrix4x3I left, Matrix4x3I right) => - new(left.Row1 - right.Row1, - left.Row2 - right.Row2, - left.Row3 - right.Row3, - left.Row4 - right.Row4); - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static Matrix4x3I operator -(Matrix4x3I value) => - new(-value.Row1, - -value.Row2, - -value.Row3, - -value.Row4); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix2x3I operator *(Matrix2x4I left, Matrix4x3I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix4x2I operator *(Matrix4x3I left, Matrix3x2I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3, - left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix4x3I operator *(Matrix4x3I left, Matrix3x3I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3, - left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix4x4I operator *(Matrix4x3I left, Matrix3x4I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3, - left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3); - } - -} diff --git a/sources/Maths/Maths/Matrix4x4F.gen.cs b/sources/Maths/Maths/Matrix4x4F.gen.cs deleted file mode 100644 index 9c2acdddf3..0000000000 --- a/sources/Maths/Maths/Matrix4x4F.gen.cs +++ /dev/null @@ -1,240 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix4x4F : - IEquatable> - where T : IFloatingPointIeee754 - { - /// The multiplicative identity matrix of size 4x4. - public static readonly Matrix4x4F Identity = new( - new(T.MultiplicativeIdentity, T.Zero, T.Zero, T.Zero), - new(T.Zero, T.MultiplicativeIdentity, T.Zero, T.Zero), - new(T.Zero, T.Zero, T.MultiplicativeIdentity, T.Zero), - new(T.Zero, T.Zero, T.Zero, T.MultiplicativeIdentity)); - - /// The 1st row of the matrix represented as a vector. - public Vector4F Row1; - - /// The 2nd row of the matrix represented as a vector. - public Vector4F Row2; - - /// The 3rd row of the matrix represented as a vector. - public Vector4F Row3; - - /// The 4th row of the matrix represented as a vector. - public Vector4F Row4; - - /// - /// Constructs a from the given rows. - /// - public Matrix4x4F(Vector4F row1, Vector4F row2, Vector4F row3, Vector4F row4) => (Row1, Row2, Row3, Row4) = (row1, row2, row3, row4); - - [UnscopedRef] - public ref Vector4F this[int row] - { - get - { - switch (row) - { - case 0: - return ref Row1; - case 1: - return ref Row2; - case 2: - return ref Row3; - case 3: - return ref Row4; - } - - throw new ArgumentOutOfRangeException(nameof(row)); - } - } - - [UnscopedRef] - public ref T this[int row, int column] => ref this[row][column]; - - /// Gets the element in the 1st row and 1st column of the matrix. - [UnscopedRef] - public ref T M11 => ref Row1.X; - - /// Gets the element in the 1st row and 2nd column of the matrix. - [UnscopedRef] - public ref T M12 => ref Row1.Y; - - /// Gets the element in the 1st row and 3rd column of the matrix. - [UnscopedRef] - public ref T M13 => ref Row1.Z; - - /// Gets the element in the 1st row and 4th column of the matrix. - [UnscopedRef] - public ref T M14 => ref Row1.W; - - /// Gets the element in the 2nd row and 1st column of the matrix. - [UnscopedRef] - public ref T M21 => ref Row2.X; - - /// Gets the element in the 2nd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M22 => ref Row2.Y; - - /// Gets the element in the 2nd row and 3rd column of the matrix. - [UnscopedRef] - public ref T M23 => ref Row2.Z; - - /// Gets the element in the 2nd row and 4th column of the matrix. - [UnscopedRef] - public ref T M24 => ref Row2.W; - - /// Gets the element in the 3rd row and 1st column of the matrix. - [UnscopedRef] - public ref T M31 => ref Row3.X; - - /// Gets the element in the 3rd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M32 => ref Row3.Y; - - /// Gets the element in the 3rd row and 3rd column of the matrix. - [UnscopedRef] - public ref T M33 => ref Row3.Z; - - /// Gets the element in the 3rd row and 4th column of the matrix. - [UnscopedRef] - public ref T M34 => ref Row3.W; - - /// Gets the element in the 4th row and 1st column of the matrix. - [UnscopedRef] - public ref T M41 => ref Row4.X; - - /// Gets the element in the 4th row and 2nd column of the matrix. - [UnscopedRef] - public ref T M42 => ref Row4.Y; - - /// Gets the element in the 4th row and 3rd column of the matrix. - [UnscopedRef] - public ref T M43 => ref Row4.Z; - - /// Gets the element in the 4th row and 4th column of the matrix. - [UnscopedRef] - public ref T M44 => ref Row4.W; - - /// - public override bool Equals(object? obj) => obj is Matrix4x4F other && Equals(other); - - /// - public bool Equals(Matrix4x4F other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); - - /// Computes the transpose of the matrix. - public Matrix4x4F Transpose() => - new(new(M11, M21, M31, M41), - new(M12, M22, M32, M42), - new(M13, M23, M33, M43), - new(M14, M24, M34, M44)); - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix4x4F left, Matrix4x4F right) => - left.Row1 == right.Row1 && - left.Row2 == right.Row2 && - left.Row3 == right.Row3 && - left.Row4 == right.Row4; - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix4x4F left, Matrix4x4F right) => !(left == right); - - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The result of the addition. - public static Matrix4x4F operator +(Matrix4x4F left, Matrix4x4F right) => - new(left.Row1 + right.Row1, - left.Row2 + right.Row2, - left.Row3 + right.Row3, - left.Row4 + right.Row4); - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static Matrix4x4F operator -(Matrix4x4F left, Matrix4x4F right) => - new(left.Row1 - right.Row1, - left.Row2 - right.Row2, - left.Row3 - right.Row3, - left.Row4 - right.Row4); - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static Matrix4x4F operator -(Matrix4x4F value) => - new(-value.Row1, - -value.Row2, - -value.Row3, - -value.Row4); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix2x4F operator *(Matrix2x4F left, Matrix4x4F right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix3x4F operator *(Matrix3x4F left, Matrix4x4F right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix4x2F operator *(Matrix4x4F left, Matrix4x2F right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4, - left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3 + left.M44 * right.Row4); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix4x3F operator *(Matrix4x4F left, Matrix4x3F right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4, - left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3 + left.M44 * right.Row4); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix4x4F operator *(Matrix4x4F left, Matrix4x4F right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4, - left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3 + left.M44 * right.Row4); - } - - static partial class Matrix4x4F - { - public static Matrix4x4F Lerp(Matrix4x4F value1, Matrix4x4F value2, T amount) - where T : IFloatingPointIeee754 => - new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount), T.Lerp(value1.M13, value2.M13, amount), T.Lerp(value1.M14, value2.M14, amount)), - new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount), T.Lerp(value1.M23, value2.M23, amount), T.Lerp(value1.M24, value2.M24, amount)), - new(T.Lerp(value1.M31, value2.M31, amount), T.Lerp(value1.M32, value2.M32, amount), T.Lerp(value1.M33, value2.M33, amount), T.Lerp(value1.M34, value2.M34, amount)), - new(T.Lerp(value1.M41, value2.M41, amount), T.Lerp(value1.M42, value2.M42, amount), T.Lerp(value1.M43, value2.M43, amount), T.Lerp(value1.M44, value2.M44, amount))); - } -} diff --git a/sources/Maths/Maths/Matrix4x4I.gen.cs b/sources/Maths/Maths/Matrix4x4I.gen.cs deleted file mode 100644 index ebae4c3681..0000000000 --- a/sources/Maths/Maths/Matrix4x4I.gen.cs +++ /dev/null @@ -1,231 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix4x4I : - IEquatable> - where T : IBinaryInteger - { - /// The multiplicative identity matrix of size 4x4. - public static readonly Matrix4x4I Identity = new( - new(T.MultiplicativeIdentity, T.Zero, T.Zero, T.Zero), - new(T.Zero, T.MultiplicativeIdentity, T.Zero, T.Zero), - new(T.Zero, T.Zero, T.MultiplicativeIdentity, T.Zero), - new(T.Zero, T.Zero, T.Zero, T.MultiplicativeIdentity)); - - /// The 1st row of the matrix represented as a vector. - public Vector4I Row1; - - /// The 2nd row of the matrix represented as a vector. - public Vector4I Row2; - - /// The 3rd row of the matrix represented as a vector. - public Vector4I Row3; - - /// The 4th row of the matrix represented as a vector. - public Vector4I Row4; - - /// - /// Constructs a from the given rows. - /// - public Matrix4x4I(Vector4I row1, Vector4I row2, Vector4I row3, Vector4I row4) => (Row1, Row2, Row3, Row4) = (row1, row2, row3, row4); - - [UnscopedRef] - public ref Vector4I this[int row] - { - get - { - switch (row) - { - case 0: - return ref Row1; - case 1: - return ref Row2; - case 2: - return ref Row3; - case 3: - return ref Row4; - } - - throw new ArgumentOutOfRangeException(nameof(row)); - } - } - - [UnscopedRef] - public ref T this[int row, int column] => ref this[row][column]; - - /// Gets the element in the 1st row and 1st column of the matrix. - [UnscopedRef] - public ref T M11 => ref Row1.X; - - /// Gets the element in the 1st row and 2nd column of the matrix. - [UnscopedRef] - public ref T M12 => ref Row1.Y; - - /// Gets the element in the 1st row and 3rd column of the matrix. - [UnscopedRef] - public ref T M13 => ref Row1.Z; - - /// Gets the element in the 1st row and 4th column of the matrix. - [UnscopedRef] - public ref T M14 => ref Row1.W; - - /// Gets the element in the 2nd row and 1st column of the matrix. - [UnscopedRef] - public ref T M21 => ref Row2.X; - - /// Gets the element in the 2nd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M22 => ref Row2.Y; - - /// Gets the element in the 2nd row and 3rd column of the matrix. - [UnscopedRef] - public ref T M23 => ref Row2.Z; - - /// Gets the element in the 2nd row and 4th column of the matrix. - [UnscopedRef] - public ref T M24 => ref Row2.W; - - /// Gets the element in the 3rd row and 1st column of the matrix. - [UnscopedRef] - public ref T M31 => ref Row3.X; - - /// Gets the element in the 3rd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M32 => ref Row3.Y; - - /// Gets the element in the 3rd row and 3rd column of the matrix. - [UnscopedRef] - public ref T M33 => ref Row3.Z; - - /// Gets the element in the 3rd row and 4th column of the matrix. - [UnscopedRef] - public ref T M34 => ref Row3.W; - - /// Gets the element in the 4th row and 1st column of the matrix. - [UnscopedRef] - public ref T M41 => ref Row4.X; - - /// Gets the element in the 4th row and 2nd column of the matrix. - [UnscopedRef] - public ref T M42 => ref Row4.Y; - - /// Gets the element in the 4th row and 3rd column of the matrix. - [UnscopedRef] - public ref T M43 => ref Row4.Z; - - /// Gets the element in the 4th row and 4th column of the matrix. - [UnscopedRef] - public ref T M44 => ref Row4.W; - - /// - public override bool Equals(object? obj) => obj is Matrix4x4I other && Equals(other); - - /// - public bool Equals(Matrix4x4I other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); - - /// Computes the transpose of the matrix. - public Matrix4x4I Transpose() => - new(new(M11, M21, M31, M41), - new(M12, M22, M32, M42), - new(M13, M23, M33, M43), - new(M14, M24, M34, M44)); - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix4x4I left, Matrix4x4I right) => - left.Row1 == right.Row1 && - left.Row2 == right.Row2 && - left.Row3 == right.Row3 && - left.Row4 == right.Row4; - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix4x4I left, Matrix4x4I right) => !(left == right); - - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The result of the addition. - public static Matrix4x4I operator +(Matrix4x4I left, Matrix4x4I right) => - new(left.Row1 + right.Row1, - left.Row2 + right.Row2, - left.Row3 + right.Row3, - left.Row4 + right.Row4); - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static Matrix4x4I operator -(Matrix4x4I left, Matrix4x4I right) => - new(left.Row1 - right.Row1, - left.Row2 - right.Row2, - left.Row3 - right.Row3, - left.Row4 - right.Row4); - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static Matrix4x4I operator -(Matrix4x4I value) => - new(-value.Row1, - -value.Row2, - -value.Row3, - -value.Row4); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix2x4I operator *(Matrix2x4I left, Matrix4x4I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix3x4I operator *(Matrix3x4I left, Matrix4x4I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix4x2I operator *(Matrix4x4I left, Matrix4x2I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4, - left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3 + left.M44 * right.Row4); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix4x3I operator *(Matrix4x4I left, Matrix4x3I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4, - left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3 + left.M44 * right.Row4); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix4x4I operator *(Matrix4x4I left, Matrix4x4I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4, - left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3 + left.M44 * right.Row4); - } - -} diff --git a/sources/Maths/Maths/Matrix5x4F.gen.cs b/sources/Maths/Maths/Matrix5X4.gen.cs similarity index 86% rename from sources/Maths/Maths/Matrix5x4F.gen.cs rename to sources/Maths/Maths/Matrix5X4.gen.cs index 0c299fd514..f2eeff2e38 100644 --- a/sources/Maths/Maths/Matrix5x4F.gen.cs +++ b/sources/Maths/Maths/Matrix5X4.gen.cs @@ -3,32 +3,32 @@ namespace Silk.NET.Maths using System.Diagnostics.CodeAnalysis; using System.Numerics; - partial struct Matrix5x4F : - IEquatable> - where T : IFloatingPointIeee754 + public partial struct Matrix5X4 : + IEquatable> + where T : INumberBase { /// The 1st row of the matrix represented as a vector. - public Vector4F Row1; + public Vector4D Row1; /// The 2nd row of the matrix represented as a vector. - public Vector4F Row2; + public Vector4D Row2; /// The 3rd row of the matrix represented as a vector. - public Vector4F Row3; + public Vector4D Row3; /// The 4th row of the matrix represented as a vector. - public Vector4F Row4; + public Vector4D Row4; /// The 5th row of the matrix represented as a vector. - public Vector4F Row5; + public Vector4D Row5; /// - /// Constructs a from the given rows. + /// Constructs a from the given rows. /// - public Matrix5x4F(Vector4F row1, Vector4F row2, Vector4F row3, Vector4F row4, Vector4F row5) => (Row1, Row2, Row3, Row4, Row5) = (row1, row2, row3, row4, row5); + public Matrix5X4(Vector4D row1, Vector4D row2, Vector4D row3, Vector4D row4, Vector4D row5) => (Row1, Row2, Row3, Row4, Row5) = (row1, row2, row3, row4, row5); [UnscopedRef] - public ref Vector4F this[int row] + public ref Vector4D this[int row] { get { @@ -134,10 +134,10 @@ public ref Vector4F this[int row] public ref T M54 => ref Row5.W; /// - public override bool Equals(object? obj) => obj is Matrix5x4F other && Equals(other); + public override bool Equals(object? obj) => obj is Matrix5X4 other && Equals(other); /// - public bool Equals(Matrix5x4F other) => this == other; + public bool Equals(Matrix5X4 other) => this == other; /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4, Row5); @@ -146,7 +146,7 @@ public ref Vector4F this[int row] /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix5x4F left, Matrix5x4F right) => + public static bool operator ==(Matrix5X4 left, Matrix5X4 right) => left.Row1 == right.Row1 && left.Row2 == right.Row2 && left.Row3 == right.Row3 && @@ -157,13 +157,13 @@ public ref Vector4F this[int row] /// The first matrix to compare. /// The second matrix to compare. /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix5x4F left, Matrix5x4F right) => !(left == right); + public static bool operator !=(Matrix5X4 left, Matrix5X4 right) => !(left == right); /// Adds two matrices together. /// The first source matrix. /// The second source matrix. /// The result of the addition. - public static Matrix5x4F operator +(Matrix5x4F left, Matrix5x4F right) => + public static Matrix5X4 operator +(Matrix5X4 left, Matrix5X4 right) => new(left.Row1 + right.Row1, left.Row2 + right.Row2, left.Row3 + right.Row3, @@ -174,7 +174,7 @@ public ref Vector4F this[int row] /// The first source matrix. /// The second source matrix. /// The result of the subtraction. - public static Matrix5x4F operator -(Matrix5x4F left, Matrix5x4F right) => + public static Matrix5X4 operator -(Matrix5X4 left, Matrix5X4 right) => new(left.Row1 - right.Row1, left.Row2 - right.Row2, left.Row3 - right.Row3, @@ -184,7 +184,7 @@ public ref Vector4F this[int row] /// Returns a new matrix with the negated elements of the given matrix. /// The source matrix. /// The negated matrix. - public static Matrix5x4F operator -(Matrix5x4F value) => + public static Matrix5X4 operator -(Matrix5X4 value) => new(-value.Row1, -value.Row2, -value.Row3, @@ -195,7 +195,7 @@ public ref Vector4F this[int row] /// The first source matrix. /// The second source matrix. /// The result of the multiplication. - public static Matrix5x4F operator *(Matrix5x4F left, Matrix4x4F right) => + public static Matrix5X4 operator *(Matrix5X4 left, Matrix4X4 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4, @@ -203,9 +203,9 @@ public ref Vector4F this[int row] left.M51 * right.Row1 + left.M52 * right.Row2 + left.M53 * right.Row3 + left.M54 * right.Row4); } - static partial class Matrix5x4F + public static partial class Matrix5X4 { - public static Matrix5x4F Lerp(Matrix5x4F value1, Matrix5x4F value2, T amount) + public static Matrix5X4 Lerp(Matrix5X4 value1, Matrix5X4 value2, T amount) where T : IFloatingPointIeee754 => new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount), T.Lerp(value1.M13, value2.M13, amount), T.Lerp(value1.M14, value2.M14, amount)), new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount), T.Lerp(value1.M23, value2.M23, amount), T.Lerp(value1.M24, value2.M24, amount)), diff --git a/sources/Maths/Maths/Matrix5x4I.gen.cs b/sources/Maths/Maths/Matrix5x4I.gen.cs deleted file mode 100644 index a57e492891..0000000000 --- a/sources/Maths/Maths/Matrix5x4I.gen.cs +++ /dev/null @@ -1,206 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix5x4I : - IEquatable> - where T : IBinaryInteger - { - /// The 1st row of the matrix represented as a vector. - public Vector4I Row1; - - /// The 2nd row of the matrix represented as a vector. - public Vector4I Row2; - - /// The 3rd row of the matrix represented as a vector. - public Vector4I Row3; - - /// The 4th row of the matrix represented as a vector. - public Vector4I Row4; - - /// The 5th row of the matrix represented as a vector. - public Vector4I Row5; - - /// - /// Constructs a from the given rows. - /// - public Matrix5x4I(Vector4I row1, Vector4I row2, Vector4I row3, Vector4I row4, Vector4I row5) => (Row1, Row2, Row3, Row4, Row5) = (row1, row2, row3, row4, row5); - - [UnscopedRef] - public ref Vector4I this[int row] - { - get - { - switch (row) - { - case 0: - return ref Row1; - case 1: - return ref Row2; - case 2: - return ref Row3; - case 3: - return ref Row4; - case 4: - return ref Row5; - } - - throw new ArgumentOutOfRangeException(nameof(row)); - } - } - - [UnscopedRef] - public ref T this[int row, int column] => ref this[row][column]; - - /// Gets the element in the 1st row and 1st column of the matrix. - [UnscopedRef] - public ref T M11 => ref Row1.X; - - /// Gets the element in the 1st row and 2nd column of the matrix. - [UnscopedRef] - public ref T M12 => ref Row1.Y; - - /// Gets the element in the 1st row and 3rd column of the matrix. - [UnscopedRef] - public ref T M13 => ref Row1.Z; - - /// Gets the element in the 1st row and 4th column of the matrix. - [UnscopedRef] - public ref T M14 => ref Row1.W; - - /// Gets the element in the 2nd row and 1st column of the matrix. - [UnscopedRef] - public ref T M21 => ref Row2.X; - - /// Gets the element in the 2nd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M22 => ref Row2.Y; - - /// Gets the element in the 2nd row and 3rd column of the matrix. - [UnscopedRef] - public ref T M23 => ref Row2.Z; - - /// Gets the element in the 2nd row and 4th column of the matrix. - [UnscopedRef] - public ref T M24 => ref Row2.W; - - /// Gets the element in the 3rd row and 1st column of the matrix. - [UnscopedRef] - public ref T M31 => ref Row3.X; - - /// Gets the element in the 3rd row and 2nd column of the matrix. - [UnscopedRef] - public ref T M32 => ref Row3.Y; - - /// Gets the element in the 3rd row and 3rd column of the matrix. - [UnscopedRef] - public ref T M33 => ref Row3.Z; - - /// Gets the element in the 3rd row and 4th column of the matrix. - [UnscopedRef] - public ref T M34 => ref Row3.W; - - /// Gets the element in the 4th row and 1st column of the matrix. - [UnscopedRef] - public ref T M41 => ref Row4.X; - - /// Gets the element in the 4th row and 2nd column of the matrix. - [UnscopedRef] - public ref T M42 => ref Row4.Y; - - /// Gets the element in the 4th row and 3rd column of the matrix. - [UnscopedRef] - public ref T M43 => ref Row4.Z; - - /// Gets the element in the 4th row and 4th column of the matrix. - [UnscopedRef] - public ref T M44 => ref Row4.W; - - /// Gets the element in the 5th row and 1st column of the matrix. - [UnscopedRef] - public ref T M51 => ref Row5.X; - - /// Gets the element in the 5th row and 2nd column of the matrix. - [UnscopedRef] - public ref T M52 => ref Row5.Y; - - /// Gets the element in the 5th row and 3rd column of the matrix. - [UnscopedRef] - public ref T M53 => ref Row5.Z; - - /// Gets the element in the 5th row and 4th column of the matrix. - [UnscopedRef] - public ref T M54 => ref Row5.W; - - /// - public override bool Equals(object? obj) => obj is Matrix5x4I other && Equals(other); - - /// - public bool Equals(Matrix5x4I other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4, Row5); - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are equal; false otherwise. - public static bool operator ==(Matrix5x4I left, Matrix5x4I right) => - left.Row1 == right.Row1 && - left.Row2 == right.Row2 && - left.Row3 == right.Row3 && - left.Row4 == right.Row4 && - left.Row5 == right.Row5; - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// true if the given matrices are not equal; false otherwise. - public static bool operator !=(Matrix5x4I left, Matrix5x4I right) => !(left == right); - - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The result of the addition. - public static Matrix5x4I operator +(Matrix5x4I left, Matrix5x4I right) => - new(left.Row1 + right.Row1, - left.Row2 + right.Row2, - left.Row3 + right.Row3, - left.Row4 + right.Row4, - left.Row5 + right.Row5); - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static Matrix5x4I operator -(Matrix5x4I left, Matrix5x4I right) => - new(left.Row1 - right.Row1, - left.Row2 - right.Row2, - left.Row3 - right.Row3, - left.Row4 - right.Row4, - left.Row5 - right.Row5); - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static Matrix5x4I operator -(Matrix5x4I value) => - new(-value.Row1, - -value.Row2, - -value.Row3, - -value.Row4, - -value.Row5); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix5x4I operator *(Matrix5x4I left, Matrix4x4I right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, - left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, - left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4, - left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3 + left.M44 * right.Row4, - left.M51 * right.Row1 + left.M52 * right.Row2 + left.M53 * right.Row3 + left.M54 * right.Row4); - } - -} diff --git a/sources/Maths/Maths/Vector2D.cs b/sources/Maths/Maths/Vector2D.cs new file mode 100644 index 0000000000..dd577a241c --- /dev/null +++ b/sources/Maths/Maths/Vector2D.cs @@ -0,0 +1,78 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + + +using System.Collections; +using System.Diagnostics.CodeAnalysis; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Text; + +namespace Silk.NET.Maths +{ + /// A structure representing a 2D integer vector. + public partial struct Vector2D + { + /// Computes the cross product of this vector with another vector. + public T Cross(Vector2D other) => (X * other.Y) - (Y * other.X); + + /// Computes the cross product of two vectors. + public static T Cross(Vector2D left, Vector2D right) => (left.X * right.Y) - (left.Y * right.X); + + // Casts + + /// Explicitly casts a to a . + public static explicit operator Vector2D(System.Numerics.Vector2 v) => + new Vector2D((T)Convert.ChangeType(v.X, typeof(T)), (T)Convert.ChangeType(v.Y, typeof(T))); + + /// Explicitly casts a to . + public static explicit operator System.Numerics.Vector2(Vector2D v) => + new System.Numerics.Vector2(Convert.ToSingle(v.X), Convert.ToSingle(v.Y)); + + public static (Vector2D Quotient, Vector2D Remainder) DivRem(Vector2D left, Vector2D right) + { + var (qX, rX) = T.DivRem(left.X, right.X); + var (qY, rY) = T.DivRem(left.Y, right.Y); + return (new Vector2D(qX, qY), new Vector2D(rX, rY)); + } + + /// Linearly interpolates between two vectors using a scalar t-value (clamped between 0 and 1). + public static Vector2D LerpClamped(Vector2D a, Vector2D b, T t) => + Vector2D.Lerp(a, b, T.Clamp(t, T.Zero, T.One)); + + /// Linearly interpolates between two vectors using a vector t-value (clamped between 0 and 1). + public static Vector2D LerpClamped(Vector2D a, Vector2D b, Vector2D t) => + new( + a.X + (b.X - a.X) * T.Clamp(t.X, T.Zero, T.One), + a.Y + (b.Y - a.Y) * T.Clamp(t.Y, T.Zero, T.One) + ); + + // IFloatingPointIeee754 + + public static (Vector2D Sin, Vector2D Cos) SinCos(Vector2D x) => + (new(T.Sin(x.X), T.Sin(x.Y)), new(T.Cos(x.X), T.Cos(x.Y))); + + public static (Vector2D SinPi, Vector2D CosPi) SinCosPi(Vector2D x) => + (new(T.SinPi(x.X), T.SinPi(x.Y)), new(T.CosPi(x.X), T.CosPi(x.Y))); + + public static Vector2D FusedMultiplyAdd(Vector2D left, Vector2D right, Vector2D addend) => + new(T.FusedMultiplyAdd(left.X, right.X, addend.X), T.FusedMultiplyAdd(left.Y, right.Y, addend.Y)); + + public static Vector2D FusedMultiplyAdd(Vector2D left, Vector2D right, T addend) => + new(T.FusedMultiplyAdd(left.X, right.X, addend), T.FusedMultiplyAdd(left.Y, right.Y, addend)); + + public static Vector2D FusedMultiplyAdd(Vector2D left, T right, Vector2D addend) => + new(T.FusedMultiplyAdd(left.X, right, addend.X), T.FusedMultiplyAdd(left.Y, right, addend.Y)); + + public static Vector2D FusedMultiplyAdd(Vector2D left, T right, T addend) => + new(T.FusedMultiplyAdd(left.X, right, addend), T.FusedMultiplyAdd(left.Y, right, addend)); + } + + public static partial class Vector2D + { + /// Computes the cross product of two vectors. + public static T Cross(this Vector2D left, Vector2D right) + where T : IFloatingPointIeee754 => (left.X * right.Y) - (left.Y * right.X); + } +} diff --git a/sources/Maths/Maths/Vector2F.gen.cs b/sources/Maths/Maths/Vector2D.gen.cs similarity index 73% rename from sources/Maths/Maths/Vector2F.gen.cs rename to sources/Maths/Maths/Vector2D.gen.cs index 66d80f2855..3c9845a843 100644 --- a/sources/Maths/Maths/Vector2F.gen.cs +++ b/sources/Maths/Maths/Vector2D.gen.cs @@ -6,16 +6,16 @@ namespace Silk.NET.Maths using System.Runtime.InteropServices; using System.Text; - partial struct Vector2F : - IEquatable>, + public partial struct Vector2D : + IEquatable>, IReadOnlyList, IFormattable, - IParsable>, + IParsable>, ISpanFormattable, - ISpanParsable>, + ISpanParsable>, IUtf8SpanFormattable, - IUtf8SpanParsable> - where T : IFloatingPointIeee754 + IUtf8SpanParsable> + where T : INumberBase { /// The X component of the vector. public T X; @@ -24,13 +24,13 @@ partial struct Vector2F : public T Y; /// Initializes all components of the vector to the same value. - public Vector2F(T value) => (X, Y) = (value, value); + public Vector2D(T value) => (X, Y) = (value, value); /// Initializes the vector with individual component values. - public Vector2F(T x, T y) => (X, Y) = (x, y); + public Vector2D(T x, T y) => (X, Y) = (x, y); /// Initializes the vector from a span of 2 values. - public Vector2F(ReadOnlySpan values) + public Vector2D(ReadOnlySpan values) { if (values.Length != 2) throw new ArgumentException("Input span must contain exactly 2 elements.", nameof(values)); @@ -40,19 +40,19 @@ public Vector2F(ReadOnlySpan values) } /// Gets a vector whose 2 elements are equal to one. - public static Vector2F One => new(T.One); + public static Vector2D One => new(T.One); /// Returns a vector whose 2 elements are equal to zero. - public static Vector2F Zero => default; + public static Vector2D Zero => default; /// Gets the vector (1, 0). - public static Vector2F UnitX => new(T.One, T.Zero); + public static Vector2D UnitX => new(T.One, T.Zero); /// Gets the vector (0, 1). - public static Vector2F UnitY => new(T.Zero, T.One); + public static Vector2D UnitY => new(T.Zero, T.One); /// Gets the squared length of the vector (dot product with itself). - public T LengthSquared => Vector2F.Dot(this, this); + public T LengthSquared => Vector2D.Dot(this, this); /// T IReadOnlyList.this[int index] => this[index]; @@ -127,14 +127,14 @@ public override string ToString() => public string ToString(string? format, IFormatProvider? formatProvider) => $"<{X.ToString(format, formatProvider)}, {Y.ToString(format, formatProvider)}>"; - /// Parses a string to a instance. - public static Vector2F Parse(string s, IFormatProvider? provider) => Parse(s.AsSpan(), provider); + /// Parses a string to a instance. + public static Vector2D Parse(string s, IFormatProvider? provider) => Parse(s.AsSpan(), provider); - /// Parses a span to a instance. - public static Vector2F Parse(ReadOnlySpan s, IFormatProvider? provider) + /// Parses a span to a instance. + public static Vector2D Parse(ReadOnlySpan s, IFormatProvider? provider) { if (!TryParse(s, provider, out var result)) - throw new FormatException("Invalid format for Vector2F."); + throw new FormatException("Invalid format for Vector2D."); return result; } @@ -213,8 +213,8 @@ public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan return true; } - /// Tries to parse a span to a instance. - public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector2F result) + /// Tries to parse a span to a instance. + public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector2D result) { result = default; @@ -234,15 +234,15 @@ public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, [Ma if (T.TryParse(xSpan, provider, out var x) && T.TryParse(ySpan, provider, out var y)) { - result = new Vector2F(x, y); + result = new Vector2D(x, y); return true; } return false; } - /// Parses a UTF-8 span to a instance. - public static Vector2F Parse(ReadOnlySpan utf8Text, IFormatProvider? provider) + /// Parses a UTF-8 span to a instance. + public static Vector2D Parse(ReadOnlySpan utf8Text, IFormatProvider? provider) { int charCount = Encoding.UTF8.GetCharCount(utf8Text); Span charBuffer = charCount <= 128 ? stackalloc char[charCount] : new char[charCount]; @@ -250,8 +250,8 @@ public static Vector2F Parse(ReadOnlySpan utf8Text, IFormatProvider? pr return Parse(charBuffer, provider); } - /// Tries to parse a UTF-8 span to a instance. - public static bool TryParse(ReadOnlySpan utf8Text, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector2F result) + /// Tries to parse a UTF-8 span to a instance. + public static bool TryParse(ReadOnlySpan utf8Text, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector2D result) { int charCount = Encoding.UTF8.GetCharCount(utf8Text); Span charBuffer = charCount <= 128 ? stackalloc char[charCount] : new char[charCount]; @@ -259,31 +259,31 @@ public static bool TryParse(ReadOnlySpan utf8Text, IFormatProvider? provid return TryParse(charBuffer, provider, out result); } - /// Tries to parse a string to a instance. - public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector2F result) => + /// Tries to parse a string to a instance. + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector2D result) => TryParse(s.AsSpan(), provider, out result); - /// Parses a span to a instance. - static Vector2F ISpanParsable>.Parse(ReadOnlySpan s, IFormatProvider? provider) => + /// Parses a span to a instance. + static Vector2D ISpanParsable>.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, provider); - /// Parses a string to a instance. - static Vector2F IParsable>.Parse(string s, IFormatProvider? provider) => + /// Parses a string to a instance. + static Vector2D IParsable>.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - /// Tries to parse a span to a instance. - static bool ISpanParsable>.TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector2F result) => + /// Tries to parse a span to a instance. + static bool ISpanParsable>.TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector2D result) => TryParse(s, provider, out result); - /// Tries to parse a string to a instance. - static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector2F result) => + /// Tries to parse a string to a instance. + static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector2D result) => TryParse(s, provider, out result); /// Returns a boolean indicating whether the given two vectors are equal. /// The first vector to compare. /// The second vector to compare. /// true if the given vectors are equal; false otherwise. - public static bool operator ==(Vector2F left, Vector2F right) => + public static bool operator ==(Vector2D left, Vector2D right) => left.X == right.X && left.Y == right.Y; @@ -291,13 +291,13 @@ static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IForm /// The first vector to compare. /// The second vector to compare. /// true if the given vectors are not equal; false otherwise. - public static bool operator !=(Vector2F left, Vector2F right) => !(left == right); + public static bool operator !=(Vector2D left, Vector2D right) => !(left == right); /// - public override bool Equals(object? obj) => obj is Vector2F other && Equals(other); + public override bool Equals(object? obj) => obj is Vector2D other && Equals(other); /// - public bool Equals(Vector2F other) => this == other; + public bool Equals(Vector2D other) => this == other; /// public override int GetHashCode() => HashCode.Combine(X, Y); @@ -311,252 +311,263 @@ public void Deconstruct(out T x, out T y) y = Y; } - /// Implicitly casts a to a . - public static implicit operator Vector2F((T X, T Y) v) => + /// Converts the components of this vector to another type. + public Vector2D As() + where TOther : INumberBase => + new(TOther.CreateSaturating(X), TOther.CreateSaturating(Y)); + + /// Implicitly casts a to a . + public static implicit operator Vector2D((T X, T Y) v) => new(v.X, v.Y); - /// Implicitly casts a to a . - public static implicit operator (T X, T Y)(Vector2F v) => + /// Implicitly casts a to a . + public static implicit operator (T X, T Y)(Vector2D v) => (v.X, v.Y); - public static Vector2F operator +(Vector2F vector) => + public static Vector2D operator +(Vector2D vector) => vector; - public static Vector2F operator -(Vector2F vector) => + public static Vector2D operator -(Vector2D vector) => new(-vector.X, -vector.Y); - public static Vector2F operator +(Vector2F left, Vector2F right) => + public static Vector2D operator +(Vector2D left, Vector2D right) => new(left.X + right.X, left.Y + right.Y); - public static Vector2F operator -(Vector2F left, Vector2F right) => + public static Vector2D operator -(Vector2D left, Vector2D right) => new(left.X - right.X, left.Y - right.Y); - public static Vector2F operator *(Vector2F left, Vector2F right) => + public static Vector2D operator *(Vector2D left, Vector2D right) => new(left.X * right.X, left.Y * right.Y); - public static Vector2F operator /(Vector2F left, Vector2F right) => + public static Vector2D operator /(Vector2D left, Vector2D right) => new(left.X / right.X, left.Y / right.Y); - public static Vector2F operator %(Vector2F left, Vector2F right) => - new(left.X % right.X, left.Y % right.Y); - - public static Vector2F operator +(Vector2F vector, T scalar) => + public static Vector2D operator +(Vector2D vector, T scalar) => new(vector.X + scalar, vector.Y + scalar); - public static Vector2F operator -(Vector2F vector, T scalar) => + public static Vector2D operator -(Vector2D vector, T scalar) => new(vector.X - scalar, vector.Y - scalar); - public static Vector2F operator *(Vector2F vector, T scalar) => + public static Vector2D operator *(Vector2D vector, T scalar) => new(vector.X * scalar, vector.Y * scalar); - public static Vector2F operator *(T scalar, Vector2F vector) => + public static Vector2D operator *(T scalar, Vector2D vector) => new(scalar * vector.X, scalar * vector.Y); - public static Vector2F operator /(Vector2F vector, T scalar) => + public static Vector2D operator /(Vector2D vector, T scalar) => new(vector.X / scalar, vector.Y / scalar); - public static Vector2F operator %(Vector2F vector, T scalar) => - new(vector.X % scalar, vector.Y % scalar); - } - static partial class Vector2F + public static partial class Vector2D { /// Computes the dot product of two vectors. - public static T Dot(this Vector2F left, Vector2F right) - where T : IFloatingPointIeee754 => + public static T Dot(this Vector2D left, Vector2D right) + where T : INumberBase => left.X * right.X + left.Y * right.Y; /// Reflects a vector over a normal vector. - public static Vector2F Reflect(Vector2F vector, Vector2F normal) - where T : IFloatingPointIeee754 + public static Vector2D Reflect(Vector2D vector, Vector2D normal) + where T : INumberBase { T dot = vector.Dot(normal); return vector - (normal * (dot + dot)); } /// Computes the length of the vector. - public static T GetLength(this Vector2F vector) + public static T GetLength(this Vector2D vector) where T : IFloatingPointIeee754 => T.Sqrt(vector.LengthSquared); /// Normalizes a vector. - public static Vector2F Normalize(this Vector2F vector) + public static Vector2D Normalize(this Vector2D vector) where T : IFloatingPointIeee754 { T length = vector.GetLength(); - return length != T.Zero ? vector / length : Vector2F.Zero; + return length != T.Zero ? vector / length : Vector2D.Zero; } /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2I Sign(this Vector2F value) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Sign(this Vector2D value) + where TSelf : INumber => new(TSelf.Sign(value.X), TSelf.Sign(value.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F Max(this Vector2F x, Vector2F y) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Max(this Vector2D x, Vector2D y) + where TSelf : INumber => new(TSelf.Max(x.X, y.X), TSelf.Max(x.Y, y.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector2F Max(this Vector2F x, TSelf y) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Max(this Vector2D x, TSelf y) + where TSelf : INumber => new(TSelf.Max(x.X, y), TSelf.Max(x.Y, y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F MaxNumber(this Vector2F x, Vector2F y) - where TSelf : IFloatingPointIeee754 => + public static Vector2D MaxNumber(this Vector2D x, Vector2D y) + where TSelf : INumber => new(TSelf.MaxNumber(x.X, y.X), TSelf.MaxNumber(x.Y, y.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector2F MaxNumber(this Vector2F x, TSelf y) - where TSelf : IFloatingPointIeee754 => + public static Vector2D MaxNumber(this Vector2D x, TSelf y) + where TSelf : INumber => new(TSelf.MaxNumber(x.X, y), TSelf.MaxNumber(x.Y, y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F Min(this Vector2F x, Vector2F y) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Min(this Vector2D x, Vector2D y) + where TSelf : INumber => new(TSelf.Min(x.X, y.X), TSelf.Min(x.Y, y.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector2F Min(this Vector2F x, TSelf y) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Min(this Vector2D x, TSelf y) + where TSelf : INumber => new(TSelf.Min(x.X, y), TSelf.Min(x.Y, y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F MinNumber(this Vector2F x, Vector2F y) - where TSelf : IFloatingPointIeee754 => + public static Vector2D MinNumber(this Vector2D x, Vector2D y) + where TSelf : INumber => new(TSelf.MinNumber(x.X, y.X), TSelf.MinNumber(x.Y, y.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector2F MinNumber(this Vector2F x, TSelf y) - where TSelf : IFloatingPointIeee754 => + public static Vector2D MinNumber(this Vector2D x, TSelf y) + where TSelf : INumber => new(TSelf.MinNumber(x.X, y), TSelf.MinNumber(x.Y, y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F Clamp(this Vector2F value, Vector2F min, Vector2F max) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Clamp(this Vector2D value, Vector2D min, Vector2D max) + where TSelf : INumber => new(TSelf.Clamp(value.X, min.X, max.X), TSelf.Clamp(value.Y, min.Y, max.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . /// A single value provided for . - public static Vector2F Clamp(this Vector2F value, TSelf min, TSelf max) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Clamp(this Vector2D value, TSelf min, TSelf max) + where TSelf : INumber => new(TSelf.Clamp(value.X, min, max), TSelf.Clamp(value.Y, min, max)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F CopySign(this Vector2F value, Vector2F sign) - where TSelf : IFloatingPointIeee754 => + public static Vector2D CopySign(this Vector2D value, Vector2D sign) + where TSelf : INumber => new(TSelf.CopySign(value.X, sign.X), TSelf.CopySign(value.Y, sign.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector2F CopySign(this Vector2F value, TSelf sign) - where TSelf : IFloatingPointIeee754 => + public static Vector2D CopySign(this Vector2D value, TSelf sign) + where TSelf : INumber => new(TSelf.CopySign(value.X, sign), TSelf.CopySign(value.Y, sign)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Abs(this Vector2F value) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Abs(this Vector2D value) + where TSelf : INumberBase => new(TSelf.Abs(value.X), TSelf.Abs(value.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F MaxMagnitude(this Vector2F x, Vector2F y) - where TSelf : IFloatingPointIeee754 => + public static Vector2D MaxMagnitude(this Vector2D x, Vector2D y) + where TSelf : INumberBase => new(TSelf.MaxMagnitude(x.X, y.X), TSelf.MaxMagnitude(x.Y, y.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F MaxMagnitudeNumber(this Vector2F x, Vector2F y) - where TSelf : IFloatingPointIeee754 => + public static Vector2D MaxMagnitudeNumber(this Vector2D x, Vector2D y) + where TSelf : INumberBase => new(TSelf.MaxMagnitudeNumber(x.X, y.X), TSelf.MaxMagnitudeNumber(x.Y, y.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F MinMagnitude(this Vector2F x, Vector2F y) - where TSelf : IFloatingPointIeee754 => + public static Vector2D MinMagnitude(this Vector2D x, Vector2D y) + where TSelf : INumberBase => new(TSelf.MinMagnitude(x.X, y.X), TSelf.MinMagnitude(x.Y, y.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F MinMagnitudeNumber(this Vector2F x, Vector2F y) - where TSelf : IFloatingPointIeee754 => + public static Vector2D MinMagnitudeNumber(this Vector2D x, Vector2D y) + where TSelf : INumberBase => new(TSelf.MinMagnitudeNumber(x.X, y.X), TSelf.MinMagnitudeNumber(x.Y, y.Y)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2D PopCount(this Vector2D value) + where TSelf : IBinaryInteger => + new(TSelf.PopCount(value.X), TSelf.PopCount(value.Y)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector2D TrailingZeroCount(this Vector2D value) + where TSelf : IBinaryInteger => + new(TSelf.TrailingZeroCount(value.X), TSelf.TrailingZeroCount(value.Y)); + /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Ceiling(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Ceiling(this Vector2D x) + where TSelf : IFloatingPoint => new(TSelf.Ceiling(x.X), TSelf.Ceiling(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Floor(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Floor(this Vector2D x) + where TSelf : IFloatingPoint => new(TSelf.Floor(x.X), TSelf.Floor(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Round(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Round(this Vector2D x) + where TSelf : IFloatingPoint => new(TSelf.Round(x.X), TSelf.Round(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . /// A single value provided for . - public static Vector2F Round(this Vector2F x, int digits, MidpointRounding mode) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Round(this Vector2D x, int digits, MidpointRounding mode) + where TSelf : IFloatingPoint => new(TSelf.Round(x.X, digits, mode), TSelf.Round(x.Y, digits, mode)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Truncate(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Truncate(this Vector2D x) + where TSelf : IFloatingPoint => new(TSelf.Truncate(x.X), TSelf.Truncate(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F Atan2(this Vector2F y, Vector2F x) + public static Vector2D Atan2(this Vector2D y, Vector2D x) where TSelf : IFloatingPointIeee754 => new(TSelf.Atan2(y.X, x.X), TSelf.Atan2(y.Y, x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F Atan2Pi(this Vector2F y, Vector2F x) + public static Vector2D Atan2Pi(this Vector2D y, Vector2D x) where TSelf : IFloatingPointIeee754 => new(TSelf.Atan2Pi(y.X, x.X), TSelf.Atan2Pi(y.Y, x.Y)); @@ -564,19 +575,19 @@ public static Vector2F Atan2Pi(this Vector2F y, Vector2FA vector whose members will be provided for . /// A vector whose members will be provided for . /// A single value provided for . - public static Vector2F Lerp(this Vector2F value1, Vector2F value2, TSelf amount) + public static Vector2D Lerp(this Vector2D value1, Vector2D value2, TSelf amount) where TSelf : IFloatingPointIeee754 => new(TSelf.Lerp(value1.X, value2.X, amount), TSelf.Lerp(value1.Y, value2.Y, amount)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F BitDecrement(this Vector2F x) + public static Vector2D BitDecrement(this Vector2D x) where TSelf : IFloatingPointIeee754 => new(TSelf.BitDecrement(x.X), TSelf.BitDecrement(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F BitIncrement(this Vector2F x) + public static Vector2D BitIncrement(this Vector2D x) where TSelf : IFloatingPointIeee754 => new(TSelf.BitIncrement(x.X), TSelf.BitIncrement(x.Y)); @@ -584,7 +595,7 @@ public static Vector2F BitIncrement(this Vector2F x) /// A vector whose members will be provided for . /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F FusedMultiplyAdd(this Vector2F left, Vector2F right, Vector2F addend) + public static Vector2D FusedMultiplyAdd(this Vector2D left, Vector2D right, Vector2D addend) where TSelf : IFloatingPointIeee754 => new(TSelf.FusedMultiplyAdd(left.X, right.X, addend.X), TSelf.FusedMultiplyAdd(left.Y, right.Y, addend.Y)); @@ -592,300 +603,300 @@ public static Vector2F FusedMultiplyAdd(this Vector2F left, /// A vector whose members will be provided for . /// A single value provided for . /// A single value provided for . - public static Vector2F FusedMultiplyAdd(this Vector2F left, TSelf right, TSelf addend) + public static Vector2D FusedMultiplyAdd(this Vector2D left, TSelf right, TSelf addend) where TSelf : IFloatingPointIeee754 => new(TSelf.FusedMultiplyAdd(left.X, right, addend), TSelf.FusedMultiplyAdd(left.Y, right, addend)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F Ieee754Remainder(this Vector2F left, Vector2F right) + public static Vector2D Ieee754Remainder(this Vector2D left, Vector2D right) where TSelf : IFloatingPointIeee754 => new(TSelf.Ieee754Remainder(left.X, right.X), TSelf.Ieee754Remainder(left.Y, right.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector2F Ieee754Remainder(this Vector2F left, TSelf right) + public static Vector2D Ieee754Remainder(this Vector2D left, TSelf right) where TSelf : IFloatingPointIeee754 => new(TSelf.Ieee754Remainder(left.X, right), TSelf.Ieee754Remainder(left.Y, right)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2I ILogB(this Vector2F x) + public static Vector2D ILogB(this Vector2D x) where TSelf : IFloatingPointIeee754 => new(TSelf.ILogB(x.X), TSelf.ILogB(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F ReciprocalEstimate(this Vector2F x) + public static Vector2D ReciprocalEstimate(this Vector2D x) where TSelf : IFloatingPointIeee754 => new(TSelf.ReciprocalEstimate(x.X), TSelf.ReciprocalEstimate(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F ReciprocalSqrtEstimate(this Vector2F x) + public static Vector2D ReciprocalSqrtEstimate(this Vector2D x) where TSelf : IFloatingPointIeee754 => new(TSelf.ReciprocalSqrtEstimate(x.X), TSelf.ReciprocalSqrtEstimate(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F ScaleB(this Vector2F x, Vector2I n) + public static Vector2D ScaleB(this Vector2D x, Vector2D n) where TSelf : IFloatingPointIeee754 => new(TSelf.ScaleB(x.X, n.X), TSelf.ScaleB(x.Y, n.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector2F ScaleB(this Vector2F x, int n) + public static Vector2D ScaleB(this Vector2D x, int n) where TSelf : IFloatingPointIeee754 => new(TSelf.ScaleB(x.X, n), TSelf.ScaleB(x.Y, n)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F Pow(this Vector2F x, Vector2F y) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Pow(this Vector2D x, Vector2D y) + where TSelf : IPowerFunctions => new(TSelf.Pow(x.X, y.X), TSelf.Pow(x.Y, y.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector2F Pow(this Vector2F x, TSelf y) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Pow(this Vector2D x, TSelf y) + where TSelf : IPowerFunctions => new(TSelf.Pow(x.X, y), TSelf.Pow(x.Y, y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Cbrt(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Cbrt(this Vector2D x) + where TSelf : IRootFunctions => new(TSelf.Cbrt(x.X), TSelf.Cbrt(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Sqrt(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Sqrt(this Vector2D x) + where TSelf : IRootFunctions => new(TSelf.Sqrt(x.X), TSelf.Sqrt(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector2F RootN(this Vector2F x, int n) - where TSelf : IFloatingPointIeee754 => + public static Vector2D RootN(this Vector2D x, int n) + where TSelf : IRootFunctions => new(TSelf.RootN(x.X, n), TSelf.RootN(x.Y, n)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F RootN(this Vector2F x, Vector2I n) - where TSelf : IFloatingPointIeee754 => + public static Vector2D RootN(this Vector2D x, Vector2D n) + where TSelf : IRootFunctions => new(TSelf.RootN(x.X, n.X), TSelf.RootN(x.Y, n.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector2F Hypot(this Vector2F x, Vector2F y) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Hypot(this Vector2D x, Vector2D y) + where TSelf : IRootFunctions => new(TSelf.Hypot(x.X, y.X), TSelf.Hypot(x.Y, y.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Log(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Log(this Vector2D x) + where TSelf : ILogarithmicFunctions => new(TSelf.Log(x.X), TSelf.Log(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector2F Log(this Vector2F x, TSelf newBase) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Log(this Vector2D x, TSelf newBase) + where TSelf : ILogarithmicFunctions => new(TSelf.Log(x.X, newBase), TSelf.Log(x.Y, newBase)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F LogP1(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D LogP1(this Vector2D x) + where TSelf : ILogarithmicFunctions => new(TSelf.LogP1(x.X), TSelf.LogP1(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Log2(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Log2(this Vector2D x) + where TSelf : ILogarithmicFunctions => new(TSelf.Log2(x.X), TSelf.Log2(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Log2P1(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Log2P1(this Vector2D x) + where TSelf : ILogarithmicFunctions => new(TSelf.Log2P1(x.X), TSelf.Log2P1(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Log10(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Log10(this Vector2D x) + where TSelf : ILogarithmicFunctions => new(TSelf.Log10(x.X), TSelf.Log10(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Log10P1(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Log10P1(this Vector2D x) + where TSelf : ILogarithmicFunctions => new(TSelf.Log10P1(x.X), TSelf.Log10P1(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Exp(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Exp(this Vector2D x) + where TSelf : IExponentialFunctions => new(TSelf.Exp(x.X), TSelf.Exp(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F ExpM1(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D ExpM1(this Vector2D x) + where TSelf : IExponentialFunctions => new(TSelf.ExpM1(x.X), TSelf.ExpM1(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Exp2(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Exp2(this Vector2D x) + where TSelf : IExponentialFunctions => new(TSelf.Exp2(x.X), TSelf.Exp2(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Exp2M1(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Exp2M1(this Vector2D x) + where TSelf : IExponentialFunctions => new(TSelf.Exp2M1(x.X), TSelf.Exp2M1(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Exp10(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Exp10(this Vector2D x) + where TSelf : IExponentialFunctions => new(TSelf.Exp10(x.X), TSelf.Exp10(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Exp10M1(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Exp10M1(this Vector2D x) + where TSelf : IExponentialFunctions => new(TSelf.Exp10M1(x.X), TSelf.Exp10M1(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Acos(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Acos(this Vector2D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Acos(x.X), TSelf.Acos(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F AcosPi(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D AcosPi(this Vector2D x) + where TSelf : ITrigonometricFunctions => new(TSelf.AcosPi(x.X), TSelf.AcosPi(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Asin(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Asin(this Vector2D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Asin(x.X), TSelf.Asin(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F AsinPi(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D AsinPi(this Vector2D x) + where TSelf : ITrigonometricFunctions => new(TSelf.AsinPi(x.X), TSelf.AsinPi(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Atan(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Atan(this Vector2D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Atan(x.X), TSelf.Atan(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F AtanPi(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D AtanPi(this Vector2D x) + where TSelf : ITrigonometricFunctions => new(TSelf.AtanPi(x.X), TSelf.AtanPi(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Cos(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Cos(this Vector2D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Cos(x.X), TSelf.Cos(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F CosPi(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D CosPi(this Vector2D x) + where TSelf : ITrigonometricFunctions => new(TSelf.CosPi(x.X), TSelf.CosPi(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Sin(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Sin(this Vector2D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Sin(x.X), TSelf.Sin(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F SinPi(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D SinPi(this Vector2D x) + where TSelf : ITrigonometricFunctions => new(TSelf.SinPi(x.X), TSelf.SinPi(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Tan(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Tan(this Vector2D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Tan(x.X), TSelf.Tan(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F TanPi(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D TanPi(this Vector2D x) + where TSelf : ITrigonometricFunctions => new(TSelf.TanPi(x.X), TSelf.TanPi(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F DegreesToRadians(this Vector2F degrees) - where TSelf : IFloatingPointIeee754 => + public static Vector2D DegreesToRadians(this Vector2D degrees) + where TSelf : ITrigonometricFunctions => new(TSelf.DegreesToRadians(degrees.X), TSelf.DegreesToRadians(degrees.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F RadiansToDegrees(this Vector2F radians) - where TSelf : IFloatingPointIeee754 => + public static Vector2D RadiansToDegrees(this Vector2D radians) + where TSelf : ITrigonometricFunctions => new(TSelf.RadiansToDegrees(radians.X), TSelf.RadiansToDegrees(radians.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Acosh(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Acosh(this Vector2D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Acosh(x.X), TSelf.Acosh(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Asinh(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Asinh(this Vector2D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Asinh(x.X), TSelf.Asinh(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Atanh(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Atanh(this Vector2D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Atanh(x.X), TSelf.Atanh(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Cosh(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Cosh(this Vector2D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Cosh(x.X), TSelf.Cosh(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Sinh(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Sinh(this Vector2D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Sinh(x.X), TSelf.Sinh(x.Y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector2F Tanh(this Vector2F x) - where TSelf : IFloatingPointIeee754 => + public static Vector2D Tanh(this Vector2D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Tanh(x.X), TSelf.Tanh(x.Y)); } } diff --git a/sources/Maths/Maths/Vector2F.cs b/sources/Maths/Maths/Vector2F.cs deleted file mode 100644 index 70db4099f6..0000000000 --- a/sources/Maths/Maths/Vector2F.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - - -using System; -using System.Collections; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Numerics; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Text; - -namespace Silk.NET.Maths -{ - /// A structure representing a 2D floating-point vector. - internal partial struct Vector2F - { - /// Linearly interpolates between two vectors using a scalar t-value (clamped between 0 and 1). - public static Vector2F LerpClamped(Vector2F a, Vector2F b, T t) => - Vector2F.Lerp(a, b, T.Clamp(t, T.Zero, T.One)); - - /// Linearly interpolates between two vectors using a vector t-value (clamped between 0 and 1). - public static Vector2F LerpClamped(Vector2F a, Vector2F b, Vector2F t) => - new( - a.X + (b.X - a.X) * T.Clamp(t.X, T.Zero, T.One), - a.Y + (b.Y - a.Y) * T.Clamp(t.Y, T.Zero, T.One) - ); - - // Casts - - /// Explicitly casts a to a . - public static explicit operator Vector2F(System.Numerics.Vector2 v) => - new((T)Convert.ChangeType(v.X, typeof(T)), (T)Convert.ChangeType(v.Y, typeof(T))); - - /// Explicitly casts a to . - public static explicit operator System.Numerics.Vector2(Vector2F v) => - new(Convert.ToSingle(v.X), Convert.ToSingle(v.Y)); - - // IFloatingPointIeee754 - - public static (Vector2F Sin, Vector2F Cos) SinCos(Vector2F x) => - (new(T.Sin(x.X), T.Sin(x.Y)), new(T.Cos(x.X), T.Cos(x.Y))); - - public static (Vector2F SinPi, Vector2F CosPi) SinCosPi(Vector2F x) => - (new(T.SinPi(x.X), T.SinPi(x.Y)), new(T.CosPi(x.X), T.CosPi(x.Y))); - - public static Vector2F FusedMultiplyAdd(Vector2F left, Vector2F right, Vector2F addend) => - new(T.FusedMultiplyAdd(left.X, right.X, addend.X), T.FusedMultiplyAdd(left.Y, right.Y, addend.Y)); - - public static Vector2F FusedMultiplyAdd(Vector2F left, Vector2F right, T addend) => - new(T.FusedMultiplyAdd(left.X, right.X, addend), T.FusedMultiplyAdd(left.Y, right.Y, addend)); - - public static Vector2F FusedMultiplyAdd(Vector2F left, T right, Vector2F addend) => - new(T.FusedMultiplyAdd(left.X, right, addend.X), T.FusedMultiplyAdd(left.Y, right, addend.Y)); - - public static Vector2F FusedMultiplyAdd(Vector2F left, T right, T addend) => - new(T.FusedMultiplyAdd(left.X, right, addend), T.FusedMultiplyAdd(left.Y, right, addend)); - } - - static partial class Vector2F - { - /// Computes the cross product of two vectors. - public static T Cross(this Vector2F left, Vector2F right) - where T : IFloatingPointIeee754 => (left.X * right.Y) - (left.Y * right.X); - } -} diff --git a/sources/Maths/Maths/Vector2I.cs b/sources/Maths/Maths/Vector2I.cs deleted file mode 100644 index 88adc7cb6e..0000000000 --- a/sources/Maths/Maths/Vector2I.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - - -using System.Collections; -using System.Diagnostics.CodeAnalysis; -using System.Numerics; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Text; - -namespace Silk.NET.Maths -{ - /// A structure representing a 2D integer vector. - internal partial struct Vector2I - { - /// Computes the cross product of this vector with another vector. - public T Cross(Vector2I other) => (X * other.Y) - (Y * other.X); - - /// Computes the cross product of two vectors. - public static T Cross(Vector2I left, Vector2I right) => (left.X * right.Y) - (left.Y * right.X); - - // Casts - - /// Explicitly casts a to a . - public static explicit operator Vector2I(System.Numerics.Vector2 v) => - new Vector2I((T)Convert.ChangeType(v.X, typeof(T)), (T)Convert.ChangeType(v.Y, typeof(T))); - - /// Explicitly casts a to . - public static explicit operator System.Numerics.Vector2(Vector2I v) => - new System.Numerics.Vector2(Convert.ToSingle(v.X), Convert.ToSingle(v.Y)); - - public static (Vector2I Quotient, Vector2I Remainder) DivRem(Vector2I left, Vector2I right) - { - var (qX, rX) = T.DivRem(left.X, right.X); - var (qY, rY) = T.DivRem(left.Y, right.Y); - return (new Vector2I(qX, qY), new Vector2I(rX, rY)); - } - } -} diff --git a/sources/Maths/Maths/Vector2I.gen.cs b/sources/Maths/Maths/Vector2I.gen.cs deleted file mode 100644 index 5295369eb4..0000000000 --- a/sources/Maths/Maths/Vector2I.gen.cs +++ /dev/null @@ -1,542 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Collections; - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - using System.Runtime.InteropServices; - using System.Text; - - partial struct Vector2I : - IEquatable>, - IReadOnlyList, - IFormattable, - IParsable>, - ISpanFormattable, - ISpanParsable>, - IUtf8SpanFormattable, - IUtf8SpanParsable> - where T : IBinaryInteger - { - /// The X component of the vector. - public T X; - - /// The Y component of the vector. - public T Y; - - /// Initializes all components of the vector to the same value. - public Vector2I(T value) => (X, Y) = (value, value); - - /// Initializes the vector with individual component values. - public Vector2I(T x, T y) => (X, Y) = (x, y); - - /// Initializes the vector from a span of 2 values. - public Vector2I(ReadOnlySpan values) - { - if (values.Length != 2) - throw new ArgumentException("Input span must contain exactly 2 elements.", nameof(values)); - - X = values[0]; - Y = values[1]; - } - - /// Gets a vector whose 2 elements are equal to one. - public static Vector2I One => new(T.One); - - /// Returns a vector whose 2 elements are equal to zero. - public static Vector2I Zero => default; - - /// Gets the vector (1, 0). - public static Vector2I UnitX => new(T.One, T.Zero); - - /// Gets the vector (0, 1). - public static Vector2I UnitY => new(T.Zero, T.One); - - /// Gets a vector with all bits set for each component. - public static Vector2I AllBitsSet => new Vector2I(T.AllBitsSet, T.AllBitsSet); - - /// Gets the squared length of the vector (dot product with itself). - public T LengthSquared => Vector2I.Dot(this, this); - - /// - T IReadOnlyList.this[int index] => this[index]; - - ///Gets the component at the specified index: 0 = X, 1 = Y. - [UnscopedRef] - public ref T this[int index] - { - get - { - switch (index) - { - case 0: - return ref X; - case 1: - return ref Y; - } - - throw new ArgumentOutOfRangeException(nameof(index)); - } - } - - /// The number of elements in the vector. - public int Count => 2; - - /// - IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); - - /// Returns an enumerator that iterates through the vector components. - public IEnumerator GetEnumerator() - { - yield return X; - yield return Y; - } - - /// Copies the components of the vector to the specified array starting at index 0. - public void CopyTo(T[] array) => CopyTo(array, 0); - - /// Copies the components of the vector to the specified array starting at the given index. - public void CopyTo(T[] array, int startIndex) - { - if (array == null) - throw new ArgumentNullException(nameof(array)); - if (startIndex < 0 || startIndex + 2 > array.Length) - throw new ArgumentOutOfRangeException(nameof(startIndex)); - - array[startIndex] = X; - array[startIndex + 1] = Y; - } - - /// Copies the components of the vector to the specified span starting at index 0. - public void CopyTo(Span span) => CopyTo(span, 0); - - /// Copies the components of the vector to the specified span starting at the given index. - public void CopyTo(Span span, int startIndex) - { - if (startIndex < 0 || startIndex + 2 > span.Length) - throw new ArgumentOutOfRangeException(nameof(startIndex)); - - span[startIndex] = X; - span[startIndex + 1] = Y; - } - - /// Returns a span over the vector components. - public Span AsSpan() => MemoryMarshal.CreateSpan(ref X, 2); - - /// Formats the vector as a string. - public override string ToString() => - $"<{X}, {Y}>"; - - /// Formats the vector as a string using the specified format and format provider. - public string ToString(string? format, IFormatProvider? formatProvider) => - $"<{X.ToString(format, formatProvider)}, {Y.ToString(format, formatProvider)}>"; - - /// Parses a string to a instance. - public static Vector2I Parse(string s, IFormatProvider? provider) => Parse(s.AsSpan(), provider); - - /// Parses a span to a instance. - public static Vector2I Parse(ReadOnlySpan s, IFormatProvider? provider) - { - if (!TryParse(s, provider, out var result)) - throw new FormatException("Invalid format for Vector2I."); - - return result; - } - - /// Formats the vector as a UTF-8 string using the specified format and format provider. - public bool TryFormat(Span utf8Destination, out int bytesWritten, ReadOnlySpan format, IFormatProvider? provider) - { - Span xBuffer = stackalloc char[64]; - Span yBuffer = stackalloc char[64]; - - if (!X.TryFormat(xBuffer, out int xChars, format, provider)|| - !Y.TryFormat(yBuffer, out int yChars, format, provider)) - { - bytesWritten = 0; - return false; - } - - int estimatedSize = Encoding.UTF8.GetByteCount(xBuffer[..xChars]) + - Encoding.UTF8.GetByteCount(yBuffer[..yChars]) + - Encoding.UTF8.GetByteCount("<, >"); - - if (utf8Destination.Length < estimatedSize) - { - bytesWritten = 0; - return false; - } - - int totalBytes = 0; - - totalBytes += Encoding.UTF8.GetBytes("<", utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(xBuffer[..xChars], utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(", ", utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(yBuffer[..yChars], utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(">", utf8Destination[totalBytes..]); - - bytesWritten = totalBytes; - return true; - } - - /// Formats the vector as a string using the specified format and format provider. - public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan format, IFormatProvider? provider) - { - Span xBuffer = stackalloc char[64]; - Span yBuffer = stackalloc char[64]; - - if (!X.TryFormat(xBuffer, out int xChars, format, provider) || - !Y.TryFormat(yBuffer, out int yChars, format, provider)) - { - charsWritten = 0; - return false; - } - - int requiredLength = 1 + xChars + 2 + yChars + 1; - - if (destination.Length < requiredLength) - { - charsWritten = 0; - return false; - } - - int pos = 0; - destination[pos++] = '<'; - - xBuffer[..xChars].CopyTo(destination[pos..]); - pos += xChars; - - destination[pos++] = ','; - destination[pos++] = ' '; - - yBuffer[..yChars].CopyTo(destination[pos..]); - pos += yChars; - - destination[pos++] = '>'; - - charsWritten = pos; - return true; - } - - /// Tries to parse a span to a instance. - public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector2I result) - { - result = default; - - s = s.Trim(); - if (s.Length < 4 || s[0] != '<' || s[^1] != '>') - return false; - - s = s[1..^1]; // Remove < and > - - int commaX = s.IndexOf(','); - if (commaX < 0) - return false; - - ReadOnlySpan xSpan = s[..commaX].Trim(); - ReadOnlySpan ySpan = s[(commaX + 1)..].Trim(); - - if (T.TryParse(xSpan, provider, out var x) && - T.TryParse(ySpan, provider, out var y)) - { - result = new Vector2I(x, y); - return true; - } - - return false; - } - - /// Parses a UTF-8 span to a instance. - public static Vector2I Parse(ReadOnlySpan utf8Text, IFormatProvider? provider) - { - int charCount = Encoding.UTF8.GetCharCount(utf8Text); - Span charBuffer = charCount <= 128 ? stackalloc char[charCount] : new char[charCount]; - Encoding.UTF8.GetChars(utf8Text, charBuffer); - return Parse(charBuffer, provider); - } - - /// Tries to parse a UTF-8 span to a instance. - public static bool TryParse(ReadOnlySpan utf8Text, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector2I result) - { - int charCount = Encoding.UTF8.GetCharCount(utf8Text); - Span charBuffer = charCount <= 128 ? stackalloc char[charCount] : new char[charCount]; - Encoding.UTF8.GetChars(utf8Text, charBuffer); - return TryParse(charBuffer, provider, out result); - } - - /// Tries to parse a string to a instance. - public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector2I result) => - TryParse(s.AsSpan(), provider, out result); - - /// Parses a span to a instance. - static Vector2I ISpanParsable>.Parse(ReadOnlySpan s, IFormatProvider? provider) => - Parse(s, provider); - - /// Parses a string to a instance. - static Vector2I IParsable>.Parse(string s, IFormatProvider? provider) => - Parse(s, provider); - - /// Tries to parse a span to a instance. - static bool ISpanParsable>.TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector2I result) => - TryParse(s, provider, out result); - - /// Tries to parse a string to a instance. - static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector2I result) => - TryParse(s, provider, out result); - - /// Returns a boolean indicating whether the given two vectors are equal. - /// The first vector to compare. - /// The second vector to compare. - /// true if the given vectors are equal; false otherwise. - public static bool operator ==(Vector2I left, Vector2I right) => - left.X == right.X && - left.Y == right.Y; - - /// Returns a boolean indicating whether the given two vectors are not equal. - /// The first vector to compare. - /// The second vector to compare. - /// true if the given vectors are not equal; false otherwise. - public static bool operator !=(Vector2I left, Vector2I right) => !(left == right); - - /// - public override bool Equals(object? obj) => obj is Vector2I other && Equals(other); - - /// - public bool Equals(Vector2I other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(X, Y); - - /// Desconstructs a vector into its components. - /// The X component. - /// The Y component. - public void Deconstruct(out T x, out T y) - { - x = X; - y = Y; - } - - /// Implicitly casts a to a . - public static implicit operator Vector2I((T X, T Y) v) => - new(v.X, v.Y); - - /// Implicitly casts a to a . - public static implicit operator (T X, T Y)(Vector2I v) => - (v.X, v.Y); - - public static Vector2I operator +(Vector2I vector) => - vector; - - public static Vector2I operator -(Vector2I vector) => - new(-vector.X, -vector.Y); - - public static Vector2I operator +(Vector2I left, Vector2I right) => - new(left.X + right.X, left.Y + right.Y); - - public static Vector2I operator -(Vector2I left, Vector2I right) => - new(left.X - right.X, left.Y - right.Y); - - public static Vector2I operator *(Vector2I left, Vector2I right) => - new(left.X * right.X, left.Y * right.Y); - - public static Vector2I operator /(Vector2I left, Vector2I right) => - new(left.X / right.X, left.Y / right.Y); - - public static Vector2I operator %(Vector2I left, Vector2I right) => - new(left.X % right.X, left.Y % right.Y); - - public static Vector2I operator +(Vector2I vector, T scalar) => - new(vector.X + scalar, vector.Y + scalar); - - public static Vector2I operator -(Vector2I vector, T scalar) => - new(vector.X - scalar, vector.Y - scalar); - - public static Vector2I operator *(Vector2I vector, T scalar) => - new(vector.X * scalar, vector.Y * scalar); - - public static Vector2I operator *(T scalar, Vector2I vector) => - new(scalar * vector.X, scalar * vector.Y); - - public static Vector2I operator /(Vector2I vector, T scalar) => - new(vector.X / scalar, vector.Y / scalar); - - public static Vector2I operator %(Vector2I vector, T scalar) => - new(vector.X % scalar, vector.Y % scalar); - - public static Vector2I operator ~(Vector2I vector) => - new Vector2I(~vector.X, ~vector.Y); - - public static Vector2I operator &(Vector2I left, Vector2I right) => - new Vector2I(left.X & right.X, left.Y & right.Y); - - public static Vector2I operator |(Vector2I left, Vector2I right) => - new Vector2I(left.X | right.X, left.Y | right.Y); - - public static Vector2I operator ^(Vector2I left, Vector2I right) => - new Vector2I(left.X ^ right.X, left.Y ^ right.Y); - - public static Vector2I operator &(Vector2I vector, T scalar) => - new Vector2I(vector.X & scalar, vector.Y & scalar); - - public static Vector2I operator &(T scalar, Vector2I vector) => - new Vector2I(scalar & vector.X, scalar & vector.Y); - - public static Vector2I operator |(Vector2I vector, T scalar) => - new Vector2I(vector.X | scalar, vector.Y | scalar); - - public static Vector2I operator |(T scalar, Vector2I vector) => - new Vector2I(scalar | vector.X, scalar | vector.Y); - - public static Vector2I operator ^(Vector2I vector, T scalar) => - new Vector2I(vector.X ^ scalar, vector.Y ^ scalar); - - public static Vector2I operator ^(T scalar, Vector2I vector) => - new Vector2I(scalar ^ vector.X, scalar ^ vector.Y); - } - - static partial class Vector2I - { - /// Computes the dot product of two vectors. - public static T Dot(this Vector2I left, Vector2I right) - where T : IBinaryInteger => - left.X * right.X + left.Y * right.Y; - - /// Reflects a vector over a normal vector. - public static Vector2I Reflect(Vector2I vector, Vector2I normal) - where T : IBinaryInteger - { - T dot = vector.Dot(normal); - return vector - (normal * (dot + dot)); - } - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - public static Vector2I Sign(this Vector2I value) - where TSelf : IBinaryInteger => - new(TSelf.Sign(value.X), TSelf.Sign(value.Y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector2I Max(this Vector2I x, Vector2I y) - where TSelf : IBinaryInteger => - new(TSelf.Max(x.X, y.X), TSelf.Max(x.Y, y.Y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - public static Vector2I Max(this Vector2I x, TSelf y) - where TSelf : IBinaryInteger => - new(TSelf.Max(x.X, y), TSelf.Max(x.Y, y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector2I MaxNumber(this Vector2I x, Vector2I y) - where TSelf : IBinaryInteger => - new(TSelf.MaxNumber(x.X, y.X), TSelf.MaxNumber(x.Y, y.Y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - public static Vector2I MaxNumber(this Vector2I x, TSelf y) - where TSelf : IBinaryInteger => - new(TSelf.MaxNumber(x.X, y), TSelf.MaxNumber(x.Y, y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector2I Min(this Vector2I x, Vector2I y) - where TSelf : IBinaryInteger => - new(TSelf.Min(x.X, y.X), TSelf.Min(x.Y, y.Y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - public static Vector2I Min(this Vector2I x, TSelf y) - where TSelf : IBinaryInteger => - new(TSelf.Min(x.X, y), TSelf.Min(x.Y, y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector2I MinNumber(this Vector2I x, Vector2I y) - where TSelf : IBinaryInteger => - new(TSelf.MinNumber(x.X, y.X), TSelf.MinNumber(x.Y, y.Y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - public static Vector2I MinNumber(this Vector2I x, TSelf y) - where TSelf : IBinaryInteger => - new(TSelf.MinNumber(x.X, y), TSelf.MinNumber(x.Y, y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector2I Clamp(this Vector2I value, Vector2I min, Vector2I max) - where TSelf : IBinaryInteger => - new(TSelf.Clamp(value.X, min.X, max.X), TSelf.Clamp(value.Y, min.Y, max.Y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - /// A single value provided for . - public static Vector2I Clamp(this Vector2I value, TSelf min, TSelf max) - where TSelf : IBinaryInteger => - new(TSelf.Clamp(value.X, min, max), TSelf.Clamp(value.Y, min, max)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector2I CopySign(this Vector2I value, Vector2I sign) - where TSelf : IBinaryInteger => - new(TSelf.CopySign(value.X, sign.X), TSelf.CopySign(value.Y, sign.Y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - public static Vector2I CopySign(this Vector2I value, TSelf sign) - where TSelf : IBinaryInteger => - new(TSelf.CopySign(value.X, sign), TSelf.CopySign(value.Y, sign)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - public static Vector2I Abs(this Vector2I value) - where TSelf : IBinaryInteger => - new(TSelf.Abs(value.X), TSelf.Abs(value.Y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector2I MaxMagnitude(this Vector2I x, Vector2I y) - where TSelf : IBinaryInteger => - new(TSelf.MaxMagnitude(x.X, y.X), TSelf.MaxMagnitude(x.Y, y.Y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector2I MaxMagnitudeNumber(this Vector2I x, Vector2I y) - where TSelf : IBinaryInteger => - new(TSelf.MaxMagnitudeNumber(x.X, y.X), TSelf.MaxMagnitudeNumber(x.Y, y.Y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector2I MinMagnitude(this Vector2I x, Vector2I y) - where TSelf : IBinaryInteger => - new(TSelf.MinMagnitude(x.X, y.X), TSelf.MinMagnitude(x.Y, y.Y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector2I MinMagnitudeNumber(this Vector2I x, Vector2I y) - where TSelf : IBinaryInteger => - new(TSelf.MinMagnitudeNumber(x.X, y.X), TSelf.MinMagnitudeNumber(x.Y, y.Y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - public static Vector2I Log2(this Vector2I value) - where TSelf : IBinaryInteger => - new(TSelf.Log2(value.X), TSelf.Log2(value.Y)); - } -} diff --git a/sources/Maths/Maths/Vector3I.cs b/sources/Maths/Maths/Vector3D.cs similarity index 69% rename from sources/Maths/Maths/Vector3I.cs rename to sources/Maths/Maths/Vector3D.cs index 4141292c52..d1a2cdb784 100644 --- a/sources/Maths/Maths/Vector3I.cs +++ b/sources/Maths/Maths/Vector3D.cs @@ -12,19 +12,19 @@ namespace Silk.NET.Maths { /// A structure representing a 3D integer vector. - internal partial struct Vector3I + public partial struct Vector3D { /// Computes the cross product of this vector with another vector. - public Vector3I Cross(Vector3I other) => - new Vector3I( + public Vector3D Cross(Vector3D other) => + new Vector3D( (Y * other.Z) - (Z * other.Y), (Z * other.X) - (X * other.Z), (X * other.Y) - (Y * other.X) ); /// Computes the cross product of two vectors. - public static Vector3I Cross(Vector3I left, Vector3I right) => - new Vector3I( + public static Vector3D Cross(Vector3D left, Vector3D right) => + new Vector3D( (left.Y * right.Z) - (left.Z * right.Y), (left.Z * right.X) - (left.X * right.Z), (left.X * right.Y) - (left.Y * right.X) @@ -32,20 +32,20 @@ public static Vector3I Cross(Vector3I left, Vector3I right) => // Casts - /// Explicitly casts a to a . - public static explicit operator Vector3I(System.Numerics.Vector3 v) => - new Vector3I((T)Convert.ChangeType(v.X, typeof(T)), (T)Convert.ChangeType(v.Y, typeof(T)), (T)Convert.ChangeType(v.Z, typeof(T))); + /// Explicitly casts a to a . + public static explicit operator Vector3D(System.Numerics.Vector3 v) => + new Vector3D((T)Convert.ChangeType(v.X, typeof(T)), (T)Convert.ChangeType(v.Y, typeof(T)), (T)Convert.ChangeType(v.Z, typeof(T))); - /// Explicitly casts a to . - public static explicit operator System.Numerics.Vector3(Vector3I v) => + /// Explicitly casts a to . + public static explicit operator System.Numerics.Vector3(Vector3D v) => new System.Numerics.Vector3(Convert.ToSingle(v.X), Convert.ToSingle(v.Y), Convert.ToSingle(v.Z)); - public static (Vector3I Quotient, Vector3I Remainder) DivRem(Vector3I left, Vector3I right) + public static (Vector3D Quotient, Vector3D Remainder) DivRem(Vector3D left, Vector3D right) { var (qX, rX) = T.DivRem(left.X, right.X); var (qY, rY) = T.DivRem(left.Y, right.Y); var (qZ, rZ) = T.DivRem(left.Z, right.Z); - return (new Vector3I(qX, qY, qZ), new Vector3I(rX, rY, rZ)); + return (new Vector3D(qX, qY, qZ), new Vector3D(rX, rY, rZ)); } } } diff --git a/sources/Maths/Maths/Vector3F.gen.cs b/sources/Maths/Maths/Vector3D.gen.cs similarity index 75% rename from sources/Maths/Maths/Vector3F.gen.cs rename to sources/Maths/Maths/Vector3D.gen.cs index 2c0d24db9c..e894afc9a1 100644 --- a/sources/Maths/Maths/Vector3F.gen.cs +++ b/sources/Maths/Maths/Vector3D.gen.cs @@ -6,16 +6,16 @@ namespace Silk.NET.Maths using System.Runtime.InteropServices; using System.Text; - partial struct Vector3F : - IEquatable>, + public partial struct Vector3D : + IEquatable>, IReadOnlyList, IFormattable, - IParsable>, + IParsable>, ISpanFormattable, - ISpanParsable>, + ISpanParsable>, IUtf8SpanFormattable, - IUtf8SpanParsable> - where T : IFloatingPointIeee754 + IUtf8SpanParsable> + where T : INumberBase { /// The X component of the vector. public T X; @@ -27,16 +27,16 @@ partial struct Vector3F : public T Z; /// Initializes all components of the vector to the same value. - public Vector3F(T value) => (X, Y, Z) = (value, value, value); + public Vector3D(T value) => (X, Y, Z) = (value, value, value); /// Initializes the vector with individual component values. - public Vector3F(T x, T y, T z) => (X, Y, Z) = (x, y, z); + public Vector3D(T x, T y, T z) => (X, Y, Z) = (x, y, z); - /// Initializes the vector using a for the initial elements, and the specified component for the remainder. - public Vector3F(Vector2F other, T z) => (X, Y, Z) = (other.X, other.Y, z); + /// Initializes the vector using a for the initial elements, and the specified component for the remainder. + public Vector3D(Vector2D other, T z) => (X, Y, Z) = (other.X, other.Y, z); /// Initializes the vector from a span of 3 values. - public Vector3F(ReadOnlySpan values) + public Vector3D(ReadOnlySpan values) { if (values.Length != 3) throw new ArgumentException("Input span must contain exactly 3 elements.", nameof(values)); @@ -47,22 +47,22 @@ public Vector3F(ReadOnlySpan values) } /// Gets a vector whose 3 elements are equal to one. - public static Vector3F One => new(T.One); + public static Vector3D One => new(T.One); /// Returns a vector whose 3 elements are equal to zero. - public static Vector3F Zero => default; + public static Vector3D Zero => default; /// Gets the vector (1, 0, 0). - public static Vector3F UnitX => new(T.One, T.Zero, T.Zero); + public static Vector3D UnitX => new(T.One, T.Zero, T.Zero); /// Gets the vector (0, 1, 0). - public static Vector3F UnitY => new(T.Zero, T.One, T.Zero); + public static Vector3D UnitY => new(T.Zero, T.One, T.Zero); /// Gets the vector (0, 0, 1). - public static Vector3F UnitZ => new(T.Zero, T.Zero, T.One); + public static Vector3D UnitZ => new(T.Zero, T.Zero, T.One); /// Gets the squared length of the vector (dot product with itself). - public T LengthSquared => Vector3F.Dot(this, this); + public T LengthSquared => Vector3D.Dot(this, this); /// T IReadOnlyList.this[int index] => this[index]; @@ -142,14 +142,14 @@ public override string ToString() => public string ToString(string? format, IFormatProvider? formatProvider) => $"<{X.ToString(format, formatProvider)}, {Y.ToString(format, formatProvider)}, {Z.ToString(format, formatProvider)}>"; - /// Parses a string to a instance. - public static Vector3F Parse(string s, IFormatProvider? provider) => Parse(s.AsSpan(), provider); + /// Parses a string to a instance. + public static Vector3D Parse(string s, IFormatProvider? provider) => Parse(s.AsSpan(), provider); - /// Parses a span to a instance. - public static Vector3F Parse(ReadOnlySpan s, IFormatProvider? provider) + /// Parses a span to a instance. + public static Vector3D Parse(ReadOnlySpan s, IFormatProvider? provider) { if (!TryParse(s, provider, out var result)) - throw new FormatException("Invalid format for Vector3F."); + throw new FormatException("Invalid format for Vector3D."); return result; } @@ -241,8 +241,8 @@ public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan return true; } - /// Tries to parse a span to a instance. - public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector3F result) + /// Tries to parse a span to a instance. + public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector3D result) { result = default; @@ -270,15 +270,15 @@ public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, [Ma T.TryParse(ySpan, provider, out var y) && T.TryParse(zSpan, provider, out var z)) { - result = new Vector3F(x, y, z); + result = new Vector3D(x, y, z); return true; } return false; } - /// Parses a UTF-8 span to a instance. - public static Vector3F Parse(ReadOnlySpan utf8Text, IFormatProvider? provider) + /// Parses a UTF-8 span to a instance. + public static Vector3D Parse(ReadOnlySpan utf8Text, IFormatProvider? provider) { int charCount = Encoding.UTF8.GetCharCount(utf8Text); Span charBuffer = charCount <= 128 ? stackalloc char[charCount] : new char[charCount]; @@ -286,8 +286,8 @@ public static Vector3F Parse(ReadOnlySpan utf8Text, IFormatProvider? pr return Parse(charBuffer, provider); } - /// Tries to parse a UTF-8 span to a instance. - public static bool TryParse(ReadOnlySpan utf8Text, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector3F result) + /// Tries to parse a UTF-8 span to a instance. + public static bool TryParse(ReadOnlySpan utf8Text, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector3D result) { int charCount = Encoding.UTF8.GetCharCount(utf8Text); Span charBuffer = charCount <= 128 ? stackalloc char[charCount] : new char[charCount]; @@ -295,31 +295,31 @@ public static bool TryParse(ReadOnlySpan utf8Text, IFormatProvider? provid return TryParse(charBuffer, provider, out result); } - /// Tries to parse a string to a instance. - public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector3F result) => + /// Tries to parse a string to a instance. + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector3D result) => TryParse(s.AsSpan(), provider, out result); - /// Parses a span to a instance. - static Vector3F ISpanParsable>.Parse(ReadOnlySpan s, IFormatProvider? provider) => + /// Parses a span to a instance. + static Vector3D ISpanParsable>.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, provider); - /// Parses a string to a instance. - static Vector3F IParsable>.Parse(string s, IFormatProvider? provider) => + /// Parses a string to a instance. + static Vector3D IParsable>.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - /// Tries to parse a span to a instance. - static bool ISpanParsable>.TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector3F result) => + /// Tries to parse a span to a instance. + static bool ISpanParsable>.TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector3D result) => TryParse(s, provider, out result); - /// Tries to parse a string to a instance. - static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector3F result) => + /// Tries to parse a string to a instance. + static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector3D result) => TryParse(s, provider, out result); /// Returns a boolean indicating whether the given two vectors are equal. /// The first vector to compare. /// The second vector to compare. /// true if the given vectors are equal; false otherwise. - public static bool operator ==(Vector3F left, Vector3F right) => + public static bool operator ==(Vector3D left, Vector3D right) => left.X == right.X && left.Y == right.Y && left.Z == right.Z; @@ -328,13 +328,13 @@ static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IForm /// The first vector to compare. /// The second vector to compare. /// true if the given vectors are not equal; false otherwise. - public static bool operator !=(Vector3F left, Vector3F right) => !(left == right); + public static bool operator !=(Vector3D left, Vector3D right) => !(left == right); /// - public override bool Equals(object? obj) => obj is Vector3F other && Equals(other); + public override bool Equals(object? obj) => obj is Vector3D other && Equals(other); /// - public bool Equals(Vector3F other) => this == other; + public bool Equals(Vector3D other) => this == other; /// public override int GetHashCode() => HashCode.Combine(X, Y, Z); @@ -350,252 +350,263 @@ public void Deconstruct(out T x, out T y, out T z) z = Z; } - /// Implicitly casts a to a . - public static implicit operator Vector3F((T X, T Y, T Z) v) => + /// Converts the components of this vector to another type. + public Vector3D As() + where TOther : INumberBase => + new(TOther.CreateSaturating(X), TOther.CreateSaturating(Y), TOther.CreateSaturating(Z)); + + /// Implicitly casts a to a . + public static implicit operator Vector3D((T X, T Y, T Z) v) => new(v.X, v.Y, v.Z); - /// Implicitly casts a to a . - public static implicit operator (T X, T Y, T Z)(Vector3F v) => + /// Implicitly casts a to a . + public static implicit operator (T X, T Y, T Z)(Vector3D v) => (v.X, v.Y, v.Z); - public static Vector3F operator +(Vector3F vector) => + public static Vector3D operator +(Vector3D vector) => vector; - public static Vector3F operator -(Vector3F vector) => + public static Vector3D operator -(Vector3D vector) => new(-vector.X, -vector.Y, -vector.Z); - public static Vector3F operator +(Vector3F left, Vector3F right) => + public static Vector3D operator +(Vector3D left, Vector3D right) => new(left.X + right.X, left.Y + right.Y, left.Z + right.Z); - public static Vector3F operator -(Vector3F left, Vector3F right) => + public static Vector3D operator -(Vector3D left, Vector3D right) => new(left.X - right.X, left.Y - right.Y, left.Z - right.Z); - public static Vector3F operator *(Vector3F left, Vector3F right) => + public static Vector3D operator *(Vector3D left, Vector3D right) => new(left.X * right.X, left.Y * right.Y, left.Z * right.Z); - public static Vector3F operator /(Vector3F left, Vector3F right) => + public static Vector3D operator /(Vector3D left, Vector3D right) => new(left.X / right.X, left.Y / right.Y, left.Z / right.Z); - public static Vector3F operator %(Vector3F left, Vector3F right) => - new(left.X % right.X, left.Y % right.Y, left.Z % right.Z); - - public static Vector3F operator +(Vector3F vector, T scalar) => + public static Vector3D operator +(Vector3D vector, T scalar) => new(vector.X + scalar, vector.Y + scalar, vector.Z + scalar); - public static Vector3F operator -(Vector3F vector, T scalar) => + public static Vector3D operator -(Vector3D vector, T scalar) => new(vector.X - scalar, vector.Y - scalar, vector.Z - scalar); - public static Vector3F operator *(Vector3F vector, T scalar) => + public static Vector3D operator *(Vector3D vector, T scalar) => new(vector.X * scalar, vector.Y * scalar, vector.Z * scalar); - public static Vector3F operator *(T scalar, Vector3F vector) => + public static Vector3D operator *(T scalar, Vector3D vector) => new(scalar * vector.X, scalar * vector.Y, scalar * vector.Z); - public static Vector3F operator /(Vector3F vector, T scalar) => + public static Vector3D operator /(Vector3D vector, T scalar) => new(vector.X / scalar, vector.Y / scalar, vector.Z / scalar); - public static Vector3F operator %(Vector3F vector, T scalar) => - new(vector.X % scalar, vector.Y % scalar, vector.Z % scalar); - } - static partial class Vector3F + public static partial class Vector3D { /// Computes the dot product of two vectors. - public static T Dot(this Vector3F left, Vector3F right) - where T : IFloatingPointIeee754 => + public static T Dot(this Vector3D left, Vector3D right) + where T : INumberBase => left.X * right.X + left.Y * right.Y + left.Z * right.Z; /// Reflects a vector over a normal vector. - public static Vector3F Reflect(Vector3F vector, Vector3F normal) - where T : IFloatingPointIeee754 + public static Vector3D Reflect(Vector3D vector, Vector3D normal) + where T : INumberBase { T dot = vector.Dot(normal); return vector - (normal * (dot + dot)); } /// Computes the length of the vector. - public static T GetLength(this Vector3F vector) + public static T GetLength(this Vector3D vector) where T : IFloatingPointIeee754 => T.Sqrt(vector.LengthSquared); /// Normalizes a vector. - public static Vector3F Normalize(this Vector3F vector) + public static Vector3D Normalize(this Vector3D vector) where T : IFloatingPointIeee754 { T length = vector.GetLength(); - return length != T.Zero ? vector / length : Vector3F.Zero; + return length != T.Zero ? vector / length : Vector3D.Zero; } /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3I Sign(this Vector3F value) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Sign(this Vector3D value) + where TSelf : INumber => new(TSelf.Sign(value.X), TSelf.Sign(value.Y), TSelf.Sign(value.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F Max(this Vector3F x, Vector3F y) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Max(this Vector3D x, Vector3D y) + where TSelf : INumber => new(TSelf.Max(x.X, y.X), TSelf.Max(x.Y, y.Y), TSelf.Max(x.Z, y.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector3F Max(this Vector3F x, TSelf y) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Max(this Vector3D x, TSelf y) + where TSelf : INumber => new(TSelf.Max(x.X, y), TSelf.Max(x.Y, y), TSelf.Max(x.Z, y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F MaxNumber(this Vector3F x, Vector3F y) - where TSelf : IFloatingPointIeee754 => + public static Vector3D MaxNumber(this Vector3D x, Vector3D y) + where TSelf : INumber => new(TSelf.MaxNumber(x.X, y.X), TSelf.MaxNumber(x.Y, y.Y), TSelf.MaxNumber(x.Z, y.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector3F MaxNumber(this Vector3F x, TSelf y) - where TSelf : IFloatingPointIeee754 => + public static Vector3D MaxNumber(this Vector3D x, TSelf y) + where TSelf : INumber => new(TSelf.MaxNumber(x.X, y), TSelf.MaxNumber(x.Y, y), TSelf.MaxNumber(x.Z, y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F Min(this Vector3F x, Vector3F y) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Min(this Vector3D x, Vector3D y) + where TSelf : INumber => new(TSelf.Min(x.X, y.X), TSelf.Min(x.Y, y.Y), TSelf.Min(x.Z, y.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector3F Min(this Vector3F x, TSelf y) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Min(this Vector3D x, TSelf y) + where TSelf : INumber => new(TSelf.Min(x.X, y), TSelf.Min(x.Y, y), TSelf.Min(x.Z, y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F MinNumber(this Vector3F x, Vector3F y) - where TSelf : IFloatingPointIeee754 => + public static Vector3D MinNumber(this Vector3D x, Vector3D y) + where TSelf : INumber => new(TSelf.MinNumber(x.X, y.X), TSelf.MinNumber(x.Y, y.Y), TSelf.MinNumber(x.Z, y.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector3F MinNumber(this Vector3F x, TSelf y) - where TSelf : IFloatingPointIeee754 => + public static Vector3D MinNumber(this Vector3D x, TSelf y) + where TSelf : INumber => new(TSelf.MinNumber(x.X, y), TSelf.MinNumber(x.Y, y), TSelf.MinNumber(x.Z, y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F Clamp(this Vector3F value, Vector3F min, Vector3F max) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Clamp(this Vector3D value, Vector3D min, Vector3D max) + where TSelf : INumber => new(TSelf.Clamp(value.X, min.X, max.X), TSelf.Clamp(value.Y, min.Y, max.Y), TSelf.Clamp(value.Z, min.Z, max.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . /// A single value provided for . - public static Vector3F Clamp(this Vector3F value, TSelf min, TSelf max) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Clamp(this Vector3D value, TSelf min, TSelf max) + where TSelf : INumber => new(TSelf.Clamp(value.X, min, max), TSelf.Clamp(value.Y, min, max), TSelf.Clamp(value.Z, min, max)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F CopySign(this Vector3F value, Vector3F sign) - where TSelf : IFloatingPointIeee754 => + public static Vector3D CopySign(this Vector3D value, Vector3D sign) + where TSelf : INumber => new(TSelf.CopySign(value.X, sign.X), TSelf.CopySign(value.Y, sign.Y), TSelf.CopySign(value.Z, sign.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector3F CopySign(this Vector3F value, TSelf sign) - where TSelf : IFloatingPointIeee754 => + public static Vector3D CopySign(this Vector3D value, TSelf sign) + where TSelf : INumber => new(TSelf.CopySign(value.X, sign), TSelf.CopySign(value.Y, sign), TSelf.CopySign(value.Z, sign)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Abs(this Vector3F value) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Abs(this Vector3D value) + where TSelf : INumberBase => new(TSelf.Abs(value.X), TSelf.Abs(value.Y), TSelf.Abs(value.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F MaxMagnitude(this Vector3F x, Vector3F y) - where TSelf : IFloatingPointIeee754 => + public static Vector3D MaxMagnitude(this Vector3D x, Vector3D y) + where TSelf : INumberBase => new(TSelf.MaxMagnitude(x.X, y.X), TSelf.MaxMagnitude(x.Y, y.Y), TSelf.MaxMagnitude(x.Z, y.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F MaxMagnitudeNumber(this Vector3F x, Vector3F y) - where TSelf : IFloatingPointIeee754 => + public static Vector3D MaxMagnitudeNumber(this Vector3D x, Vector3D y) + where TSelf : INumberBase => new(TSelf.MaxMagnitudeNumber(x.X, y.X), TSelf.MaxMagnitudeNumber(x.Y, y.Y), TSelf.MaxMagnitudeNumber(x.Z, y.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F MinMagnitude(this Vector3F x, Vector3F y) - where TSelf : IFloatingPointIeee754 => + public static Vector3D MinMagnitude(this Vector3D x, Vector3D y) + where TSelf : INumberBase => new(TSelf.MinMagnitude(x.X, y.X), TSelf.MinMagnitude(x.Y, y.Y), TSelf.MinMagnitude(x.Z, y.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F MinMagnitudeNumber(this Vector3F x, Vector3F y) - where TSelf : IFloatingPointIeee754 => + public static Vector3D MinMagnitudeNumber(this Vector3D x, Vector3D y) + where TSelf : INumberBase => new(TSelf.MinMagnitudeNumber(x.X, y.X), TSelf.MinMagnitudeNumber(x.Y, y.Y), TSelf.MinMagnitudeNumber(x.Z, y.Z)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3D PopCount(this Vector3D value) + where TSelf : IBinaryInteger => + new(TSelf.PopCount(value.X), TSelf.PopCount(value.Y), TSelf.PopCount(value.Z)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector3D TrailingZeroCount(this Vector3D value) + where TSelf : IBinaryInteger => + new(TSelf.TrailingZeroCount(value.X), TSelf.TrailingZeroCount(value.Y), TSelf.TrailingZeroCount(value.Z)); + /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Ceiling(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Ceiling(this Vector3D x) + where TSelf : IFloatingPoint => new(TSelf.Ceiling(x.X), TSelf.Ceiling(x.Y), TSelf.Ceiling(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Floor(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Floor(this Vector3D x) + where TSelf : IFloatingPoint => new(TSelf.Floor(x.X), TSelf.Floor(x.Y), TSelf.Floor(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Round(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Round(this Vector3D x) + where TSelf : IFloatingPoint => new(TSelf.Round(x.X), TSelf.Round(x.Y), TSelf.Round(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . /// A single value provided for . - public static Vector3F Round(this Vector3F x, int digits, MidpointRounding mode) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Round(this Vector3D x, int digits, MidpointRounding mode) + where TSelf : IFloatingPoint => new(TSelf.Round(x.X, digits, mode), TSelf.Round(x.Y, digits, mode), TSelf.Round(x.Z, digits, mode)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Truncate(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Truncate(this Vector3D x) + where TSelf : IFloatingPoint => new(TSelf.Truncate(x.X), TSelf.Truncate(x.Y), TSelf.Truncate(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F Atan2(this Vector3F y, Vector3F x) + public static Vector3D Atan2(this Vector3D y, Vector3D x) where TSelf : IFloatingPointIeee754 => new(TSelf.Atan2(y.X, x.X), TSelf.Atan2(y.Y, x.Y), TSelf.Atan2(y.Z, x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F Atan2Pi(this Vector3F y, Vector3F x) + public static Vector3D Atan2Pi(this Vector3D y, Vector3D x) where TSelf : IFloatingPointIeee754 => new(TSelf.Atan2Pi(y.X, x.X), TSelf.Atan2Pi(y.Y, x.Y), TSelf.Atan2Pi(y.Z, x.Z)); @@ -603,19 +614,19 @@ public static Vector3F Atan2Pi(this Vector3F y, Vector3FA vector whose members will be provided for . /// A vector whose members will be provided for . /// A single value provided for . - public static Vector3F Lerp(this Vector3F value1, Vector3F value2, TSelf amount) + public static Vector3D Lerp(this Vector3D value1, Vector3D value2, TSelf amount) where TSelf : IFloatingPointIeee754 => new(TSelf.Lerp(value1.X, value2.X, amount), TSelf.Lerp(value1.Y, value2.Y, amount), TSelf.Lerp(value1.Z, value2.Z, amount)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F BitDecrement(this Vector3F x) + public static Vector3D BitDecrement(this Vector3D x) where TSelf : IFloatingPointIeee754 => new(TSelf.BitDecrement(x.X), TSelf.BitDecrement(x.Y), TSelf.BitDecrement(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F BitIncrement(this Vector3F x) + public static Vector3D BitIncrement(this Vector3D x) where TSelf : IFloatingPointIeee754 => new(TSelf.BitIncrement(x.X), TSelf.BitIncrement(x.Y), TSelf.BitIncrement(x.Z)); @@ -623,7 +634,7 @@ public static Vector3F BitIncrement(this Vector3F x) /// A vector whose members will be provided for . /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F FusedMultiplyAdd(this Vector3F left, Vector3F right, Vector3F addend) + public static Vector3D FusedMultiplyAdd(this Vector3D left, Vector3D right, Vector3D addend) where TSelf : IFloatingPointIeee754 => new(TSelf.FusedMultiplyAdd(left.X, right.X, addend.X), TSelf.FusedMultiplyAdd(left.Y, right.Y, addend.Y), TSelf.FusedMultiplyAdd(left.Z, right.Z, addend.Z)); @@ -631,300 +642,300 @@ public static Vector3F FusedMultiplyAdd(this Vector3F left, /// A vector whose members will be provided for . /// A single value provided for . /// A single value provided for . - public static Vector3F FusedMultiplyAdd(this Vector3F left, TSelf right, TSelf addend) + public static Vector3D FusedMultiplyAdd(this Vector3D left, TSelf right, TSelf addend) where TSelf : IFloatingPointIeee754 => new(TSelf.FusedMultiplyAdd(left.X, right, addend), TSelf.FusedMultiplyAdd(left.Y, right, addend), TSelf.FusedMultiplyAdd(left.Z, right, addend)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F Ieee754Remainder(this Vector3F left, Vector3F right) + public static Vector3D Ieee754Remainder(this Vector3D left, Vector3D right) where TSelf : IFloatingPointIeee754 => new(TSelf.Ieee754Remainder(left.X, right.X), TSelf.Ieee754Remainder(left.Y, right.Y), TSelf.Ieee754Remainder(left.Z, right.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector3F Ieee754Remainder(this Vector3F left, TSelf right) + public static Vector3D Ieee754Remainder(this Vector3D left, TSelf right) where TSelf : IFloatingPointIeee754 => new(TSelf.Ieee754Remainder(left.X, right), TSelf.Ieee754Remainder(left.Y, right), TSelf.Ieee754Remainder(left.Z, right)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3I ILogB(this Vector3F x) + public static Vector3D ILogB(this Vector3D x) where TSelf : IFloatingPointIeee754 => new(TSelf.ILogB(x.X), TSelf.ILogB(x.Y), TSelf.ILogB(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F ReciprocalEstimate(this Vector3F x) + public static Vector3D ReciprocalEstimate(this Vector3D x) where TSelf : IFloatingPointIeee754 => new(TSelf.ReciprocalEstimate(x.X), TSelf.ReciprocalEstimate(x.Y), TSelf.ReciprocalEstimate(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F ReciprocalSqrtEstimate(this Vector3F x) + public static Vector3D ReciprocalSqrtEstimate(this Vector3D x) where TSelf : IFloatingPointIeee754 => new(TSelf.ReciprocalSqrtEstimate(x.X), TSelf.ReciprocalSqrtEstimate(x.Y), TSelf.ReciprocalSqrtEstimate(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F ScaleB(this Vector3F x, Vector3I n) + public static Vector3D ScaleB(this Vector3D x, Vector3D n) where TSelf : IFloatingPointIeee754 => new(TSelf.ScaleB(x.X, n.X), TSelf.ScaleB(x.Y, n.Y), TSelf.ScaleB(x.Z, n.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector3F ScaleB(this Vector3F x, int n) + public static Vector3D ScaleB(this Vector3D x, int n) where TSelf : IFloatingPointIeee754 => new(TSelf.ScaleB(x.X, n), TSelf.ScaleB(x.Y, n), TSelf.ScaleB(x.Z, n)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F Pow(this Vector3F x, Vector3F y) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Pow(this Vector3D x, Vector3D y) + where TSelf : IPowerFunctions => new(TSelf.Pow(x.X, y.X), TSelf.Pow(x.Y, y.Y), TSelf.Pow(x.Z, y.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector3F Pow(this Vector3F x, TSelf y) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Pow(this Vector3D x, TSelf y) + where TSelf : IPowerFunctions => new(TSelf.Pow(x.X, y), TSelf.Pow(x.Y, y), TSelf.Pow(x.Z, y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Cbrt(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Cbrt(this Vector3D x) + where TSelf : IRootFunctions => new(TSelf.Cbrt(x.X), TSelf.Cbrt(x.Y), TSelf.Cbrt(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Sqrt(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Sqrt(this Vector3D x) + where TSelf : IRootFunctions => new(TSelf.Sqrt(x.X), TSelf.Sqrt(x.Y), TSelf.Sqrt(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector3F RootN(this Vector3F x, int n) - where TSelf : IFloatingPointIeee754 => + public static Vector3D RootN(this Vector3D x, int n) + where TSelf : IRootFunctions => new(TSelf.RootN(x.X, n), TSelf.RootN(x.Y, n), TSelf.RootN(x.Z, n)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F RootN(this Vector3F x, Vector3I n) - where TSelf : IFloatingPointIeee754 => + public static Vector3D RootN(this Vector3D x, Vector3D n) + where TSelf : IRootFunctions => new(TSelf.RootN(x.X, n.X), TSelf.RootN(x.Y, n.Y), TSelf.RootN(x.Z, n.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector3F Hypot(this Vector3F x, Vector3F y) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Hypot(this Vector3D x, Vector3D y) + where TSelf : IRootFunctions => new(TSelf.Hypot(x.X, y.X), TSelf.Hypot(x.Y, y.Y), TSelf.Hypot(x.Z, y.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Log(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Log(this Vector3D x) + where TSelf : ILogarithmicFunctions => new(TSelf.Log(x.X), TSelf.Log(x.Y), TSelf.Log(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector3F Log(this Vector3F x, TSelf newBase) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Log(this Vector3D x, TSelf newBase) + where TSelf : ILogarithmicFunctions => new(TSelf.Log(x.X, newBase), TSelf.Log(x.Y, newBase), TSelf.Log(x.Z, newBase)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F LogP1(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D LogP1(this Vector3D x) + where TSelf : ILogarithmicFunctions => new(TSelf.LogP1(x.X), TSelf.LogP1(x.Y), TSelf.LogP1(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Log2(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Log2(this Vector3D x) + where TSelf : ILogarithmicFunctions => new(TSelf.Log2(x.X), TSelf.Log2(x.Y), TSelf.Log2(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Log2P1(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Log2P1(this Vector3D x) + where TSelf : ILogarithmicFunctions => new(TSelf.Log2P1(x.X), TSelf.Log2P1(x.Y), TSelf.Log2P1(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Log10(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Log10(this Vector3D x) + where TSelf : ILogarithmicFunctions => new(TSelf.Log10(x.X), TSelf.Log10(x.Y), TSelf.Log10(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Log10P1(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Log10P1(this Vector3D x) + where TSelf : ILogarithmicFunctions => new(TSelf.Log10P1(x.X), TSelf.Log10P1(x.Y), TSelf.Log10P1(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Exp(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Exp(this Vector3D x) + where TSelf : IExponentialFunctions => new(TSelf.Exp(x.X), TSelf.Exp(x.Y), TSelf.Exp(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F ExpM1(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D ExpM1(this Vector3D x) + where TSelf : IExponentialFunctions => new(TSelf.ExpM1(x.X), TSelf.ExpM1(x.Y), TSelf.ExpM1(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Exp2(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Exp2(this Vector3D x) + where TSelf : IExponentialFunctions => new(TSelf.Exp2(x.X), TSelf.Exp2(x.Y), TSelf.Exp2(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Exp2M1(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Exp2M1(this Vector3D x) + where TSelf : IExponentialFunctions => new(TSelf.Exp2M1(x.X), TSelf.Exp2M1(x.Y), TSelf.Exp2M1(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Exp10(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Exp10(this Vector3D x) + where TSelf : IExponentialFunctions => new(TSelf.Exp10(x.X), TSelf.Exp10(x.Y), TSelf.Exp10(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Exp10M1(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Exp10M1(this Vector3D x) + where TSelf : IExponentialFunctions => new(TSelf.Exp10M1(x.X), TSelf.Exp10M1(x.Y), TSelf.Exp10M1(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Acos(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Acos(this Vector3D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Acos(x.X), TSelf.Acos(x.Y), TSelf.Acos(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F AcosPi(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D AcosPi(this Vector3D x) + where TSelf : ITrigonometricFunctions => new(TSelf.AcosPi(x.X), TSelf.AcosPi(x.Y), TSelf.AcosPi(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Asin(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Asin(this Vector3D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Asin(x.X), TSelf.Asin(x.Y), TSelf.Asin(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F AsinPi(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D AsinPi(this Vector3D x) + where TSelf : ITrigonometricFunctions => new(TSelf.AsinPi(x.X), TSelf.AsinPi(x.Y), TSelf.AsinPi(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Atan(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Atan(this Vector3D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Atan(x.X), TSelf.Atan(x.Y), TSelf.Atan(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F AtanPi(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D AtanPi(this Vector3D x) + where TSelf : ITrigonometricFunctions => new(TSelf.AtanPi(x.X), TSelf.AtanPi(x.Y), TSelf.AtanPi(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Cos(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Cos(this Vector3D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Cos(x.X), TSelf.Cos(x.Y), TSelf.Cos(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F CosPi(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D CosPi(this Vector3D x) + where TSelf : ITrigonometricFunctions => new(TSelf.CosPi(x.X), TSelf.CosPi(x.Y), TSelf.CosPi(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Sin(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Sin(this Vector3D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Sin(x.X), TSelf.Sin(x.Y), TSelf.Sin(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F SinPi(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D SinPi(this Vector3D x) + where TSelf : ITrigonometricFunctions => new(TSelf.SinPi(x.X), TSelf.SinPi(x.Y), TSelf.SinPi(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Tan(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Tan(this Vector3D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Tan(x.X), TSelf.Tan(x.Y), TSelf.Tan(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F TanPi(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D TanPi(this Vector3D x) + where TSelf : ITrigonometricFunctions => new(TSelf.TanPi(x.X), TSelf.TanPi(x.Y), TSelf.TanPi(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F DegreesToRadians(this Vector3F degrees) - where TSelf : IFloatingPointIeee754 => + public static Vector3D DegreesToRadians(this Vector3D degrees) + where TSelf : ITrigonometricFunctions => new(TSelf.DegreesToRadians(degrees.X), TSelf.DegreesToRadians(degrees.Y), TSelf.DegreesToRadians(degrees.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F RadiansToDegrees(this Vector3F radians) - where TSelf : IFloatingPointIeee754 => + public static Vector3D RadiansToDegrees(this Vector3D radians) + where TSelf : ITrigonometricFunctions => new(TSelf.RadiansToDegrees(radians.X), TSelf.RadiansToDegrees(radians.Y), TSelf.RadiansToDegrees(radians.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Acosh(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Acosh(this Vector3D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Acosh(x.X), TSelf.Acosh(x.Y), TSelf.Acosh(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Asinh(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Asinh(this Vector3D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Asinh(x.X), TSelf.Asinh(x.Y), TSelf.Asinh(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Atanh(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Atanh(this Vector3D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Atanh(x.X), TSelf.Atanh(x.Y), TSelf.Atanh(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Cosh(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Cosh(this Vector3D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Cosh(x.X), TSelf.Cosh(x.Y), TSelf.Cosh(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Sinh(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Sinh(this Vector3D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Sinh(x.X), TSelf.Sinh(x.Y), TSelf.Sinh(x.Z)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector3F Tanh(this Vector3F x) - where TSelf : IFloatingPointIeee754 => + public static Vector3D Tanh(this Vector3D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Tanh(x.X), TSelf.Tanh(x.Y), TSelf.Tanh(x.Z)); } } diff --git a/sources/Maths/Maths/Vector3I.gen.cs b/sources/Maths/Maths/Vector3I.gen.cs deleted file mode 100644 index 197cb262d2..0000000000 --- a/sources/Maths/Maths/Vector3I.gen.cs +++ /dev/null @@ -1,581 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Collections; - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - using System.Runtime.InteropServices; - using System.Text; - - partial struct Vector3I : - IEquatable>, - IReadOnlyList, - IFormattable, - IParsable>, - ISpanFormattable, - ISpanParsable>, - IUtf8SpanFormattable, - IUtf8SpanParsable> - where T : IBinaryInteger - { - /// The X component of the vector. - public T X; - - /// The Y component of the vector. - public T Y; - - /// The Z component of the vector. - public T Z; - - /// Initializes all components of the vector to the same value. - public Vector3I(T value) => (X, Y, Z) = (value, value, value); - - /// Initializes the vector with individual component values. - public Vector3I(T x, T y, T z) => (X, Y, Z) = (x, y, z); - - /// Initializes the vector using a for the initial elements, and the specified component for the remainder. - public Vector3I(Vector2I other, T z) => (X, Y, Z) = (other.X, other.Y, z); - - /// Initializes the vector from a span of 3 values. - public Vector3I(ReadOnlySpan values) - { - if (values.Length != 3) - throw new ArgumentException("Input span must contain exactly 3 elements.", nameof(values)); - - X = values[0]; - Y = values[1]; - Z = values[2]; - } - - /// Gets a vector whose 3 elements are equal to one. - public static Vector3I One => new(T.One); - - /// Returns a vector whose 3 elements are equal to zero. - public static Vector3I Zero => default; - - /// Gets the vector (1, 0, 0). - public static Vector3I UnitX => new(T.One, T.Zero, T.Zero); - - /// Gets the vector (0, 1, 0). - public static Vector3I UnitY => new(T.Zero, T.One, T.Zero); - - /// Gets the vector (0, 0, 1). - public static Vector3I UnitZ => new(T.Zero, T.Zero, T.One); - - /// Gets a vector with all bits set for each component. - public static Vector3I AllBitsSet => new Vector3I(T.AllBitsSet, T.AllBitsSet, T.AllBitsSet); - - /// Gets the squared length of the vector (dot product with itself). - public T LengthSquared => Vector3I.Dot(this, this); - - /// - T IReadOnlyList.this[int index] => this[index]; - - ///Gets the component at the specified index: 0 = X, 1 = Y, 2 = Z. - [UnscopedRef] - public ref T this[int index] - { - get - { - switch (index) - { - case 0: - return ref X; - case 1: - return ref Y; - case 2: - return ref Z; - } - - throw new ArgumentOutOfRangeException(nameof(index)); - } - } - - /// The number of elements in the vector. - public int Count => 3; - - /// - IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); - - /// Returns an enumerator that iterates through the vector components. - public IEnumerator GetEnumerator() - { - yield return X; - yield return Y; - yield return Z; - } - - /// Copies the components of the vector to the specified array starting at index 0. - public void CopyTo(T[] array) => CopyTo(array, 0); - - /// Copies the components of the vector to the specified array starting at the given index. - public void CopyTo(T[] array, int startIndex) - { - if (array == null) - throw new ArgumentNullException(nameof(array)); - if (startIndex < 0 || startIndex + 3 > array.Length) - throw new ArgumentOutOfRangeException(nameof(startIndex)); - - array[startIndex] = X; - array[startIndex + 1] = Y; - array[startIndex + 2] = Z; - } - - /// Copies the components of the vector to the specified span starting at index 0. - public void CopyTo(Span span) => CopyTo(span, 0); - - /// Copies the components of the vector to the specified span starting at the given index. - public void CopyTo(Span span, int startIndex) - { - if (startIndex < 0 || startIndex + 3 > span.Length) - throw new ArgumentOutOfRangeException(nameof(startIndex)); - - span[startIndex] = X; - span[startIndex + 1] = Y; - span[startIndex + 2] = Z; - } - - /// Returns a span over the vector components. - public Span AsSpan() => MemoryMarshal.CreateSpan(ref X, 3); - - /// Formats the vector as a string. - public override string ToString() => - $"<{X}, {Y}, {Z}>"; - - /// Formats the vector as a string using the specified format and format provider. - public string ToString(string? format, IFormatProvider? formatProvider) => - $"<{X.ToString(format, formatProvider)}, {Y.ToString(format, formatProvider)}, {Z.ToString(format, formatProvider)}>"; - - /// Parses a string to a instance. - public static Vector3I Parse(string s, IFormatProvider? provider) => Parse(s.AsSpan(), provider); - - /// Parses a span to a instance. - public static Vector3I Parse(ReadOnlySpan s, IFormatProvider? provider) - { - if (!TryParse(s, provider, out var result)) - throw new FormatException("Invalid format for Vector3I."); - - return result; - } - - /// Formats the vector as a UTF-8 string using the specified format and format provider. - public bool TryFormat(Span utf8Destination, out int bytesWritten, ReadOnlySpan format, IFormatProvider? provider) - { - Span xBuffer = stackalloc char[64]; - Span yBuffer = stackalloc char[64]; - Span zBuffer = stackalloc char[64]; - - if (!X.TryFormat(xBuffer, out int xChars, format, provider)|| - !Y.TryFormat(yBuffer, out int yChars, format, provider)|| - !Z.TryFormat(zBuffer, out int zChars, format, provider)) - { - bytesWritten = 0; - return false; - } - - int estimatedSize = Encoding.UTF8.GetByteCount(xBuffer[..xChars]) + - Encoding.UTF8.GetByteCount(yBuffer[..yChars]) + - Encoding.UTF8.GetByteCount(zBuffer[..zChars]) + - Encoding.UTF8.GetByteCount("<, >"); - - if (utf8Destination.Length < estimatedSize) - { - bytesWritten = 0; - return false; - } - - int totalBytes = 0; - - totalBytes += Encoding.UTF8.GetBytes("<", utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(xBuffer[..xChars], utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(", ", utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(yBuffer[..yChars], utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(", ", utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(zBuffer[..zChars], utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(">", utf8Destination[totalBytes..]); - - bytesWritten = totalBytes; - return true; - } - - /// Formats the vector as a string using the specified format and format provider. - public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan format, IFormatProvider? provider) - { - Span xBuffer = stackalloc char[64]; - Span yBuffer = stackalloc char[64]; - Span zBuffer = stackalloc char[64]; - - if (!X.TryFormat(xBuffer, out int xChars, format, provider) || - !Y.TryFormat(yBuffer, out int yChars, format, provider) || - !Z.TryFormat(zBuffer, out int zChars, format, provider)) - { - charsWritten = 0; - return false; - } - - int requiredLength = 1 + xChars + 2 + yChars + 2 + zChars + 1; - - if (destination.Length < requiredLength) - { - charsWritten = 0; - return false; - } - - int pos = 0; - destination[pos++] = '<'; - - xBuffer[..xChars].CopyTo(destination[pos..]); - pos += xChars; - - destination[pos++] = ','; - destination[pos++] = ' '; - - yBuffer[..yChars].CopyTo(destination[pos..]); - pos += yChars; - - destination[pos++] = ','; - destination[pos++] = ' '; - - zBuffer[..zChars].CopyTo(destination[pos..]); - pos += zChars; - - destination[pos++] = '>'; - - charsWritten = pos; - return true; - } - - /// Tries to parse a span to a instance. - public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector3I result) - { - result = default; - - s = s.Trim(); - if (s.Length < 6 || s[0] != '<' || s[^1] != '>') - return false; - - s = s[1..^1]; // Remove < and > - - int commaX = s.IndexOf(','); - if (commaX < 0) - return false; - - ReadOnlySpan remainder1 = s.Slice(commaX + 1); - int commaYRelative = remainder1.IndexOf(','); - if (commaYRelative < 0) - return false; - int commaY = commaX + 1 + commaYRelative; - - ReadOnlySpan xSpan = s[..commaX].Trim(); - ReadOnlySpan ySpan = s[(commaX + 1)..commaY].Trim(); - ReadOnlySpan zSpan = s[(commaY + 1)..].Trim(); - - if (T.TryParse(xSpan, provider, out var x) && - T.TryParse(ySpan, provider, out var y) && - T.TryParse(zSpan, provider, out var z)) - { - result = new Vector3I(x, y, z); - return true; - } - - return false; - } - - /// Parses a UTF-8 span to a instance. - public static Vector3I Parse(ReadOnlySpan utf8Text, IFormatProvider? provider) - { - int charCount = Encoding.UTF8.GetCharCount(utf8Text); - Span charBuffer = charCount <= 128 ? stackalloc char[charCount] : new char[charCount]; - Encoding.UTF8.GetChars(utf8Text, charBuffer); - return Parse(charBuffer, provider); - } - - /// Tries to parse a UTF-8 span to a instance. - public static bool TryParse(ReadOnlySpan utf8Text, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector3I result) - { - int charCount = Encoding.UTF8.GetCharCount(utf8Text); - Span charBuffer = charCount <= 128 ? stackalloc char[charCount] : new char[charCount]; - Encoding.UTF8.GetChars(utf8Text, charBuffer); - return TryParse(charBuffer, provider, out result); - } - - /// Tries to parse a string to a instance. - public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector3I result) => - TryParse(s.AsSpan(), provider, out result); - - /// Parses a span to a instance. - static Vector3I ISpanParsable>.Parse(ReadOnlySpan s, IFormatProvider? provider) => - Parse(s, provider); - - /// Parses a string to a instance. - static Vector3I IParsable>.Parse(string s, IFormatProvider? provider) => - Parse(s, provider); - - /// Tries to parse a span to a instance. - static bool ISpanParsable>.TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector3I result) => - TryParse(s, provider, out result); - - /// Tries to parse a string to a instance. - static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector3I result) => - TryParse(s, provider, out result); - - /// Returns a boolean indicating whether the given two vectors are equal. - /// The first vector to compare. - /// The second vector to compare. - /// true if the given vectors are equal; false otherwise. - public static bool operator ==(Vector3I left, Vector3I right) => - left.X == right.X && - left.Y == right.Y && - left.Z == right.Z; - - /// Returns a boolean indicating whether the given two vectors are not equal. - /// The first vector to compare. - /// The second vector to compare. - /// true if the given vectors are not equal; false otherwise. - public static bool operator !=(Vector3I left, Vector3I right) => !(left == right); - - /// - public override bool Equals(object? obj) => obj is Vector3I other && Equals(other); - - /// - public bool Equals(Vector3I other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(X, Y, Z); - - /// Desconstructs a vector into its components. - /// The X component. - /// The Y component. - /// The Z component. - public void Deconstruct(out T x, out T y, out T z) - { - x = X; - y = Y; - z = Z; - } - - /// Implicitly casts a to a . - public static implicit operator Vector3I((T X, T Y, T Z) v) => - new(v.X, v.Y, v.Z); - - /// Implicitly casts a to a . - public static implicit operator (T X, T Y, T Z)(Vector3I v) => - (v.X, v.Y, v.Z); - - public static Vector3I operator +(Vector3I vector) => - vector; - - public static Vector3I operator -(Vector3I vector) => - new(-vector.X, -vector.Y, -vector.Z); - - public static Vector3I operator +(Vector3I left, Vector3I right) => - new(left.X + right.X, left.Y + right.Y, left.Z + right.Z); - - public static Vector3I operator -(Vector3I left, Vector3I right) => - new(left.X - right.X, left.Y - right.Y, left.Z - right.Z); - - public static Vector3I operator *(Vector3I left, Vector3I right) => - new(left.X * right.X, left.Y * right.Y, left.Z * right.Z); - - public static Vector3I operator /(Vector3I left, Vector3I right) => - new(left.X / right.X, left.Y / right.Y, left.Z / right.Z); - - public static Vector3I operator %(Vector3I left, Vector3I right) => - new(left.X % right.X, left.Y % right.Y, left.Z % right.Z); - - public static Vector3I operator +(Vector3I vector, T scalar) => - new(vector.X + scalar, vector.Y + scalar, vector.Z + scalar); - - public static Vector3I operator -(Vector3I vector, T scalar) => - new(vector.X - scalar, vector.Y - scalar, vector.Z - scalar); - - public static Vector3I operator *(Vector3I vector, T scalar) => - new(vector.X * scalar, vector.Y * scalar, vector.Z * scalar); - - public static Vector3I operator *(T scalar, Vector3I vector) => - new(scalar * vector.X, scalar * vector.Y, scalar * vector.Z); - - public static Vector3I operator /(Vector3I vector, T scalar) => - new(vector.X / scalar, vector.Y / scalar, vector.Z / scalar); - - public static Vector3I operator %(Vector3I vector, T scalar) => - new(vector.X % scalar, vector.Y % scalar, vector.Z % scalar); - - public static Vector3I operator ~(Vector3I vector) => - new Vector3I(~vector.X, ~vector.Y, ~vector.Z); - - public static Vector3I operator &(Vector3I left, Vector3I right) => - new Vector3I(left.X & right.X, left.Y & right.Y, left.Z & right.Z); - - public static Vector3I operator |(Vector3I left, Vector3I right) => - new Vector3I(left.X | right.X, left.Y | right.Y, left.Z | right.Z); - - public static Vector3I operator ^(Vector3I left, Vector3I right) => - new Vector3I(left.X ^ right.X, left.Y ^ right.Y, left.Z ^ right.Z); - - public static Vector3I operator &(Vector3I vector, T scalar) => - new Vector3I(vector.X & scalar, vector.Y & scalar, vector.Z & scalar); - - public static Vector3I operator &(T scalar, Vector3I vector) => - new Vector3I(scalar & vector.X, scalar & vector.Y, scalar & vector.Z); - - public static Vector3I operator |(Vector3I vector, T scalar) => - new Vector3I(vector.X | scalar, vector.Y | scalar, vector.Z | scalar); - - public static Vector3I operator |(T scalar, Vector3I vector) => - new Vector3I(scalar | vector.X, scalar | vector.Y, scalar | vector.Z); - - public static Vector3I operator ^(Vector3I vector, T scalar) => - new Vector3I(vector.X ^ scalar, vector.Y ^ scalar, vector.Z ^ scalar); - - public static Vector3I operator ^(T scalar, Vector3I vector) => - new Vector3I(scalar ^ vector.X, scalar ^ vector.Y, scalar ^ vector.Z); - } - - static partial class Vector3I - { - /// Computes the dot product of two vectors. - public static T Dot(this Vector3I left, Vector3I right) - where T : IBinaryInteger => - left.X * right.X + left.Y * right.Y + left.Z * right.Z; - - /// Reflects a vector over a normal vector. - public static Vector3I Reflect(Vector3I vector, Vector3I normal) - where T : IBinaryInteger - { - T dot = vector.Dot(normal); - return vector - (normal * (dot + dot)); - } - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - public static Vector3I Sign(this Vector3I value) - where TSelf : IBinaryInteger => - new(TSelf.Sign(value.X), TSelf.Sign(value.Y), TSelf.Sign(value.Z)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector3I Max(this Vector3I x, Vector3I y) - where TSelf : IBinaryInteger => - new(TSelf.Max(x.X, y.X), TSelf.Max(x.Y, y.Y), TSelf.Max(x.Z, y.Z)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - public static Vector3I Max(this Vector3I x, TSelf y) - where TSelf : IBinaryInteger => - new(TSelf.Max(x.X, y), TSelf.Max(x.Y, y), TSelf.Max(x.Z, y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector3I MaxNumber(this Vector3I x, Vector3I y) - where TSelf : IBinaryInteger => - new(TSelf.MaxNumber(x.X, y.X), TSelf.MaxNumber(x.Y, y.Y), TSelf.MaxNumber(x.Z, y.Z)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - public static Vector3I MaxNumber(this Vector3I x, TSelf y) - where TSelf : IBinaryInteger => - new(TSelf.MaxNumber(x.X, y), TSelf.MaxNumber(x.Y, y), TSelf.MaxNumber(x.Z, y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector3I Min(this Vector3I x, Vector3I y) - where TSelf : IBinaryInteger => - new(TSelf.Min(x.X, y.X), TSelf.Min(x.Y, y.Y), TSelf.Min(x.Z, y.Z)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - public static Vector3I Min(this Vector3I x, TSelf y) - where TSelf : IBinaryInteger => - new(TSelf.Min(x.X, y), TSelf.Min(x.Y, y), TSelf.Min(x.Z, y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector3I MinNumber(this Vector3I x, Vector3I y) - where TSelf : IBinaryInteger => - new(TSelf.MinNumber(x.X, y.X), TSelf.MinNumber(x.Y, y.Y), TSelf.MinNumber(x.Z, y.Z)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - public static Vector3I MinNumber(this Vector3I x, TSelf y) - where TSelf : IBinaryInteger => - new(TSelf.MinNumber(x.X, y), TSelf.MinNumber(x.Y, y), TSelf.MinNumber(x.Z, y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector3I Clamp(this Vector3I value, Vector3I min, Vector3I max) - where TSelf : IBinaryInteger => - new(TSelf.Clamp(value.X, min.X, max.X), TSelf.Clamp(value.Y, min.Y, max.Y), TSelf.Clamp(value.Z, min.Z, max.Z)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - /// A single value provided for . - public static Vector3I Clamp(this Vector3I value, TSelf min, TSelf max) - where TSelf : IBinaryInteger => - new(TSelf.Clamp(value.X, min, max), TSelf.Clamp(value.Y, min, max), TSelf.Clamp(value.Z, min, max)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector3I CopySign(this Vector3I value, Vector3I sign) - where TSelf : IBinaryInteger => - new(TSelf.CopySign(value.X, sign.X), TSelf.CopySign(value.Y, sign.Y), TSelf.CopySign(value.Z, sign.Z)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - public static Vector3I CopySign(this Vector3I value, TSelf sign) - where TSelf : IBinaryInteger => - new(TSelf.CopySign(value.X, sign), TSelf.CopySign(value.Y, sign), TSelf.CopySign(value.Z, sign)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - public static Vector3I Abs(this Vector3I value) - where TSelf : IBinaryInteger => - new(TSelf.Abs(value.X), TSelf.Abs(value.Y), TSelf.Abs(value.Z)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector3I MaxMagnitude(this Vector3I x, Vector3I y) - where TSelf : IBinaryInteger => - new(TSelf.MaxMagnitude(x.X, y.X), TSelf.MaxMagnitude(x.Y, y.Y), TSelf.MaxMagnitude(x.Z, y.Z)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector3I MaxMagnitudeNumber(this Vector3I x, Vector3I y) - where TSelf : IBinaryInteger => - new(TSelf.MaxMagnitudeNumber(x.X, y.X), TSelf.MaxMagnitudeNumber(x.Y, y.Y), TSelf.MaxMagnitudeNumber(x.Z, y.Z)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector3I MinMagnitude(this Vector3I x, Vector3I y) - where TSelf : IBinaryInteger => - new(TSelf.MinMagnitude(x.X, y.X), TSelf.MinMagnitude(x.Y, y.Y), TSelf.MinMagnitude(x.Z, y.Z)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector3I MinMagnitudeNumber(this Vector3I x, Vector3I y) - where TSelf : IBinaryInteger => - new(TSelf.MinMagnitudeNumber(x.X, y.X), TSelf.MinMagnitudeNumber(x.Y, y.Y), TSelf.MinMagnitudeNumber(x.Z, y.Z)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - public static Vector3I Log2(this Vector3I value) - where TSelf : IBinaryInteger => - new(TSelf.Log2(value.X), TSelf.Log2(value.Y), TSelf.Log2(value.Z)); - } -} diff --git a/sources/Maths/Maths/Vector4I.cs b/sources/Maths/Maths/Vector4D.cs similarity index 69% rename from sources/Maths/Maths/Vector4I.cs rename to sources/Maths/Maths/Vector4D.cs index 3b7442adbc..a50f79549d 100644 --- a/sources/Maths/Maths/Vector4I.cs +++ b/sources/Maths/Maths/Vector4D.cs @@ -11,25 +11,25 @@ namespace Silk.NET.Maths { /// A structure representing a 4D integer vector. - internal partial struct Vector4I + public partial struct Vector4D { // Casts - /// Explicitly casts a System.Numerics.Vector4 to a Vector4I. - public static explicit operator Vector4I(System.Numerics.Vector4 v) => - new Vector4I((T)Convert.ChangeType(v.X, typeof(T)), (T)Convert.ChangeType(v.Y, typeof(T)), (T)Convert.ChangeType(v.Z, typeof(T)), (T)Convert.ChangeType(v.W, typeof(T))); + /// Explicitly casts a System.Numerics.Vector4 to a Vector4D. + public static explicit operator Vector4D(System.Numerics.Vector4 v) => + new Vector4D((T)Convert.ChangeType(v.X, typeof(T)), (T)Convert.ChangeType(v.Y, typeof(T)), (T)Convert.ChangeType(v.Z, typeof(T)), (T)Convert.ChangeType(v.W, typeof(T))); - /// Explicitly casts a Vector4I to System.Numerics.Vector4. - public static explicit operator System.Numerics.Vector4(Vector4I v) => + /// Explicitly casts a Vector4D to System.Numerics.Vector4. + public static explicit operator System.Numerics.Vector4(Vector4D v) => new System.Numerics.Vector4(Convert.ToSingle(v.X), Convert.ToSingle(v.Y), Convert.ToSingle(v.Z), Convert.ToSingle(v.W)); - public static (Vector4I Quotient, Vector4I Remainder) DivRem(Vector4I left, Vector4I right) + public static (Vector4D Quotient, Vector4D Remainder) DivRem(Vector4D left, Vector4D right) { var (qX, rX) = T.DivRem(left.X, right.X); var (qY, rY) = T.DivRem(left.Y, right.Y); var (qZ, rZ) = T.DivRem(left.Z, right.Z); var (qW, rW) = T.DivRem(left.W, right.W); - return (new Vector4I(qX, qY, qZ, qW), new Vector4I(rX, rY, rZ, rW)); + return (new Vector4D(qX, qY, qZ, qW), new Vector4D(rX, rY, rZ, rW)); } } } diff --git a/sources/Maths/Maths/Vector4F.gen.cs b/sources/Maths/Maths/Vector4D.gen.cs similarity index 76% rename from sources/Maths/Maths/Vector4F.gen.cs rename to sources/Maths/Maths/Vector4D.gen.cs index cd0dd8a87d..1cecb3c459 100644 --- a/sources/Maths/Maths/Vector4F.gen.cs +++ b/sources/Maths/Maths/Vector4D.gen.cs @@ -6,16 +6,16 @@ namespace Silk.NET.Maths using System.Runtime.InteropServices; using System.Text; - partial struct Vector4F : - IEquatable>, + public partial struct Vector4D : + IEquatable>, IReadOnlyList, IFormattable, - IParsable>, + IParsable>, ISpanFormattable, - ISpanParsable>, + ISpanParsable>, IUtf8SpanFormattable, - IUtf8SpanParsable> - where T : IFloatingPointIeee754 + IUtf8SpanParsable> + where T : INumberBase { /// The X component of the vector. public T X; @@ -30,19 +30,19 @@ partial struct Vector4F : public T W; /// Initializes all components of the vector to the same value. - public Vector4F(T value) => (X, Y, Z, W) = (value, value, value, value); + public Vector4D(T value) => (X, Y, Z, W) = (value, value, value, value); /// Initializes the vector with individual component values. - public Vector4F(T x, T y, T z, T w) => (X, Y, Z, W) = (x, y, z, w); + public Vector4D(T x, T y, T z, T w) => (X, Y, Z, W) = (x, y, z, w); - /// Initializes the vector using a for the initial elements, and the specified components for the remainder. - public Vector4F(Vector2F other, T z, T w) => (X, Y, Z, W) = (other.X, other.Y, z, w); + /// Initializes the vector using a for the initial elements, and the specified components for the remainder. + public Vector4D(Vector2D other, T z, T w) => (X, Y, Z, W) = (other.X, other.Y, z, w); - /// Initializes the vector using a for the initial elements, and the specified component for the remainder. - public Vector4F(Vector3F other, T w) => (X, Y, Z, W) = (other.X, other.Y, other.Z, w); + /// Initializes the vector using a for the initial elements, and the specified component for the remainder. + public Vector4D(Vector3D other, T w) => (X, Y, Z, W) = (other.X, other.Y, other.Z, w); /// Initializes the vector from a span of 4 values. - public Vector4F(ReadOnlySpan values) + public Vector4D(ReadOnlySpan values) { if (values.Length != 4) throw new ArgumentException("Input span must contain exactly 4 elements.", nameof(values)); @@ -54,25 +54,25 @@ public Vector4F(ReadOnlySpan values) } /// Gets a vector whose 4 elements are equal to one. - public static Vector4F One => new(T.One); + public static Vector4D One => new(T.One); /// Returns a vector whose 4 elements are equal to zero. - public static Vector4F Zero => default; + public static Vector4D Zero => default; /// Gets the vector (1, 0, 0, 0). - public static Vector4F UnitX => new(T.One, T.Zero, T.Zero, T.Zero); + public static Vector4D UnitX => new(T.One, T.Zero, T.Zero, T.Zero); /// Gets the vector (0, 1, 0, 0). - public static Vector4F UnitY => new(T.Zero, T.One, T.Zero, T.Zero); + public static Vector4D UnitY => new(T.Zero, T.One, T.Zero, T.Zero); /// Gets the vector (0, 0, 1, 0). - public static Vector4F UnitZ => new(T.Zero, T.Zero, T.One, T.Zero); + public static Vector4D UnitZ => new(T.Zero, T.Zero, T.One, T.Zero); /// Gets the vector (0, 0, 0, 1). - public static Vector4F UnitW => new(T.Zero, T.Zero, T.Zero, T.One); + public static Vector4D UnitW => new(T.Zero, T.Zero, T.Zero, T.One); /// Gets the squared length of the vector (dot product with itself). - public T LengthSquared => Vector4F.Dot(this, this); + public T LengthSquared => Vector4D.Dot(this, this); /// T IReadOnlyList.this[int index] => this[index]; @@ -157,14 +157,14 @@ public override string ToString() => public string ToString(string? format, IFormatProvider? formatProvider) => $"<{X.ToString(format, formatProvider)}, {Y.ToString(format, formatProvider)}, {Z.ToString(format, formatProvider)}, {W.ToString(format, formatProvider)}>"; - /// Parses a string to a instance. - public static Vector4F Parse(string s, IFormatProvider? provider) => Parse(s.AsSpan(), provider); + /// Parses a string to a instance. + public static Vector4D Parse(string s, IFormatProvider? provider) => Parse(s.AsSpan(), provider); - /// Parses a span to a instance. - public static Vector4F Parse(ReadOnlySpan s, IFormatProvider? provider) + /// Parses a span to a instance. + public static Vector4D Parse(ReadOnlySpan s, IFormatProvider? provider) { if (!TryParse(s, provider, out var result)) - throw new FormatException("Invalid format for Vector4F."); + throw new FormatException("Invalid format for Vector4D."); return result; } @@ -269,8 +269,8 @@ public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan return true; } - /// Tries to parse a span to a instance. - public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector4F result) + /// Tries to parse a span to a instance. + public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector4D result) { result = default; @@ -306,15 +306,15 @@ public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, [Ma T.TryParse(zSpan, provider, out var z) && T.TryParse(wSpan, provider, out var w)) { - result = new Vector4F(x, y, z, w); + result = new Vector4D(x, y, z, w); return true; } return false; } - /// Parses a UTF-8 span to a instance. - public static Vector4F Parse(ReadOnlySpan utf8Text, IFormatProvider? provider) + /// Parses a UTF-8 span to a instance. + public static Vector4D Parse(ReadOnlySpan utf8Text, IFormatProvider? provider) { int charCount = Encoding.UTF8.GetCharCount(utf8Text); Span charBuffer = charCount <= 128 ? stackalloc char[charCount] : new char[charCount]; @@ -322,8 +322,8 @@ public static Vector4F Parse(ReadOnlySpan utf8Text, IFormatProvider? pr return Parse(charBuffer, provider); } - /// Tries to parse a UTF-8 span to a instance. - public static bool TryParse(ReadOnlySpan utf8Text, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector4F result) + /// Tries to parse a UTF-8 span to a instance. + public static bool TryParse(ReadOnlySpan utf8Text, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector4D result) { int charCount = Encoding.UTF8.GetCharCount(utf8Text); Span charBuffer = charCount <= 128 ? stackalloc char[charCount] : new char[charCount]; @@ -331,31 +331,31 @@ public static bool TryParse(ReadOnlySpan utf8Text, IFormatProvider? provid return TryParse(charBuffer, provider, out result); } - /// Tries to parse a string to a instance. - public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector4F result) => + /// Tries to parse a string to a instance. + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector4D result) => TryParse(s.AsSpan(), provider, out result); - /// Parses a span to a instance. - static Vector4F ISpanParsable>.Parse(ReadOnlySpan s, IFormatProvider? provider) => + /// Parses a span to a instance. + static Vector4D ISpanParsable>.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, provider); - /// Parses a string to a instance. - static Vector4F IParsable>.Parse(string s, IFormatProvider? provider) => + /// Parses a string to a instance. + static Vector4D IParsable>.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - /// Tries to parse a span to a instance. - static bool ISpanParsable>.TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector4F result) => + /// Tries to parse a span to a instance. + static bool ISpanParsable>.TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector4D result) => TryParse(s, provider, out result); - /// Tries to parse a string to a instance. - static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector4F result) => + /// Tries to parse a string to a instance. + static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector4D result) => TryParse(s, provider, out result); /// Returns a boolean indicating whether the given two vectors are equal. /// The first vector to compare. /// The second vector to compare. /// true if the given vectors are equal; false otherwise. - public static bool operator ==(Vector4F left, Vector4F right) => + public static bool operator ==(Vector4D left, Vector4D right) => left.X == right.X && left.Y == right.Y && left.Z == right.Z && @@ -365,13 +365,13 @@ static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IForm /// The first vector to compare. /// The second vector to compare. /// true if the given vectors are not equal; false otherwise. - public static bool operator !=(Vector4F left, Vector4F right) => !(left == right); + public static bool operator !=(Vector4D left, Vector4D right) => !(left == right); /// - public override bool Equals(object? obj) => obj is Vector4F other && Equals(other); + public override bool Equals(object? obj) => obj is Vector4D other && Equals(other); /// - public bool Equals(Vector4F other) => this == other; + public bool Equals(Vector4D other) => this == other; /// public override int GetHashCode() => HashCode.Combine(X, Y, Z, W); @@ -389,252 +389,263 @@ public void Deconstruct(out T x, out T y, out T z, out T w) w = W; } - /// Implicitly casts a to a . - public static implicit operator Vector4F((T X, T Y, T Z, T W) v) => + /// Converts the components of this vector to another type. + public Vector4D As() + where TOther : INumberBase => + new(TOther.CreateSaturating(X), TOther.CreateSaturating(Y), TOther.CreateSaturating(Z), TOther.CreateSaturating(W)); + + /// Implicitly casts a to a . + public static implicit operator Vector4D((T X, T Y, T Z, T W) v) => new(v.X, v.Y, v.Z, v.W); - /// Implicitly casts a to a . - public static implicit operator (T X, T Y, T Z, T W)(Vector4F v) => + /// Implicitly casts a to a . + public static implicit operator (T X, T Y, T Z, T W)(Vector4D v) => (v.X, v.Y, v.Z, v.W); - public static Vector4F operator +(Vector4F vector) => + public static Vector4D operator +(Vector4D vector) => vector; - public static Vector4F operator -(Vector4F vector) => + public static Vector4D operator -(Vector4D vector) => new(-vector.X, -vector.Y, -vector.Z, -vector.W); - public static Vector4F operator +(Vector4F left, Vector4F right) => + public static Vector4D operator +(Vector4D left, Vector4D right) => new(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W); - public static Vector4F operator -(Vector4F left, Vector4F right) => + public static Vector4D operator -(Vector4D left, Vector4D right) => new(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W); - public static Vector4F operator *(Vector4F left, Vector4F right) => + public static Vector4D operator *(Vector4D left, Vector4D right) => new(left.X * right.X, left.Y * right.Y, left.Z * right.Z, left.W * right.W); - public static Vector4F operator /(Vector4F left, Vector4F right) => + public static Vector4D operator /(Vector4D left, Vector4D right) => new(left.X / right.X, left.Y / right.Y, left.Z / right.Z, left.W / right.W); - public static Vector4F operator %(Vector4F left, Vector4F right) => - new(left.X % right.X, left.Y % right.Y, left.Z % right.Z, left.W % right.W); - - public static Vector4F operator +(Vector4F vector, T scalar) => + public static Vector4D operator +(Vector4D vector, T scalar) => new(vector.X + scalar, vector.Y + scalar, vector.Z + scalar, vector.W + scalar); - public static Vector4F operator -(Vector4F vector, T scalar) => + public static Vector4D operator -(Vector4D vector, T scalar) => new(vector.X - scalar, vector.Y - scalar, vector.Z - scalar, vector.W - scalar); - public static Vector4F operator *(Vector4F vector, T scalar) => + public static Vector4D operator *(Vector4D vector, T scalar) => new(vector.X * scalar, vector.Y * scalar, vector.Z * scalar, vector.W * scalar); - public static Vector4F operator *(T scalar, Vector4F vector) => + public static Vector4D operator *(T scalar, Vector4D vector) => new(scalar * vector.X, scalar * vector.Y, scalar * vector.Z, scalar * vector.W); - public static Vector4F operator /(Vector4F vector, T scalar) => + public static Vector4D operator /(Vector4D vector, T scalar) => new(vector.X / scalar, vector.Y / scalar, vector.Z / scalar, vector.W / scalar); - public static Vector4F operator %(Vector4F vector, T scalar) => - new(vector.X % scalar, vector.Y % scalar, vector.Z % scalar, vector.W % scalar); - } - static partial class Vector4F + public static partial class Vector4D { /// Computes the dot product of two vectors. - public static T Dot(this Vector4F left, Vector4F right) - where T : IFloatingPointIeee754 => + public static T Dot(this Vector4D left, Vector4D right) + where T : INumberBase => left.X * right.X + left.Y * right.Y + left.Z * right.Z + left.W * right.W; /// Reflects a vector over a normal vector. - public static Vector4F Reflect(Vector4F vector, Vector4F normal) - where T : IFloatingPointIeee754 + public static Vector4D Reflect(Vector4D vector, Vector4D normal) + where T : INumberBase { T dot = vector.Dot(normal); return vector - (normal * (dot + dot)); } /// Computes the length of the vector. - public static T GetLength(this Vector4F vector) + public static T GetLength(this Vector4D vector) where T : IFloatingPointIeee754 => T.Sqrt(vector.LengthSquared); /// Normalizes a vector. - public static Vector4F Normalize(this Vector4F vector) + public static Vector4D Normalize(this Vector4D vector) where T : IFloatingPointIeee754 { T length = vector.GetLength(); - return length != T.Zero ? vector / length : Vector4F.Zero; + return length != T.Zero ? vector / length : Vector4D.Zero; } /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4I Sign(this Vector4F value) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Sign(this Vector4D value) + where TSelf : INumber => new(TSelf.Sign(value.X), TSelf.Sign(value.Y), TSelf.Sign(value.Z), TSelf.Sign(value.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F Max(this Vector4F x, Vector4F y) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Max(this Vector4D x, Vector4D y) + where TSelf : INumber => new(TSelf.Max(x.X, y.X), TSelf.Max(x.Y, y.Y), TSelf.Max(x.Z, y.Z), TSelf.Max(x.W, y.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector4F Max(this Vector4F x, TSelf y) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Max(this Vector4D x, TSelf y) + where TSelf : INumber => new(TSelf.Max(x.X, y), TSelf.Max(x.Y, y), TSelf.Max(x.Z, y), TSelf.Max(x.W, y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F MaxNumber(this Vector4F x, Vector4F y) - where TSelf : IFloatingPointIeee754 => + public static Vector4D MaxNumber(this Vector4D x, Vector4D y) + where TSelf : INumber => new(TSelf.MaxNumber(x.X, y.X), TSelf.MaxNumber(x.Y, y.Y), TSelf.MaxNumber(x.Z, y.Z), TSelf.MaxNumber(x.W, y.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector4F MaxNumber(this Vector4F x, TSelf y) - where TSelf : IFloatingPointIeee754 => + public static Vector4D MaxNumber(this Vector4D x, TSelf y) + where TSelf : INumber => new(TSelf.MaxNumber(x.X, y), TSelf.MaxNumber(x.Y, y), TSelf.MaxNumber(x.Z, y), TSelf.MaxNumber(x.W, y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F Min(this Vector4F x, Vector4F y) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Min(this Vector4D x, Vector4D y) + where TSelf : INumber => new(TSelf.Min(x.X, y.X), TSelf.Min(x.Y, y.Y), TSelf.Min(x.Z, y.Z), TSelf.Min(x.W, y.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector4F Min(this Vector4F x, TSelf y) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Min(this Vector4D x, TSelf y) + where TSelf : INumber => new(TSelf.Min(x.X, y), TSelf.Min(x.Y, y), TSelf.Min(x.Z, y), TSelf.Min(x.W, y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F MinNumber(this Vector4F x, Vector4F y) - where TSelf : IFloatingPointIeee754 => + public static Vector4D MinNumber(this Vector4D x, Vector4D y) + where TSelf : INumber => new(TSelf.MinNumber(x.X, y.X), TSelf.MinNumber(x.Y, y.Y), TSelf.MinNumber(x.Z, y.Z), TSelf.MinNumber(x.W, y.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector4F MinNumber(this Vector4F x, TSelf y) - where TSelf : IFloatingPointIeee754 => + public static Vector4D MinNumber(this Vector4D x, TSelf y) + where TSelf : INumber => new(TSelf.MinNumber(x.X, y), TSelf.MinNumber(x.Y, y), TSelf.MinNumber(x.Z, y), TSelf.MinNumber(x.W, y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F Clamp(this Vector4F value, Vector4F min, Vector4F max) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Clamp(this Vector4D value, Vector4D min, Vector4D max) + where TSelf : INumber => new(TSelf.Clamp(value.X, min.X, max.X), TSelf.Clamp(value.Y, min.Y, max.Y), TSelf.Clamp(value.Z, min.Z, max.Z), TSelf.Clamp(value.W, min.W, max.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . /// A single value provided for . - public static Vector4F Clamp(this Vector4F value, TSelf min, TSelf max) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Clamp(this Vector4D value, TSelf min, TSelf max) + where TSelf : INumber => new(TSelf.Clamp(value.X, min, max), TSelf.Clamp(value.Y, min, max), TSelf.Clamp(value.Z, min, max), TSelf.Clamp(value.W, min, max)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F CopySign(this Vector4F value, Vector4F sign) - where TSelf : IFloatingPointIeee754 => + public static Vector4D CopySign(this Vector4D value, Vector4D sign) + where TSelf : INumber => new(TSelf.CopySign(value.X, sign.X), TSelf.CopySign(value.Y, sign.Y), TSelf.CopySign(value.Z, sign.Z), TSelf.CopySign(value.W, sign.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector4F CopySign(this Vector4F value, TSelf sign) - where TSelf : IFloatingPointIeee754 => + public static Vector4D CopySign(this Vector4D value, TSelf sign) + where TSelf : INumber => new(TSelf.CopySign(value.X, sign), TSelf.CopySign(value.Y, sign), TSelf.CopySign(value.Z, sign), TSelf.CopySign(value.W, sign)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Abs(this Vector4F value) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Abs(this Vector4D value) + where TSelf : INumberBase => new(TSelf.Abs(value.X), TSelf.Abs(value.Y), TSelf.Abs(value.Z), TSelf.Abs(value.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F MaxMagnitude(this Vector4F x, Vector4F y) - where TSelf : IFloatingPointIeee754 => + public static Vector4D MaxMagnitude(this Vector4D x, Vector4D y) + where TSelf : INumberBase => new(TSelf.MaxMagnitude(x.X, y.X), TSelf.MaxMagnitude(x.Y, y.Y), TSelf.MaxMagnitude(x.Z, y.Z), TSelf.MaxMagnitude(x.W, y.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F MaxMagnitudeNumber(this Vector4F x, Vector4F y) - where TSelf : IFloatingPointIeee754 => + public static Vector4D MaxMagnitudeNumber(this Vector4D x, Vector4D y) + where TSelf : INumberBase => new(TSelf.MaxMagnitudeNumber(x.X, y.X), TSelf.MaxMagnitudeNumber(x.Y, y.Y), TSelf.MaxMagnitudeNumber(x.Z, y.Z), TSelf.MaxMagnitudeNumber(x.W, y.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F MinMagnitude(this Vector4F x, Vector4F y) - where TSelf : IFloatingPointIeee754 => + public static Vector4D MinMagnitude(this Vector4D x, Vector4D y) + where TSelf : INumberBase => new(TSelf.MinMagnitude(x.X, y.X), TSelf.MinMagnitude(x.Y, y.Y), TSelf.MinMagnitude(x.Z, y.Z), TSelf.MinMagnitude(x.W, y.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F MinMagnitudeNumber(this Vector4F x, Vector4F y) - where TSelf : IFloatingPointIeee754 => + public static Vector4D MinMagnitudeNumber(this Vector4D x, Vector4D y) + where TSelf : INumberBase => new(TSelf.MinMagnitudeNumber(x.X, y.X), TSelf.MinMagnitudeNumber(x.Y, y.Y), TSelf.MinMagnitudeNumber(x.Z, y.Z), TSelf.MinMagnitudeNumber(x.W, y.W)); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4D PopCount(this Vector4D value) + where TSelf : IBinaryInteger => + new(TSelf.PopCount(value.X), TSelf.PopCount(value.Y), TSelf.PopCount(value.Z), TSelf.PopCount(value.W)); + + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + public static Vector4D TrailingZeroCount(this Vector4D value) + where TSelf : IBinaryInteger => + new(TSelf.TrailingZeroCount(value.X), TSelf.TrailingZeroCount(value.Y), TSelf.TrailingZeroCount(value.Z), TSelf.TrailingZeroCount(value.W)); + /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Ceiling(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Ceiling(this Vector4D x) + where TSelf : IFloatingPoint => new(TSelf.Ceiling(x.X), TSelf.Ceiling(x.Y), TSelf.Ceiling(x.Z), TSelf.Ceiling(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Floor(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Floor(this Vector4D x) + where TSelf : IFloatingPoint => new(TSelf.Floor(x.X), TSelf.Floor(x.Y), TSelf.Floor(x.Z), TSelf.Floor(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Round(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Round(this Vector4D x) + where TSelf : IFloatingPoint => new(TSelf.Round(x.X), TSelf.Round(x.Y), TSelf.Round(x.Z), TSelf.Round(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . /// A single value provided for . - public static Vector4F Round(this Vector4F x, int digits, MidpointRounding mode) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Round(this Vector4D x, int digits, MidpointRounding mode) + where TSelf : IFloatingPoint => new(TSelf.Round(x.X, digits, mode), TSelf.Round(x.Y, digits, mode), TSelf.Round(x.Z, digits, mode), TSelf.Round(x.W, digits, mode)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Truncate(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Truncate(this Vector4D x) + where TSelf : IFloatingPoint => new(TSelf.Truncate(x.X), TSelf.Truncate(x.Y), TSelf.Truncate(x.Z), TSelf.Truncate(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F Atan2(this Vector4F y, Vector4F x) + public static Vector4D Atan2(this Vector4D y, Vector4D x) where TSelf : IFloatingPointIeee754 => new(TSelf.Atan2(y.X, x.X), TSelf.Atan2(y.Y, x.Y), TSelf.Atan2(y.Z, x.Z), TSelf.Atan2(y.W, x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F Atan2Pi(this Vector4F y, Vector4F x) + public static Vector4D Atan2Pi(this Vector4D y, Vector4D x) where TSelf : IFloatingPointIeee754 => new(TSelf.Atan2Pi(y.X, x.X), TSelf.Atan2Pi(y.Y, x.Y), TSelf.Atan2Pi(y.Z, x.Z), TSelf.Atan2Pi(y.W, x.W)); @@ -642,19 +653,19 @@ public static Vector4F Atan2Pi(this Vector4F y, Vector4FA vector whose members will be provided for . /// A vector whose members will be provided for . /// A single value provided for . - public static Vector4F Lerp(this Vector4F value1, Vector4F value2, TSelf amount) + public static Vector4D Lerp(this Vector4D value1, Vector4D value2, TSelf amount) where TSelf : IFloatingPointIeee754 => new(TSelf.Lerp(value1.X, value2.X, amount), TSelf.Lerp(value1.Y, value2.Y, amount), TSelf.Lerp(value1.Z, value2.Z, amount), TSelf.Lerp(value1.W, value2.W, amount)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F BitDecrement(this Vector4F x) + public static Vector4D BitDecrement(this Vector4D x) where TSelf : IFloatingPointIeee754 => new(TSelf.BitDecrement(x.X), TSelf.BitDecrement(x.Y), TSelf.BitDecrement(x.Z), TSelf.BitDecrement(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F BitIncrement(this Vector4F x) + public static Vector4D BitIncrement(this Vector4D x) where TSelf : IFloatingPointIeee754 => new(TSelf.BitIncrement(x.X), TSelf.BitIncrement(x.Y), TSelf.BitIncrement(x.Z), TSelf.BitIncrement(x.W)); @@ -662,7 +673,7 @@ public static Vector4F BitIncrement(this Vector4F x) /// A vector whose members will be provided for . /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F FusedMultiplyAdd(this Vector4F left, Vector4F right, Vector4F addend) + public static Vector4D FusedMultiplyAdd(this Vector4D left, Vector4D right, Vector4D addend) where TSelf : IFloatingPointIeee754 => new(TSelf.FusedMultiplyAdd(left.X, right.X, addend.X), TSelf.FusedMultiplyAdd(left.Y, right.Y, addend.Y), TSelf.FusedMultiplyAdd(left.Z, right.Z, addend.Z), TSelf.FusedMultiplyAdd(left.W, right.W, addend.W)); @@ -670,300 +681,300 @@ public static Vector4F FusedMultiplyAdd(this Vector4F left, /// A vector whose members will be provided for . /// A single value provided for . /// A single value provided for . - public static Vector4F FusedMultiplyAdd(this Vector4F left, TSelf right, TSelf addend) + public static Vector4D FusedMultiplyAdd(this Vector4D left, TSelf right, TSelf addend) where TSelf : IFloatingPointIeee754 => new(TSelf.FusedMultiplyAdd(left.X, right, addend), TSelf.FusedMultiplyAdd(left.Y, right, addend), TSelf.FusedMultiplyAdd(left.Z, right, addend), TSelf.FusedMultiplyAdd(left.W, right, addend)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F Ieee754Remainder(this Vector4F left, Vector4F right) + public static Vector4D Ieee754Remainder(this Vector4D left, Vector4D right) where TSelf : IFloatingPointIeee754 => new(TSelf.Ieee754Remainder(left.X, right.X), TSelf.Ieee754Remainder(left.Y, right.Y), TSelf.Ieee754Remainder(left.Z, right.Z), TSelf.Ieee754Remainder(left.W, right.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector4F Ieee754Remainder(this Vector4F left, TSelf right) + public static Vector4D Ieee754Remainder(this Vector4D left, TSelf right) where TSelf : IFloatingPointIeee754 => new(TSelf.Ieee754Remainder(left.X, right), TSelf.Ieee754Remainder(left.Y, right), TSelf.Ieee754Remainder(left.Z, right), TSelf.Ieee754Remainder(left.W, right)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4I ILogB(this Vector4F x) + public static Vector4D ILogB(this Vector4D x) where TSelf : IFloatingPointIeee754 => new(TSelf.ILogB(x.X), TSelf.ILogB(x.Y), TSelf.ILogB(x.Z), TSelf.ILogB(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F ReciprocalEstimate(this Vector4F x) + public static Vector4D ReciprocalEstimate(this Vector4D x) where TSelf : IFloatingPointIeee754 => new(TSelf.ReciprocalEstimate(x.X), TSelf.ReciprocalEstimate(x.Y), TSelf.ReciprocalEstimate(x.Z), TSelf.ReciprocalEstimate(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F ReciprocalSqrtEstimate(this Vector4F x) + public static Vector4D ReciprocalSqrtEstimate(this Vector4D x) where TSelf : IFloatingPointIeee754 => new(TSelf.ReciprocalSqrtEstimate(x.X), TSelf.ReciprocalSqrtEstimate(x.Y), TSelf.ReciprocalSqrtEstimate(x.Z), TSelf.ReciprocalSqrtEstimate(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F ScaleB(this Vector4F x, Vector4I n) + public static Vector4D ScaleB(this Vector4D x, Vector4D n) where TSelf : IFloatingPointIeee754 => new(TSelf.ScaleB(x.X, n.X), TSelf.ScaleB(x.Y, n.Y), TSelf.ScaleB(x.Z, n.Z), TSelf.ScaleB(x.W, n.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector4F ScaleB(this Vector4F x, int n) + public static Vector4D ScaleB(this Vector4D x, int n) where TSelf : IFloatingPointIeee754 => new(TSelf.ScaleB(x.X, n), TSelf.ScaleB(x.Y, n), TSelf.ScaleB(x.Z, n), TSelf.ScaleB(x.W, n)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F Pow(this Vector4F x, Vector4F y) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Pow(this Vector4D x, Vector4D y) + where TSelf : IPowerFunctions => new(TSelf.Pow(x.X, y.X), TSelf.Pow(x.Y, y.Y), TSelf.Pow(x.Z, y.Z), TSelf.Pow(x.W, y.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector4F Pow(this Vector4F x, TSelf y) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Pow(this Vector4D x, TSelf y) + where TSelf : IPowerFunctions => new(TSelf.Pow(x.X, y), TSelf.Pow(x.Y, y), TSelf.Pow(x.Z, y), TSelf.Pow(x.W, y)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Cbrt(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Cbrt(this Vector4D x) + where TSelf : IRootFunctions => new(TSelf.Cbrt(x.X), TSelf.Cbrt(x.Y), TSelf.Cbrt(x.Z), TSelf.Cbrt(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Sqrt(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Sqrt(this Vector4D x) + where TSelf : IRootFunctions => new(TSelf.Sqrt(x.X), TSelf.Sqrt(x.Y), TSelf.Sqrt(x.Z), TSelf.Sqrt(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector4F RootN(this Vector4F x, int n) - where TSelf : IFloatingPointIeee754 => + public static Vector4D RootN(this Vector4D x, int n) + where TSelf : IRootFunctions => new(TSelf.RootN(x.X, n), TSelf.RootN(x.Y, n), TSelf.RootN(x.Z, n), TSelf.RootN(x.W, n)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F RootN(this Vector4F x, Vector4I n) - where TSelf : IFloatingPointIeee754 => + public static Vector4D RootN(this Vector4D x, Vector4D n) + where TSelf : IRootFunctions => new(TSelf.RootN(x.X, n.X), TSelf.RootN(x.Y, n.Y), TSelf.RootN(x.Z, n.Z), TSelf.RootN(x.W, n.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A vector whose members will be provided for . - public static Vector4F Hypot(this Vector4F x, Vector4F y) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Hypot(this Vector4D x, Vector4D y) + where TSelf : IRootFunctions => new(TSelf.Hypot(x.X, y.X), TSelf.Hypot(x.Y, y.Y), TSelf.Hypot(x.Z, y.Z), TSelf.Hypot(x.W, y.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Log(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Log(this Vector4D x) + where TSelf : ILogarithmicFunctions => new(TSelf.Log(x.X), TSelf.Log(x.Y), TSelf.Log(x.Z), TSelf.Log(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . /// A single value provided for . - public static Vector4F Log(this Vector4F x, TSelf newBase) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Log(this Vector4D x, TSelf newBase) + where TSelf : ILogarithmicFunctions => new(TSelf.Log(x.X, newBase), TSelf.Log(x.Y, newBase), TSelf.Log(x.Z, newBase), TSelf.Log(x.W, newBase)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F LogP1(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D LogP1(this Vector4D x) + where TSelf : ILogarithmicFunctions => new(TSelf.LogP1(x.X), TSelf.LogP1(x.Y), TSelf.LogP1(x.Z), TSelf.LogP1(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Log2(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Log2(this Vector4D x) + where TSelf : ILogarithmicFunctions => new(TSelf.Log2(x.X), TSelf.Log2(x.Y), TSelf.Log2(x.Z), TSelf.Log2(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Log2P1(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Log2P1(this Vector4D x) + where TSelf : ILogarithmicFunctions => new(TSelf.Log2P1(x.X), TSelf.Log2P1(x.Y), TSelf.Log2P1(x.Z), TSelf.Log2P1(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Log10(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Log10(this Vector4D x) + where TSelf : ILogarithmicFunctions => new(TSelf.Log10(x.X), TSelf.Log10(x.Y), TSelf.Log10(x.Z), TSelf.Log10(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Log10P1(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Log10P1(this Vector4D x) + where TSelf : ILogarithmicFunctions => new(TSelf.Log10P1(x.X), TSelf.Log10P1(x.Y), TSelf.Log10P1(x.Z), TSelf.Log10P1(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Exp(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Exp(this Vector4D x) + where TSelf : IExponentialFunctions => new(TSelf.Exp(x.X), TSelf.Exp(x.Y), TSelf.Exp(x.Z), TSelf.Exp(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F ExpM1(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D ExpM1(this Vector4D x) + where TSelf : IExponentialFunctions => new(TSelf.ExpM1(x.X), TSelf.ExpM1(x.Y), TSelf.ExpM1(x.Z), TSelf.ExpM1(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Exp2(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Exp2(this Vector4D x) + where TSelf : IExponentialFunctions => new(TSelf.Exp2(x.X), TSelf.Exp2(x.Y), TSelf.Exp2(x.Z), TSelf.Exp2(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Exp2M1(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Exp2M1(this Vector4D x) + where TSelf : IExponentialFunctions => new(TSelf.Exp2M1(x.X), TSelf.Exp2M1(x.Y), TSelf.Exp2M1(x.Z), TSelf.Exp2M1(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Exp10(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Exp10(this Vector4D x) + where TSelf : IExponentialFunctions => new(TSelf.Exp10(x.X), TSelf.Exp10(x.Y), TSelf.Exp10(x.Z), TSelf.Exp10(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Exp10M1(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Exp10M1(this Vector4D x) + where TSelf : IExponentialFunctions => new(TSelf.Exp10M1(x.X), TSelf.Exp10M1(x.Y), TSelf.Exp10M1(x.Z), TSelf.Exp10M1(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Acos(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Acos(this Vector4D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Acos(x.X), TSelf.Acos(x.Y), TSelf.Acos(x.Z), TSelf.Acos(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F AcosPi(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D AcosPi(this Vector4D x) + where TSelf : ITrigonometricFunctions => new(TSelf.AcosPi(x.X), TSelf.AcosPi(x.Y), TSelf.AcosPi(x.Z), TSelf.AcosPi(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Asin(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Asin(this Vector4D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Asin(x.X), TSelf.Asin(x.Y), TSelf.Asin(x.Z), TSelf.Asin(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F AsinPi(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D AsinPi(this Vector4D x) + where TSelf : ITrigonometricFunctions => new(TSelf.AsinPi(x.X), TSelf.AsinPi(x.Y), TSelf.AsinPi(x.Z), TSelf.AsinPi(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Atan(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Atan(this Vector4D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Atan(x.X), TSelf.Atan(x.Y), TSelf.Atan(x.Z), TSelf.Atan(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F AtanPi(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D AtanPi(this Vector4D x) + where TSelf : ITrigonometricFunctions => new(TSelf.AtanPi(x.X), TSelf.AtanPi(x.Y), TSelf.AtanPi(x.Z), TSelf.AtanPi(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Cos(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Cos(this Vector4D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Cos(x.X), TSelf.Cos(x.Y), TSelf.Cos(x.Z), TSelf.Cos(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F CosPi(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D CosPi(this Vector4D x) + where TSelf : ITrigonometricFunctions => new(TSelf.CosPi(x.X), TSelf.CosPi(x.Y), TSelf.CosPi(x.Z), TSelf.CosPi(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Sin(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Sin(this Vector4D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Sin(x.X), TSelf.Sin(x.Y), TSelf.Sin(x.Z), TSelf.Sin(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F SinPi(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D SinPi(this Vector4D x) + where TSelf : ITrigonometricFunctions => new(TSelf.SinPi(x.X), TSelf.SinPi(x.Y), TSelf.SinPi(x.Z), TSelf.SinPi(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Tan(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Tan(this Vector4D x) + where TSelf : ITrigonometricFunctions => new(TSelf.Tan(x.X), TSelf.Tan(x.Y), TSelf.Tan(x.Z), TSelf.Tan(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F TanPi(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D TanPi(this Vector4D x) + where TSelf : ITrigonometricFunctions => new(TSelf.TanPi(x.X), TSelf.TanPi(x.Y), TSelf.TanPi(x.Z), TSelf.TanPi(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F DegreesToRadians(this Vector4F degrees) - where TSelf : IFloatingPointIeee754 => + public static Vector4D DegreesToRadians(this Vector4D degrees) + where TSelf : ITrigonometricFunctions => new(TSelf.DegreesToRadians(degrees.X), TSelf.DegreesToRadians(degrees.Y), TSelf.DegreesToRadians(degrees.Z), TSelf.DegreesToRadians(degrees.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F RadiansToDegrees(this Vector4F radians) - where TSelf : IFloatingPointIeee754 => + public static Vector4D RadiansToDegrees(this Vector4D radians) + where TSelf : ITrigonometricFunctions => new(TSelf.RadiansToDegrees(radians.X), TSelf.RadiansToDegrees(radians.Y), TSelf.RadiansToDegrees(radians.Z), TSelf.RadiansToDegrees(radians.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Acosh(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Acosh(this Vector4D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Acosh(x.X), TSelf.Acosh(x.Y), TSelf.Acosh(x.Z), TSelf.Acosh(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Asinh(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Asinh(this Vector4D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Asinh(x.X), TSelf.Asinh(x.Y), TSelf.Asinh(x.Z), TSelf.Asinh(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Atanh(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Atanh(this Vector4D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Atanh(x.X), TSelf.Atanh(x.Y), TSelf.Atanh(x.Z), TSelf.Atanh(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Cosh(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Cosh(this Vector4D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Cosh(x.X), TSelf.Cosh(x.Y), TSelf.Cosh(x.Z), TSelf.Cosh(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Sinh(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Sinh(this Vector4D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Sinh(x.X), TSelf.Sinh(x.Y), TSelf.Sinh(x.Z), TSelf.Sinh(x.W)); /// Applies to the provided arguments. /// A vector whose members will be provided for . - public static Vector4F Tanh(this Vector4F x) - where TSelf : IFloatingPointIeee754 => + public static Vector4D Tanh(this Vector4D x) + where TSelf : IHyperbolicFunctions => new(TSelf.Tanh(x.X), TSelf.Tanh(x.Y), TSelf.Tanh(x.Z), TSelf.Tanh(x.W)); } } diff --git a/sources/Maths/Maths/Vector4I.gen.cs b/sources/Maths/Maths/Vector4I.gen.cs deleted file mode 100644 index b87494d968..0000000000 --- a/sources/Maths/Maths/Vector4I.gen.cs +++ /dev/null @@ -1,620 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Collections; - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - using System.Runtime.InteropServices; - using System.Text; - - partial struct Vector4I : - IEquatable>, - IReadOnlyList, - IFormattable, - IParsable>, - ISpanFormattable, - ISpanParsable>, - IUtf8SpanFormattable, - IUtf8SpanParsable> - where T : IBinaryInteger - { - /// The X component of the vector. - public T X; - - /// The Y component of the vector. - public T Y; - - /// The Z component of the vector. - public T Z; - - /// The W component of the vector. - public T W; - - /// Initializes all components of the vector to the same value. - public Vector4I(T value) => (X, Y, Z, W) = (value, value, value, value); - - /// Initializes the vector with individual component values. - public Vector4I(T x, T y, T z, T w) => (X, Y, Z, W) = (x, y, z, w); - - /// Initializes the vector using a for the initial elements, and the specified components for the remainder. - public Vector4I(Vector2I other, T z, T w) => (X, Y, Z, W) = (other.X, other.Y, z, w); - - /// Initializes the vector using a for the initial elements, and the specified component for the remainder. - public Vector4I(Vector3I other, T w) => (X, Y, Z, W) = (other.X, other.Y, other.Z, w); - - /// Initializes the vector from a span of 4 values. - public Vector4I(ReadOnlySpan values) - { - if (values.Length != 4) - throw new ArgumentException("Input span must contain exactly 4 elements.", nameof(values)); - - X = values[0]; - Y = values[1]; - Z = values[2]; - W = values[3]; - } - - /// Gets a vector whose 4 elements are equal to one. - public static Vector4I One => new(T.One); - - /// Returns a vector whose 4 elements are equal to zero. - public static Vector4I Zero => default; - - /// Gets the vector (1, 0, 0, 0). - public static Vector4I UnitX => new(T.One, T.Zero, T.Zero, T.Zero); - - /// Gets the vector (0, 1, 0, 0). - public static Vector4I UnitY => new(T.Zero, T.One, T.Zero, T.Zero); - - /// Gets the vector (0, 0, 1, 0). - public static Vector4I UnitZ => new(T.Zero, T.Zero, T.One, T.Zero); - - /// Gets the vector (0, 0, 0, 1). - public static Vector4I UnitW => new(T.Zero, T.Zero, T.Zero, T.One); - - /// Gets a vector with all bits set for each component. - public static Vector4I AllBitsSet => new Vector4I(T.AllBitsSet, T.AllBitsSet, T.AllBitsSet, T.AllBitsSet); - - /// Gets the squared length of the vector (dot product with itself). - public T LengthSquared => Vector4I.Dot(this, this); - - /// - T IReadOnlyList.this[int index] => this[index]; - - ///Gets the component at the specified index: 0 = X, 1 = Y, 2 = Z, 3 = W. - [UnscopedRef] - public ref T this[int index] - { - get - { - switch (index) - { - case 0: - return ref X; - case 1: - return ref Y; - case 2: - return ref Z; - case 3: - return ref W; - } - - throw new ArgumentOutOfRangeException(nameof(index)); - } - } - - /// The number of elements in the vector. - public int Count => 4; - - /// - IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); - - /// Returns an enumerator that iterates through the vector components. - public IEnumerator GetEnumerator() - { - yield return X; - yield return Y; - yield return Z; - yield return W; - } - - /// Copies the components of the vector to the specified array starting at index 0. - public void CopyTo(T[] array) => CopyTo(array, 0); - - /// Copies the components of the vector to the specified array starting at the given index. - public void CopyTo(T[] array, int startIndex) - { - if (array == null) - throw new ArgumentNullException(nameof(array)); - if (startIndex < 0 || startIndex + 4 > array.Length) - throw new ArgumentOutOfRangeException(nameof(startIndex)); - - array[startIndex] = X; - array[startIndex + 1] = Y; - array[startIndex + 2] = Z; - array[startIndex + 3] = W; - } - - /// Copies the components of the vector to the specified span starting at index 0. - public void CopyTo(Span span) => CopyTo(span, 0); - - /// Copies the components of the vector to the specified span starting at the given index. - public void CopyTo(Span span, int startIndex) - { - if (startIndex < 0 || startIndex + 4 > span.Length) - throw new ArgumentOutOfRangeException(nameof(startIndex)); - - span[startIndex] = X; - span[startIndex + 1] = Y; - span[startIndex + 2] = Z; - span[startIndex + 3] = W; - } - - /// Returns a span over the vector components. - public Span AsSpan() => MemoryMarshal.CreateSpan(ref X, 4); - - /// Formats the vector as a string. - public override string ToString() => - $"<{X}, {Y}, {Z}, {W}>"; - - /// Formats the vector as a string using the specified format and format provider. - public string ToString(string? format, IFormatProvider? formatProvider) => - $"<{X.ToString(format, formatProvider)}, {Y.ToString(format, formatProvider)}, {Z.ToString(format, formatProvider)}, {W.ToString(format, formatProvider)}>"; - - /// Parses a string to a instance. - public static Vector4I Parse(string s, IFormatProvider? provider) => Parse(s.AsSpan(), provider); - - /// Parses a span to a instance. - public static Vector4I Parse(ReadOnlySpan s, IFormatProvider? provider) - { - if (!TryParse(s, provider, out var result)) - throw new FormatException("Invalid format for Vector4I."); - - return result; - } - - /// Formats the vector as a UTF-8 string using the specified format and format provider. - public bool TryFormat(Span utf8Destination, out int bytesWritten, ReadOnlySpan format, IFormatProvider? provider) - { - Span xBuffer = stackalloc char[64]; - Span yBuffer = stackalloc char[64]; - Span zBuffer = stackalloc char[64]; - Span wBuffer = stackalloc char[64]; - - if (!X.TryFormat(xBuffer, out int xChars, format, provider)|| - !Y.TryFormat(yBuffer, out int yChars, format, provider)|| - !Z.TryFormat(zBuffer, out int zChars, format, provider)|| - !W.TryFormat(wBuffer, out int wChars, format, provider)) - { - bytesWritten = 0; - return false; - } - - int estimatedSize = Encoding.UTF8.GetByteCount(xBuffer[..xChars]) + - Encoding.UTF8.GetByteCount(yBuffer[..yChars]) + - Encoding.UTF8.GetByteCount(zBuffer[..zChars]) + - Encoding.UTF8.GetByteCount(wBuffer[..wChars]) + - Encoding.UTF8.GetByteCount("<, >"); - - if (utf8Destination.Length < estimatedSize) - { - bytesWritten = 0; - return false; - } - - int totalBytes = 0; - - totalBytes += Encoding.UTF8.GetBytes("<", utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(xBuffer[..xChars], utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(", ", utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(yBuffer[..yChars], utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(", ", utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(zBuffer[..zChars], utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(", ", utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(wBuffer[..wChars], utf8Destination[totalBytes..]); - totalBytes += Encoding.UTF8.GetBytes(">", utf8Destination[totalBytes..]); - - bytesWritten = totalBytes; - return true; - } - - /// Formats the vector as a string using the specified format and format provider. - public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan format, IFormatProvider? provider) - { - Span xBuffer = stackalloc char[64]; - Span yBuffer = stackalloc char[64]; - Span zBuffer = stackalloc char[64]; - Span wBuffer = stackalloc char[64]; - - if (!X.TryFormat(xBuffer, out int xChars, format, provider) || - !Y.TryFormat(yBuffer, out int yChars, format, provider) || - !Z.TryFormat(zBuffer, out int zChars, format, provider) || - !W.TryFormat(wBuffer, out int wChars, format, provider)) - { - charsWritten = 0; - return false; - } - - int requiredLength = 1 + xChars + 2 + yChars + 2 + zChars + 2 + wChars + 1; - - if (destination.Length < requiredLength) - { - charsWritten = 0; - return false; - } - - int pos = 0; - destination[pos++] = '<'; - - xBuffer[..xChars].CopyTo(destination[pos..]); - pos += xChars; - - destination[pos++] = ','; - destination[pos++] = ' '; - - yBuffer[..yChars].CopyTo(destination[pos..]); - pos += yChars; - - destination[pos++] = ','; - destination[pos++] = ' '; - - zBuffer[..zChars].CopyTo(destination[pos..]); - pos += zChars; - - destination[pos++] = ','; - destination[pos++] = ' '; - - wBuffer[..wChars].CopyTo(destination[pos..]); - pos += wChars; - - destination[pos++] = '>'; - - charsWritten = pos; - return true; - } - - /// Tries to parse a span to a instance. - public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector4I result) - { - result = default; - - s = s.Trim(); - if (s.Length < 8 || s[0] != '<' || s[^1] != '>') - return false; - - s = s[1..^1]; // Remove < and > - - int commaX = s.IndexOf(','); - if (commaX < 0) - return false; - - ReadOnlySpan remainder1 = s.Slice(commaX + 1); - int commaYRelative = remainder1.IndexOf(','); - if (commaYRelative < 0) - return false; - int commaY = commaX + 1 + commaYRelative; - - ReadOnlySpan remainder2 = s.Slice(commaY + 1); - int commaZRelative = remainder2.IndexOf(','); - if (commaZRelative < 0) - return false; - int commaZ = commaY + 1 + commaZRelative; - - ReadOnlySpan xSpan = s[..commaX].Trim(); - ReadOnlySpan ySpan = s[(commaX + 1)..commaY].Trim(); - ReadOnlySpan zSpan = s[(commaY + 1)..commaZ].Trim(); - ReadOnlySpan wSpan = s[(commaZ + 1)..].Trim(); - - if (T.TryParse(xSpan, provider, out var x) && - T.TryParse(ySpan, provider, out var y) && - T.TryParse(zSpan, provider, out var z) && - T.TryParse(wSpan, provider, out var w)) - { - result = new Vector4I(x, y, z, w); - return true; - } - - return false; - } - - /// Parses a UTF-8 span to a instance. - public static Vector4I Parse(ReadOnlySpan utf8Text, IFormatProvider? provider) - { - int charCount = Encoding.UTF8.GetCharCount(utf8Text); - Span charBuffer = charCount <= 128 ? stackalloc char[charCount] : new char[charCount]; - Encoding.UTF8.GetChars(utf8Text, charBuffer); - return Parse(charBuffer, provider); - } - - /// Tries to parse a UTF-8 span to a instance. - public static bool TryParse(ReadOnlySpan utf8Text, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector4I result) - { - int charCount = Encoding.UTF8.GetCharCount(utf8Text); - Span charBuffer = charCount <= 128 ? stackalloc char[charCount] : new char[charCount]; - Encoding.UTF8.GetChars(utf8Text, charBuffer); - return TryParse(charBuffer, provider, out result); - } - - /// Tries to parse a string to a instance. - public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector4I result) => - TryParse(s.AsSpan(), provider, out result); - - /// Parses a span to a instance. - static Vector4I ISpanParsable>.Parse(ReadOnlySpan s, IFormatProvider? provider) => - Parse(s, provider); - - /// Parses a string to a instance. - static Vector4I IParsable>.Parse(string s, IFormatProvider? provider) => - Parse(s, provider); - - /// Tries to parse a span to a instance. - static bool ISpanParsable>.TryParse(ReadOnlySpan s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector4I result) => - TryParse(s, provider, out result); - - /// Tries to parse a string to a instance. - static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out Vector4I result) => - TryParse(s, provider, out result); - - /// Returns a boolean indicating whether the given two vectors are equal. - /// The first vector to compare. - /// The second vector to compare. - /// true if the given vectors are equal; false otherwise. - public static bool operator ==(Vector4I left, Vector4I right) => - left.X == right.X && - left.Y == right.Y && - left.Z == right.Z && - left.W == right.W; - - /// Returns a boolean indicating whether the given two vectors are not equal. - /// The first vector to compare. - /// The second vector to compare. - /// true if the given vectors are not equal; false otherwise. - public static bool operator !=(Vector4I left, Vector4I right) => !(left == right); - - /// - public override bool Equals(object? obj) => obj is Vector4I other && Equals(other); - - /// - public bool Equals(Vector4I other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(X, Y, Z, W); - - /// Desconstructs a vector into its components. - /// The X component. - /// The Y component. - /// The Z component. - /// The W component. - public void Deconstruct(out T x, out T y, out T z, out T w) - { - x = X; - y = Y; - z = Z; - w = W; - } - - /// Implicitly casts a to a . - public static implicit operator Vector4I((T X, T Y, T Z, T W) v) => - new(v.X, v.Y, v.Z, v.W); - - /// Implicitly casts a to a . - public static implicit operator (T X, T Y, T Z, T W)(Vector4I v) => - (v.X, v.Y, v.Z, v.W); - - public static Vector4I operator +(Vector4I vector) => - vector; - - public static Vector4I operator -(Vector4I vector) => - new(-vector.X, -vector.Y, -vector.Z, -vector.W); - - public static Vector4I operator +(Vector4I left, Vector4I right) => - new(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W); - - public static Vector4I operator -(Vector4I left, Vector4I right) => - new(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W); - - public static Vector4I operator *(Vector4I left, Vector4I right) => - new(left.X * right.X, left.Y * right.Y, left.Z * right.Z, left.W * right.W); - - public static Vector4I operator /(Vector4I left, Vector4I right) => - new(left.X / right.X, left.Y / right.Y, left.Z / right.Z, left.W / right.W); - - public static Vector4I operator %(Vector4I left, Vector4I right) => - new(left.X % right.X, left.Y % right.Y, left.Z % right.Z, left.W % right.W); - - public static Vector4I operator +(Vector4I vector, T scalar) => - new(vector.X + scalar, vector.Y + scalar, vector.Z + scalar, vector.W + scalar); - - public static Vector4I operator -(Vector4I vector, T scalar) => - new(vector.X - scalar, vector.Y - scalar, vector.Z - scalar, vector.W - scalar); - - public static Vector4I operator *(Vector4I vector, T scalar) => - new(vector.X * scalar, vector.Y * scalar, vector.Z * scalar, vector.W * scalar); - - public static Vector4I operator *(T scalar, Vector4I vector) => - new(scalar * vector.X, scalar * vector.Y, scalar * vector.Z, scalar * vector.W); - - public static Vector4I operator /(Vector4I vector, T scalar) => - new(vector.X / scalar, vector.Y / scalar, vector.Z / scalar, vector.W / scalar); - - public static Vector4I operator %(Vector4I vector, T scalar) => - new(vector.X % scalar, vector.Y % scalar, vector.Z % scalar, vector.W % scalar); - - public static Vector4I operator ~(Vector4I vector) => - new Vector4I(~vector.X, ~vector.Y, ~vector.Z, ~vector.W); - - public static Vector4I operator &(Vector4I left, Vector4I right) => - new Vector4I(left.X & right.X, left.Y & right.Y, left.Z & right.Z, left.W & right.W); - - public static Vector4I operator |(Vector4I left, Vector4I right) => - new Vector4I(left.X | right.X, left.Y | right.Y, left.Z | right.Z, left.W | right.W); - - public static Vector4I operator ^(Vector4I left, Vector4I right) => - new Vector4I(left.X ^ right.X, left.Y ^ right.Y, left.Z ^ right.Z, left.W ^ right.W); - - public static Vector4I operator &(Vector4I vector, T scalar) => - new Vector4I(vector.X & scalar, vector.Y & scalar, vector.Z & scalar, vector.W & scalar); - - public static Vector4I operator &(T scalar, Vector4I vector) => - new Vector4I(scalar & vector.X, scalar & vector.Y, scalar & vector.Z, scalar & vector.W); - - public static Vector4I operator |(Vector4I vector, T scalar) => - new Vector4I(vector.X | scalar, vector.Y | scalar, vector.Z | scalar, vector.W | scalar); - - public static Vector4I operator |(T scalar, Vector4I vector) => - new Vector4I(scalar | vector.X, scalar | vector.Y, scalar | vector.Z, scalar | vector.W); - - public static Vector4I operator ^(Vector4I vector, T scalar) => - new Vector4I(vector.X ^ scalar, vector.Y ^ scalar, vector.Z ^ scalar, vector.W ^ scalar); - - public static Vector4I operator ^(T scalar, Vector4I vector) => - new Vector4I(scalar ^ vector.X, scalar ^ vector.Y, scalar ^ vector.Z, scalar ^ vector.W); - } - - static partial class Vector4I - { - /// Computes the dot product of two vectors. - public static T Dot(this Vector4I left, Vector4I right) - where T : IBinaryInteger => - left.X * right.X + left.Y * right.Y + left.Z * right.Z + left.W * right.W; - - /// Reflects a vector over a normal vector. - public static Vector4I Reflect(Vector4I vector, Vector4I normal) - where T : IBinaryInteger - { - T dot = vector.Dot(normal); - return vector - (normal * (dot + dot)); - } - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - public static Vector4I Sign(this Vector4I value) - where TSelf : IBinaryInteger => - new(TSelf.Sign(value.X), TSelf.Sign(value.Y), TSelf.Sign(value.Z), TSelf.Sign(value.W)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector4I Max(this Vector4I x, Vector4I y) - where TSelf : IBinaryInteger => - new(TSelf.Max(x.X, y.X), TSelf.Max(x.Y, y.Y), TSelf.Max(x.Z, y.Z), TSelf.Max(x.W, y.W)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - public static Vector4I Max(this Vector4I x, TSelf y) - where TSelf : IBinaryInteger => - new(TSelf.Max(x.X, y), TSelf.Max(x.Y, y), TSelf.Max(x.Z, y), TSelf.Max(x.W, y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector4I MaxNumber(this Vector4I x, Vector4I y) - where TSelf : IBinaryInteger => - new(TSelf.MaxNumber(x.X, y.X), TSelf.MaxNumber(x.Y, y.Y), TSelf.MaxNumber(x.Z, y.Z), TSelf.MaxNumber(x.W, y.W)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - public static Vector4I MaxNumber(this Vector4I x, TSelf y) - where TSelf : IBinaryInteger => - new(TSelf.MaxNumber(x.X, y), TSelf.MaxNumber(x.Y, y), TSelf.MaxNumber(x.Z, y), TSelf.MaxNumber(x.W, y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector4I Min(this Vector4I x, Vector4I y) - where TSelf : IBinaryInteger => - new(TSelf.Min(x.X, y.X), TSelf.Min(x.Y, y.Y), TSelf.Min(x.Z, y.Z), TSelf.Min(x.W, y.W)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - public static Vector4I Min(this Vector4I x, TSelf y) - where TSelf : IBinaryInteger => - new(TSelf.Min(x.X, y), TSelf.Min(x.Y, y), TSelf.Min(x.Z, y), TSelf.Min(x.W, y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector4I MinNumber(this Vector4I x, Vector4I y) - where TSelf : IBinaryInteger => - new(TSelf.MinNumber(x.X, y.X), TSelf.MinNumber(x.Y, y.Y), TSelf.MinNumber(x.Z, y.Z), TSelf.MinNumber(x.W, y.W)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - public static Vector4I MinNumber(this Vector4I x, TSelf y) - where TSelf : IBinaryInteger => - new(TSelf.MinNumber(x.X, y), TSelf.MinNumber(x.Y, y), TSelf.MinNumber(x.Z, y), TSelf.MinNumber(x.W, y)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector4I Clamp(this Vector4I value, Vector4I min, Vector4I max) - where TSelf : IBinaryInteger => - new(TSelf.Clamp(value.X, min.X, max.X), TSelf.Clamp(value.Y, min.Y, max.Y), TSelf.Clamp(value.Z, min.Z, max.Z), TSelf.Clamp(value.W, min.W, max.W)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - /// A single value provided for . - public static Vector4I Clamp(this Vector4I value, TSelf min, TSelf max) - where TSelf : IBinaryInteger => - new(TSelf.Clamp(value.X, min, max), TSelf.Clamp(value.Y, min, max), TSelf.Clamp(value.Z, min, max), TSelf.Clamp(value.W, min, max)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector4I CopySign(this Vector4I value, Vector4I sign) - where TSelf : IBinaryInteger => - new(TSelf.CopySign(value.X, sign.X), TSelf.CopySign(value.Y, sign.Y), TSelf.CopySign(value.Z, sign.Z), TSelf.CopySign(value.W, sign.W)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A single value provided for . - public static Vector4I CopySign(this Vector4I value, TSelf sign) - where TSelf : IBinaryInteger => - new(TSelf.CopySign(value.X, sign), TSelf.CopySign(value.Y, sign), TSelf.CopySign(value.Z, sign), TSelf.CopySign(value.W, sign)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - public static Vector4I Abs(this Vector4I value) - where TSelf : IBinaryInteger => - new(TSelf.Abs(value.X), TSelf.Abs(value.Y), TSelf.Abs(value.Z), TSelf.Abs(value.W)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector4I MaxMagnitude(this Vector4I x, Vector4I y) - where TSelf : IBinaryInteger => - new(TSelf.MaxMagnitude(x.X, y.X), TSelf.MaxMagnitude(x.Y, y.Y), TSelf.MaxMagnitude(x.Z, y.Z), TSelf.MaxMagnitude(x.W, y.W)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector4I MaxMagnitudeNumber(this Vector4I x, Vector4I y) - where TSelf : IBinaryInteger => - new(TSelf.MaxMagnitudeNumber(x.X, y.X), TSelf.MaxMagnitudeNumber(x.Y, y.Y), TSelf.MaxMagnitudeNumber(x.Z, y.Z), TSelf.MaxMagnitudeNumber(x.W, y.W)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector4I MinMagnitude(this Vector4I x, Vector4I y) - where TSelf : IBinaryInteger => - new(TSelf.MinMagnitude(x.X, y.X), TSelf.MinMagnitude(x.Y, y.Y), TSelf.MinMagnitude(x.Z, y.Z), TSelf.MinMagnitude(x.W, y.W)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - /// A vector whose members will be provided for . - public static Vector4I MinMagnitudeNumber(this Vector4I x, Vector4I y) - where TSelf : IBinaryInteger => - new(TSelf.MinMagnitudeNumber(x.X, y.X), TSelf.MinMagnitudeNumber(x.Y, y.Y), TSelf.MinMagnitudeNumber(x.Z, y.Z), TSelf.MinMagnitudeNumber(x.W, y.W)); - - /// Applies to the provided arguments. - /// A vector whose members will be provided for . - public static Vector4I Log2(this Vector4I value) - where TSelf : IBinaryInteger => - new(TSelf.Log2(value.X), TSelf.Log2(value.Y), TSelf.Log2(value.Z), TSelf.Log2(value.W)); - } -} From aefd7eaf161db8cce54453f9ffb8d84cba64fc11 Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Mon, 30 Jun 2025 19:45:07 -0700 Subject: [PATCH 03/19] Merge matrix types. --- sources/Maths/Maths/Matrix2X2.Ops.cs | 50 ++-- sources/Maths/Maths/Matrix2X2.cs | 208 +------------ sources/Maths/Maths/Matrix2X2.gen.cs | 53 +++- sources/Maths/Maths/Matrix2X3.Ops.cs | 41 +-- sources/Maths/Maths/Matrix2X3.cs | 243 +-------------- sources/Maths/Maths/Matrix2X3.gen.cs | 57 +++- sources/Maths/Maths/Matrix2X4.Ops.cs | 32 +- sources/Maths/Maths/Matrix2X4.cs | 277 +----------------- sources/Maths/Maths/Matrix2X4.gen.cs | 63 +++- sources/Maths/Maths/Matrix3X2.Ops.cs | 66 ++--- sources/Maths/Maths/Matrix3X2.cs | 240 +-------------- sources/Maths/Maths/Matrix3X2.gen.cs | 58 +++- sources/Maths/Maths/Matrix3X3.Ops.cs | 72 ++--- sources/Maths/Maths/Matrix3X3.cs | 279 +----------------- sources/Maths/Maths/Matrix3X3.gen.cs | 67 ++++- sources/Maths/Maths/Matrix3X4.Ops.cs | 38 +-- sources/Maths/Maths/Matrix3X4.cs | 319 +------------------- sources/Maths/Maths/Matrix3X4.gen.cs | 72 ++++- sources/Maths/Maths/Matrix4X2.Ops.cs | 45 +-- sources/Maths/Maths/Matrix4X2.cs | 295 +------------------ sources/Maths/Maths/Matrix4X2.gen.cs | 65 +++- sources/Maths/Maths/Matrix4X3.Ops.cs | 39 +-- sources/Maths/Maths/Matrix4X3.cs | 328 +-------------------- sources/Maths/Maths/Matrix4X3.gen.cs | 73 ++++- sources/Maths/Maths/Matrix4X4.Ops.cs | 115 ++++---- sources/Maths/Maths/Matrix4X4.cs | 423 +-------------------------- sources/Maths/Maths/Matrix4X4.gen.cs | 309 +++++++++++++++++++ sources/Maths/Maths/Matrix5X4.Ops.cs | 30 +- sources/Maths/Maths/Matrix5X4.cs | 402 +------------------------ sources/Maths/Maths/Matrix5X4.gen.cs | 74 ++++- 30 files changed, 1075 insertions(+), 3358 deletions(-) create mode 100644 sources/Maths/Maths/Matrix4X4.gen.cs diff --git a/sources/Maths/Maths/Matrix2X2.Ops.cs b/sources/Maths/Maths/Matrix2X2.Ops.cs index 0d768ab0ce..e7f5828da8 100644 --- a/sources/Maths/Maths/Matrix2X2.Ops.cs +++ b/sources/Maths/Maths/Matrix2X2.Ops.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.CompilerServices; namespace Silk.NET.Maths @@ -9,14 +10,15 @@ namespace Silk.NET.Maths /// /// Methods for working with /// - public static class Matrix2X2 + public static partial class Matrix2X2 { /// Adds two matrices together. /// The first source matrix. /// The second source matrix. /// The resulting matrix. [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X2 Add(Matrix2X2 value1, Matrix2X2 value2) where T : unmanaged, IFormattable, IEquatable, IComparable + public static Matrix2X2 Add(Matrix2X2 value1, Matrix2X2 value2) + where T : INumberBase { return value1 + value2; } @@ -26,68 +28,54 @@ public static Matrix2X2 Add(Matrix2X2 value1, Matrix2X2 value2) wher /// The second source matrix. /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X2 Multiply(Matrix2X2 value1, Matrix2X2 value2) where T : unmanaged, IFormattable, IEquatable, IComparable => value1 * value2; + public static Matrix2X2 Multiply(Matrix2X2 value1, Matrix2X2 value2) + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X2 Multiply(Matrix3X2 value1, Matrix2X2 value2) where T : unmanaged, IFormattable, IEquatable, IComparable => value1 * value2; + public static Matrix3X2 Multiply(Matrix3X2 value1, Matrix2X2 value2) + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X3 Multiply(Matrix2X2 value1, Matrix2X3 value2) where T : unmanaged, IFormattable, IEquatable, IComparable => value1 * value2; + public static Matrix2X3 Multiply(Matrix2X2 value1, Matrix2X3 value2) + where T : INumberBase => value1 * value2; /// Multiplies a matrix by a scalar value. /// The source matrix. /// The scaling factor. /// The scaled matrix. [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X2 Multiply(Matrix2X2 value1, T value2) where T : unmanaged, IFormattable, IEquatable, IComparable => value1 * value2; + public static Matrix2X2 Multiply(Matrix2X2 value1, T value2) + where T : INumberBase => value1 * value2; /// Multiplies a vector by a matrix. /// The vector. /// The matrix. /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Multiply(Vector2D value1, Matrix2X2 value2) where T : unmanaged, IFormattable, IEquatable, IComparable => value1 * value2; + public static Vector2D Multiply(Vector2D value1, Matrix2X2 value2) + where T : INumberBase => value1 * value2; /// Returns a new matrix with the negated elements of the given matrix. /// The source matrix. /// The negated matrix. [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X2 Negate(Matrix2X2 value) where T : unmanaged, IFormattable, IEquatable, IComparable => -value; + public static Matrix2X2 Negate(Matrix2X2 value) + where T : INumberBase => -value; /// Subtracts the second matrix from the first. /// The first source matrix. /// The second source matrix. /// The result of the subtraction. [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X2 Subtract(Matrix2X2 value1, Matrix2X2 value2) where T : unmanaged, IFormattable, IEquatable, IComparable => value1 - value2; - - - /// Linearly interpolates between the corresponding values of two matrices. - /// The first source matrix. - /// The second source matrix. - /// The relative weight of the second source matrix. - /// The interpolated matrix. - public static unsafe Matrix2X2 Lerp(Matrix2X2 matrix1, Matrix2X2 matrix2, T amount) where T : unmanaged, IFormattable, IEquatable, IComparable - { - Matrix2X2 result = default; - - // First row - result.M11 = Scalar.Add(matrix1.M11, Scalar.Multiply(Scalar.Subtract(matrix2.M11, matrix1.M11), amount)); - result.M12 = Scalar.Add(matrix1.M12, Scalar.Multiply(Scalar.Subtract(matrix2.M12, matrix1.M12), amount)); - - // Second row - result.M21 = Scalar.Add(matrix1.M21, Scalar.Multiply(Scalar.Subtract(matrix2.M21, matrix1.M21), amount)); - result.M22 = Scalar.Add(matrix1.M22, Scalar.Multiply(Scalar.Subtract(matrix2.M22, matrix1.M22), amount)); - - return result; - } + public static Matrix2X2 Subtract(Matrix2X2 value1, Matrix2X2 value2) + where T : INumberBase => value1 - value2; } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Matrix2X2.cs b/sources/Maths/Maths/Matrix2X2.cs index e01fcf288f..50bde7046e 100644 --- a/sources/Maths/Maths/Matrix2X2.cs +++ b/sources/Maths/Maths/Matrix2X2.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -11,117 +12,8 @@ namespace Silk.NET.Maths /// A structure encapsulating a 2x2 matrix. [Serializable] [DataContract] - public struct Matrix2X2 : IEquatable> - where T : unmanaged, IFormattable, IEquatable, IComparable + public partial struct Matrix2X2 { - private static readonly Matrix2X2 _identity = new(Scalar.One, Scalar.Zero, Scalar.Zero, - Scalar.One); - - /// - /// Row 1 of the matrix. - /// - [IgnoreDataMember] - public Vector2D Row1; - /// - /// Row 2 of the matrix. - /// - [IgnoreDataMember] - public Vector2D Row2; - - /// - /// Column 1 of the matrix. - /// - [IgnoreDataMember] - public Vector2D Column1 => new(M11, M21); - - /// - /// Column 2 of the matrix. - /// - [IgnoreDataMember] - public Vector2D Column2 => new(M12, M22); - - - /// Value at row 1, column 1 of the matrix. - [DataMember] - public T M11 - { - readonly get => Row1.X; - set => Row1.X = value; - } - - /// Value at row 1, column 2 of the matrix. - [DataMember] - public T M12 - { - readonly get => Row1.Y; - set => Row1.Y = value; - } - - /// Value at row 2, column 1 of the matrix. - [DataMember] - public T M21 - { - readonly get => Row2.X; - set => Row2.X = value; - } - - /// Value at row 2, column 2 of the matrix. - [DataMember] - public T M22 - { - readonly get => Row2.Y; - set => Row2.Y = value; - } - - /// - /// Indexer for the rows of this matrix. - /// - /// The row to select. Zero based. - public unsafe Vector2D this[int x] - { - get - { - static void VerifyBounds(int i) - { - static void ThrowHelper() => throw new IndexOutOfRangeException(); - - if (i > 1 || i < 0) - ThrowHelper(); - } - - VerifyBounds(x); - return Unsafe.Add(ref Row1, x); - } - } - - /// - /// Indexer for the values in this matrix. - /// - /// The row to select. Zero based. - /// The column to select. Zero based. - public unsafe T this[int x, int y] - { - get - { - var row = this[x]; - return row[y]; - } - } - - /// Constructs a from the given components. - public Matrix2X2(T m11, T m12, T m21, T m22) - { - Row1 = new(m11, m12); - Row2 = new(m21, m22); - } - - /// Constructs a from the given rows. - public Matrix2X2(Vector2D row1, Vector2D row2) - { - Row1 = row1; - Row2 = row2; - } - /// Constructs a from the given . /// The source . public Matrix2X2(Matrix3X2 value) @@ -162,63 +54,12 @@ public Matrix2X2(Matrix4X2 value) Row2 = new(value.M21, value.M22); } - /// Returns the multiplicative identity matrix. - public static Matrix2X2 Identity => _identity; - /// Returns whether the matrix is the identity matrix. public readonly bool IsIdentity => Scalar.Equal(M11, Scalar.One) && Scalar.Equal(M22, Scalar.One) && // Check diagonal element first for early out. Scalar.Equal(M12, Scalar.Zero) && Scalar.Equal(M21, Scalar.Zero); - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - public static unsafe Matrix2X2 operator +(Matrix2X2 value1, Matrix2X2 value2) - { - Matrix2X2 m; - - m.Row1 = value1.Row1 + value2.Row1; - m.Row2 = value1.Row2 + value2.Row2; - - return m; - } - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are equal; False otherwise. - public static unsafe bool operator ==(Matrix2X2 value1, Matrix2X2 value2) - { - return Scalar.Equal(value1.M11, value2.M11) && Scalar.Equal(value1.M22, value2.M22) && - // Check diagonal elements first for early out. - Scalar.Equal(value1.M12, value2.M12) && Scalar.Equal(value1.M21, value2.M21); - } - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are not equal; False if they are equal. - public static unsafe bool operator !=(Matrix2X2 value1, Matrix2X2 value2) - { - return Scalar.NotEqual(value1.M11, value2.M11) || - Scalar.NotEqual(value1.M22, value2.M22) || // Check diagonal elements first for early out. - Scalar.NotEqual(value1.M12, value2.M12) || Scalar.NotEqual(value1.M21, value2.M21); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix2X2 operator *(Matrix2X2 value1, Matrix2X2 value2) - { - return new - ( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2, value1.M21 * value2.Row1 + value1.M22 * value2.Row2 - ); - } - /// Multiplies a vector by a matrix. /// The vector. /// The matrix. @@ -237,23 +78,6 @@ public readonly bool IsIdentity return new(value1.Row1 * value2, value1.Row2 * value2); } - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static unsafe Matrix2X2 operator -(Matrix2X2 value1, Matrix2X2 value2) - { - return new(value1.Row1 - value2.Row1, value1.Row2 - value2.Row2); - } - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static unsafe Matrix2X2 operator -(Matrix2X2 value) - { - return new(-value.Row1, -value.Row2); - } - /// Calculates the determinant of the matrix. /// The determinant of the matrix. public readonly T GetDeterminant() @@ -267,32 +91,6 @@ public readonly T GetDeterminant() return Scalar.Subtract(Scalar.Multiply(a, d), Scalar.Multiply(b, c)); } - /// Returns a boolean indicating whether the given Object is equal to this matrix instance. - /// The Object to compare against. - /// True if the Object is equal to this matrix; False otherwise. - [MethodImpl((MethodImplOptions) 768)] - public override readonly bool Equals(object? obj) => (obj is Matrix2X2 other) && Equals(other); - - /// Returns a boolean indicating whether this matrix instance is equal to the other given matrix. - /// The matrix to compare this instance to. - /// True if the matrices are equal; False otherwise. - public readonly bool Equals(Matrix2X2 other) => this == other; - - /// Returns the hash code for this instance. - /// The hash code. - public override readonly int GetHashCode() - { - HashCode hash = default; - - hash.Add(M11); - hash.Add(M12); - - hash.Add(M21); - hash.Add(M22); - - return hash.ToHashCode(); - } - /// Returns a String representing this matrix instance. /// The string representation. public override readonly string ToString() @@ -414,7 +212,7 @@ public static explicit operator Matrix2X2(Matrix2X2 from) /// /// The type to cast to /// The casted matrix - public Matrix2X2 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Matrix2X2 As() where TOther : INumberBase { return new(Row1.As(), Row2.As()); } diff --git a/sources/Maths/Maths/Matrix2X2.gen.cs b/sources/Maths/Maths/Matrix2X2.gen.cs index fb351734b6..d1bffe8d59 100644 --- a/sources/Maths/Maths/Matrix2X2.gen.cs +++ b/sources/Maths/Maths/Matrix2X2.gen.cs @@ -2,27 +2,55 @@ namespace Silk.NET.Maths { using System.Diagnostics.CodeAnalysis; using System.Numerics; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; public partial struct Matrix2X2 : IEquatable> where T : INumberBase { /// The multiplicative identity matrix of size 2x2. - public static readonly Matrix2X2 Identity = new( + public static Matrix2X2 Identity { get; } = new( new(T.MultiplicativeIdentity, T.Zero), new(T.Zero, T.MultiplicativeIdentity)); /// The 1st row of the matrix represented as a vector. + [IgnoreDataMember] public Vector2D Row1; /// The 2nd row of the matrix represented as a vector. + [IgnoreDataMember] public Vector2D Row2; + /// The 1st column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector2D Column1 => new(Row1.X, Row2.X); + + /// The 2nd column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector2D Column2 => new(Row1.Y, Row2.Y); + /// /// Constructs a from the given rows. /// - public Matrix2X2(Vector2D row1, Vector2D row2) => (Row1, Row2) = (row1, row2); + public Matrix2X2(Vector2D row1, Vector2D row2) => + (Row1, Row2) = (row1, row2); + /// + /// Constructs a from the given components. + /// + public Matrix2X2( + T m11, T m12, + T m21, T m22) + { + Row1 = new(m11, m12); + Row2 = new(m21, m22); + } + + /// + /// Indexer for the rows of this matrix. + /// + /// The row to select. Zero based. [UnscopedRef] public ref Vector2D this[int row] { @@ -36,30 +64,40 @@ public ref Vector2D this[int row] return ref Row2; } - throw new ArgumentOutOfRangeException(nameof(row)); + throw new IndexOutOfRangeException(); } } + /// + /// Indexer for the values in this matrix. + /// + /// The row to select. Zero based. + /// The column to select. Zero based. [UnscopedRef] public ref T this[int row, int column] => ref this[row][column]; /// Gets the element in the 1st row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M11 => ref Row1.X; /// Gets the element in the 1st row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M12 => ref Row1.Y; /// Gets the element in the 2nd row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M21 => ref Row2.X; /// Gets the element in the 2nd row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M22 => ref Row2.Y; /// + [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix2X2 other && Equals(other); /// @@ -121,9 +159,14 @@ public Matrix2X2 Transpose() => public static partial class Matrix2X2 { + /// Linearly interpolates between the corresponding values of two matrices. + /// The first source matrix. + /// The second source matrix. + /// The relative weight of the second source matrix. + /// The interpolated matrix. public static Matrix2X2 Lerp(Matrix2X2 value1, Matrix2X2 value2, T amount) where T : IFloatingPointIeee754 => - new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount)), - new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount))); + new(Vector2D.Lerp(value1.Row1, value2.Row1, amount), + Vector2D.Lerp(value1.Row2, value2.Row2, amount)); } } diff --git a/sources/Maths/Maths/Matrix2X3.Ops.cs b/sources/Maths/Maths/Matrix2X3.Ops.cs index 6ebb6124ca..cd5d662780 100644 --- a/sources/Maths/Maths/Matrix2X3.Ops.cs +++ b/sources/Maths/Maths/Matrix2X3.Ops.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.CompilerServices; namespace Silk.NET.Maths @@ -9,7 +10,7 @@ namespace Silk.NET.Maths /// /// Methods for working with /// - public static class Matrix2X3 + public static partial class Matrix2X3 { private const float BillboardEpsilon = 1e-4f; @@ -19,7 +20,7 @@ public static class Matrix2X3 /// The resulting matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X3 Add(Matrix2X3 value1, Matrix2X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { return value1 + value2; } @@ -31,7 +32,7 @@ public static Matrix2X3 Add(Matrix2X3 value1, Matrix2X3 value2) /// The forward vector of the camera. /// The created billboard matrix public static Matrix2X3 CreateBillboard(Vector3D objectPosition, Vector3D cameraPosition, Vector3D cameraUpVector, Vector3D cameraForwardVector) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Vector3D zaxis = objectPosition - cameraPosition; var norm = zaxis.LengthSquared; @@ -56,7 +57,7 @@ public static Matrix2X3 CreateBillboard(Vector3D objectPosition, Vector /// The angle to rotate around the given axis, in radians. /// The rotation matrix. public static Matrix2X3 CreateFromAxisAngle(Vector3D axis, T angle) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { // a: angle // x, y, z: unit vector for axis. @@ -105,7 +106,7 @@ public static Matrix2X3 CreateFromAxisAngle(Vector3D axis, T angle) /// The source Quaternion. /// The rotation matrix. public static Matrix2X3 CreateFromQuaternion(Silk.NET.Maths.Legacy.Quaternion quaternion) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix2X3 result = Matrix2X3.Identity; @@ -138,7 +139,7 @@ public static Matrix2X3 CreateFromQuaternion(Silk.NET.Maths.Legacy.Quatern /// Angle of rotation, in radians, around the Z-axis. /// The rotation matrix. public static Matrix2X3 CreateFromYawPitchRoll(T yaw, T pitch, T roll) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Legacy.Quaternion q = Legacy.Quaternion.CreateFromYawPitchRoll(yaw, pitch, roll); return CreateFromQuaternion(q); @@ -150,7 +151,7 @@ public static Matrix2X3 CreateFromYawPitchRoll(T yaw, T pitch, T roll) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X3 Multiply(Matrix2X3 value1, Matrix3X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; @@ -160,7 +161,7 @@ public static Matrix2X3 Multiply(Matrix2X3 value1, Matrix3X3 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X2 Multiply(Matrix2X3 value1, Matrix3X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -169,7 +170,7 @@ public static Matrix2X2 Multiply(Matrix2X3 value1, Matrix3X2 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X3 Multiply(Matrix2X2 value1, Matrix2X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by a scalar value. @@ -178,7 +179,7 @@ public static Matrix2X3 Multiply(Matrix2X2 value1, Matrix2X3 value2) /// The scaled matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X3 Multiply(Matrix2X3 value1, T value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a vector by a matrix. @@ -187,7 +188,7 @@ public static Matrix2X3 Multiply(Matrix2X3 value1, T value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Vector3D Multiply(Vector2D value1, Matrix2X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Returns a new matrix with the negated elements of the given matrix. @@ -195,7 +196,7 @@ public static Vector3D Multiply(Vector2D value1, Matrix2X3 value2) /// The negated matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X3 Negate(Matrix2X3 value) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => -value; /// Subtracts the second matrix from the first. @@ -204,27 +205,15 @@ public static Matrix2X3 Negate(Matrix2X3 value) /// The result of the subtraction. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X3 Subtract(Matrix2X3 value1, Matrix2X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 - value2; - - /// Linearly interpolates between the corresponding values of two matrices. - /// The first source matrix. - /// The second source matrix. - /// The relative weight of the second source matrix. - /// The interpolated matrix. - public static unsafe Matrix2X3 Lerp(Matrix2X3 matrix1, Matrix2X3 matrix2, T amount) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new(Vector3D.Lerp(matrix1.Row1, matrix2.Row2, amount), Vector3D.Lerp(matrix1.Row2, matrix2.Row2, amount)); - } - /// Transforms the given matrix by applying the given Quaternion rotation. /// The source matrix to transform. /// The rotation to apply. /// The transformed matrix. public static Matrix2X3 Transform(Matrix2X3 value, Legacy.Quaternion rotation) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { // Compute rotation matrix. T x2 = Scalar.Add(rotation.X, rotation.X); diff --git a/sources/Maths/Maths/Matrix2X3.cs b/sources/Maths/Maths/Matrix2X3.cs index 87bdfc4701..63e4bc944b 100644 --- a/sources/Maths/Maths/Matrix2X3.cs +++ b/sources/Maths/Maths/Matrix2X3.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -11,8 +12,7 @@ namespace Silk.NET.Maths /// A structure encapsulating a 2x3 matrix. [Serializable] [DataContract] - public struct Matrix2X3 : IEquatable> - where T : unmanaged, IFormattable, IEquatable, IComparable + public partial struct Matrix2X3 { private static readonly Matrix2X3 _identity = new ( @@ -20,136 +20,6 @@ public struct Matrix2X3 : IEquatable> Scalar.Zero, Scalar.One, Scalar.Zero ); - /// - /// Row 1 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Row1; - - /// - /// Row 2 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Row2; - - /// - /// Column 1 of the matrix. - /// - [IgnoreDataMember] - public Vector2D Column1 => new Vector2D(M11, M21); - - /// - /// Column 2 of the matrix. - /// - [IgnoreDataMember] - public Vector2D Column2 => new Vector2D(M12, M22); - - /// - /// Column 3 of the matrix. - /// - [IgnoreDataMember] - public Vector2D Column3 => new Vector2D(M13, M23); - - /// Value at row 1, column 1 of the matrix. - [DataMember] - public T M11 - { - readonly get => Row1.X; - set => Row1.X = value; - } - - /// Value at row 1, column 2 of the matrix. - [DataMember] - public T M12 - { - readonly get => Row1.Y; - set => Row1.Y = value; - } - - /// Value at row 1, column 3 of the matrix. - [DataMember] - public T M13 - { - readonly get => Row1.Z; - set => Row1.Z = value; - } - - /// Value at row 2, column 1 of the matrix. - [DataMember] - public T M21 - { - readonly get => Row1.X; - set => Row1.X = value; - } - - /// Value at row 2, column 2 of the matrix. - [DataMember] - public T M22 - { - readonly get => Row2.Y; - set => Row2.Y = value; - } - - /// Value at row 2, column 3 of the matrix. - [DataMember] - public T M23 - { - readonly get => Row2.Z; - set => Row2.Z = value; - } - - /// - /// Indexer for the rows of this matrix. - /// - /// The row to select. Zero based. - public unsafe Vector3D this[int x] - { - get - { - static void VerifyBounds(int i) - { - static void ThrowHelper() => throw new IndexOutOfRangeException(); - - if (i > 1 || i < 0) - ThrowHelper(); - } - - VerifyBounds(x); - return Unsafe.Add(ref Row1, x); - } - } - - /// - /// Indexer for the values in this matrix. - /// - /// The row to select. Zero based. - /// The column to select. Zero based. - public unsafe T this[int x, int y] - { - get - { - var row = this[x]; - return row[y]; - } - } - - /// Constructs a from the given components. - public Matrix2X3(T m11, T m12, T m13, - T m21, T m22, T m23) - { - Row1 = new(m11, m12, m13); - Row2 = new(m21, m22, m23); - } - - /// - /// Constructs a from the given rows. - /// - public Matrix2X3(Vector3D row1, Vector3D row2) - { - Row1 = row1; - Row2 = row2; - } - /// Constructs a from the given . /// The source . public Matrix2X3(Matrix3X2 value) @@ -201,48 +71,6 @@ public readonly bool IsIdentity Scalar.Equal(M12, Scalar.Zero) && Scalar.Equal(M13, Scalar.Zero) && Scalar.Equal(M21, Scalar.Zero) && Scalar.Equal(M23, Scalar.Zero); - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - public static unsafe Matrix2X3 operator +(Matrix2X3 value1, Matrix2X3 value2) - { - return new(value1.Row1 + value2.Row1, value1.Row2 + value2.Row2); - } - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are equal; False otherwise. - public static unsafe bool operator ==(Matrix2X3 value1, Matrix2X3 value2) - { - return Scalar.Equal(value1.M11, value2.M11) && Scalar.Equal(value1.M22, value2.M22) && - // Check diagonal elements first for early out. - Scalar.Equal(value1.M12, value2.M12) && Scalar.Equal(value1.M13, value2.M13) && - Scalar.Equal(value1.M21, value2.M21) && Scalar.Equal(value1.M23, value2.M23); - } - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are not equal; False if they are equal. - public static unsafe bool operator !=(Matrix2X3 value1, Matrix2X3 value2) - { - return Scalar.NotEqual(value1.M11, value2.M11) || - Scalar.NotEqual(value1.M22, value2.M22) || // Check diagonal elements first for early out. - Scalar.NotEqual(value1.M12, value2.M12) || Scalar.NotEqual(value1.M13, value2.M13) || - Scalar.NotEqual(value1.M21, value2.M21) || Scalar.NotEqual(value1.M23, value2.M23); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix2X3 operator *(Matrix2X3 value1, Matrix3X3 value2) - { - return new(value1.M11 * value2.Row1 + value1.M12 * value2.Row2 + value1.M13 * value2.Row3, value1.M21 * value2.Row1 + value1.M22 * value2.Row2 + value1.M23 * value2.Row3); - } - /// Multiplies a vector by a matrix. /// The vector. /// The matrix. @@ -252,24 +80,6 @@ public readonly bool IsIdentity return value1.X * value2.Row1 + value1.Y * value2.Row2; } - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix2X3 operator *(Matrix2X2 value1, Matrix2X3 value2) - { - return new(value1.M11 * value2.Row1 + value1.M12 * value2.Row2, value1.M21 * value2.Row1 + value2.M22 * value2.Row2); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix2X2 operator *(Matrix2X3 value1, Matrix3X2 value2) - { - return new(value1.M11 * value2.Row1 + value1.M12 * value2.Row2, value1.M21 * value2.Row1 + value1.M22 * value2.Row2); - } - /// Multiplies a matrix by a scalar value. /// The source matrix. /// The scaling factor. @@ -279,53 +89,6 @@ public readonly bool IsIdentity return new(value1.Row1 * value2, value1.Row2 * value2); } - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static unsafe Matrix2X3 operator -(Matrix2X3 value1, Matrix2X3 value2) - { - return new(value1.Row1 - value2.Row1, value1.Row2 - value2.Row2); - } - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static unsafe Matrix2X3 operator -(Matrix2X3 value) - { - return new(-value.Row1, -value.Row2); - } - - /// Returns a boolean indicating whether the given Object is equal to this matrix instance. - /// The Object to compare against. - /// True if the Object is equal to this matrix; False otherwise. - [MethodImpl((MethodImplOptions) 768)] - public override readonly bool Equals(object? obj) - => (obj is Matrix2X3 other) && Equals(other); - - /// Returns a boolean indicating whether this matrix instance is equal to the other given matrix. - /// The matrix to compare this instance to. - /// True if the matrices are equal; False otherwise. - public readonly bool Equals(Matrix2X3 other) - => this == other; - - /// Returns the hash code for this instance. - /// The hash code. - public override readonly int GetHashCode() - { - HashCode hash = default; - - hash.Add(M11); - hash.Add(M12); - hash.Add(M13); - - hash.Add(M21); - hash.Add(M22); - hash.Add(M23); - - return hash.ToHashCode(); - } - /// Returns a String representing this matrix instance. /// The string representation. public override readonly string ToString() @@ -454,7 +217,7 @@ public static explicit operator Matrix2X3(Matrix2X3 from) /// /// The type to cast to /// The casted matrix - public Matrix2X3 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Matrix2X3 As() where TOther : INumberBase { return new(Row1.As(), Row2.As()); } diff --git a/sources/Maths/Maths/Matrix2X3.gen.cs b/sources/Maths/Maths/Matrix2X3.gen.cs index 2039da3a7d..7447bdd571 100644 --- a/sources/Maths/Maths/Matrix2X3.gen.cs +++ b/sources/Maths/Maths/Matrix2X3.gen.cs @@ -2,22 +2,54 @@ namespace Silk.NET.Maths { using System.Diagnostics.CodeAnalysis; using System.Numerics; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; public partial struct Matrix2X3 : IEquatable> where T : INumberBase { /// The 1st row of the matrix represented as a vector. + [IgnoreDataMember] public Vector3D Row1; /// The 2nd row of the matrix represented as a vector. + [IgnoreDataMember] public Vector3D Row2; + /// The 1st column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector2D Column1 => new(Row1.X, Row2.X); + + /// The 2nd column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector2D Column2 => new(Row1.Y, Row2.Y); + + /// The 3rd column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector2D Column3 => new(Row1.Z, Row2.Z); + /// /// Constructs a from the given rows. /// - public Matrix2X3(Vector3D row1, Vector3D row2) => (Row1, Row2) = (row1, row2); + public Matrix2X3(Vector3D row1, Vector3D row2) => + (Row1, Row2) = (row1, row2); + + /// + /// Constructs a from the given components. + /// + public Matrix2X3( + T m11, T m12, T m13, + T m21, T m22, T m23) + { + Row1 = new(m11, m12, m13); + Row2 = new(m21, m22, m23); + } + /// + /// Indexer for the rows of this matrix. + /// + /// The row to select. Zero based. [UnscopedRef] public ref Vector3D this[int row] { @@ -31,38 +63,50 @@ public ref Vector3D this[int row] return ref Row2; } - throw new ArgumentOutOfRangeException(nameof(row)); + throw new IndexOutOfRangeException(); } } + /// + /// Indexer for the values in this matrix. + /// + /// The row to select. Zero based. + /// The column to select. Zero based. [UnscopedRef] public ref T this[int row, int column] => ref this[row][column]; /// Gets the element in the 1st row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M11 => ref Row1.X; /// Gets the element in the 1st row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M12 => ref Row1.Y; /// Gets the element in the 1st row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M13 => ref Row1.Z; /// Gets the element in the 2nd row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M21 => ref Row2.X; /// Gets the element in the 2nd row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M22 => ref Row2.Y; /// Gets the element in the 2nd row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M23 => ref Row2.Z; /// + [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix2X3 other && Equals(other); /// @@ -133,9 +177,14 @@ public Matrix3X2 Transpose() => public static partial class Matrix2X3 { + /// Linearly interpolates between the corresponding values of two matrices. + /// The first source matrix. + /// The second source matrix. + /// The relative weight of the second source matrix. + /// The interpolated matrix. public static Matrix2X3 Lerp(Matrix2X3 value1, Matrix2X3 value2, T amount) where T : IFloatingPointIeee754 => - new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount), T.Lerp(value1.M13, value2.M13, amount)), - new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount), T.Lerp(value1.M23, value2.M23, amount))); + new(Vector3D.Lerp(value1.Row1, value2.Row1, amount), + Vector3D.Lerp(value1.Row2, value2.Row2, amount)); } } diff --git a/sources/Maths/Maths/Matrix2X4.Ops.cs b/sources/Maths/Maths/Matrix2X4.Ops.cs index b7402f1507..4d0f06cbd4 100644 --- a/sources/Maths/Maths/Matrix2X4.Ops.cs +++ b/sources/Maths/Maths/Matrix2X4.Ops.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.CompilerServices; namespace Silk.NET.Maths @@ -9,7 +10,7 @@ namespace Silk.NET.Maths /// /// Methods for working with /// - public static class Matrix2X4 + public static partial class Matrix2X4 { /// Adds two matrices together. /// The first source matrix. @@ -17,7 +18,7 @@ public static class Matrix2X4 /// The resulting matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X4 Add(Matrix2X4 value1, Matrix2X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { return value1 + value2; } @@ -28,7 +29,7 @@ public static Matrix2X4 Add(Matrix2X4 value1, Matrix2X4 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X4 Multiply(Matrix2X4 value1, Matrix4X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -37,7 +38,7 @@ public static Matrix2X4 Multiply(Matrix2X4 value1, Matrix4X4 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X3 Multiply(Matrix2X4 value1, Matrix4X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -46,7 +47,7 @@ public static Matrix2X3 Multiply(Matrix2X4 value1, Matrix4X3 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X2 Multiply(Matrix2X4 value1, Matrix4X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -55,7 +56,7 @@ public static Matrix2X2 Multiply(Matrix2X4 value1, Matrix4X2 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X4 Multiply(Matrix4X2 value1, Matrix2X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; @@ -65,7 +66,7 @@ public static Matrix4X4 Multiply(Matrix4X2 value1, Matrix2X4 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X4 Multiply(Matrix3X2 value1, Matrix2X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; @@ -75,7 +76,7 @@ public static Matrix3X4 Multiply(Matrix3X2 value1, Matrix2X4 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X4 Multiply(Matrix2X2 value1, Matrix2X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a vector by a matrix. @@ -84,18 +85,7 @@ public static Matrix2X4 Multiply(Matrix2X2 value1, Matrix2X4 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Vector4D Multiply(Vector2D value1, Matrix2X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; - - /// Linearly interpolates between the corresponding values of two matrices. - /// The first source matrix. - /// The second source matrix. - /// The relative weight of the second source matrix. - /// The interpolated matrix. - public static unsafe Matrix2X4 Lerp(Matrix2X4 matrix1, Matrix2X4 matrix2, T amount) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new(Vector4D.Lerp(matrix1.Row1, matrix2.Row1, amount), Vector4D.Lerp(matrix1.Row2, matrix2.Row2, amount)); - } } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Matrix2X4.cs b/sources/Maths/Maths/Matrix2X4.cs index 7e6f38eabf..51d70e9c93 100644 --- a/sources/Maths/Maths/Matrix2X4.cs +++ b/sources/Maths/Maths/Matrix2X4.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -11,8 +12,7 @@ namespace Silk.NET.Maths /// A structure encapsulating a 2x4 matrix. [Serializable] [DataContract] - public struct Matrix2X4 : IEquatable> - where T : unmanaged, IFormattable, IEquatable, IComparable + public partial struct Matrix2X4 { private static readonly Matrix2X4 _identity = new ( @@ -20,157 +20,6 @@ public struct Matrix2X4 : IEquatable> Scalar.Zero, Scalar.One, Scalar.Zero, Scalar.Zero ); - /// - /// Row 1 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Row1; - - /// - /// Row 2 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Row2; - - /// - /// Column 1 of the matrix. - /// - [IgnoreDataMember] - public Vector2D Column1 => new(M11, M21); - - /// - /// Column 2 of the matrix. - /// - [IgnoreDataMember] - public Vector2D Column2 => new(M12, M22); - - /// - /// Column 3 of the matrix. - /// - [IgnoreDataMember] - public Vector2D Column3 => new(M13, M23); - - /// - /// Column 4 of the matrix. - /// - [IgnoreDataMember] - public Vector2D Column4 => new(M14, M24); - - /// Value at row 1, column 1 of the matrix. - [DataMember] - public T M11 - { - readonly get => Row1.X; - set => Row1.X = value; - } - - /// Value at row 1, column 2 of the matrix. - [DataMember] - public T M12 - { - readonly get => Row1.Y; - set => Row1.Y = value; - } - - /// Value at row 1, column 3 of the matrix. - [DataMember] - public T M13 - { - readonly get => Row1.Z; - set => Row1.Z = value; - } - - /// Value at row 1, column 4 of the matrix. - [DataMember] - public T M14 - { - readonly get => Row1.W; - set => Row1.W = value; - } - - /// Value at row 2, column 1 of the matrix. - [DataMember] - public T M21 - { - readonly get => Row2.X; - set => Row2.X = value; - } - - /// Value at row 2, column 2 of the matrix. - [DataMember] - public T M22 - { - readonly get => Row2.Y; - set => Row2.Y = value; - } - - /// Value at row 2, column 3 of the matrix. - [DataMember] - public T M23 - { - readonly get => Row2.Z; - set => Row2.Z = value; - } - - /// Value at row 2, column 4 of the matrix. - [DataMember] - public T M24 - { - readonly get => Row2.W; - set => Row2.W = value; - } - - /// - /// Indexer for the rows of this matrix. - /// - /// The row to select. Zero based. - public unsafe Vector4D this[int x] - { - get - { - static void VerifyBounds(int i) - { - static void ThrowHelper() => throw new IndexOutOfRangeException(); - - if (i > 1 || i < 0) - ThrowHelper(); - } - - VerifyBounds(x); - return Unsafe.Add(ref Row1, x); - } - } - - /// - /// Indexer for the values in this matrix. - /// - /// The row to select. Zero based. - /// The column to select. Zero based. - public unsafe T this[int x, int j] - { - get - { - var row = this[x]; - return row[j]; - } - } - - /// - /// Constructs a from the given rows - /// - public Matrix2X4(Vector4D row1, Vector4D row2) - { - Row1 = row1; - Row2 = row2; - } - - /// Constructs a from the given components. - public Matrix2X4(T m11, T m12, T m13, T m14, T m21, T m22, T m23, T m24) - { - Row1 = new(m11, m12, m13, m14); - Row2 = new(m21, m22, m23, m24); - } - /// Constructs a from the given . /// The source . public Matrix2X4(Matrix3X2 value) @@ -223,51 +72,6 @@ public readonly bool IsIdentity Scalar.Equal(M14, Scalar.Zero) && Scalar.Equal(M21, Scalar.Zero) && Scalar.Equal(M23, Scalar.Zero) && Scalar.Equal(M24, Scalar.Zero); - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - public static unsafe Matrix2X4 operator +(Matrix2X4 value1, Matrix2X4 value2) - { - return new(value1.Row1 + value2.Row1, value1.Row2 + value2.Row2); - } - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are equal; False otherwise. - public static unsafe bool operator ==(Matrix2X4 value1, Matrix2X4 value2) - { - return Scalar.Equal(value1.M11, value2.M11) && - Scalar.Equal(value1.M22, value2.M22) && // Check diagonal elements first for early out. - Scalar.Equal(value1.M12, value2.M12) && Scalar.Equal(value1.M13, value2.M13) && - Scalar.Equal(value1.M14, value2.M14) && Scalar.Equal(value1.M21, value2.M21) && - Scalar.Equal(value1.M23, value2.M23) && Scalar.Equal(value1.M24, value2.M24); - } - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are not equal; False if they are equal. - public static unsafe bool operator !=(Matrix2X4 value1, Matrix2X4 value2) - { - return Scalar.NotEqual(value1.M11, value2.M11) || - Scalar.NotEqual(value1.M22, value2.M22) || // Check diagonal elements first for early out. - Scalar.NotEqual(value1.M12, value2.M12) || Scalar.NotEqual(value1.M13, value2.M13) || - Scalar.NotEqual(value1.M14, value2.M14) || Scalar.NotEqual(value1.M21, value2.M21) || - Scalar.NotEqual(value1.M23, value2.M23) || Scalar.NotEqual(value1.M24, value2.M24); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix2X4 operator *(Matrix2X4 value1, Matrix4X4 value2) - { - return new(value1.M11 * value2.Row1 + value1.M12 * value1.Row2 + value1.M13 * value2.Row3 + value1.M14 * value2.Row4, - value1.M21 * value2.Row1 + value1.M22 * value1.Row2 + value1.M23 * value2.Row3 + value1.M24 * value2.Row4); - } - /// Multiplies a vector by a matrix. /// The vector. /// The matrix. @@ -287,32 +91,6 @@ public readonly bool IsIdentity value1.M21 * value2.Row1 + value2.M22 * value2.Row2 + value1.M23 * value2.Row3 + value1.M24 * value2.Row4); } - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix3X4 operator *(Matrix3X2 value1, Matrix2X4 value2) - { - return new - ( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2, - value1.M31 * value2.Row1 + value1.M32 * value2.Row2 - ); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix2X4 operator *(Matrix2X2 value1, Matrix2X4 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2 - ); - } - /// Multiplies a matrix by a scalar value. /// The source matrix. /// The scaling factor. @@ -322,55 +100,6 @@ public readonly bool IsIdentity return new(value1.Row1 * value2, value1.Row2 * value2); } - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static unsafe Matrix2X4 operator -(Matrix2X4 value1, Matrix2X4 value2) - { - return new(value1.Row1 - value2.Row1, value1.Row2 - value2.Row2); - } - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static unsafe Matrix2X4 operator -(Matrix2X4 value) - { - return new(-value.Row1, -value.Row2); - } - - /// Returns a boolean indicating whether the given Object is equal to this matrix instance. - /// The Object to compare against. - /// True if the Object is equal to this matrix; False otherwise. - [MethodImpl((MethodImplOptions) 768)] - public override readonly bool Equals(object? obj) - => (obj is Matrix2X4 other) && Equals(other); - - /// Returns a boolean indicating whether this matrix instance is equal to the other given matrix. - /// The matrix to compare this instance to. - /// True if the matrices are equal; False otherwise. - public readonly bool Equals(Matrix2X4 other) - => this == other; - - /// Returns the hash code for this instance. - /// The hash code. - public override readonly int GetHashCode() - { - HashCode hash = default; - - hash.Add(M11); - hash.Add(M12); - hash.Add(M13); - hash.Add(M14); - - hash.Add(M21); - hash.Add(M22); - hash.Add(M23); - hash.Add(M24); - - return hash.ToHashCode(); - } - /// Returns a String representing this matrix instance. /// The string representation. public override readonly string ToString() @@ -553,7 +282,7 @@ public static explicit operator Matrix2X4(Matrix2X4 from) /// /// The type to cast to /// The casted matrix - public Matrix2X4 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Matrix2X4 As() where TOther : INumberBase { return new(Row1.As(), Row2.As()); } diff --git a/sources/Maths/Maths/Matrix2X4.gen.cs b/sources/Maths/Maths/Matrix2X4.gen.cs index 10496deda3..970be0f0f5 100644 --- a/sources/Maths/Maths/Matrix2X4.gen.cs +++ b/sources/Maths/Maths/Matrix2X4.gen.cs @@ -2,22 +2,58 @@ namespace Silk.NET.Maths { using System.Diagnostics.CodeAnalysis; using System.Numerics; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; public partial struct Matrix2X4 : IEquatable> where T : INumberBase { /// The 1st row of the matrix represented as a vector. + [IgnoreDataMember] public Vector4D Row1; /// The 2nd row of the matrix represented as a vector. + [IgnoreDataMember] public Vector4D Row2; + /// The 1st column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector2D Column1 => new(Row1.X, Row2.X); + + /// The 2nd column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector2D Column2 => new(Row1.Y, Row2.Y); + + /// The 3rd column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector2D Column3 => new(Row1.Z, Row2.Z); + + /// The 4th column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector2D Column4 => new(Row1.W, Row2.W); + /// /// Constructs a from the given rows. /// - public Matrix2X4(Vector4D row1, Vector4D row2) => (Row1, Row2) = (row1, row2); + public Matrix2X4(Vector4D row1, Vector4D row2) => + (Row1, Row2) = (row1, row2); + /// + /// Constructs a from the given components. + /// + public Matrix2X4( + T m11, T m12, T m13, T m14, + T m21, T m22, T m23, T m24) + { + Row1 = new(m11, m12, m13, m14); + Row2 = new(m21, m22, m23, m24); + } + + /// + /// Indexer for the rows of this matrix. + /// + /// The row to select. Zero based. [UnscopedRef] public ref Vector4D this[int row] { @@ -31,46 +67,60 @@ public ref Vector4D this[int row] return ref Row2; } - throw new ArgumentOutOfRangeException(nameof(row)); + throw new IndexOutOfRangeException(); } } + /// + /// Indexer for the values in this matrix. + /// + /// The row to select. Zero based. + /// The column to select. Zero based. [UnscopedRef] public ref T this[int row, int column] => ref this[row][column]; /// Gets the element in the 1st row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M11 => ref Row1.X; /// Gets the element in the 1st row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M12 => ref Row1.Y; /// Gets the element in the 1st row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M13 => ref Row1.Z; /// Gets the element in the 1st row and 4th column of the matrix. + [DataMember] [UnscopedRef] public ref T M14 => ref Row1.W; /// Gets the element in the 2nd row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M21 => ref Row2.X; /// Gets the element in the 2nd row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M22 => ref Row2.Y; /// Gets the element in the 2nd row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M23 => ref Row2.Z; /// Gets the element in the 2nd row and 4th column of the matrix. + [DataMember] [UnscopedRef] public ref T M24 => ref Row2.W; /// + [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix2X4 other && Equals(other); /// @@ -151,9 +201,14 @@ public Matrix4X2 Transpose() => public static partial class Matrix2X4 { + /// Linearly interpolates between the corresponding values of two matrices. + /// The first source matrix. + /// The second source matrix. + /// The relative weight of the second source matrix. + /// The interpolated matrix. public static Matrix2X4 Lerp(Matrix2X4 value1, Matrix2X4 value2, T amount) where T : IFloatingPointIeee754 => - new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount), T.Lerp(value1.M13, value2.M13, amount), T.Lerp(value1.M14, value2.M14, amount)), - new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount), T.Lerp(value1.M23, value2.M23, amount), T.Lerp(value1.M24, value2.M24, amount))); + new(Vector4D.Lerp(value1.Row1, value2.Row1, amount), + Vector4D.Lerp(value1.Row2, value2.Row2, amount)); } } diff --git a/sources/Maths/Maths/Matrix3X2.Ops.cs b/sources/Maths/Maths/Matrix3X2.Ops.cs index 20d7ff905a..4f5194fe0a 100644 --- a/sources/Maths/Maths/Matrix3X2.Ops.cs +++ b/sources/Maths/Maths/Matrix3X2.Ops.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.CompilerServices; namespace Silk.NET.Maths @@ -9,7 +10,7 @@ namespace Silk.NET.Maths /// /// Methods for working with /// - public static class Matrix3X2 + public static partial class Matrix3X2 { #if MATHF private const float RotationEpsilon = 0.001f * MathF.PI / 180f; // 0.1% of a degree @@ -23,14 +24,14 @@ public static class Matrix3X2 /// The matrix containing the summed values. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X2 Add(Matrix3X2 value1, Matrix3X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 + value2; /// Creates a rotation matrix using the given rotation in radians. /// The amount of rotation, in radians. /// A rotation matrix. public static Matrix3X2 CreateRotation(T radians) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { radians = Scalar.IEEERemainder(radians, Scalar.Tau); @@ -121,7 +122,7 @@ public static Matrix3X2 CreateRotation(T radians) /// The center point. /// A rotation matrix. public static Matrix3X2 CreateRotation(T radians, Vector2D centerPoint) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { radians = Scalar.IEEERemainder(radians, Scalar.Tau); @@ -210,7 +211,7 @@ public static Matrix3X2 CreateRotation(T radians, Vector2D centerPoint) /// The scale to use. /// A scaling matrix. public static Matrix3X2 CreateScale(Vector2D scales) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X2 result = Matrix3X2.Identity; @@ -225,7 +226,7 @@ public static Matrix3X2 CreateScale(Vector2D scales) /// Value to scale by on the Y-axis. /// A scaling matrix. public static Matrix3X2 CreateScale(T xScale, T yScale) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X2 result = Matrix3X2.Identity; @@ -241,7 +242,7 @@ public static Matrix3X2 CreateScale(T xScale, T yScale) /// The center point. /// A scaling matrix. public static Matrix3X2 CreateScale(T xScale, T yScale, Vector2D centerPoint) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X2 result = Matrix3X2.Identity; @@ -261,7 +262,7 @@ public static Matrix3X2 CreateScale(T xScale, T yScale, Vector2D center /// The center offset. /// A scaling matrix. public static Matrix3X2 CreateScale(Vector2D scales, Vector2D centerPoint) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X2 result = Matrix3X2.Identity; @@ -280,7 +281,7 @@ public static Matrix3X2 CreateScale(Vector2D scales, Vector2D center /// The uniform scale to use. /// A scaling matrix. public static Matrix3X2 CreateScale(T scale) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X2 result = Matrix3X2.Identity; @@ -295,7 +296,7 @@ public static Matrix3X2 CreateScale(T scale) /// The center offset. /// A scaling matrix. public static Matrix3X2 CreateScale(T scale, Vector2D centerPoint) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X2 result = Matrix3X2.Identity; @@ -315,7 +316,7 @@ public static Matrix3X2 CreateScale(T scale, Vector2D centerPoint) /// The Y angle, in radians. /// A skew matrix. public static Matrix3X2 CreateSkew(T radiansX, T radiansY) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X2 result = Matrix3X2.Identity; @@ -334,7 +335,7 @@ public static Matrix3X2 CreateSkew(T radiansX, T radiansY) /// The center point. /// A skew matrix. public static Matrix3X2 CreateSkew(T radiansX, T radiansY, Vector2D centerPoint) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X2 result = Matrix3X2.Identity; @@ -354,10 +355,10 @@ public static Matrix3X2 CreateSkew(T radiansX, T radiansY, Vector2D cen } /// Creates a translation matrix from the given vector. - /// The translation position. ` + /// The translation position. /// A translation matrix. public static Matrix3X2 CreateTranslation(Vector2D position) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X2 result = Matrix3X2.Identity; @@ -372,7 +373,7 @@ public static Matrix3X2 CreateTranslation(Vector2D position) /// The Y position. /// A translation matrix. public static Matrix3X2 CreateTranslation(T xPosition, T yPosition) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X2 result = Matrix3X2.Identity; @@ -387,11 +388,11 @@ public static Matrix3X2 CreateTranslation(T xPosition, T yPosition) /// The output matrix. /// True if the operation succeeded, False otherwise. public static bool Invert(Matrix3X2 matrix, out Matrix3X2 result) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : IFloatingPointIeee754 { T det = Scalar.Subtract(Scalar.Multiply(matrix.M11, matrix.M22), Scalar.Multiply(matrix.M21, matrix.M12)); - if (!Scalar.GreaterThanOrEqual(Scalar.Abs(det), Scalar.Epsilon)) + if (!(T.Abs(det) >= T.Epsilon)) { result = new(Scalar.NaN, Scalar.NaN, Scalar.NaN, Scalar.NaN, Scalar.NaN, Scalar.NaN); return false; @@ -413,26 +414,13 @@ public static bool Invert(Matrix3X2 matrix, out Matrix3X2 result) return true; } - /// Linearly interpolates from matrix1 to matrix2, based on the third parameter. - /// The first source matrix. - /// The second source matrix. - /// The relative weighting of matrix2. - /// The interpolated matrix. - public static Matrix3X2 Lerp(Matrix3X2 matrix1, Matrix3X2 matrix2, T amount) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new(Vector2D.Lerp(matrix1.Row1, matrix2.Row1, amount), - Vector2D.Lerp(matrix1.Row2, matrix2.Row2, amount), - Vector2D.Lerp(matrix1.Row3, matrix2.Row3, amount)); - } - /// Multiplies two matrices together and returns the resulting matrix. /// The first source matrix. /// The second source matrix. /// The product matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X2 Multiply(Matrix3X2 value1, Matrix2X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a vector by a matrix. @@ -441,7 +429,7 @@ public static Matrix3X2 Multiply(Matrix3X2 value1, Matrix2X2 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Vector2D Multiply(Vector3D value1, Matrix3X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies two matrices together and returns the resulting matrix. @@ -450,7 +438,7 @@ public static Vector2D Multiply(Vector3D value1, Matrix3X2 value2) /// The product matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X3 Multiply(Matrix3X2 value1, Matrix2X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies two matrices together and returns the resulting matrix. @@ -459,7 +447,7 @@ public static Matrix3X3 Multiply(Matrix3X2 value1, Matrix2X3 value2) /// The product matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X2 Multiply(Matrix2X3 value1, Matrix3X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies two matrices together and returns the resulting matrix. @@ -468,7 +456,7 @@ public static Matrix2X2 Multiply(Matrix2X3 value1, Matrix3X2 value2) /// The product matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X3 Multiply(Matrix2X3 value1, Matrix3X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Scales all elements in a matrix by the given scalar factor. @@ -477,7 +465,7 @@ public static Matrix2X3 Multiply(Matrix2X3 value1, Matrix3X3 value2) /// The resulting matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X2 Multiply(Matrix3X2 value1, T value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Negates the given matrix by multiplying all values by -1. @@ -485,7 +473,7 @@ public static Matrix3X2 Multiply(Matrix3X2 value1, T value2) /// The negated matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X2 Negate(Matrix3X2 value) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => -value; /// Subtracts each matrix element in value2 from its corresponding element in value1. @@ -494,7 +482,7 @@ public static Matrix3X2 Negate(Matrix3X2 value) /// The matrix containing the resulting values. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X2 Subtract(Matrix3X2 value1, Matrix3X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 - value2; } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Matrix3X2.cs b/sources/Maths/Maths/Matrix3X2.cs index 8d80e72d79..7f3224660c 100644 --- a/sources/Maths/Maths/Matrix3X2.cs +++ b/sources/Maths/Maths/Matrix3X2.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -11,9 +12,7 @@ namespace Silk.NET.Maths /// A structure encapsulating a 3x2 matrix. [Serializable] [DataContract] - public struct Matrix3X2 - : IEquatable> - where T : unmanaged, IFormattable, IComparable, IEquatable + public partial struct Matrix3X2 { private static readonly Matrix3X2 _identity = new( Scalar.One, Scalar.Zero, @@ -21,139 +20,6 @@ public struct Matrix3X2 Scalar.Zero, Scalar.Zero ); - /// - /// Row 1 of the matrix. - /// - [IgnoreDataMember] - public Vector2D Row1; - - /// - /// Row 2 of the matrix. - /// - [IgnoreDataMember] - public Vector2D Row2; - - /// - /// Row 3 of the matrix. - /// - [IgnoreDataMember] - public Vector2D Row3; - - /// - /// Column 1 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Column1 => new(Row1.X, Row2.X, Row3.X); - - /// - /// Column 2 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Column2 => new(Row1.Y, Row2.Y, Row3.Y); - - /// The first element of the first row - [DataMember] - public T M11 - { - readonly get => Row1.X; - set => Row1.X = value; - } - - /// The second element of the first row - [DataMember] - public T M12 - { - readonly get => Row1.Y; - set => Row1.Y = value; - } - - /// The first element of the second row - [DataMember] - public T M21 - { - readonly get => Row2.X; - set => Row2.X = value; - } - - /// The second element of the second row - [DataMember] - public T M22 - { - readonly get => Row2.Y; - set => Row2.Y = value; - } - - /// The first element of the third row - [DataMember] - public T M31 - { - readonly get => Row3.X; - set => Row3.X = value; - } - - /// The second element of the third row - [DataMember] - public T M32 - { - readonly get => Row3.Y; - set => Row3.Y = value; - } - - /// - /// Indexer for the rows of this matrix. - /// - /// The row to select. Zero based. - public unsafe Vector2D this[int x] - { - get - { - static void VerifyBounds(int i) - { - static void ThrowHelper() => throw new IndexOutOfRangeException(); - - if (i > 2 || i < 0) - ThrowHelper(); - } - - VerifyBounds(x); - return Unsafe.Add(ref Row1, x); - } - } - - /// - /// Indexer for the values in this matrix. - /// - /// The row to select. Zero based. - /// The column to select. Zero based. - public unsafe T this[int x, int y] - { - get - { - var row = this[x]; - return row[y]; - } - } - - /// Constructs a from the given components. - public Matrix3X2(T m11, T m12, - T m21, T m22, - T m31, T m32) - { - Row1 = new(m11, m12); - Row2 = new(m21, m22); - Row3 = new(m31, m32); - } - - /// - /// Constructs a from the given rows. - /// - public Matrix3X2(Vector2D row1, Vector2D row2, Vector2D row3) - { - Row1 = row1; - Row2 = row2; - Row3 = row3; - } - /// Constructs a from the given Matrix4x3. /// The source Matrix4x3. public Matrix3X2(Matrix4X3 value) @@ -206,54 +72,6 @@ public Matrix3X2(Matrix4X2 value) [IgnoreDataMember] public readonly bool IsIdentity => this == Identity; - /// Adds each matrix element in value1 with its corresponding element in value2. - /// The first source matrix. - /// The second source matrix. - /// The matrix containing the summed values. - public static Matrix3X2 operator +(Matrix3X2 value1, Matrix3X2 value2) - { - return new(value1.Row1 + value2.Row1, value1.Row2 + value2.Row2, value1.Row3 + value2.Row3); - } - - /// Returns a boolean indicating whether the given matrices are equal. - /// The first source matrix. - /// The second source matrix. - /// True if the matrices are equal; False otherwise. - public static bool operator ==(Matrix3X2 value1, Matrix3X2 value2) - { - return (Scalar.Equal(value1.M11, value2.M11) - && Scalar.Equal(value1.M22, value2.M22) // Check diagonal element first for early out - && Scalar.Equal(value1.M12, value2.M12) - && Scalar.Equal(value1.M21, value2.M21) - && Scalar.Equal(value1.M31, value2.M31) - && Scalar.Equal(value1.M32, value2.M32)); - } - - /// Returns a boolean indicating whether the given matrices are not equal. - /// The first source matrix. - /// The second source matrix. - /// True if the matrices are not equal; False if they are equal. - public static bool operator !=(Matrix3X2 value1, Matrix3X2 value2) - { - return (Scalar.NotEqual(value1.M11, value2.M11) - || Scalar.NotEqual(value1.M22, value2.M22) // Check diagonal element first for early out - || Scalar.NotEqual(value1.M12, value2.M12) - || Scalar.NotEqual(value1.M21, value2.M21) - || Scalar.NotEqual(value1.M31, value2.M31) - || Scalar.NotEqual(value1.M32, value2.M32)); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix3X3 operator *(Matrix3X2 value1, Matrix2X3 value2) - { - return new(value1.M11 * value2.Row1 * value1.M12 * value2.Row2, - value1.M21 * value2.Row1 * value1.M22 * value2.Row2, - value1.M31 * value2.Row1 * value1.M32 * value2.Row2); - } - /// Multiplies a vector by a matrix. /// The vector. /// The matrix. @@ -263,19 +81,6 @@ public Matrix3X2(Matrix4X2 value) return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3; } - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix3X2 operator *(Matrix3X2 value1, Matrix2X2 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2, - value1.M31 * value2.Row1 + value1.M32 * value2.Row2 - ); - } - /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -298,38 +103,6 @@ public Matrix3X2(Matrix4X2 value) return new(value1.Row1 * value2, value1.Row2 * value2, value1.Row3 * value2); } - /// Subtracts each matrix element in value2 from its corresponding element in value1. - /// The first source matrix. - /// The second source matrix. - /// The matrix containing the resulting values. - public static Matrix3X2 operator -(Matrix3X2 value1, Matrix3X2 value2) - { - return new(value1.Row1 - value2.Row1, value1.Row2 - value2.Row2, value1.Row3 - value2.Row3); - } - - /// Negates the given matrix by multiplying all values by -1. - /// The source matrix. - /// The negated matrix. - public static Matrix3X2 operator -(Matrix3X2 value) - { - return new(-value.Row1, -value.Row2, -value.Row3); - } - - /// Returns a boolean indicating whether the given Object is equal to this matrix instance. - /// The Object to compare against. - /// True if the Object is equal to this matrix; False otherwise. - [MethodImpl((MethodImplOptions) 768)] - public override readonly bool Equals(object? obj) - => (obj is Matrix3X2 other) && Equals(other); - - /// Returns a boolean indicating whether the matrix is equal to the other given matrix. - /// The other matrix to test equality against. - /// True if this matrix is equal to other; False otherwise. - public readonly bool Equals(Matrix3X2 other) - { - return this == other; - } - /// Calculates the determinant for this matrix. /// The determinant is calculated by expanding the matrix with a third column whose values are (0,0,1). /// The determinant. @@ -354,13 +127,6 @@ public readonly T GetDeterminant() return Scalar.Subtract(Scalar.Multiply(M11, M22), Scalar.Multiply(M21, M12)); } - /// Returns the hash code for this instance. - /// The hash code. - public override readonly int GetHashCode() - { - return HashCode.Combine(M11, M12, M21, M22, M31, M32); - } - /// Returns a String representing this matrix instance. /// The string representation. public override readonly string ToString() @@ -532,7 +298,7 @@ public static explicit operator Matrix3X2(Matrix3X2 from) /// /// The type to cast to /// The casted matrix - public Matrix3X2 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Matrix3X2 As() where TOther : INumberBase { return new(Row1.As(), Row2.As(), Row3.As()); } diff --git a/sources/Maths/Maths/Matrix3X2.gen.cs b/sources/Maths/Maths/Matrix3X2.gen.cs index bde0ebf4e0..1caf6ea066 100644 --- a/sources/Maths/Maths/Matrix3X2.gen.cs +++ b/sources/Maths/Maths/Matrix3X2.gen.cs @@ -2,25 +2,56 @@ namespace Silk.NET.Maths { using System.Diagnostics.CodeAnalysis; using System.Numerics; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; public partial struct Matrix3X2 : IEquatable> where T : INumberBase { /// The 1st row of the matrix represented as a vector. + [IgnoreDataMember] public Vector2D Row1; /// The 2nd row of the matrix represented as a vector. + [IgnoreDataMember] public Vector2D Row2; /// The 3rd row of the matrix represented as a vector. + [IgnoreDataMember] public Vector2D Row3; + /// The 1st column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector3D Column1 => new(Row1.X, Row2.X, Row3.X); + + /// The 2nd column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector3D Column2 => new(Row1.Y, Row2.Y, Row3.Y); + /// /// Constructs a from the given rows. /// - public Matrix3X2(Vector2D row1, Vector2D row2, Vector2D row3) => (Row1, Row2, Row3) = (row1, row2, row3); + public Matrix3X2(Vector2D row1, Vector2D row2, Vector2D row3) => + (Row1, Row2, Row3) = (row1, row2, row3); + /// + /// Constructs a from the given components. + /// + public Matrix3X2( + T m11, T m12, + T m21, T m22, + T m31, T m32) + { + Row1 = new(m11, m12); + Row2 = new(m21, m22); + Row3 = new(m31, m32); + } + + /// + /// Indexer for the rows of this matrix. + /// + /// The row to select. Zero based. [UnscopedRef] public ref Vector2D this[int row] { @@ -36,38 +67,50 @@ public ref Vector2D this[int row] return ref Row3; } - throw new ArgumentOutOfRangeException(nameof(row)); + throw new IndexOutOfRangeException(); } } + /// + /// Indexer for the values in this matrix. + /// + /// The row to select. Zero based. + /// The column to select. Zero based. [UnscopedRef] public ref T this[int row, int column] => ref this[row][column]; /// Gets the element in the 1st row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M11 => ref Row1.X; /// Gets the element in the 1st row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M12 => ref Row1.Y; /// Gets the element in the 2nd row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M21 => ref Row2.X; /// Gets the element in the 2nd row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M22 => ref Row2.Y; /// Gets the element in the 3rd row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M31 => ref Row3.X; /// Gets the element in the 3rd row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M32 => ref Row3.Y; /// + [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix3X2 other && Equals(other); /// @@ -143,10 +186,15 @@ public Matrix2X3 Transpose() => public static partial class Matrix3X2 { + /// Linearly interpolates between the corresponding values of two matrices. + /// The first source matrix. + /// The second source matrix. + /// The relative weight of the second source matrix. + /// The interpolated matrix. public static Matrix3X2 Lerp(Matrix3X2 value1, Matrix3X2 value2, T amount) where T : IFloatingPointIeee754 => - new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount)), - new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount)), - new(T.Lerp(value1.M31, value2.M31, amount), T.Lerp(value1.M32, value2.M32, amount))); + new(Vector2D.Lerp(value1.Row1, value2.Row1, amount), + Vector2D.Lerp(value1.Row2, value2.Row2, amount), + Vector2D.Lerp(value1.Row3, value2.Row3, amount)); } } diff --git a/sources/Maths/Maths/Matrix3X3.Ops.cs b/sources/Maths/Maths/Matrix3X3.Ops.cs index aa3905c23a..5a77409ea4 100644 --- a/sources/Maths/Maths/Matrix3X3.Ops.cs +++ b/sources/Maths/Maths/Matrix3X3.Ops.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.CompilerServices; namespace Silk.NET.Maths @@ -9,21 +10,22 @@ namespace Silk.NET.Maths /// /// Methods for working with /// - public static class Matrix3X3 + public static partial class Matrix3X3 { private const float BillboardEpsilon = 1e-4f; private const float DecomposeEpsilon = 0.0001f; private struct CanonicalBasis - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { public Vector3D Row0; public Vector3D Row1; public Vector3D Row2; }; + /* private struct VectorBasis - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { #pragma warning disable 649 public unsafe Vector3D* Element0; @@ -31,6 +33,7 @@ private struct VectorBasis public unsafe Vector3D* Element2; #pragma warning restore 649 } + */ /// Adds two matrices together. /// The first source matrix. @@ -38,7 +41,7 @@ private struct VectorBasis /// The resulting matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X3 Add(Matrix3X3 value1, Matrix3X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { return value1 + value2; } @@ -50,7 +53,7 @@ public static Matrix3X3 Add(Matrix3X3 value1, Matrix3X3 value2) /// The forward vector of the camera. /// The created billboard matrix public static Matrix3X3 CreateBillboard(Vector3D objectPosition, Vector3D cameraPosition, Vector3D cameraUpVector, Vector3D cameraForwardVector) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Vector3D zaxis = objectPosition - cameraPosition; var norm = zaxis.LengthSquared; @@ -75,7 +78,7 @@ public static Matrix3X3 CreateBillboard(Vector3D objectPosition, Vector /// The angle to rotate around the given axis, in radians. /// The rotation matrix. public static Matrix3X3 CreateFromAxisAngle(Vector3D axis, T angle) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { // a: angle // x, y, z: unit vector for axis. @@ -128,7 +131,7 @@ public static Matrix3X3 CreateFromAxisAngle(Vector3D axis, T angle) /// The source Quaternion. /// The rotation matrix. public static Matrix3X3 CreateFromQuaternion(Silk.NET.Maths.Legacy.Quaternion quaternion) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X3 result = Matrix3X3.Identity; @@ -165,7 +168,7 @@ public static Matrix3X3 CreateFromQuaternion(Silk.NET.Maths.Legacy.Quatern /// Angle of rotation, in radians, around the Z-axis. /// The rotation matrix. public static Matrix3X3 CreateFromYawPitchRoll(T yaw, T pitch, T roll) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Legacy.Quaternion q = Legacy.Quaternion.CreateFromYawPitchRoll(yaw, pitch, roll); return CreateFromQuaternion(q); @@ -175,7 +178,7 @@ public static Matrix3X3 CreateFromYawPitchRoll(T yaw, T pitch, T roll) /// The amount, in radians, by which to rotate around the X-axis. /// The rotation matrix. public static Matrix3X3 CreateRotationX(T radians) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X3 result = Matrix3X3.Identity; @@ -199,7 +202,7 @@ public static Matrix3X3 CreateRotationX(T radians) /// The amount, in radians, by which to rotate around the Y-axis. /// The rotation matrix. public static Matrix3X3 CreateRotationY(T radians) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X3 result = Matrix3X3.Identity; @@ -222,7 +225,7 @@ public static Matrix3X3 CreateRotationY(T radians) /// The amount, in radians, by which to rotate around the Z-axis. /// The rotation matrix. public static Matrix3X3 CreateRotationZ(T radians) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X3 result = Matrix3X3.Identity; @@ -247,7 +250,7 @@ public static Matrix3X3 CreateRotationZ(T radians) /// Value to scale by on the Z-axis. /// The scaling matrix. public static Matrix3X3 CreateScale(T xScale, T yScale, T zScale) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X3 result = Matrix3X3.Identity; result.M11 = xScale; @@ -260,7 +263,7 @@ public static Matrix3X3 CreateScale(T xScale, T yScale, T zScale) /// The vector containing the amount to scale by on each axis. /// The scaling matrix. public static Matrix3X3 CreateScale(Vector3D scales) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X3 result = Matrix3X3.Identity; result.M11 = scales.X; @@ -273,7 +276,7 @@ public static Matrix3X3 CreateScale(Vector3D scales) /// The uniform scaling factor. /// The scaling matrix. public static Matrix3X3 CreateScale(T scale) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix3X3 result = Matrix3X3.Identity; @@ -290,7 +293,7 @@ public static Matrix3X3 CreateScale(T scale) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X3 Multiply(Matrix3X3 value1, Matrix3X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -299,7 +302,7 @@ public static Matrix3X3 Multiply(Matrix3X3 value1, Matrix3X3 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X3 Multiply(Matrix2X3 value1, Matrix3X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; @@ -309,7 +312,7 @@ public static Matrix2X3 Multiply(Matrix2X3 value1, Matrix3X3 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X2 Multiply(Matrix3X3 value1, Matrix3X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; @@ -319,7 +322,7 @@ public static Matrix3X2 Multiply(Matrix3X3 value1, Matrix3X2 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X3 Multiply(Matrix4X3 value1, Matrix3X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; @@ -329,7 +332,7 @@ public static Matrix4X3 Multiply(Matrix4X3 value1, Matrix3X3 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X4 Multiply(Matrix3X3 value1, Matrix3X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by a scalar value. @@ -338,7 +341,7 @@ public static Matrix3X4 Multiply(Matrix3X3 value1, Matrix3X4 value2) /// The scaled matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X3 Multiply(Matrix3X3 value1, T value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a vector by a matrix. @@ -347,7 +350,7 @@ public static Matrix3X3 Multiply(Matrix3X3 value1, T value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Vector3D Multiply(Vector3D value1, Matrix3X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Returns a new matrix with the negated elements of the given matrix. @@ -355,7 +358,7 @@ public static Vector3D Multiply(Vector3D value1, Matrix3X3 value2) /// The negated matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X3 Negate(Matrix3X3 value) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => -value; /// Subtracts the second matrix from the first. @@ -364,9 +367,10 @@ public static Matrix3X3 Negate(Matrix3X3 value) /// The result of the subtraction. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X3 Subtract(Matrix3X3 value1, Matrix3X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 - value2; + /* /// Attempts to extract the scale, translation, and rotation components from the given scale/rotation/translation matrix. /// If successful, the out parameters will contained the extracted values. /// The source matrix. @@ -374,7 +378,7 @@ public static Matrix3X3 Subtract(Matrix3X3 value1, Matrix3X3 value2) /// The rotation component of the transformation matrix. /// True if the source matrix was successfully decomposed; False otherwise. public static bool Decompose(Matrix3X3 matrix, out Vector3D scale, out Silk.NET.Maths.Legacy.Quaternion rotation) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { bool result = true; @@ -559,28 +563,14 @@ public static bool Decompose(Matrix3X3 matrix, out Vector3D scale, out return result; } - - /// Linearly interpolates between the corresponding values of two matrices. - /// The first source matrix. - /// The second source matrix. - /// The relative weight of the second source matrix. - /// The interpolated matrix. - public static unsafe Matrix3X3 Lerp(Matrix3X3 matrix1, Matrix3X3 matrix2, T amount) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new( - Vector3D.Lerp(matrix1.Row1, matrix2.Row1, amount), - Vector3D.Lerp(matrix1.Row2, matrix2.Row2, amount), - Vector3D.Lerp(matrix1.Row3, matrix2.Row3, amount) - ); - } + */ /// Transforms the given matrix by applying the given Quaternion rotation. /// The source matrix to transform. /// The rotation to apply. /// The transformed matrix. public static Matrix3X3 Transform(Matrix3X3 value, Legacy.Quaternion rotation) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { // Compute rotation matrix. T x2 = Scalar.Add(rotation.X, rotation.X); @@ -620,7 +610,7 @@ public static Matrix3X3 Transform(Matrix3X3 value, Legacy.Quaternion /// The source matrix. /// The transposed matrix. public static unsafe Matrix3X3 Transpose(Matrix3X3 matrix) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { return new(matrix.Column1, matrix.Column2, matrix.Column3); } diff --git a/sources/Maths/Maths/Matrix3X3.cs b/sources/Maths/Maths/Matrix3X3.cs index 755697a772..b5161c146d 100644 --- a/sources/Maths/Maths/Matrix3X3.cs +++ b/sources/Maths/Maths/Matrix3X3.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -11,179 +12,8 @@ namespace Silk.NET.Maths /// A structure encapsulating a 3x3 matrix. [Serializable] [DataContract] - public struct Matrix3X3 : IEquatable> - where T : unmanaged, IFormattable, IEquatable, IComparable + public partial struct Matrix3X3 { - private static readonly Matrix3X3 _identity = new - ( - Scalar.One, Scalar.Zero, Scalar.Zero, - Scalar.Zero, Scalar.One, Scalar.Zero, - Scalar.Zero, Scalar.Zero, Scalar.One - ); - - /// - /// Row 1 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Row1; - - /// - /// Row 2 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Row2; - - /// - /// Row 3 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Row3; - - /// - /// Column 1 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Column1 => new(Row1.X, Row2.X, Row3.X); - - - /// - /// Column 2 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Column2 => new(Row1.Y, Row2.Y, Row3.Y); - - - /// - /// Column 3 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Column3 => new(Row1.Z, Row2.Z, Row3.Z); - - /// Value at row 1, column 1 of the matrix. - [DataMember] - public T M11 - { - readonly get => Row1.X; - set => Row1.X = value; - } - - /// Value at row 1, column 2 of the matrix. - [DataMember] - public T M12 - { - readonly get => Row1.Y; - set => Row1.Y = value; - } - - /// Value at row 1, column 3 of the matrix. - [DataMember] - public T M13 - { - readonly get => Row1.Z; - set => Row1.Z = value; - } - - /// Value at row 2, column 1 of the matrix. - [DataMember] - public T M21 - { - readonly get => Row2.X; - set => Row2.X = value; - } - - /// Value at row 2, column 2 of the matrix. - [DataMember] - public T M22 - { - readonly get => Row2.Y; - set => Row2.Y = value; - } - - /// Value at row 2, column 3 of the matrix. - [DataMember] - public T M23 - { - readonly get => Row2.Z; - set => Row2.Z = value; - } - - /// Value at row 3, column 1 of the matrix. - [DataMember] - public T M31 - { - readonly get => Row3.X; - set => Row3.X = value; - } - - /// Value at row 3, column 2 of the matrix. - [DataMember] - public T M32 - { - readonly get => Row3.Y; - set => Row3.Y = value; - } - - /// Value at row 3, column 3 of the matrix. - [DataMember] - public T M33 - { - readonly get => Row3.Z; - set => Row3.Z = value; - } - - /// - /// Indexer for the rows of this matrix. - /// - /// The row to select. Zero based. - public unsafe Vector3D this[int x] - { - get - { - static void VerifyBounds(int i) - { - static void ThrowHelper() => throw new IndexOutOfRangeException(); - - if (i > 2 || i < 0) - ThrowHelper(); - } - - VerifyBounds(x); - return Unsafe.Add(ref Row1, x); - } - } - - /// - /// Indexer for the values in this matrix. - /// - /// The row to select. Zero based. - /// The column to select. Zero based. - public unsafe T this[int x, int i] - { - get - { - var row = this[x]; - return row[i]; - } - } - - /// - /// Constructs a from the given rows. - /// - public Matrix3X3(Vector3D row1, Vector3D row2, Vector3D row3) - { - Row1 = row1; - Row2 = row2; - Row3 = row3; - } - - /// Constructs a from the given components. - public Matrix3X3(T m11, T m12, T m13, T m21, T m22, T m23, T m31, T m32, T m33) - { - Row1 = new(m11, m12, m13); - Row2 = new(m21, m22, m23); - Row3 = new(m31, m32, m33); - } - /// Constructs a from the given . /// The source . public Matrix3X3(Matrix3X2 value) @@ -247,9 +77,6 @@ public Matrix3X3(Matrix4X4 value) Row3 = new(value.M31, value.M32, value.M33); } - /// Returns the multiplicative identity matrix. - public static Matrix3X3 Identity => _identity; - /// Returns whether the matrix is the identity matrix. [IgnoreDataMember] public readonly bool IsIdentity @@ -259,55 +86,6 @@ public readonly bool IsIdentity Scalar.Equal(M21, Scalar.Zero) && Scalar.Equal(M23, Scalar.Zero) && Scalar.Equal(M31, Scalar.Zero) && Scalar.Equal(M32, Scalar.Zero); - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - public static unsafe Matrix3X3 operator +(Matrix3X3 value1, Matrix3X3 value2) - { - return new(value1.Row1 + value2.Row1, value1.Row2 + value2.Row2, value1.Row3 + value2.Row3); - } - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are equal; False otherwise. - public static unsafe bool operator ==(Matrix3X3 value1, Matrix3X3 value2) - { - return Scalar.Equal(value1.M11, value2.M11) && Scalar.Equal(value1.M22, value2.M22) && - Scalar.Equal(value1.M33, value2.M33) && - // Check diagonal elements first for early out. - Scalar.Equal(value1.M12, value2.M12) && Scalar.Equal(value1.M13, value2.M13) && - Scalar.Equal(value1.M21, value2.M21) && Scalar.Equal(value1.M23, value2.M23) && - Scalar.Equal(value1.M31, value2.M31) && Scalar.Equal(value1.M32, value2.M32); - } - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are not equal; False if they are equal. - public static unsafe bool operator !=(Matrix3X3 value1, Matrix3X3 value2) - { - return Scalar.NotEqual(value1.M11, value2.M11) || Scalar.NotEqual(value1.M22, value2.M22) || - Scalar.NotEqual(value1.M33, value2.M33) || // Check diagonal elements first for early out. - Scalar.NotEqual(value1.M12, value2.M12) || Scalar.NotEqual(value1.M13, value2.M13) || - Scalar.NotEqual(value1.M21, value2.M21) || Scalar.NotEqual(value1.M23, value2.M23) || - Scalar.NotEqual(value1.M31, value2.M31) || Scalar.NotEqual(value1.M32, value2.M32); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix3X3 operator *(Matrix3X3 value1, Matrix3X3 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2 + value1.M13 * value2.Row3, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2 + value1.M23 * value2.Row3, - value1.M31 * value2.Row1 + value1.M32 * value2.Row2 + value1.M33 * value2.Row3 - ); - } - /// Multiplies a vector by a matrix. /// The vector. /// The matrix. @@ -326,36 +104,6 @@ public readonly bool IsIdentity return new(value1.Row1 * value2, value1.Row2 * value2, value1.Row3 * value2); } - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static unsafe Matrix3X3 operator -(Matrix3X3 value1, Matrix3X3 value2) - { - return new(value1.Row1 - value2.Row1, value1.Row2 - value2.Row2, value1.Row3 - value2.Row3); - } - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static unsafe Matrix3X3 operator -(Matrix3X3 value) - { - return new(-value.Row1, -value.Row2, -value.Row3); - } - - /// Returns a boolean indicating whether the given Object is equal to this matrix instance. - /// The Object to compare against. - /// True if the Object is equal to this matrix; False otherwise. - [MethodImpl((MethodImplOptions) 768)] - public override readonly bool Equals(object? obj) - => (obj is Matrix3X3 other) && Equals(other); - - /// Returns a boolean indicating whether this matrix instance is equal to the other given matrix. - /// The matrix to compare this instance to. - /// True if the matrices are equal; False otherwise. - public readonly bool Equals(Matrix3X3 other) - => this == other; - /// Calculates the determinant of the matrix. /// The determinant of the matrix. public readonly T GetDeterminant() @@ -375,27 +123,6 @@ public readonly T GetDeterminant() Scalar.Multiply(c, Scalar.Subtract(Scalar.Multiply(d, h), Scalar.Multiply(e, g)))); } - /// Returns the hash code for this instance. - /// The hash code. - public override readonly int GetHashCode() - { - HashCode hash = default; - - hash.Add(M11); - hash.Add(M12); - hash.Add(M13); - - hash.Add(M21); - hash.Add(M22); - hash.Add(M23); - - hash.Add(M31); - hash.Add(M32); - hash.Add(M33); - - return hash.ToHashCode(); - } - /// Returns a String representing this matrix instance. /// The string representation. public override readonly string ToString() @@ -541,7 +268,7 @@ public static explicit operator Matrix3X3(Matrix3X3 from) /// /// The type to cast to /// The casted matrix - public Matrix3X3 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Matrix3X3 As() where TOther : INumberBase { return new(Row1.As(), Row2.As(), Row3.As()); } diff --git a/sources/Maths/Maths/Matrix3X3.gen.cs b/sources/Maths/Maths/Matrix3X3.gen.cs index df79a5c810..ad3c0b5b2a 100644 --- a/sources/Maths/Maths/Matrix3X3.gen.cs +++ b/sources/Maths/Maths/Matrix3X3.gen.cs @@ -2,31 +2,66 @@ namespace Silk.NET.Maths { using System.Diagnostics.CodeAnalysis; using System.Numerics; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; public partial struct Matrix3X3 : IEquatable> where T : INumberBase { /// The multiplicative identity matrix of size 3x3. - public static readonly Matrix3X3 Identity = new( + public static Matrix3X3 Identity { get; } = new( new(T.MultiplicativeIdentity, T.Zero, T.Zero), new(T.Zero, T.MultiplicativeIdentity, T.Zero), new(T.Zero, T.Zero, T.MultiplicativeIdentity)); /// The 1st row of the matrix represented as a vector. + [IgnoreDataMember] public Vector3D Row1; /// The 2nd row of the matrix represented as a vector. + [IgnoreDataMember] public Vector3D Row2; /// The 3rd row of the matrix represented as a vector. + [IgnoreDataMember] public Vector3D Row3; + /// The 1st column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector3D Column1 => new(Row1.X, Row2.X, Row3.X); + + /// The 2nd column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector3D Column2 => new(Row1.Y, Row2.Y, Row3.Y); + + /// The 3rd column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector3D Column3 => new(Row1.Z, Row2.Z, Row3.Z); + /// /// Constructs a from the given rows. /// - public Matrix3X3(Vector3D row1, Vector3D row2, Vector3D row3) => (Row1, Row2, Row3) = (row1, row2, row3); + public Matrix3X3(Vector3D row1, Vector3D row2, Vector3D row3) => + (Row1, Row2, Row3) = (row1, row2, row3); + + /// + /// Constructs a from the given components. + /// + public Matrix3X3( + T m11, T m12, T m13, + T m21, T m22, T m23, + T m31, T m32, T m33) + { + Row1 = new(m11, m12, m13); + Row2 = new(m21, m22, m23); + Row3 = new(m31, m32, m33); + } + /// + /// Indexer for the rows of this matrix. + /// + /// The row to select. Zero based. [UnscopedRef] public ref Vector3D this[int row] { @@ -42,50 +77,65 @@ public ref Vector3D this[int row] return ref Row3; } - throw new ArgumentOutOfRangeException(nameof(row)); + throw new IndexOutOfRangeException(); } } + /// + /// Indexer for the values in this matrix. + /// + /// The row to select. Zero based. + /// The column to select. Zero based. [UnscopedRef] public ref T this[int row, int column] => ref this[row][column]; /// Gets the element in the 1st row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M11 => ref Row1.X; /// Gets the element in the 1st row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M12 => ref Row1.Y; /// Gets the element in the 1st row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M13 => ref Row1.Z; /// Gets the element in the 2nd row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M21 => ref Row2.X; /// Gets the element in the 2nd row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M22 => ref Row2.Y; /// Gets the element in the 2nd row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M23 => ref Row2.Z; /// Gets the element in the 3rd row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M31 => ref Row3.X; /// Gets the element in the 3rd row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M32 => ref Row3.Y; /// Gets the element in the 3rd row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M33 => ref Row3.Z; /// + [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix3X3 other && Equals(other); /// @@ -170,10 +220,15 @@ public Matrix3X3 Transpose() => public static partial class Matrix3X3 { + /// Linearly interpolates between the corresponding values of two matrices. + /// The first source matrix. + /// The second source matrix. + /// The relative weight of the second source matrix. + /// The interpolated matrix. public static Matrix3X3 Lerp(Matrix3X3 value1, Matrix3X3 value2, T amount) where T : IFloatingPointIeee754 => - new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount), T.Lerp(value1.M13, value2.M13, amount)), - new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount), T.Lerp(value1.M23, value2.M23, amount)), - new(T.Lerp(value1.M31, value2.M31, amount), T.Lerp(value1.M32, value2.M32, amount), T.Lerp(value1.M33, value2.M33, amount))); + new(Vector3D.Lerp(value1.Row1, value2.Row1, amount), + Vector3D.Lerp(value1.Row2, value2.Row2, amount), + Vector3D.Lerp(value1.Row3, value2.Row3, amount)); } } diff --git a/sources/Maths/Maths/Matrix3X4.Ops.cs b/sources/Maths/Maths/Matrix3X4.Ops.cs index 3c9c07af8a..ae25df3fb3 100644 --- a/sources/Maths/Maths/Matrix3X4.Ops.cs +++ b/sources/Maths/Maths/Matrix3X4.Ops.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.CompilerServices; namespace Silk.NET.Maths @@ -9,7 +10,7 @@ namespace Silk.NET.Maths /// /// Methods for working with /// - public static class Matrix3X4 + public static partial class Matrix3X4 { /// Adds two matrices together. /// The first source matrix. @@ -17,7 +18,7 @@ public static class Matrix3X4 /// The resulting matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X4 Add(Matrix3X4 value1, Matrix3X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { return value1 + value2; } @@ -28,7 +29,7 @@ public static Matrix3X4 Add(Matrix3X4 value1, Matrix3X4 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X3 Multiply(Matrix3X4 value1, Matrix4X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -37,7 +38,7 @@ public static Matrix3X3 Multiply(Matrix3X4 value1, Matrix4X3 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X4 Multiply(Matrix3X4 value1, Matrix4X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -46,7 +47,7 @@ public static Matrix3X4 Multiply(Matrix3X4 value1, Matrix4X4 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X4 Multiply(Matrix3X3 value1, Matrix3X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; @@ -56,7 +57,7 @@ public static Matrix3X4 Multiply(Matrix3X3 value1, Matrix3X4 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X4 Multiply(Matrix4X3 value1, Matrix3X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by a scalar value. @@ -65,7 +66,7 @@ public static Matrix4X4 Multiply(Matrix4X3 value1, Matrix3X4 value2) /// The scaled matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X4 Multiply(Matrix3X4 value1, T value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a vector by a matrix. @@ -74,7 +75,7 @@ public static Matrix3X4 Multiply(Matrix3X4 value1, T value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Vector4D Multiply(Vector3D value1, Matrix3X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Returns a new matrix with the negated elements of the given matrix. @@ -82,7 +83,7 @@ public static Vector4D Multiply(Vector3D value1, Matrix3X4 value2) /// The negated matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X4 Negate(Matrix3X4 value) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => -value; /// Subtracts the second matrix from the first. @@ -91,22 +92,7 @@ public static Matrix3X4 Negate(Matrix3X4 value) /// The result of the subtraction. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X4 Subtract(Matrix3X4 value1, Matrix3X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 - value2; - - /// Linearly interpolates between the corresponding values of two matrices. - /// The first source matrix. - /// The second source matrix. - /// The relative weight of the second source matrix. - /// The interpolated matrix. - public static unsafe Matrix3X4 Lerp(Matrix3X4 matrix1, Matrix3X4 matrix2, T amount) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new( - Vector4D.Lerp(matrix1.Row1, matrix2.Row1, amount), - Vector4D.Lerp(matrix1.Row2, matrix2.Row2, amount), - Vector4D.Lerp(matrix1.Row3, matrix2.Row3, amount) - ); - } } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Matrix3X4.cs b/sources/Maths/Maths/Matrix3X4.cs index ee466c0958..966669f93b 100644 --- a/sources/Maths/Maths/Matrix3X4.cs +++ b/sources/Maths/Maths/Matrix3X4.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -11,8 +12,7 @@ namespace Silk.NET.Maths /// A structure encapsulating a 3x4 matrix. [Serializable] [DataContract] - public struct Matrix3X4 : IEquatable> - where T : unmanaged, IFormattable, IEquatable, IComparable + public partial struct Matrix3X4 { private static readonly Matrix3X4 _identity = new ( @@ -21,200 +21,6 @@ public struct Matrix3X4 : IEquatable> Scalar.Zero, Scalar.Zero, Scalar.One, Scalar.Zero ); - /// - /// Row 1 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Row1; - - /// - /// Row 2 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Row2; - - /// - /// Row 3 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Row3; - - /// - /// Column 1 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Column1 => new(Row1.X, Row2.X, Row3.X); - - /// - /// Column 2 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Column2 => new(Row1.Y, Row2.Y, Row3.Y); - - /// - /// Column 3 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Column3 => new(Row1.Z, Row2.Z, Row3.Z); - - /// - /// Column 4 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Column4 => new(Row1.W, Row2.W, Row3.W); - - /// Value at row 1, column 1 of the matrix. - [DataMember] - public T M11 - { - readonly get => Row1.X; - set => Row1.X = value; - } - - /// Value at row 1, column 2 of the matrix. - [DataMember] - public T M12 - { - readonly get => Row1.Y; - set => Row1.Y = value; - } - - /// Value at row 1, column 3 of the matrix. - [DataMember] - public T M13 - { - readonly get => Row1.Z; - set => Row1.Z = value; - } - - /// Value at row 1, column 4 of the matrix. - [DataMember] - public T M14 - { - readonly get => Row1.W; - set => Row1.W = value; - } - - /// Value at row 2, column 1 of the matrix. - [DataMember] - public T M21 - { - readonly get => Row2.X; - set => Row2.X = value; - } - - /// Value at row 2, column 2 of the matrix. - [DataMember] - public T M22 - { - readonly get => Row2.Y; - set => Row2.Y = value; - } - - /// Value at row 2, column 3 of the matrix. - [DataMember] - public T M23 - { - readonly get => Row2.Z; - set => Row2.Z = value; - } - - /// Value at row 2, column 4 of the matrix. - [DataMember] - public T M24 - { - readonly get => Row2.W; - set => Row2.W = value; - } - - /// Value at row 3, column 1 of the matrix. - [DataMember] - public T M31 - { - readonly get => Row3.X; - set => Row3.X = value; - } - - /// Value at row 3, column 2 of the matrix. - [DataMember] - public T M32 - { - readonly get => Row3.Y; - set => Row3.Y = value; - } - - /// Value at row 3, column 3 of the matrix. - [DataMember] - public T M33 - { - readonly get => Row3.Z; - set => Row3.Z = value; - } - - /// Value at row 3, column 4 of the matrix. - [DataMember] - public T M34 - { - readonly get => Row3.W; - set => Row3.W = value; - } - - /// - /// Indexer for the rows of this matrix. - /// - /// The row to select. Zero based. - public unsafe Vector4D this[int x] - { - get - { - static void VerifyBounds(int i) - { - static void ThrowHelper() => throw new IndexOutOfRangeException(); - - if (i > 2 || i < 0) - ThrowHelper(); - } - - VerifyBounds(x); - return Unsafe.Add(ref Row1, x); - } - } - - /// - /// Indexer for the values in this matrix. - /// - /// The row to select. Zero based. - /// The column to select. Zero based. - public unsafe T this[int x, int y] - { - get - { - var row = this[x]; - return row[y]; - } - } - - /// - /// Constructs a from the given rows. - /// - /// - /// - /// - public Matrix3X4(Vector4D row1, Vector4D row2, Vector4D row3) - { - Row1 = row1; - Row2 = row2; - Row3 = row3; - } - - /// Constructs a from the given components. - public Matrix3X4(T m11, T m12, T m13, T m14, T m21, T m22, T m23, T m24, T m31, T m32, T m33, T m34) - { - Row1 = new(m11, m12, m13, m14); - Row2 = new(m21, m22, m23, m24); - Row3 = new(m31, m32, m33, m34); - } - /// Constructs a from the given . /// The source . public Matrix3X4(Matrix3X2 value) @@ -283,58 +89,6 @@ public readonly bool IsIdentity Scalar.Equal(M31, Scalar.Zero) && Scalar.Equal(M32, Scalar.Zero) && Scalar.Equal(M34, Scalar.Zero); - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - public static unsafe Matrix3X4 operator +(Matrix3X4 value1, Matrix3X4 value2) - { - return new(value1.Row1 + value2.Row1, value1.Row2 + value2.Row2, value1.Row3 + value2.Row3); - } - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are equal; False otherwise. - public static unsafe bool operator ==(Matrix3X4 value1, Matrix3X4 value2) - { - return Scalar.Equal(value1.M11, value2.M11) && Scalar.Equal(value1.M22, value2.M22) && - Scalar.Equal(value1.M33, value2.M33) && // Check diagonal elements first for early out. - Scalar.Equal(value1.M12, value2.M12) && Scalar.Equal(value1.M13, value2.M13) && - Scalar.Equal(value1.M14, value2.M14) && Scalar.Equal(value1.M21, value2.M21) && - Scalar.Equal(value1.M23, value2.M23) && Scalar.Equal(value1.M24, value2.M24) && - Scalar.Equal(value1.M31, value2.M31) && Scalar.Equal(value1.M32, value2.M32) && - Scalar.Equal(value1.M34, value2.M34); - } - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are not equal; False if they are equal. - public static unsafe bool operator !=(Matrix3X4 value1, Matrix3X4 value2) - { - return Scalar.NotEqual(value1.M11, value2.M11) || Scalar.NotEqual(value1.M22, value2.M22) || - Scalar.NotEqual(value1.M33, value2.M33) || // Check diagonal elements first for early out. - Scalar.NotEqual(value1.M12, value2.M12) || Scalar.NotEqual(value1.M13, value2.M13) || - Scalar.NotEqual(value1.M14, value2.M14) || Scalar.NotEqual(value1.M21, value2.M21) || - Scalar.NotEqual(value1.M23, value2.M23) || Scalar.NotEqual(value1.M24, value2.M24) || - Scalar.NotEqual(value1.M31, value2.M31) || Scalar.NotEqual(value1.M32, value2.M32) || - Scalar.NotEqual(value1.M34, value2.M34); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix3X3 operator *(Matrix3X4 value1, Matrix4X3 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2 + value1.M13 * value2.Row3 + value1.M14 * value2.Row4, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2 + value1.M23 * value2.Row3 + value1.M24 * value2.Row4, - value1.M31 * value2.Row1 + value1.M32 * value2.Row2 + value1.M33 * value2.Row3 + value1.M34 * value2.Row4 - ); - } - /// Multiplies a vector by a matrix. /// The vector. /// The matrix. @@ -344,19 +98,6 @@ public readonly bool IsIdentity return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3; } - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix3X4 operator *(Matrix3X3 value1, Matrix3X4 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2 + value1.M13 * value2.Row3, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2 + value1.M23 * value2.Row3, - value1.M31 * value2.Row1 + value1.M32 * value2.Row2 + value1.M33 * value2.Row3 - ); - } - /// Multiplies a matrix by a scalar value. /// The source matrix. /// The scaling factor. @@ -366,60 +107,6 @@ public readonly bool IsIdentity return new(value1.Row1 * value2, value1.Row2 * value2, value1.Row3 * value2); } - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static unsafe Matrix3X4 operator -(Matrix3X4 value1, Matrix3X4 value2) - { - return new(value1.Row1 - value2.Row1, value1.Row2 - value2.Row2, value1.Row3 - value2.Row3); - } - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static unsafe Matrix3X4 operator -(Matrix3X4 value) - { - return new(-value.Row1, -value.Row2, -value.Row3); - } - - /// Returns a boolean indicating whether the given Object is equal to this matrix instance. - /// The Object to compare against. - /// True if the Object is equal to this matrix; False otherwise. - [MethodImpl((MethodImplOptions) 768)] - public override readonly bool Equals(object? obj) - => (obj is Matrix3X4 other) && Equals(other); - - /// Returns a boolean indicating whether this matrix instance is equal to the other given matrix. - /// The matrix to compare this instance to. - /// True if the matrices are equal; False otherwise. - public readonly bool Equals(Matrix3X4 other) - => this == other; - - /// Returns the hash code for this instance. - /// The hash code. - public override readonly int GetHashCode() - { - HashCode hash = default; - - hash.Add(M11); - hash.Add(M12); - hash.Add(M13); - hash.Add(M14); - - hash.Add(M21); - hash.Add(M22); - hash.Add(M23); - hash.Add(M24); - - hash.Add(M31); - hash.Add(M32); - hash.Add(M33); - hash.Add(M34); - - return hash.ToHashCode(); - } - /// Returns a String representing this matrix instance. /// The string representation. public override readonly string ToString() @@ -627,7 +314,7 @@ public static explicit operator Matrix3X4(Matrix3X4 from) /// /// The type to cast to /// The casted matrix - public Matrix3X4 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Matrix3X4 As() where TOther : INumberBase { return new(Row1.As(), Row2.As(), Row3.As()); } diff --git a/sources/Maths/Maths/Matrix3X4.gen.cs b/sources/Maths/Maths/Matrix3X4.gen.cs index 72a40e990d..fa2463be59 100644 --- a/sources/Maths/Maths/Matrix3X4.gen.cs +++ b/sources/Maths/Maths/Matrix3X4.gen.cs @@ -2,25 +2,64 @@ namespace Silk.NET.Maths { using System.Diagnostics.CodeAnalysis; using System.Numerics; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; public partial struct Matrix3X4 : IEquatable> where T : INumberBase { /// The 1st row of the matrix represented as a vector. + [IgnoreDataMember] public Vector4D Row1; /// The 2nd row of the matrix represented as a vector. + [IgnoreDataMember] public Vector4D Row2; /// The 3rd row of the matrix represented as a vector. + [IgnoreDataMember] public Vector4D Row3; + /// The 1st column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector3D Column1 => new(Row1.X, Row2.X, Row3.X); + + /// The 2nd column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector3D Column2 => new(Row1.Y, Row2.Y, Row3.Y); + + /// The 3rd column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector3D Column3 => new(Row1.Z, Row2.Z, Row3.Z); + + /// The 4th column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector3D Column4 => new(Row1.W, Row2.W, Row3.W); + /// /// Constructs a from the given rows. /// - public Matrix3X4(Vector4D row1, Vector4D row2, Vector4D row3) => (Row1, Row2, Row3) = (row1, row2, row3); + public Matrix3X4(Vector4D row1, Vector4D row2, Vector4D row3) => + (Row1, Row2, Row3) = (row1, row2, row3); + /// + /// Constructs a from the given components. + /// + public Matrix3X4( + T m11, T m12, T m13, T m14, + T m21, T m22, T m23, T m24, + T m31, T m32, T m33, T m34) + { + Row1 = new(m11, m12, m13, m14); + Row2 = new(m21, m22, m23, m24); + Row3 = new(m31, m32, m33, m34); + } + + /// + /// Indexer for the rows of this matrix. + /// + /// The row to select. Zero based. [UnscopedRef] public ref Vector4D this[int row] { @@ -36,62 +75,80 @@ public ref Vector4D this[int row] return ref Row3; } - throw new ArgumentOutOfRangeException(nameof(row)); + throw new IndexOutOfRangeException(); } } + /// + /// Indexer for the values in this matrix. + /// + /// The row to select. Zero based. + /// The column to select. Zero based. [UnscopedRef] public ref T this[int row, int column] => ref this[row][column]; /// Gets the element in the 1st row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M11 => ref Row1.X; /// Gets the element in the 1st row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M12 => ref Row1.Y; /// Gets the element in the 1st row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M13 => ref Row1.Z; /// Gets the element in the 1st row and 4th column of the matrix. + [DataMember] [UnscopedRef] public ref T M14 => ref Row1.W; /// Gets the element in the 2nd row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M21 => ref Row2.X; /// Gets the element in the 2nd row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M22 => ref Row2.Y; /// Gets the element in the 2nd row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M23 => ref Row2.Z; /// Gets the element in the 2nd row and 4th column of the matrix. + [DataMember] [UnscopedRef] public ref T M24 => ref Row2.W; /// Gets the element in the 3rd row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M31 => ref Row3.X; /// Gets the element in the 3rd row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M32 => ref Row3.Y; /// Gets the element in the 3rd row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M33 => ref Row3.Z; /// Gets the element in the 3rd row and 4th column of the matrix. + [DataMember] [UnscopedRef] public ref T M34 => ref Row3.W; /// + [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix3X4 other && Equals(other); /// @@ -186,10 +243,15 @@ public Matrix4X3 Transpose() => public static partial class Matrix3X4 { + /// Linearly interpolates between the corresponding values of two matrices. + /// The first source matrix. + /// The second source matrix. + /// The relative weight of the second source matrix. + /// The interpolated matrix. public static Matrix3X4 Lerp(Matrix3X4 value1, Matrix3X4 value2, T amount) where T : IFloatingPointIeee754 => - new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount), T.Lerp(value1.M13, value2.M13, amount), T.Lerp(value1.M14, value2.M14, amount)), - new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount), T.Lerp(value1.M23, value2.M23, amount), T.Lerp(value1.M24, value2.M24, amount)), - new(T.Lerp(value1.M31, value2.M31, amount), T.Lerp(value1.M32, value2.M32, amount), T.Lerp(value1.M33, value2.M33, amount), T.Lerp(value1.M34, value2.M34, amount))); + new(Vector4D.Lerp(value1.Row1, value2.Row1, amount), + Vector4D.Lerp(value1.Row2, value2.Row2, amount), + Vector4D.Lerp(value1.Row3, value2.Row3, amount)); } } diff --git a/sources/Maths/Maths/Matrix4X2.Ops.cs b/sources/Maths/Maths/Matrix4X2.Ops.cs index 3fa4c29020..697280fe63 100644 --- a/sources/Maths/Maths/Matrix4X2.Ops.cs +++ b/sources/Maths/Maths/Matrix4X2.Ops.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.CompilerServices; namespace Silk.NET.Maths @@ -9,7 +10,7 @@ namespace Silk.NET.Maths /// /// Methods for working with /// - public static class Matrix4X2 + public static partial class Matrix4X2 { /// Adds two matrices together. /// The first source matrix. @@ -17,7 +18,7 @@ public static class Matrix4X2 /// The resulting matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X2 Add(Matrix4X2 value1, Matrix4X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { return value1 + value2; } @@ -28,7 +29,7 @@ public static Matrix4X2 Add(Matrix4X2 value1, Matrix4X2 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X2 Multiply(Matrix4X2 value1, Matrix2X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -37,7 +38,7 @@ public static Matrix4X2 Multiply(Matrix4X2 value1, Matrix2X2 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X3 Multiply(Matrix4X2 value1, Matrix2X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -46,7 +47,7 @@ public static Matrix4X3 Multiply(Matrix4X2 value1, Matrix2X3 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X4 Multiply(Matrix4X2 value1, Matrix2X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -55,7 +56,7 @@ public static Matrix4X4 Multiply(Matrix4X2 value1, Matrix2X4 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X2 Multiply(Matrix2X4 value1, Matrix4X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -64,7 +65,7 @@ public static Matrix2X2 Multiply(Matrix2X4 value1, Matrix4X2 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X2 Multiply(Matrix3X4 value1, Matrix4X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a vector by a matrix. @@ -73,7 +74,7 @@ public static Matrix3X2 Multiply(Matrix3X4 value1, Matrix4X2 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Vector2D Multiply(Vector4D value1, Matrix4X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -82,7 +83,7 @@ public static Vector2D Multiply(Vector4D value1, Matrix4X2 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X2 Multiply(Matrix4X4 value1, Matrix4X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Returns a new matrix with the negated elements of the given matrix. @@ -90,7 +91,7 @@ public static Matrix4X2 Multiply(Matrix4X4 value1, Matrix4X2 value2) /// The negated matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X2 Negate(Matrix4X2 value) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => -value; /// Subtracts the second matrix from the first. @@ -99,12 +100,12 @@ public static Matrix4X2 Negate(Matrix4X2 value) /// The result of the subtraction. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X2 Subtract(Matrix4X2 value1, Matrix4X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 - value2; /*[MethodImpl((MethodImplOptions)768)] private static Vector128 Permute(Vector128 value, byte control) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { if (Avx.IsSupported) { @@ -120,23 +121,5 @@ private static Vector128 Permute(Vector128 value, byte control) throw new PlatformNotSupportedException(); } }*/ - - - /// Linearly interpolates between the corresponding values of two matrices. - /// The first source matrix. - /// The second source matrix. - /// The relative weight of the second source matrix. - /// The interpolated matrix. - public static unsafe Matrix4X2 Lerp(Matrix4X2 matrix1, Matrix4X2 matrix2, T amount) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new - ( - Vector2D.Lerp(matrix1.Row1, matrix2.Row1, amount), - Vector2D.Lerp(matrix1.Row2, matrix2.Row2, amount), - Vector2D.Lerp(matrix1.Row3, matrix2.Row3, amount), - Vector2D.Lerp(matrix1.Row4, matrix2.Row4, amount) - ); - } } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Matrix4X2.cs b/sources/Maths/Maths/Matrix4X2.cs index ca60eb79d5..45d2b8c231 100644 --- a/sources/Maths/Maths/Matrix4X2.cs +++ b/sources/Maths/Maths/Matrix4X2.cs @@ -4,6 +4,7 @@ using System; using System.Diagnostics; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -12,8 +13,7 @@ namespace Silk.NET.Maths /// A structure encapsulating a 4x2 matrix. [Serializable] [DataContract] - public struct Matrix4X2 : IEquatable> - where T : unmanaged, IFormattable, IEquatable, IComparable + public partial struct Matrix4X2 { private static readonly Matrix4X2 _identity = new ( @@ -23,163 +23,6 @@ public struct Matrix4X2 : IEquatable> Scalar.Zero, Scalar.Zero ); - /// - /// Row 1 of the matrix. - /// - [IgnoreDataMember] - public Vector2D Row1; - - /// - /// Row 2 of the matrix - /// - [IgnoreDataMember] - public Vector2D Row2; - - /// - /// Row 3 of the matrix - /// - [IgnoreDataMember] - public Vector2D Row3; - - /// - /// Row 4 of the matrix - /// - [IgnoreDataMember] - public Vector2D Row4; - - - - /// - /// Column 1 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Column1 => new(Row1.X, Row2.X, Row3.X, Row4.X); - - /// - /// Column 2 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Column2 => new(Row1.Y, Row2.Y, Row3.X, Row4.X); - - /// Value at row 1, column 1 of the matrix. - [DataMember] - public T M11 - { - readonly get => Row1.X; - set => Row1.X = value; - } - - /// Value at row 1, column 2 of the matrix. - [DataMember] - public T M12 - { - readonly get => Row1.Y; - set => Row1.Y = value; - } - - /// Value at row 2, column 1 of the matrix. - [DataMember] - public T M21 - { - readonly get => Row2.X; - set => Row2.X = value; - } - - /// Value at row 2, column 2 of the matrix. - [DataMember] - public T M22 - { - readonly get => Row2.Y; - set => Row2.Y = value; - } - - /// Value at row 3, column 1 of the matrix. - [DataMember] - public T M31 - { - readonly get => Row3.X; - set => Row3.X = value; - } - - /// Value at row 3, column 2 of the matrix. - [DataMember] - public T M32 - { - readonly get => Row3.Y; - set => Row3.Y = value; - } - - /// Value at row 4, column 1 of the matrix. - [DataMember] - public T M41 - { - readonly get => Row4.X; - set => Row4.X = value; - } - - /// Value at row 4, column 2 of the matrix. - [DataMember] - public T M42 - { - readonly get => Row4.Y; - set => Row4.Y = value; - } - - /// - /// Indexer for the rows of this matrix. - /// - /// The row to select. Zero based. - public unsafe Vector2D this[int x] - { - get - { - static void VerifyBounds(int i) - { - static void ThrowHelper() => throw new IndexOutOfRangeException(); - - if (i > 3 || i < 0) - ThrowHelper(); - } - - VerifyBounds(x); - return Unsafe.Add(ref Row1, x); - } - } - - /// - /// Indexer for the values in this matrix. - /// - /// The row to select. Zero based. - /// The column to select. Zero based. - public unsafe T this[int x, int y] - { - get - { - var row = this[x]; - return row[y]; - } - } - - /// - /// Constructs a from the given rows. - /// - public Matrix4X2(Vector2D row1, Vector2D row2, Vector2D row3, Vector2D row4) - { - Row1 = row1; - Row2 = row2; - Row3 = row3; - Row4 = row4; - } - - /// Constructs a from the given components. - public Matrix4X2(T m11, T m12, T m21, T m22, T m31, T m32, T m41, T m42) - { - Row1 = new(m11, m12); - Row2 = new(m21, m22); - Row3 = new(m31, m32); - Row4 = new(m41, m42); - } - /// Constructs a from the given . /// The source . public Matrix4X2(Matrix3X2 value) @@ -242,87 +85,6 @@ public readonly bool IsIdentity Scalar.Equal(M31, Scalar.Zero) && Scalar.Equal(M32, Scalar.Zero) && Scalar.Equal(M41, Scalar.Zero) && Scalar.Equal(M42, Scalar.Zero); - - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - public static unsafe Matrix4X2 operator +(Matrix4X2 value1, Matrix4X2 value2) - { - return new - ( - value1.Row1 + value2.Row1, value1.Row2 + value2.Row2, value1.Row3 + value2.Row3, - value1.Row4 + value2.Row4 - ); - } - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are equal; False otherwise. - public static unsafe bool operator ==(Matrix4X2 value1, Matrix4X2 value2) - { - return Scalar.Equal(value1.M11, value2.M11) && Scalar.Equal(value1.M22, value2.M22) && - // Check diagonal elements first for early out. - Scalar.Equal(value1.M12, value2.M12) && Scalar.Equal(value1.M21, value2.M21) && - Scalar.Equal(value1.M31, value2.M31) && Scalar.Equal(value1.M32, value2.M32) && - Scalar.Equal(value1.M41, value2.M41) && Scalar.Equal(value1.M42, value2.M42); - } - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are not equal; False if they are equal. - public static unsafe bool operator !=(Matrix4X2 value1, Matrix4X2 value2) - { - return Scalar.NotEqual(value1.M11, value2.M11) || Scalar.NotEqual(value1.M22, value2.M22) || // Check diagonal elements first for early out. - Scalar.NotEqual(value1.M12, value2.M12) || Scalar.NotEqual(value1.M21, value2.M21) || - Scalar.NotEqual(value1.M31, value2.M31) || Scalar.NotEqual(value1.M32, value2.M32) || - Scalar.NotEqual(value1.M41, value2.M41) || Scalar.NotEqual(value1.M42, value2.M42); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix4X2 operator *(Matrix4X2 value1, Matrix2X2 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2, - value1.M31 * value2.Row1 + value1.M32 * value2.Row2, - value1.M41 * value2.Row1 + value1.M42 * value2.Row2 - ); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix4X3 operator *(Matrix4X2 value1, Matrix2X3 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2, - value1.M31 * value2.Row1 + value1.M32 * value2.Row2, - value1.M41 * value2.Row1 + value1.M42 * value2.Row2 - ); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix4X4 operator *(Matrix4X2 value1, Matrix2X4 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2, - value1.M31 * value2.Row1 + value1.M32 * value2.Row2, - value1.M41 * value2.Row1 + value1.M42 * value2.Row2 - ); - } - /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -380,57 +142,6 @@ public readonly bool IsIdentity return new(value1.Row1 * value2, value1.Row2 * value2, value1.Row3 * value2, value1.Row4 * value2); } - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static unsafe Matrix4X2 operator -(Matrix4X2 value1, Matrix4X2 value2) - { - return new(value1.Row1 - value2.Row1, value1.Row2 - value2.Row2, value1.Row3 - value2.Row3, value1.Row4 - value2.Row4); - } - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static unsafe Matrix4X2 operator -(Matrix4X2 value) - { - return new(-value.Row1, -value.Row2, -value.Row3, -value.Row4); - } - - /// Returns a boolean indicating whether the given Object is equal to this matrix instance. - /// The Object to compare against. - /// True if the Object is equal to this matrix; False otherwise. - [MethodImpl((MethodImplOptions) 768)] - public override readonly bool Equals(object? obj) - => (obj is Matrix4X2 other) && Equals(other); - - /// Returns a boolean indicating whether this matrix instance is equal to the other given matrix. - /// The matrix to compare this instance to. - /// True if the matrices are equal; False otherwise. - public readonly bool Equals(Matrix4X2 other) - => this == other; - - /// Returns the hash code for this instance. - /// The hash code. - public override readonly int GetHashCode() - { - HashCode hash = default; - - hash.Add(M11); - hash.Add(M12); - - hash.Add(M21); - hash.Add(M22); - - hash.Add(M31); - hash.Add(M32); - - hash.Add(M41); - hash.Add(M42); - - return hash.ToHashCode(); - } - /// Returns a String representing this matrix instance. /// The string representation. public override readonly string ToString() @@ -615,7 +326,7 @@ public static explicit operator Matrix4X2(Matrix4X2 from) /// /// The type to cast to /// The casted matrix - public Matrix4X2 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Matrix4X2 As() where TOther : INumberBase { return new(Row1.As(), Row2.As(), Row3.As(), Row4.As()); } diff --git a/sources/Maths/Maths/Matrix4X2.gen.cs b/sources/Maths/Maths/Matrix4X2.gen.cs index 36b257c507..8bd1df9859 100644 --- a/sources/Maths/Maths/Matrix4X2.gen.cs +++ b/sources/Maths/Maths/Matrix4X2.gen.cs @@ -2,28 +2,62 @@ namespace Silk.NET.Maths { using System.Diagnostics.CodeAnalysis; using System.Numerics; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; public partial struct Matrix4X2 : IEquatable> where T : INumberBase { /// The 1st row of the matrix represented as a vector. + [IgnoreDataMember] public Vector2D Row1; /// The 2nd row of the matrix represented as a vector. + [IgnoreDataMember] public Vector2D Row2; /// The 3rd row of the matrix represented as a vector. + [IgnoreDataMember] public Vector2D Row3; /// The 4th row of the matrix represented as a vector. + [IgnoreDataMember] public Vector2D Row4; + /// The 1st column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector4D Column1 => new(Row1.X, Row2.X, Row3.X, Row4.X); + + /// The 2nd column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector4D Column2 => new(Row1.Y, Row2.Y, Row3.Y, Row4.Y); + /// /// Constructs a from the given rows. /// - public Matrix4X2(Vector2D row1, Vector2D row2, Vector2D row3, Vector2D row4) => (Row1, Row2, Row3, Row4) = (row1, row2, row3, row4); + public Matrix4X2(Vector2D row1, Vector2D row2, Vector2D row3, Vector2D row4) => + (Row1, Row2, Row3, Row4) = (row1, row2, row3, row4); + /// + /// Constructs a from the given components. + /// + public Matrix4X2( + T m11, T m12, + T m21, T m22, + T m31, T m32, + T m41, T m42) + { + Row1 = new(m11, m12); + Row2 = new(m21, m22); + Row3 = new(m31, m32); + Row4 = new(m41, m42); + } + + /// + /// Indexer for the rows of this matrix. + /// + /// The row to select. Zero based. [UnscopedRef] public ref Vector2D this[int row] { @@ -41,46 +75,60 @@ public ref Vector2D this[int row] return ref Row4; } - throw new ArgumentOutOfRangeException(nameof(row)); + throw new IndexOutOfRangeException(); } } + /// + /// Indexer for the values in this matrix. + /// + /// The row to select. Zero based. + /// The column to select. Zero based. [UnscopedRef] public ref T this[int row, int column] => ref this[row][column]; /// Gets the element in the 1st row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M11 => ref Row1.X; /// Gets the element in the 1st row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M12 => ref Row1.Y; /// Gets the element in the 2nd row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M21 => ref Row2.X; /// Gets the element in the 2nd row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M22 => ref Row2.Y; /// Gets the element in the 3rd row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M31 => ref Row3.X; /// Gets the element in the 3rd row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M32 => ref Row3.Y; /// Gets the element in the 4th row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M41 => ref Row4.X; /// Gets the element in the 4th row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M42 => ref Row4.Y; /// + [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix4X2 other && Equals(other); /// @@ -172,11 +220,16 @@ public Matrix2X4 Transpose() => public static partial class Matrix4X2 { + /// Linearly interpolates between the corresponding values of two matrices. + /// The first source matrix. + /// The second source matrix. + /// The relative weight of the second source matrix. + /// The interpolated matrix. public static Matrix4X2 Lerp(Matrix4X2 value1, Matrix4X2 value2, T amount) where T : IFloatingPointIeee754 => - new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount)), - new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount)), - new(T.Lerp(value1.M31, value2.M31, amount), T.Lerp(value1.M32, value2.M32, amount)), - new(T.Lerp(value1.M41, value2.M41, amount), T.Lerp(value1.M42, value2.M42, amount))); + new(Vector2D.Lerp(value1.Row1, value2.Row1, amount), + Vector2D.Lerp(value1.Row2, value2.Row2, amount), + Vector2D.Lerp(value1.Row3, value2.Row3, amount), + Vector2D.Lerp(value1.Row4, value2.Row4, amount)); } } diff --git a/sources/Maths/Maths/Matrix4X3.Ops.cs b/sources/Maths/Maths/Matrix4X3.Ops.cs index 09407f0f98..807192cc85 100644 --- a/sources/Maths/Maths/Matrix4X3.Ops.cs +++ b/sources/Maths/Maths/Matrix4X3.Ops.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.CompilerServices; namespace Silk.NET.Maths @@ -9,7 +10,7 @@ namespace Silk.NET.Maths /// /// Methods for working with /// - public static class Matrix4X3 + public static partial class Matrix4X3 { /// Adds two matrices together. /// The first source matrix. @@ -17,7 +18,7 @@ public static class Matrix4X3 /// The resulting matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X3 Add(Matrix4X3 value1, Matrix4X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { return value1 + value2; } @@ -28,7 +29,7 @@ public static Matrix4X3 Add(Matrix4X3 value1, Matrix4X3 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X3 Multiply(Matrix4X3 value1, Matrix3X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -37,7 +38,7 @@ public static Matrix4X3 Multiply(Matrix4X3 value1, Matrix3X3 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X4 Multiply(Matrix4X3 value1, Matrix3X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -46,7 +47,7 @@ public static Matrix4X4 Multiply(Matrix4X3 value1, Matrix3X4 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X3 Multiply(Matrix4X4 value1, Matrix4X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -55,7 +56,7 @@ public static Matrix4X3 Multiply(Matrix4X4 value1, Matrix4X3 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix3X3 Multiply(Matrix3X4 value1, Matrix4X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by a scalar value. @@ -64,7 +65,7 @@ public static Matrix3X3 Multiply(Matrix3X4 value1, Matrix4X3 value2) /// The scaled matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X3 Multiply(Matrix4X3 value1, T value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a vector by a matrix. @@ -73,7 +74,7 @@ public static Matrix4X3 Multiply(Matrix4X3 value1, T value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Vector3D Multiply(Vector4D value1, Matrix4X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Returns a new matrix with the negated elements of the given matrix. @@ -81,7 +82,7 @@ public static Vector3D Multiply(Vector4D value1, Matrix4X3 value2) /// The negated matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X3 Negate(Matrix4X3 value) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => -value; /// Subtracts the second matrix from the first. @@ -90,23 +91,7 @@ public static Matrix4X3 Negate(Matrix4X3 value) /// The result of the subtraction. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X3 Subtract(Matrix4X3 value1, Matrix4X3 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 - value2; - - /// Linearly interpolates between the corresponding values of two matrices. - /// The first source matrix. - /// The second source matrix. - /// The relative weight of the second source matrix. - /// The interpolated matrix. - public static unsafe Matrix4X3 Lerp(Matrix4X3 matrix1, Matrix4X3 matrix2, T amount) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new( - Vector3D.Lerp(matrix1.Row1, matrix2.Row1, amount), - Vector3D.Lerp(matrix1.Row2, matrix2.Row2, amount), - Vector3D.Lerp(matrix1.Row3, matrix2.Row3, amount), - Vector3D.Lerp(matrix1.Row4, matrix2.Row4, amount) - ); - } } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Matrix4X3.cs b/sources/Maths/Maths/Matrix4X3.cs index 57088ec556..3cfd7e313a 100644 --- a/sources/Maths/Maths/Matrix4X3.cs +++ b/sources/Maths/Maths/Matrix4X3.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -11,8 +12,9 @@ namespace Silk.NET.Maths /// A structure encapsulating a 4x3 matrix. [Serializable] [DataContract] - public struct Matrix4X3 : IEquatable> - where T : unmanaged, IFormattable, IEquatable, IComparable + public partial struct Matrix4X3 + : IEquatable> + where T : INumberBase { private static readonly Matrix4X3 _identity = new ( @@ -22,199 +24,6 @@ public struct Matrix4X3 : IEquatable> Scalar.Zero, Scalar.Zero, Scalar.Zero ); - /// - /// Row 1 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Row1; - - /// - /// Row 1 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Row2; - - /// - /// Row 1 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Row3; - - /// - /// Row 1 of the matrix. - /// - [IgnoreDataMember] - public Vector3D Row4; - - /// - /// Column 1 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Column1 => new(Row1.X, Row2.X, Row3.X, Row4.X); - - /// - /// Column 2 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Column2 => new(Row1.Y, Row2.Y, Row3.Y, Row4.Y); - - /// - /// Column 3 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Column3 => new(Row1.Z, Row2.Z, Row3.Z, Row4.Z); - - /// Value at row 1, column 1 of the matrix. - [DataMember] - public T M11 - { - readonly get => Row1.X; - set => Row1.X = value; - } - - /// Value at row 1, column 2 of the matrix. - [DataMember] - public T M12 - { - readonly get => Row1.Y; - set => Row1.Y = value; - } - - /// Value at row 1, column 3 of the matrix. - [DataMember] - public T M13 - { - readonly get => Row1.Z; - set => Row1.Z = value; - } - - /// Value at row 2, column 1 of the matrix. - [DataMember] - public T M21 - { - readonly get => Row2.X; - set => Row2.X = value; - } - - /// Value at row 2, column 2 of the matrix. - [DataMember] - public T M22 - { - readonly get => Row2.Y; - set => Row2.Y = value; - } - - /// Value at row 2, column 3 of the matrix. - [DataMember] - public T M23 - { - readonly get => Row2.Z; - set => Row2.Z = value; - } - - /// Value at row 3, column 1 of the matrix. - [DataMember] - public T M31 - { - readonly get => Row3.X; - set => Row3.X = value; - } - - /// Value at row 3, column 2 of the matrix. - [DataMember] - public T M32 - { - readonly get => Row3.Y; - set => Row3.Y = value; - } - - /// Value at row 3, column 3 of the matrix. - [DataMember] - public T M33 - { - readonly get => Row3.Z; - set => Row3.Z = value; - } - - /// Value at row 4, column 1 of the matrix. - [DataMember] - public T M41 - { - readonly get => Row4.X; - set => Row4.X = value; - } - - /// Value at row 4, column 2 of the matrix. - [DataMember] - public T M42 - { - readonly get => Row4.Y; - set => Row4.Y = value; - } - - /// Value at row 4, column 3 of the matrix. - [DataMember] - public T M43 - { - readonly get => Row4.Z; - set => Row4.Z = value; - } - - /// - /// Indexer for the rows of this matrix. - /// - /// The row to select. Zero based. - public unsafe Vector3D this[int x] - { - get - { - static void VerifyBounds(int i) - { - static void ThrowHelper() => throw new IndexOutOfRangeException(); - - if (i > 3 || i < 0) - ThrowHelper(); - } - - VerifyBounds(x); - return Unsafe.Add(ref Row1, x); - } - } - - /// - /// Indexer for the values in this matrix. - /// - /// The row to select. Zero based. - /// The column to select. Zero based. - public unsafe T this[int x, int i] - { - get - { - var row = this[x]; - return row[i]; - } - } - - /// - /// Constructs a from the given rows. - /// - public Matrix4X3(Vector3D row1, Vector3D row2, Vector3D row3, Vector3D row4) - { - Row1 = row1; - Row2 = row2; - Row3 = row3; - Row4 = row4; - } - - /// Constructs a from the given components. - public Matrix4X3(T m11, T m12, T m13, T m21, T m22, T m23, T m31, T m32, T m33, T m41, T m42, T m43) - { - Row1 = new(m11, m12, m13); - Row2 = new(m21, m22, m23); - Row3 = new(m31, m32, m33); - Row4 = new(m41, m42, m43); - } - /// Constructs a from the given . /// The source . public Matrix4X3(Matrix3X2 value) @@ -299,73 +108,6 @@ public readonly bool IsIdentity Scalar.Equal(M41, Scalar.Zero) && Scalar.Equal(M42, Scalar.Zero) && Scalar.Equal(M43, Scalar.Zero); - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - public static unsafe Matrix4X3 operator +(Matrix4X3 value1, Matrix4X3 value2) - { - return new(value1.Row1 + value2.Row1, value1.Row2 + value2.Row2, value1.Row3 + value2.Row3, value1.Row4 + value2.Row4); - } - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are equal; False otherwise. - public static unsafe bool operator ==(Matrix4X3 value1, Matrix4X3 value2) - { - return Scalar.Equal(value1.M11, value2.M11) && Scalar.Equal(value1.M22, value2.M22) && - Scalar.Equal(value1.M33, value2.M33) && // Check diagonal elements first for early out. - Scalar.Equal(value1.M12, value2.M12) && Scalar.Equal(value1.M13, value2.M13) && - Scalar.Equal(value1.M21, value2.M21) && Scalar.Equal(value1.M23, value2.M23) && - Scalar.Equal(value1.M31, value2.M31) && Scalar.Equal(value1.M32, value2.M32) && - Scalar.Equal(value1.M41, value2.M41) && Scalar.Equal(value1.M42, value2.M42) && - Scalar.Equal(value1.M43, value2.M43); - } - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are not equal; False if they are equal. - public static unsafe bool operator !=(Matrix4X3 value1, Matrix4X3 value2) - { - return Scalar.NotEqual(value1.M11, value2.M11) || Scalar.NotEqual(value1.M22, value2.M22) || - Scalar.NotEqual(value1.M33, value2.M33) || // Check diagonal elements first for early out. - Scalar.NotEqual(value1.M12, value2.M12) || Scalar.NotEqual(value1.M13, value2.M13) || - Scalar.NotEqual(value1.M21, value2.M21) || Scalar.NotEqual(value1.M23, value2.M23) || - Scalar.NotEqual(value1.M31, value2.M31) || Scalar.NotEqual(value1.M32, value2.M32) || - Scalar.NotEqual(value1.M41, value2.M41) || Scalar.NotEqual(value1.M42, value2.M42) || - Scalar.NotEqual(value1.M43, value2.M43); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix4X4 operator *(Matrix4X3 value1, Matrix3X4 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2 + value1.M13 * value2.Row3, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2 + value1.M23 * value2.Row3, - value1.M31 * value2.Row1 + value1.M32 * value2.Row2 + value1.M33 * value2.Row3, - value1.M41 * value2.Row1 + value1.M42 * value2.Row2 + value1.M43 * value2.Row3 - ); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix4X3 operator *(Matrix4X3 value1, Matrix3X3 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2 + value1.M13 * value2.Row3, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2 + value1.M23 * value2.Row3, - value1.M31 * value2.Row1 + value1.M32 * value2.Row2 + value1.M33 * value2.Row3, - value1.M41 * value2.Row1 + value1.M42 * value2.Row2 + value1.M43 * value2.Row3 - ); - } - /// Multiplies a vector by a matrix. /// The vector. /// The matrix. @@ -384,66 +126,6 @@ public readonly bool IsIdentity return new(value1.Row1 * value2, value1.Row2 * value2, value1.Row3 * value2, value1.Row4 * value2); } - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static unsafe Matrix4X3 operator -(Matrix4X3 value1, Matrix4X3 value2) - { - return new( - value1.Row1 - value2.Row1, - value1.Row2 - value2.Row2, - value1.Row3 - value2.Row3, - value1.Row4 - value2.Row4 - ); - } - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static unsafe Matrix4X3 operator -(Matrix4X3 value) - { - return new(-value.Row1, -value.Row2, -value.Row3, -value.Row4); - } - - /// Returns a boolean indicating whether the given Object is equal to this matrix instance. - /// The Object to compare against. - /// True if the Object is equal to this matrix; False otherwise. - [MethodImpl((MethodImplOptions) 768)] - public override readonly bool Equals(object? obj) - => (obj is Matrix4X3 other) && Equals(other); - - /// Returns a boolean indicating whether this matrix instance is equal to the other given matrix. - /// The matrix to compare this instance to. - /// True if the matrices are equal; False otherwise. - public readonly bool Equals(Matrix4X3 other) - => this == other; - - /// Returns the hash code for this instance. - /// The hash code. - public override readonly int GetHashCode() - { - HashCode hash = default; - - hash.Add(M11); - hash.Add(M12); - hash.Add(M13); - - hash.Add(M21); - hash.Add(M22); - hash.Add(M23); - - hash.Add(M31); - hash.Add(M32); - hash.Add(M33); - - hash.Add(M41); - hash.Add(M42); - hash.Add(M43); - - return hash.ToHashCode(); - } - /// Returns a String representing this matrix instance. /// The string representation. public override readonly string ToString() @@ -676,7 +358,7 @@ public static explicit operator Matrix4X3(Matrix4X3 from) /// /// The type to cast to /// The casted matrix - public Matrix4X3 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Matrix4X3 As() where TOther : INumberBase { return new(Row1.As(), Row2.As(), Row3.As(), Row4.As()); } diff --git a/sources/Maths/Maths/Matrix4X3.gen.cs b/sources/Maths/Maths/Matrix4X3.gen.cs index ba7647e55a..7fcb883410 100644 --- a/sources/Maths/Maths/Matrix4X3.gen.cs +++ b/sources/Maths/Maths/Matrix4X3.gen.cs @@ -2,28 +2,66 @@ namespace Silk.NET.Maths { using System.Diagnostics.CodeAnalysis; using System.Numerics; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; public partial struct Matrix4X3 : IEquatable> where T : INumberBase { /// The 1st row of the matrix represented as a vector. + [IgnoreDataMember] public Vector3D Row1; /// The 2nd row of the matrix represented as a vector. + [IgnoreDataMember] public Vector3D Row2; /// The 3rd row of the matrix represented as a vector. + [IgnoreDataMember] public Vector3D Row3; /// The 4th row of the matrix represented as a vector. + [IgnoreDataMember] public Vector3D Row4; + /// The 1st column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector4D Column1 => new(Row1.X, Row2.X, Row3.X, Row4.X); + + /// The 2nd column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector4D Column2 => new(Row1.Y, Row2.Y, Row3.Y, Row4.Y); + + /// The 3rd column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector4D Column3 => new(Row1.Z, Row2.Z, Row3.Z, Row4.Z); + /// /// Constructs a from the given rows. /// - public Matrix4X3(Vector3D row1, Vector3D row2, Vector3D row3, Vector3D row4) => (Row1, Row2, Row3, Row4) = (row1, row2, row3, row4); + public Matrix4X3(Vector3D row1, Vector3D row2, Vector3D row3, Vector3D row4) => + (Row1, Row2, Row3, Row4) = (row1, row2, row3, row4); + + /// + /// Constructs a from the given components. + /// + public Matrix4X3( + T m11, T m12, T m13, + T m21, T m22, T m23, + T m31, T m32, T m33, + T m41, T m42, T m43) + { + Row1 = new(m11, m12, m13); + Row2 = new(m21, m22, m23); + Row3 = new(m31, m32, m33); + Row4 = new(m41, m42, m43); + } + /// + /// Indexer for the rows of this matrix. + /// + /// The row to select. Zero based. [UnscopedRef] public ref Vector3D this[int row] { @@ -41,62 +79,80 @@ public ref Vector3D this[int row] return ref Row4; } - throw new ArgumentOutOfRangeException(nameof(row)); + throw new IndexOutOfRangeException(); } } + /// + /// Indexer for the values in this matrix. + /// + /// The row to select. Zero based. + /// The column to select. Zero based. [UnscopedRef] public ref T this[int row, int column] => ref this[row][column]; /// Gets the element in the 1st row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M11 => ref Row1.X; /// Gets the element in the 1st row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M12 => ref Row1.Y; /// Gets the element in the 1st row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M13 => ref Row1.Z; /// Gets the element in the 2nd row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M21 => ref Row2.X; /// Gets the element in the 2nd row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M22 => ref Row2.Y; /// Gets the element in the 2nd row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M23 => ref Row2.Z; /// Gets the element in the 3rd row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M31 => ref Row3.X; /// Gets the element in the 3rd row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M32 => ref Row3.Y; /// Gets the element in the 3rd row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M33 => ref Row3.Z; /// Gets the element in the 4th row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M41 => ref Row4.X; /// Gets the element in the 4th row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M42 => ref Row4.Y; /// Gets the element in the 4th row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M43 => ref Row4.Z; /// + [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix4X3 other && Equals(other); /// @@ -197,11 +253,16 @@ public Matrix3X4 Transpose() => public static partial class Matrix4X3 { + /// Linearly interpolates between the corresponding values of two matrices. + /// The first source matrix. + /// The second source matrix. + /// The relative weight of the second source matrix. + /// The interpolated matrix. public static Matrix4X3 Lerp(Matrix4X3 value1, Matrix4X3 value2, T amount) where T : IFloatingPointIeee754 => - new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount), T.Lerp(value1.M13, value2.M13, amount)), - new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount), T.Lerp(value1.M23, value2.M23, amount)), - new(T.Lerp(value1.M31, value2.M31, amount), T.Lerp(value1.M32, value2.M32, amount), T.Lerp(value1.M33, value2.M33, amount)), - new(T.Lerp(value1.M41, value2.M41, amount), T.Lerp(value1.M42, value2.M42, amount), T.Lerp(value1.M43, value2.M43, amount))); + new(Vector3D.Lerp(value1.Row1, value2.Row1, amount), + Vector3D.Lerp(value1.Row2, value2.Row2, amount), + Vector3D.Lerp(value1.Row3, value2.Row3, amount), + Vector3D.Lerp(value1.Row4, value2.Row4, amount)); } } diff --git a/sources/Maths/Maths/Matrix4X4.Ops.cs b/sources/Maths/Maths/Matrix4X4.Ops.cs index fb74c4345a..5bc49c3d06 100644 --- a/sources/Maths/Maths/Matrix4X4.Ops.cs +++ b/sources/Maths/Maths/Matrix4X4.Ops.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.CompilerServices; namespace Silk.NET.Maths @@ -9,7 +10,7 @@ namespace Silk.NET.Maths /// /// Methods for working with /// - public static class Matrix4X4 + public static partial class Matrix4X4 { private const float BillboardEpsilon = 1e-4f; #if MATHF @@ -20,15 +21,16 @@ public static class Matrix4X4 private const float DecomposeEpsilon = 0.0001f; private struct CanonicalBasis - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { public Vector3D Row0; public Vector3D Row1; public Vector3D Row2; }; + /* private struct VectorBasis - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { #pragma warning disable 649 public unsafe Vector3D* Element0; @@ -36,6 +38,7 @@ private struct VectorBasis public unsafe Vector3D* Element2; #pragma warning restore 649 } + */ /// Adds two matrices together. /// The first source matrix. @@ -43,7 +46,7 @@ private struct VectorBasis /// The resulting matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X4 Add(Matrix4X4 value1, Matrix4X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { return value1 + value2; } @@ -55,7 +58,7 @@ public static Matrix4X4 Add(Matrix4X4 value1, Matrix4X4 value2) /// The forward vector of the camera. /// The created billboard matrix public static Matrix4X4 CreateBillboard(Vector3D objectPosition, Vector3D cameraPosition, Vector3D cameraUpVector, Vector3D cameraForwardVector) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Vector3D zaxis = objectPosition - cameraPosition; var norm = zaxis.LengthSquared; @@ -87,7 +90,7 @@ public static Matrix4X4 CreateBillboard(Vector3D objectPosition, Vector /// Forward vector of the object. /// The created billboard matrix. public static Matrix4X4 CreateConstrainedBillboard(Vector3D objectPosition, Vector3D cameraPosition, Vector3D rotateAxis, Vector3D cameraForwardVector, Vector3D objectForwardVector) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { // Treat the case when object and camera positions are too close. Vector3D faceDir = objectPosition - cameraPosition; @@ -109,17 +112,17 @@ public static Matrix4X4 CreateConstrainedBillboard(Vector3D objectPosit // Treat the case when angle between faceDir and rotateAxis is too close to 0. T dot = Vector3D.Dot(rotateAxis, faceDir); - if (Scalar.GreaterThan(Scalar.Abs(dot), Scalar.As(BillboardMinAngle))) + if (Scalar.GreaterThan(T.Abs(dot), Scalar.As(BillboardMinAngle))) { zaxis = objectForwardVector; // Make sure passed values are useful for compute. dot = Vector3D.Dot(rotateAxis, zaxis); - if (Scalar.GreaterThan(Scalar.Abs(dot), Scalar.As(BillboardMinAngle))) + if (Scalar.GreaterThan(T.Abs(dot), Scalar.As(BillboardMinAngle))) { zaxis = - Scalar.GreaterThan(Scalar.Abs(rotateAxis.Z), Scalar.As(BillboardMinAngle)) + Scalar.GreaterThan(T.Abs(rotateAxis.Z), Scalar.As(BillboardMinAngle)) ? new Vector3D(Scalar.One, Scalar.Zero, Scalar.Zero) : new Vector3D(Scalar.Zero, Scalar.Zero, Scalar.MinusOne); } @@ -145,7 +148,7 @@ public static Matrix4X4 CreateConstrainedBillboard(Vector3D objectPosit /// The angle to rotate around the given axis, in radians. /// The rotation matrix. public static Matrix4X4 CreateFromAxisAngle(Vector3D axis, T angle) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { // a: angle // x, y, z: unit vector for axis. @@ -198,7 +201,7 @@ public static Matrix4X4 CreateFromAxisAngle(Vector3D axis, T angle) /// The source Quaternion. /// The rotation matrix. public static Matrix4X4 CreateFromQuaternion(Silk.NET.Maths.Legacy.Quaternion quaternion) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; @@ -235,7 +238,7 @@ public static Matrix4X4 CreateFromQuaternion(Silk.NET.Maths.Legacy.Quatern /// Angle of rotation, in radians, around the Z-axis. /// The rotation matrix. public static Matrix4X4 CreateFromYawPitchRoll(T yaw, T pitch, T roll) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Legacy.Quaternion q = Legacy.Quaternion.CreateFromYawPitchRoll(yaw, pitch, roll); return CreateFromQuaternion(q); @@ -247,7 +250,7 @@ public static Matrix4X4 CreateFromYawPitchRoll(T yaw, T pitch, T roll) /// The direction that is "up" from the camera's point of view. /// The view matrix. public static Matrix4X4 CreateLookAt(Vector3D cameraPosition, Vector3D cameraTarget, Vector3D cameraUpVector) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Vector3D zaxis = Vector3D.Normalize(cameraPosition - cameraTarget); Vector3D xaxis = Vector3D.Normalize(Vector3D.Cross(cameraUpVector, zaxis)); @@ -281,7 +284,7 @@ public static Matrix4X4 CreateLookAt(Vector3D cameraPosition, Vector3D< /// Maximum Z-value of the view volume. /// The orthographic projection matrix. public static Matrix4X4 CreateOrthographic(T width, T height, T zNearPlane, T zFarPlane) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; @@ -302,7 +305,7 @@ public static Matrix4X4 CreateOrthographic(T width, T height, T zNearPlane /// Maximum Z-value of the view volume. /// The orthographic projection matrix. public static Matrix4X4 CreateOrthographicOffCenter(T left, T right, T bottom, T top, T zNearPlane, T zFarPlane) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; @@ -326,7 +329,7 @@ public static Matrix4X4 CreateOrthographicOffCenter(T left, T right, T bot /// Distance to the far view plane. /// The perspective projection matrix. public static Matrix4X4 CreatePerspective(T width, T height, T nearPlaneDistance, T farPlaneDistance) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { if (!Scalar.GreaterThan(nearPlaneDistance, Scalar.Zero)) throw new ArgumentOutOfRangeException(nameof(nearPlaneDistance)); @@ -362,7 +365,7 @@ public static Matrix4X4 CreatePerspective(T width, T height, T nearPlaneDi /// Distance to the far view plane. /// The perspective projection matrix. public static Matrix4X4 CreatePerspectiveFieldOfView(T fieldOfView, T aspectRatio, T nearPlaneDistance, T farPlaneDistance) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { if (!Scalar.GreaterThan(fieldOfView, Scalar.Zero) || Scalar.GreaterThanOrEqual(fieldOfView, Scalar.Pi)) throw new ArgumentOutOfRangeException(nameof(fieldOfView)); @@ -404,7 +407,7 @@ public static Matrix4X4 CreatePerspectiveFieldOfView(T fieldOfView, T aspe /// Distance to of the far view plane. /// The perspective projection matrix. public static Matrix4X4 CreatePerspectiveOffCenter(T left, T right, T bottom, T top, T nearPlaneDistance, T farPlaneDistance) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { if (!Scalar.GreaterThan(nearPlaneDistance, Scalar.Zero)) throw new ArgumentOutOfRangeException(nameof(nearPlaneDistance)); @@ -436,7 +439,7 @@ public static Matrix4X4 CreatePerspectiveOffCenter(T left, T right, T bott /// The Plane about which to create a reflection. /// A new matrix expressing the reflection. public static Matrix4X4 CreateReflection(Plane value) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { value = Plane.Normalize(value); @@ -473,7 +476,7 @@ public static Matrix4X4 CreateReflection(Plane value) /// The amount, in radians, by which to rotate around the X-axis. /// The rotation matrix. public static Matrix4X4 CreateRotationX(T radians) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; @@ -498,7 +501,7 @@ public static Matrix4X4 CreateRotationX(T radians) /// The center point. /// The rotation matrix. public static Matrix4X4 CreateRotationX(T radians, Vector3D centerPoint) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; @@ -527,7 +530,7 @@ public static Matrix4X4 CreateRotationX(T radians, Vector3D centerPoint /// The amount, in radians, by which to rotate around the Y-axis. /// The rotation matrix. public static Matrix4X4 CreateRotationY(T radians) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; @@ -551,7 +554,7 @@ public static Matrix4X4 CreateRotationY(T radians) /// The center point. /// The rotation matrix. public static Matrix4X4 CreateRotationY(T radians, Vector3D centerPoint) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; @@ -579,7 +582,7 @@ public static Matrix4X4 CreateRotationY(T radians, Vector3D centerPoint /// The amount, in radians, by which to rotate around the Z-axis. /// The rotation matrix. public static Matrix4X4 CreateRotationZ(T radians) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; @@ -603,7 +606,7 @@ public static Matrix4X4 CreateRotationZ(T radians) /// The center point. /// The rotation matrix. public static Matrix4X4 CreateRotationZ(T radians, Vector3D centerPoint) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; @@ -633,7 +636,7 @@ public static Matrix4X4 CreateRotationZ(T radians, Vector3D centerPoint /// Value to scale by on the Z-axis. /// The scaling matrix. public static Matrix4X4 CreateScale(T xScale, T yScale, T zScale) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; result.M11 = xScale; @@ -649,7 +652,7 @@ public static Matrix4X4 CreateScale(T xScale, T yScale, T zScale) /// The center point. /// The scaling matrix. public static Matrix4X4 CreateScale(T xScale, T yScale, T zScale, Vector3D centerPoint) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; @@ -670,7 +673,7 @@ public static Matrix4X4 CreateScale(T xScale, T yScale, T zScale, Vector3D /// The vector containing the amount to scale by on each axis. /// The scaling matrix. public static Matrix4X4 CreateScale(Vector3D scales) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; result.M11 = scales.X; @@ -684,7 +687,7 @@ public static Matrix4X4 CreateScale(Vector3D scales) /// The center point. /// The scaling matrix. public static Matrix4X4 CreateScale(Vector3D scales, Vector3D centerPoint) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; @@ -705,7 +708,7 @@ public static Matrix4X4 CreateScale(Vector3D scales, Vector3D center /// The uniform scaling factor. /// The scaling matrix. public static Matrix4X4 CreateScale(T scale) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; @@ -721,7 +724,7 @@ public static Matrix4X4 CreateScale(T scale) /// The center point. /// The scaling matrix. public static Matrix4X4 CreateScale(T scale, Vector3D centerPoint) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; @@ -745,7 +748,7 @@ public static Matrix4X4 CreateScale(T scale, Vector3D centerPoint) /// The Plane onto which the new matrix should flatten geometry so as to cast a shadow. /// A new Matrix that can be used to flatten geometry onto the specified plane from the specified direction. public static Matrix4X4 CreateShadow(Vector3D lightDirection, Plane plane) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Plane p = Plane.Normalize(plane); @@ -781,7 +784,7 @@ public static Matrix4X4 CreateShadow(Vector3D lightDirection, Plane /// The amount to translate in each axis. /// The translation matrix. public static Matrix4X4 CreateTranslation(Vector3D position) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; result.M41 = position.X; @@ -796,7 +799,7 @@ public static Matrix4X4 CreateTranslation(Vector3D position) /// The amount to translate on the Z-axis. /// The translation matrix. public static Matrix4X4 CreateTranslation(T xPosition, T yPosition, T zPosition) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4 result = Matrix4X4.Identity; ; result.M41 = xPosition; @@ -811,7 +814,7 @@ public static Matrix4X4 CreateTranslation(T xPosition, T yPosition, T zPos /// Upward direction of the object; usually [0, 1, 0]. /// The world matrix. public static Matrix4X4 CreateWorld(Vector3D position, Vector3D forward, Vector3D up) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Vector3D zaxis = Vector3D.Normalize(-forward); Vector3D xaxis = Vector3D.Normalize(Vector3D.Cross(up, zaxis)); @@ -845,7 +848,7 @@ public static Matrix4X4 CreateWorld(Vector3D position, Vector3D forw /// [MethodImpl((MethodImplOptions) 768)] public static unsafe bool Invert(Matrix4X4 matrix, out Matrix4X4 result) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { // This implementation is based on the DirectX Math Library XMMatrixInverse method // https://github.com/microsoft/DirectXMath/blob/master/Inc/DirectXMathMatrix.inl @@ -1137,7 +1140,7 @@ static bool SoftwareFallback(Matrix4X4 matrix, out Matrix4X4 result) T det = Scalar.Add(Scalar.Add(Scalar.Add(Scalar.Multiply(a, a11), Scalar.Multiply(b, a12)), Scalar.Multiply(c, a13)), Scalar.Multiply(d, a14)); - if (!Scalar.GreaterThanOrEqual(Scalar.Abs(det), Scalar.Epsilon)) + if (!Scalar.GreaterThanOrEqual(T.Abs(det), Scalar.Epsilon)) { result = new Matrix4X4(Scalar.NaN, Scalar.NaN, Scalar.NaN, Scalar.NaN, Scalar.NaN, Scalar.NaN, Scalar.NaN, Scalar.NaN, @@ -1195,7 +1198,7 @@ static bool SoftwareFallback(Matrix4X4 matrix, out Matrix4X4 result) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X4 Multiply(Matrix4X4 value1, Matrix4X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a vector by a matrix. @@ -1204,7 +1207,7 @@ public static Matrix4X4 Multiply(Matrix4X4 value1, Matrix4X4 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Vector4D Multiply(Vector4D value1, Matrix4X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -1213,7 +1216,7 @@ public static Vector4D Multiply(Vector4D value1, Matrix4X4 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix2X4 Multiply(Matrix2X4 value1, Matrix4X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by another matrix. @@ -1222,7 +1225,7 @@ public static Matrix2X4 Multiply(Matrix2X4 value1, Matrix4X4 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X2 Multiply(Matrix4X4 value1, Matrix4X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by a scalar value. @@ -1231,7 +1234,7 @@ public static Matrix4X2 Multiply(Matrix4X4 value1, Matrix4X2 value2) /// The scaled matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X4 Multiply(Matrix4X4 value1, T value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Returns a new matrix with the negated elements of the given matrix. @@ -1239,7 +1242,7 @@ public static Matrix4X4 Multiply(Matrix4X4 value1, T value2) /// The negated matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X4 Negate(Matrix4X4 value) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => -value; /// Subtracts the second matrix from the first. @@ -1248,7 +1251,7 @@ public static Matrix4X4 Negate(Matrix4X4 value) /// The result of the subtraction. [MethodImpl((MethodImplOptions) 768)] public static Matrix4X4 Subtract(Matrix4X4 value1, Matrix4X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 - value2; /*[MethodImpl((MethodImplOptions)768)] @@ -1269,6 +1272,7 @@ private static Vector128 Permute(Vector128 value, byte control) } }*/ + /* /// Attempts to extract the scale, translation, and rotation components from the given scale/rotation/translation matrix. /// If successful, the out parameters will contained the extracted values. /// The source matrix. @@ -1277,7 +1281,7 @@ private static Vector128 Permute(Vector128 value, byte control) /// The translation component of the transformation matrix /// True if the source matrix was successfully decomposed; False otherwise. public static bool Decompose(Matrix4X4 matrix, out Vector3D scale, out Silk.NET.Maths.Legacy.Quaternion rotation, out Vector3D translation) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { bool result = true; @@ -1467,29 +1471,14 @@ public static bool Decompose(Matrix4X4 matrix, out Vector3D scale, out return result; } - - /// Linearly interpolates between the corresponding values of two matrices. - /// The first source matrix. - /// The second source matrix. - /// The relative weight of the second source matrix. - /// The interpolated matrix. - public static unsafe Matrix4X4 Lerp(Matrix4X4 matrix1, Matrix4X4 matrix2, T amount) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new( - Vector4D.Lerp(matrix1.Row1, matrix2.Row1, amount), - Vector4D.Lerp(matrix1.Row2, matrix2.Row2, amount), - Vector4D.Lerp(matrix1.Row3, matrix2.Row3, amount), - Vector4D.Lerp(matrix1.Row4, matrix2.Row4, amount) - ); - } + */ /// Transforms the given matrix by applying the given Quaternion rotation. /// The source matrix to transform. /// The rotation to apply. /// The transformed matrix. public static Matrix4X4 Transform(Matrix4X4 value, Legacy.Quaternion rotation) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { // Compute rotation matrix. T x2 = Scalar.Add(rotation.X, rotation.X); @@ -1534,7 +1523,7 @@ public static Matrix4X4 Transform(Matrix4X4 value, Legacy.Quaternion /// The source matrix. /// The transposed matrix. public static unsafe Matrix4X4 Transpose(Matrix4X4 matrix) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { return new(matrix.Column1, matrix.Column2, matrix.Column3, matrix.Column4); } diff --git a/sources/Maths/Maths/Matrix4X4.cs b/sources/Maths/Maths/Matrix4X4.cs index 1bc8c0553a..700a86cdb5 100644 --- a/sources/Maths/Maths/Matrix4X4.cs +++ b/sources/Maths/Maths/Matrix4X4.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -11,266 +12,8 @@ namespace Silk.NET.Maths /// A structure encapsulating a 4x4 matrix. [Serializable] [DataContract] - public struct Matrix4X4 : IEquatable> - where T : unmanaged, IFormattable, IEquatable, IComparable + public partial struct Matrix4X4 { - private static readonly Matrix4X4 _identity = new - ( - Scalar.One, Scalar.Zero, Scalar.Zero, Scalar.Zero, - Scalar.Zero, Scalar.One, Scalar.Zero, Scalar.Zero, - Scalar.Zero, Scalar.Zero, Scalar.One, Scalar.Zero, - Scalar.Zero, Scalar.Zero, Scalar.Zero, Scalar.One - ); - - /// - /// Row 1 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Row1; - - /// - /// Row 2 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Row2; - - /// - /// Row 3 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Row3; - - /// - /// Row 4 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Row4; - - /// - /// Column 1 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Column1 => new(Row1.X, Row2.X, Row3.X, Row4.X); - - /// - /// Column 2 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Column2 => new(Row1.Y, Row2.Y, Row3.Y, Row4.Y); - - /// - /// Column 3 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Column3 => new(Row1.Z, Row2.Z, Row3.Z, Row4.Z); - - /// - /// Column 4 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Column4 => new(Row1.W, Row2.W, Row3.W, Row4.W); - - /// Value at row 1, column 1 of the matrix. - [DataMember] - public T M11 - { - readonly get => Row1.X; - set => Row1.X = value; - } - - /// Value at row 1, column 2 of the matrix. - [DataMember] - public T M12 - { - readonly get => Row1.Y; - set => Row1.Y = value; - } - - /// Value at row 1, column 3 of the matrix. - [DataMember] - public T M13 - { - readonly get => Row1.Z; - set => Row1.Z = value; - } - - /// Value at row 1, column 4 of the matrix. - [DataMember] - public T M14 - { - readonly get => Row1.W; - set => Row1.W = value; - } - - /// Value at row 2, column 1 of the matrix. - [DataMember] - public T M21 - { - readonly get => Row2.X; - set => Row2.X = value; - } - - /// Value at row 2, column 2 of the matrix. - [DataMember] - public T M22 - { - readonly get => Row2.Y; - set => Row2.Y = value; - } - - /// Value at row 2, column 3 of the matrix. - [DataMember] - public T M23 - { - readonly get => Row2.Z; - set => Row2.Z = value; - } - - /// Value at row 2, column 4 of the matrix. - [DataMember] - public T M24 - { - readonly get => Row2.W; - set => Row2.W = value; - } - - /// Value at row 3, column 1 of the matrix. - [DataMember] - public T M31 - { - readonly get => Row3.X; - set => Row3.X = value; - } - - /// Value at row 3, column 2 of the matrix. - [DataMember] - public T M32 - { - readonly get => Row3.Y; - set => Row3.Y = value; - } - - /// Value at row 3, column 3 of the matrix. - [DataMember] - public T M33 - { - readonly get => Row3.Z; - set => Row3.Z = value; - } - - /// Value at row 3, column 4 of the matrix. - [DataMember] - public T M34 - { - readonly get => Row3.W; - set => Row3.W = value; - } - - /// Value at row 4, column 1 of the matrix. - [DataMember] - public T M41 - { - readonly get => Row4.X; - set => Row4.X = value; - } - - /// Value at row 4, column 2 of the matrix. - [DataMember] - public T M42 - { - readonly get => Row4.Y; - set => Row4.Y = value; - } - - /// Value at row 4, column 3 of the matrix. - [DataMember] - public T M43 - { - readonly get => Row4.Z; - set => Row4.Z = value; - } - - /// Value at row 4, column 4 of the matrix. - [DataMember] - public T M44 - { - readonly get => Row4.W; - set => Row4.W = value; - } - - /// - /// Indexer for the rows of this matrix. - /// - /// The row to select. Zero based. - public unsafe Vector4D this[int x] - { - get - { - static void VerifyBounds(int i) - { - static void ThrowHelper() => throw new IndexOutOfRangeException(); - - if (i > 3 || i < 0) - ThrowHelper(); - } - - VerifyBounds(x); - return Unsafe.Add(ref Row1, x); - } - } - - /// - /// Indexer for the values in this matrix. - /// - /// The row to select. Zero based. - /// The column to select. Zero based. - public unsafe T this[int x, int y] - { - get - { - var row = this[x]; - return row[y]; - } - } - - /// - /// Constructs a from the given rows - /// - public Matrix4X4(Vector4D row1, Vector4D row2, Vector4D row3, Vector4D row4) - { - Row1 = row1; - Row2 = row2; - Row3 = row3; - Row4 = row4; - } - - /// Constructs a from the given components. - public Matrix4X4 - ( - T m11, - T m12, - T m13, - T m14, - T m21, - T m22, - T m23, - T m24, - T m31, - T m32, - T m33, - T m34, - T m41, - T m42, - T m43, - T m44 - ) - { - Row1 = new(m11, m12, m13, m14); - Row2 = new(m21, m22, m23, m24); - Row3 = new(m31, m32, m33, m34); - Row4 = new(m41, m42, m43, m44); - } - /// Constructs a from the given . /// The source . public Matrix4X4(Matrix3X2 value) @@ -331,9 +74,6 @@ public Matrix4X4(Matrix4X2 value) Row4 = new(value.M41, value.M42, default, Scalar.One); } - /// Returns the multiplicative identity matrix. - public static Matrix4X4 Identity => _identity; - /// Returns whether the matrix is the identity matrix. [IgnoreDataMember] public readonly bool IsIdentity @@ -347,67 +87,6 @@ public readonly bool IsIdentity Scalar.Equal(M34, Scalar.Zero) && Scalar.Equal(M41, Scalar.Zero) && Scalar.Equal(M42, Scalar.Zero) && Scalar.Equal(M43, Scalar.Zero); - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - public static unsafe Matrix4X4 operator +(Matrix4X4 value1, Matrix4X4 value2) - { - return new - ( - value1.Row1 + value2.Row1, value1.Row2 + value2.Row2, value1.Row3 + value2.Row3, - value1.Row4 + value2.Row4 - ); - } - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are equal; False otherwise. - public static unsafe bool operator ==(Matrix4X4 value1, Matrix4X4 value2) - { - return Scalar.Equal(value1.M11, value2.M11) && Scalar.Equal(value1.M22, value2.M22) && - Scalar.Equal(value1.M33, value2.M33) && - Scalar.Equal(value1.M44, value2.M44) && // Check diagonal elements first for early out. - Scalar.Equal(value1.M12, value2.M12) && Scalar.Equal(value1.M13, value2.M13) && - Scalar.Equal(value1.M14, value2.M14) && Scalar.Equal(value1.M21, value2.M21) && - Scalar.Equal(value1.M23, value2.M23) && Scalar.Equal(value1.M24, value2.M24) && - Scalar.Equal(value1.M31, value2.M31) && Scalar.Equal(value1.M32, value2.M32) && - Scalar.Equal(value1.M34, value2.M34) && Scalar.Equal(value1.M41, value2.M41) && - Scalar.Equal(value1.M42, value2.M42) && Scalar.Equal(value1.M43, value2.M43); - } - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are not equal; False if they are equal. - public static unsafe bool operator !=(Matrix4X4 value1, Matrix4X4 value2) - { - return Scalar.NotEqual(value1.M11, value2.M11) || Scalar.NotEqual(value1.M22, value2.M22) || - Scalar.NotEqual(value1.M33, value2.M33) || - Scalar.NotEqual(value1.M44, value2.M44) || // Check diagonal elements first for early out. - Scalar.NotEqual(value1.M12, value2.M12) || Scalar.NotEqual(value1.M13, value2.M13) || - Scalar.NotEqual(value1.M14, value2.M14) || Scalar.NotEqual(value1.M21, value2.M21) || - Scalar.NotEqual(value1.M23, value2.M23) || Scalar.NotEqual(value1.M24, value2.M24) || - Scalar.NotEqual(value1.M31, value2.M31) || Scalar.NotEqual(value1.M32, value2.M32) || - Scalar.NotEqual(value1.M34, value2.M34) || Scalar.NotEqual(value1.M41, value2.M41) || - Scalar.NotEqual(value1.M42, value2.M42) || Scalar.NotEqual(value1.M43, value2.M43); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix4X4 operator *(Matrix4X4 value1, Matrix4X4 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2 + value1.M13 * value2.Row3 + value1.M14 * value2.Row4, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2 + value1.M23 * value2.Row3 + value1.M24 * value2.Row4, - value1.M31 * value2.Row1 + value1.M32 * value2.Row2 + value1.M33 * value2.Row3 + value1.M34 * value2.Row4, - value1.M41 * value2.Row1 + value1.M42 * value2.Row2 + value1.M43 * value2.Row3 + value1.M44 * value2.Row4 - ); - } - /// Multiplies a vector by a matrix. /// The vector. /// The matrix. @@ -418,33 +97,6 @@ public readonly bool IsIdentity value1.W * value2.Row4; } - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix3X4 operator *(Matrix3X4 value1, Matrix4X4 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2 + value1.M13 * value2.Row3 + value1.M14 * value2.Row4, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2 + value1.M23 * value2.Row3 + value1.M24 * value2.Row4, - value1.M31 * value2.Row1 + value1.M32 * value2.Row2 + value1.M33 * value2.Row3 + value1.M34 * value2.Row4 - ); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix4X3 operator *(Matrix4X4 value1, Matrix4X3 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2 + value1.M13 * value2.Row3 + value1.M14 * value2.Row4, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2 + value1.M23 * value2.Row3 + value1.M24 * value2.Row4, - value1.M31 * value2.Row1 + value1.M32 * value2.Row2 + value1.M33 * value2.Row3 + value1.M34 * value2.Row4, - value1.M41 * value2.Row1 + value1.M42 * value2.Row2 + value1.M43 * value2.Row3 + value1.M44 * value2.Row4 - ); - } - /// Multiplies a matrix by a scalar value. /// The source matrix. /// The scaling factor. @@ -459,46 +111,6 @@ public readonly bool IsIdentity ); } - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static unsafe Matrix4X4 operator -(Matrix4X4 value1, Matrix4X4 value2) - { - return new( - value1.Row1 - value2.Row1, - value1.Row2 - value2.Row2, - value1.Row3 - value2.Row3, - value1.Row4 - value2.Row4 - ); - } - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static unsafe Matrix4X4 operator -(Matrix4X4 value) - { - return new( - -value.Row1, - -value.Row2, - -value.Row3, - -value.Row4 - ); - } - - /// Returns a boolean indicating whether the given Object is equal to this matrix instance. - /// The Object to compare against. - /// True if the Object is equal to this matrix; False otherwise. - [MethodImpl((MethodImplOptions) 768)] - public override readonly bool Equals(object? obj) - => (obj is Matrix4X4 other) && Equals(other); - - /// Returns a boolean indicating whether this matrix instance is equal to the other given matrix. - /// The matrix to compare this instance to. - /// True if the matrices are equal; False otherwise. - public readonly bool Equals(Matrix4X4 other) - => this == other; - /// Calculates the determinant of the matrix. /// The determinant of the matrix. public readonly T GetDeterminant() @@ -563,35 +175,6 @@ public readonly T GetDeterminant() Scalar.Multiply(g, in_jm))))); } - /// Returns the hash code for this instance. - /// The hash code. - public override readonly int GetHashCode() - { - HashCode hash = default; - - hash.Add(M11); - hash.Add(M12); - hash.Add(M13); - hash.Add(M14); - - hash.Add(M21); - hash.Add(M22); - hash.Add(M23); - hash.Add(M24); - - hash.Add(M31); - hash.Add(M32); - hash.Add(M33); - hash.Add(M34); - - hash.Add(M41); - hash.Add(M42); - hash.Add(M43); - hash.Add(M44); - - return hash.ToHashCode(); - } - /// Returns a String representing this matrix instance. /// The string representation. public override readonly string ToString() @@ -824,7 +407,7 @@ public static explicit operator Matrix4X4(Matrix4X4 from) /// /// The type to cast to /// The casted matrix - public Matrix4X4 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Matrix4X4 As() where TOther : INumberBase { return new(Row1.As(), Row2.As(), Row3.As(), Row4.As()); } diff --git a/sources/Maths/Maths/Matrix4X4.gen.cs b/sources/Maths/Maths/Matrix4X4.gen.cs new file mode 100644 index 0000000000..7fe91550bb --- /dev/null +++ b/sources/Maths/Maths/Matrix4X4.gen.cs @@ -0,0 +1,309 @@ +namespace Silk.NET.Maths +{ + using System.Diagnostics.CodeAnalysis; + using System.Numerics; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; + + public partial struct Matrix4X4 : + IEquatable> + where T : INumberBase + { + /// The multiplicative identity matrix of size 4x4. + public static Matrix4X4 Identity { get; } = new( + new(T.MultiplicativeIdentity, T.Zero, T.Zero, T.Zero), + new(T.Zero, T.MultiplicativeIdentity, T.Zero, T.Zero), + new(T.Zero, T.Zero, T.MultiplicativeIdentity, T.Zero), + new(T.Zero, T.Zero, T.Zero, T.MultiplicativeIdentity)); + + /// The 1st row of the matrix represented as a vector. + [IgnoreDataMember] + public Vector4D Row1; + + /// The 2nd row of the matrix represented as a vector. + [IgnoreDataMember] + public Vector4D Row2; + + /// The 3rd row of the matrix represented as a vector. + [IgnoreDataMember] + public Vector4D Row3; + + /// The 4th row of the matrix represented as a vector. + [IgnoreDataMember] + public Vector4D Row4; + + /// The 1st column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector4D Column1 => new(Row1.X, Row2.X, Row3.X, Row4.X); + + /// The 2nd column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector4D Column2 => new(Row1.Y, Row2.Y, Row3.Y, Row4.Y); + + /// The 3rd column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector4D Column3 => new(Row1.Z, Row2.Z, Row3.Z, Row4.Z); + + /// The 4th column of the matrix represented as a vector. + [IgnoreDataMember] + public Vector4D Column4 => new(Row1.W, Row2.W, Row3.W, Row4.W); + + /// + /// Constructs a from the given rows. + /// + public Matrix4X4(Vector4D row1, Vector4D row2, Vector4D row3, Vector4D row4) => + (Row1, Row2, Row3, Row4) = (row1, row2, row3, row4); + + /// + /// Constructs a from the given components. + /// + public Matrix4X4( + T m11, T m12, T m13, T m14, + T m21, T m22, T m23, T m24, + T m31, T m32, T m33, T m34, + T m41, T m42, T m43, T m44) + { + Row1 = new(m11, m12, m13, m14); + Row2 = new(m21, m22, m23, m24); + Row3 = new(m31, m32, m33, m34); + Row4 = new(m41, m42, m43, m44); + } + + /// + /// Indexer for the rows of this matrix. + /// + /// The row to select. Zero based. + [UnscopedRef] + public ref Vector4D this[int row] + { + get + { + switch (row) + { + case 0: + return ref Row1; + case 1: + return ref Row2; + case 2: + return ref Row3; + case 3: + return ref Row4; + } + + throw new IndexOutOfRangeException(); + } + } + + /// + /// Indexer for the values in this matrix. + /// + /// The row to select. Zero based. + /// The column to select. Zero based. + [UnscopedRef] + public ref T this[int row, int column] => ref this[row][column]; + + /// Gets the element in the 1st row and 1st column of the matrix. + [DataMember] + [UnscopedRef] + public ref T M11 => ref Row1.X; + + /// Gets the element in the 1st row and 2nd column of the matrix. + [DataMember] + [UnscopedRef] + public ref T M12 => ref Row1.Y; + + /// Gets the element in the 1st row and 3rd column of the matrix. + [DataMember] + [UnscopedRef] + public ref T M13 => ref Row1.Z; + + /// Gets the element in the 1st row and 4th column of the matrix. + [DataMember] + [UnscopedRef] + public ref T M14 => ref Row1.W; + + /// Gets the element in the 2nd row and 1st column of the matrix. + [DataMember] + [UnscopedRef] + public ref T M21 => ref Row2.X; + + /// Gets the element in the 2nd row and 2nd column of the matrix. + [DataMember] + [UnscopedRef] + public ref T M22 => ref Row2.Y; + + /// Gets the element in the 2nd row and 3rd column of the matrix. + [DataMember] + [UnscopedRef] + public ref T M23 => ref Row2.Z; + + /// Gets the element in the 2nd row and 4th column of the matrix. + [DataMember] + [UnscopedRef] + public ref T M24 => ref Row2.W; + + /// Gets the element in the 3rd row and 1st column of the matrix. + [DataMember] + [UnscopedRef] + public ref T M31 => ref Row3.X; + + /// Gets the element in the 3rd row and 2nd column of the matrix. + [DataMember] + [UnscopedRef] + public ref T M32 => ref Row3.Y; + + /// Gets the element in the 3rd row and 3rd column of the matrix. + [DataMember] + [UnscopedRef] + public ref T M33 => ref Row3.Z; + + /// Gets the element in the 3rd row and 4th column of the matrix. + [DataMember] + [UnscopedRef] + public ref T M34 => ref Row3.W; + + /// Gets the element in the 4th row and 1st column of the matrix. + [DataMember] + [UnscopedRef] + public ref T M41 => ref Row4.X; + + /// Gets the element in the 4th row and 2nd column of the matrix. + [DataMember] + [UnscopedRef] + public ref T M42 => ref Row4.Y; + + /// Gets the element in the 4th row and 3rd column of the matrix. + [DataMember] + [UnscopedRef] + public ref T M43 => ref Row4.Z; + + /// Gets the element in the 4th row and 4th column of the matrix. + [DataMember] + [UnscopedRef] + public ref T M44 => ref Row4.W; + + /// + [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] + public override bool Equals(object? obj) => obj is Matrix4X4 other && Equals(other); + + /// + public bool Equals(Matrix4X4 other) => this == other; + + /// + public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); + + /// Computes the transpose of the matrix. + public Matrix4X4 Transpose() => + new(new(M11, M21, M31, M41), + new(M12, M22, M32, M42), + new(M13, M23, M33, M43), + new(M14, M24, M34, M44)); + + /// Returns a boolean indicating whether the given two matrices are equal. + /// The first matrix to compare. + /// The second matrix to compare. + /// true if the given matrices are equal; false otherwise. + public static bool operator ==(Matrix4X4 left, Matrix4X4 right) => + left.Row1 == right.Row1 && + left.Row2 == right.Row2 && + left.Row3 == right.Row3 && + left.Row4 == right.Row4; + + /// Returns a boolean indicating whether the given two matrices are not equal. + /// The first matrix to compare. + /// The second matrix to compare. + /// true if the given matrices are not equal; false otherwise. + public static bool operator !=(Matrix4X4 left, Matrix4X4 right) => !(left == right); + + /// Adds two matrices together. + /// The first source matrix. + /// The second source matrix. + /// The result of the addition. + public static Matrix4X4 operator +(Matrix4X4 left, Matrix4X4 right) => + new(left.Row1 + right.Row1, + left.Row2 + right.Row2, + left.Row3 + right.Row3, + left.Row4 + right.Row4); + + /// Subtracts the second matrix from the first. + /// The first source matrix. + /// The second source matrix. + /// The result of the subtraction. + public static Matrix4X4 operator -(Matrix4X4 left, Matrix4X4 right) => + new(left.Row1 - right.Row1, + left.Row2 - right.Row2, + left.Row3 - right.Row3, + left.Row4 - right.Row4); + + /// Returns a new matrix with the negated elements of the given matrix. + /// The source matrix. + /// The negated matrix. + public static Matrix4X4 operator -(Matrix4X4 value) => + new(-value.Row1, + -value.Row2, + -value.Row3, + -value.Row4); + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X4 operator *(Matrix2X4 left, Matrix4X4 right) => + new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, + left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4); + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X4 operator *(Matrix3X4 left, Matrix4X4 right) => + new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, + left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, + left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4); + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X2 operator *(Matrix4X4 left, Matrix4X2 right) => + new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, + left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, + left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4, + left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3 + left.M44 * right.Row4); + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X3 operator *(Matrix4X4 left, Matrix4X3 right) => + new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, + left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, + left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4, + left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3 + left.M44 * right.Row4); + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X4 operator *(Matrix4X4 left, Matrix4X4 right) => + new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, + left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, + left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4, + left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3 + left.M44 * right.Row4); + } + + public static partial class Matrix4X4 + { + /// Linearly interpolates between the corresponding values of two matrices. + /// The first source matrix. + /// The second source matrix. + /// The relative weight of the second source matrix. + /// The interpolated matrix. + public static Matrix4X4 Lerp(Matrix4X4 value1, Matrix4X4 value2, T amount) + where T : IFloatingPointIeee754 => + new(Vector4D.Lerp(value1.Row1, value2.Row1, amount), + Vector4D.Lerp(value1.Row2, value2.Row2, amount), + Vector4D.Lerp(value1.Row3, value2.Row3, amount), + Vector4D.Lerp(value1.Row4, value2.Row4, amount)); + } +} diff --git a/sources/Maths/Maths/Matrix5X4.Ops.cs b/sources/Maths/Maths/Matrix5X4.Ops.cs index 18fe708f4e..032181692f 100644 --- a/sources/Maths/Maths/Matrix5X4.Ops.cs +++ b/sources/Maths/Maths/Matrix5X4.Ops.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.CompilerServices; namespace Silk.NET.Maths @@ -9,7 +10,7 @@ namespace Silk.NET.Maths /// /// Methods for working with /// - public static class Matrix5X4 + public static partial class Matrix5X4 { /// Adds two matrices together. /// The first source matrix. @@ -17,7 +18,7 @@ public static class Matrix5X4 /// The resulting matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix5X4 Add(Matrix5X4 value1, Matrix5X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { return value1 + value2; } @@ -28,7 +29,7 @@ public static Matrix5X4 Add(Matrix5X4 value1, Matrix5X4 value2) /// The result of the multiplication. [MethodImpl((MethodImplOptions) 768)] public static Vector4D Multiply(Vector4D value1, Matrix5X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Multiplies a matrix by a scalar value. @@ -37,7 +38,7 @@ public static Vector4D Multiply(Vector4D value1, Matrix5X4 value2) /// The scaled matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix5X4 Multiply(Matrix5X4 value1, T value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 * value2; /// Returns a new matrix with the negated elements of the given matrix. @@ -45,7 +46,7 @@ public static Matrix5X4 Multiply(Matrix5X4 value1, T value2) /// The negated matrix. [MethodImpl((MethodImplOptions) 768)] public static Matrix5X4 Negate(Matrix5X4 value) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => -value; /// Subtracts the second matrix from the first. @@ -54,24 +55,7 @@ public static Matrix5X4 Negate(Matrix5X4 value) /// The result of the subtraction. [MethodImpl((MethodImplOptions) 768)] public static Matrix5X4 Subtract(Matrix5X4 value1, Matrix5X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => value1 - value2; - - /// Linearly interpolates between the corresponding values of two matrices. - /// The first source matrix. - /// The second source matrix. - /// The relative weight of the second source matrix. - /// The interpolated matrix. - public static unsafe Matrix5X4 Lerp(Matrix5X4 matrix1, Matrix5X4 matrix2, T amount) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return new( - Vector4D.Lerp(matrix1.Row1, matrix2.Row1, amount), - Vector4D.Lerp(matrix1.Row2, matrix2.Row2, amount), - Vector4D.Lerp(matrix1.Row3, matrix2.Row3, amount), - Vector4D.Lerp(matrix1.Row4, matrix2.Row4, amount), - Vector4D.Lerp(matrix1.Row5, matrix2.Row5, amount) - ); - } } } diff --git a/sources/Maths/Maths/Matrix5X4.cs b/sources/Maths/Maths/Matrix5X4.cs index 348ba77941..b9c85c3f89 100644 --- a/sources/Maths/Maths/Matrix5X4.cs +++ b/sources/Maths/Maths/Matrix5X4.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -11,8 +12,7 @@ namespace Silk.NET.Maths /// A structure encapsulating a 4x4 matrix. [Serializable] [DataContract] - public struct Matrix5X4 : IEquatable> - where T : unmanaged, IFormattable, IEquatable, IComparable + public partial struct Matrix5X4 { private static readonly Matrix5X4 _identity = new ( @@ -23,275 +23,6 @@ public struct Matrix5X4 : IEquatable> Scalar.Zero, Scalar.Zero, Scalar.Zero, Scalar.Zero ); - /// - /// Row 1 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Row1; - - /// - /// Row 2 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Row2; - - /// - /// Row 3 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Row3; - - /// - /// Row 4 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Row4; - - /// - /// Row 5 of the matrix. - /// - [IgnoreDataMember] - public Vector4D Row5; - - /// Value at row 1, column 1 of the matrix. - [DataMember] - public T M11 - { - readonly get => Row1.X; - set => Row1.X = value; - } - - /// Value at row 1, column 2 of the matrix. - [DataMember] - public T M12 - { - readonly get => Row1.Y; - set => Row1.Y = value; - } - - /// Value at row 1, column 3 of the matrix. - [DataMember] - public T M13 - { - readonly get => Row1.Z; - set => Row1.Z = value; - } - - /// Value at row 1, column 4 of the matrix. - [DataMember] - public T M14 - { - readonly get => Row1.W; - set => Row1.W = value; - } - - /// Value at row 2, column 1 of the matrix. - [DataMember] - public T M21 - { - readonly get => Row2.X; - set => Row2.X = value; - } - - /// Value at row 2, column 2 of the matrix. - [DataMember] - public T M22 - { - readonly get => Row2.Y; - set => Row2.Y = value; - } - - /// Value at row 2, column 3 of the matrix. - [DataMember] - public T M23 - { - readonly get => Row2.Z; - set => Row2.Z = value; - } - - /// Value at row 2, column 4 of the matrix. - [DataMember] - public T M24 - { - readonly get => Row2.W; - set => Row2.W = value; - } - - /// Value at row 3, column 1 of the matrix. - [DataMember] - public T M31 - { - readonly get => Row3.X; - set => Row3.X = value; - } - - /// Value at row 3, column 2 of the matrix. - [DataMember] - public T M32 - { - readonly get => Row3.Y; - set => Row3.Y = value; - } - - /// Value at row 3, column 3 of the matrix. - [DataMember] - public T M33 - { - readonly get => Row3.Z; - set => Row3.Z = value; - } - - /// Value at row 3, column 4 of the matrix. - [DataMember] - public T M34 - { - readonly get => Row3.W; - set => Row3.W = value; - } - - /// Value at row 4, column 1 of the matrix. - [DataMember] - public T M41 - { - readonly get => Row4.X; - set => Row4.X = value; - } - - /// Value at row 4, column 2 of the matrix. - [DataMember] - public T M42 - { - readonly get => Row4.Y; - set => Row4.Y = value; - } - - /// Value at row 4, column 3 of the matrix. - [DataMember] - public T M43 - { - readonly get => Row4.Z; - set => Row4.Z = value; - } - - /// Value at row 4, column 4 of the matrix. - [DataMember] - public T M44 - { - readonly get => Row4.W; - set => Row4.W = value; - } - - /// Value at row 5, column 1 of the matrix. - [DataMember] - public T M51 - { - readonly get => Row5.X; - set => Row5.X = value; - } - - /// Value at row 5, column 2 of the matrix. - [DataMember] - public T M52 - { - readonly get => Row5.Y; - set => Row5.Y = value; - } - - /// Value at row 5, column 3 of the matrix. - [DataMember] - public T M53 - { - readonly get => Row5.Z; - set => Row5.Z = value; - } - - /// Value at row 5, column 4 of the matrix. - [DataMember] - public T M54 - { - readonly get => Row5.W; - set => Row5.W = value; - } - - /// - /// Indexer for the rows of this matrix. - /// - /// The row to select. Zero based. - public unsafe Vector4D this[int x] - { - get - { - static void VerifyBounds(int i) - { - static void ThrowHelper() => throw new IndexOutOfRangeException(); - - if (i > 4 || i < 0) - ThrowHelper(); - } - - VerifyBounds(x); - return Unsafe.Add(ref Row1, x); - } - } - - /// - /// Indexer for the values in this matrix. - /// - /// The row to select. Zero based. - /// The column to select. Zero based. - public unsafe T this[int x, int y] - { - get - { - var row = this[x]; - return row[y]; - } - } - - /// - /// Constructs a from the given rows - /// - public Matrix5X4(Vector4D row1, Vector4D row2, Vector4D row3, Vector4D row4, Vector4D row5) - { - Row1 = row1; - Row2 = row2; - Row3 = row3; - Row4 = row4; - Row5 = row5; - } - - /// Constructs a from the given components. - public Matrix5X4 - ( - T m11, - T m12, - T m13, - T m14, - T m21, - T m22, - T m23, - T m24, - T m31, - T m32, - T m33, - T m34, - T m41, - T m42, - T m43, - T m44, - T m51, - T m52, - T m53, - T m54 - ) - { - Row1 = new(m11, m12, m13, m14); - Row2 = new(m21, m22, m23, m24); - Row3 = new(m31, m32, m33, m34); - Row4 = new(m41, m42, m43, m44); - Row5 = new(m51, m52, m53, m54); - } - /// Constructs a from the given . /// The source . public Matrix5X4(Matrix3X2 value) @@ -387,57 +118,6 @@ public readonly bool IsIdentity Scalar.Equal(M51, Scalar.Zero) && Scalar.Equal(M52, Scalar.Zero) && Scalar.Equal(M53, Scalar.Zero) && Scalar.Equal(M54, Scalar.Zero); - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - public static unsafe Matrix5X4 operator +(Matrix5X4 value1, Matrix5X4 value2) - { - return new - ( - value1.Row1 + value2.Row1, value1.Row2 + value2.Row2, value1.Row3 + value2.Row3, - value1.Row4 + value2.Row4, value1.Row5 + value2.Row5 - ); - } - - /// Returns a boolean indicating whether the given two matrices are equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are equal; False otherwise. - public static unsafe bool operator ==(Matrix5X4 value1, Matrix5X4 value2) - { - return Scalar.Equal(value1.M11, value2.M11) && Scalar.Equal(value1.M22, value2.M22) && - Scalar.Equal(value1.M33, value2.M33) && - Scalar.Equal(value1.M44, value2.M44) && // Check diagonal elements first for early out. - Scalar.Equal(value1.M12, value2.M12) && Scalar.Equal(value1.M13, value2.M13) && - Scalar.Equal(value1.M14, value2.M14) && Scalar.Equal(value1.M21, value2.M21) && - Scalar.Equal(value1.M23, value2.M23) && Scalar.Equal(value1.M24, value2.M24) && - Scalar.Equal(value1.M31, value2.M31) && Scalar.Equal(value1.M32, value2.M32) && - Scalar.Equal(value1.M34, value2.M34) && Scalar.Equal(value1.M41, value2.M41) && - Scalar.Equal(value1.M42, value2.M42) && Scalar.Equal(value1.M43, value2.M43) && - Scalar.Equal(value1.M51, value2.M51) && Scalar.Equal(value1.M52, value2.M52) && - Scalar.Equal(value1.M53, value2.M53) && Scalar.Equal(value1.M54, value2.M54); - } - - /// Returns a boolean indicating whether the given two matrices are not equal. - /// The first matrix to compare. - /// The second matrix to compare. - /// True if the given matrices are not equal; False if they are equal. - public static unsafe bool operator !=(Matrix5X4 value1, Matrix5X4 value2) - { - return Scalar.NotEqual(value1.M11, value2.M11) || Scalar.NotEqual(value1.M22, value2.M22) || - Scalar.NotEqual(value1.M33, value2.M33) || - Scalar.NotEqual(value1.M44, value2.M44) || // Check diagonal elements first for early out. - Scalar.NotEqual(value1.M12, value2.M12) || Scalar.NotEqual(value1.M13, value2.M13) || - Scalar.NotEqual(value1.M14, value2.M14) || Scalar.NotEqual(value1.M21, value2.M21) || - Scalar.NotEqual(value1.M23, value2.M23) || Scalar.NotEqual(value1.M24, value2.M24) || - Scalar.NotEqual(value1.M31, value2.M31) || Scalar.NotEqual(value1.M32, value2.M32) || - Scalar.NotEqual(value1.M34, value2.M34) || Scalar.NotEqual(value1.M41, value2.M41) || - Scalar.NotEqual(value1.M42, value2.M42) || Scalar.NotEqual(value1.M43, value2.M43) || - Scalar.NotEqual(value1.M51, value2.M51) || Scalar.NotEqual(value1.M52, value2.M52) || - Scalar.NotEqual(value1.M53, value2.M53) || Scalar.NotEqual(value1.M54, value2.M54); - } - /// Multiplies a vector by a matrix. /// The vector. /// The matrix. @@ -463,82 +143,6 @@ public readonly bool IsIdentity ); } - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - public static unsafe Matrix5X4 operator -(Matrix5X4 value1, Matrix5X4 value2) - { - return new( - value1.Row1 - value2.Row1, - value1.Row2 - value2.Row2, - value1.Row3 - value2.Row3, - value1.Row4 - value2.Row4, - value1.Row5 - value2.Row5 - ); - } - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - public static unsafe Matrix5X4 operator -(Matrix5X4 value) - { - return new( - -value.Row1, - -value.Row2, - -value.Row3, - -value.Row4, - -value.Row5 - ); - } - - /// Returns a boolean indicating whether the given Object is equal to this matrix instance. - /// The Object to compare against. - /// True if the Object is equal to this matrix; False otherwise. - [MethodImpl((MethodImplOptions) 768)] - public override readonly bool Equals(object? obj) - => (obj is Matrix5X4 other) && Equals(other); - - /// Returns a boolean indicating whether this matrix instance is equal to the other given matrix. - /// The matrix to compare this instance to. - /// True if the matrices are equal; False otherwise. - public readonly bool Equals(Matrix5X4 other) - => this == other; - - /// Returns the hash code for this instance. - /// The hash code. - public override readonly int GetHashCode() - { - HashCode hash = default; - - hash.Add(M11); - hash.Add(M12); - hash.Add(M13); - hash.Add(M14); - - hash.Add(M21); - hash.Add(M22); - hash.Add(M23); - hash.Add(M24); - - hash.Add(M31); - hash.Add(M32); - hash.Add(M33); - hash.Add(M34); - - hash.Add(M41); - hash.Add(M42); - hash.Add(M43); - hash.Add(M44); - - hash.Add(M51); - hash.Add(M52); - hash.Add(M53); - hash.Add(M54); - - return hash.ToHashCode(); - } - /// Returns a String representing this matrix instance. /// The string representation. public override readonly string ToString() @@ -796,7 +400,7 @@ public static explicit operator Matrix5X4(Matrix5X4 from) /// /// The type to cast to /// The casted matrix - public Matrix5X4 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Matrix5X4 As() where TOther : INumberBase { return new(Row1.As(), Row2.As(), Row3.As(), Row4.As(), Row5.As()); } diff --git a/sources/Maths/Maths/Matrix5X4.gen.cs b/sources/Maths/Maths/Matrix5X4.gen.cs index f2eeff2e38..c4da23f556 100644 --- a/sources/Maths/Maths/Matrix5X4.gen.cs +++ b/sources/Maths/Maths/Matrix5X4.gen.cs @@ -2,31 +2,60 @@ namespace Silk.NET.Maths { using System.Diagnostics.CodeAnalysis; using System.Numerics; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; public partial struct Matrix5X4 : IEquatable> where T : INumberBase { /// The 1st row of the matrix represented as a vector. + [IgnoreDataMember] public Vector4D Row1; /// The 2nd row of the matrix represented as a vector. + [IgnoreDataMember] public Vector4D Row2; /// The 3rd row of the matrix represented as a vector. + [IgnoreDataMember] public Vector4D Row3; /// The 4th row of the matrix represented as a vector. + [IgnoreDataMember] public Vector4D Row4; /// The 5th row of the matrix represented as a vector. + [IgnoreDataMember] public Vector4D Row5; /// /// Constructs a from the given rows. /// - public Matrix5X4(Vector4D row1, Vector4D row2, Vector4D row3, Vector4D row4, Vector4D row5) => (Row1, Row2, Row3, Row4, Row5) = (row1, row2, row3, row4, row5); + public Matrix5X4(Vector4D row1, Vector4D row2, Vector4D row3, Vector4D row4, Vector4D row5) => + (Row1, Row2, Row3, Row4, Row5) = (row1, row2, row3, row4, row5); + /// + /// Constructs a from the given components. + /// + public Matrix5X4( + T m11, T m12, T m13, T m14, + T m21, T m22, T m23, T m24, + T m31, T m32, T m33, T m34, + T m41, T m42, T m43, T m44, + T m51, T m52, T m53, T m54) + { + Row1 = new(m11, m12, m13, m14); + Row2 = new(m21, m22, m23, m24); + Row3 = new(m31, m32, m33, m34); + Row4 = new(m41, m42, m43, m44); + Row5 = new(m51, m52, m53, m54); + } + + /// + /// Indexer for the rows of this matrix. + /// + /// The row to select. Zero based. [UnscopedRef] public ref Vector4D this[int row] { @@ -46,94 +75,120 @@ public ref Vector4D this[int row] return ref Row5; } - throw new ArgumentOutOfRangeException(nameof(row)); + throw new IndexOutOfRangeException(); } } + /// + /// Indexer for the values in this matrix. + /// + /// The row to select. Zero based. + /// The column to select. Zero based. [UnscopedRef] public ref T this[int row, int column] => ref this[row][column]; /// Gets the element in the 1st row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M11 => ref Row1.X; /// Gets the element in the 1st row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M12 => ref Row1.Y; /// Gets the element in the 1st row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M13 => ref Row1.Z; /// Gets the element in the 1st row and 4th column of the matrix. + [DataMember] [UnscopedRef] public ref T M14 => ref Row1.W; /// Gets the element in the 2nd row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M21 => ref Row2.X; /// Gets the element in the 2nd row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M22 => ref Row2.Y; /// Gets the element in the 2nd row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M23 => ref Row2.Z; /// Gets the element in the 2nd row and 4th column of the matrix. + [DataMember] [UnscopedRef] public ref T M24 => ref Row2.W; /// Gets the element in the 3rd row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M31 => ref Row3.X; /// Gets the element in the 3rd row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M32 => ref Row3.Y; /// Gets the element in the 3rd row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M33 => ref Row3.Z; /// Gets the element in the 3rd row and 4th column of the matrix. + [DataMember] [UnscopedRef] public ref T M34 => ref Row3.W; /// Gets the element in the 4th row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M41 => ref Row4.X; /// Gets the element in the 4th row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M42 => ref Row4.Y; /// Gets the element in the 4th row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M43 => ref Row4.Z; /// Gets the element in the 4th row and 4th column of the matrix. + [DataMember] [UnscopedRef] public ref T M44 => ref Row4.W; /// Gets the element in the 5th row and 1st column of the matrix. + [DataMember] [UnscopedRef] public ref T M51 => ref Row5.X; /// Gets the element in the 5th row and 2nd column of the matrix. + [DataMember] [UnscopedRef] public ref T M52 => ref Row5.Y; /// Gets the element in the 5th row and 3rd column of the matrix. + [DataMember] [UnscopedRef] public ref T M53 => ref Row5.Z; /// Gets the element in the 5th row and 4th column of the matrix. + [DataMember] [UnscopedRef] public ref T M54 => ref Row5.W; /// + [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix5X4 other && Equals(other); /// @@ -205,12 +260,17 @@ public ref Vector4D this[int row] public static partial class Matrix5X4 { + /// Linearly interpolates between the corresponding values of two matrices. + /// The first source matrix. + /// The second source matrix. + /// The relative weight of the second source matrix. + /// The interpolated matrix. public static Matrix5X4 Lerp(Matrix5X4 value1, Matrix5X4 value2, T amount) where T : IFloatingPointIeee754 => - new(new(T.Lerp(value1.M11, value2.M11, amount), T.Lerp(value1.M12, value2.M12, amount), T.Lerp(value1.M13, value2.M13, amount), T.Lerp(value1.M14, value2.M14, amount)), - new(T.Lerp(value1.M21, value2.M21, amount), T.Lerp(value1.M22, value2.M22, amount), T.Lerp(value1.M23, value2.M23, amount), T.Lerp(value1.M24, value2.M24, amount)), - new(T.Lerp(value1.M31, value2.M31, amount), T.Lerp(value1.M32, value2.M32, amount), T.Lerp(value1.M33, value2.M33, amount), T.Lerp(value1.M34, value2.M34, amount)), - new(T.Lerp(value1.M41, value2.M41, amount), T.Lerp(value1.M42, value2.M42, amount), T.Lerp(value1.M43, value2.M43, amount), T.Lerp(value1.M44, value2.M44, amount)), - new(T.Lerp(value1.M51, value2.M51, amount), T.Lerp(value1.M52, value2.M52, amount), T.Lerp(value1.M53, value2.M53, amount), T.Lerp(value1.M54, value2.M54, amount))); + new(Vector4D.Lerp(value1.Row1, value2.Row1, amount), + Vector4D.Lerp(value1.Row2, value2.Row2, amount), + Vector4D.Lerp(value1.Row3, value2.Row3, amount), + Vector4D.Lerp(value1.Row4, value2.Row4, amount), + Vector4D.Lerp(value1.Row5, value2.Row5, amount)); } } From acaf6b4b28d4311d929cd402a1dcc31320de4510 Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Mon, 30 Jun 2025 19:45:25 -0700 Subject: [PATCH 04/19] Update existing types to use INumberBase. --- sources/Maths/Maths/Box2D.cs | 9 +++++---- sources/Maths/Maths/Box3D.cs | 4 ++-- sources/Maths/Maths/Circle.cs | 8 +++++--- sources/Maths/Maths/Cube.cs | 9 +++++---- sources/Maths/Maths/Legacy/Quaternion.cs | 6 ++++-- sources/Maths/Maths/Plane.Ops.cs | 17 +++++++++-------- sources/Maths/Maths/Plane.cs | 10 ++++++---- sources/Maths/Maths/Ray2D.cs | 8 +++++--- sources/Maths/Maths/Ray3D.cs | 7 ++++--- sources/Maths/Maths/Rectangle.Ops.cs | 5 +++-- sources/Maths/Maths/Rectangle.cs | 9 +++++---- sources/Maths/Maths/Sphere.cs | 7 ++++--- 12 files changed, 57 insertions(+), 42 deletions(-) diff --git a/sources/Maths/Maths/Box2D.cs b/sources/Maths/Maths/Box2D.cs index c9b4945be4..a5536faf6e 100644 --- a/sources/Maths/Maths/Box2D.cs +++ b/sources/Maths/Maths/Box2D.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -14,7 +15,7 @@ namespace Silk.NET.Maths [DataContract] public struct Box2D : IEquatable> - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { /// /// The min. @@ -148,7 +149,7 @@ public Box2D GetScaled(Vector2D scale, Vector2D anchor) /// The type of the scale. /// The calculated box. public Box2D GetScaled(Vector2D scale, Vector2D anchor) - where TScale : unmanaged, IFormattable, IEquatable, IComparable + where TScale : INumberBase { return this.As().GetScaled(scale, anchor.As()).As(); } @@ -209,9 +210,9 @@ public override int GetHashCode() /// /// The type to cast to /// The casted box - public Box2D As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Box2D As() where TOther : INumberBase { return new(Min.As(), Max.As()); } } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Box3D.cs b/sources/Maths/Maths/Box3D.cs index 48812a2039..f32a0afd1f 100644 --- a/sources/Maths/Maths/Box3D.cs +++ b/sources/Maths/Maths/Box3D.cs @@ -15,7 +15,7 @@ namespace Silk.NET.Maths [DataContract] public struct Box3D : IEquatable> - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { /// /// The min. @@ -222,7 +222,7 @@ public override int GetHashCode() /// /// The type to cast to /// The casted box - public Box3D As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Box3D As() where TOther : INumberBase { return new(Min.As(), Max.As()); } diff --git a/sources/Maths/Maths/Circle.cs b/sources/Maths/Maths/Circle.cs index fafcc12f4d..fd0a4ff342 100644 --- a/sources/Maths/Maths/Circle.cs +++ b/sources/Maths/Maths/Circle.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.Serialization; namespace Silk.NET.Maths @@ -12,7 +13,8 @@ namespace Silk.NET.Maths [Serializable] [DataContract] public struct Circle - : IEquatable> where T : unmanaged, IFormattable, IEquatable, IComparable + : IEquatable> + where T : INumberBase { /// /// The center. @@ -172,9 +174,9 @@ public override int GetHashCode() /// /// The type to cast to /// The casted circle - public Circle As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Circle As() where TOther : INumberBase { return new(Center.As(), Scalar.As(Radius)); } } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Cube.cs b/sources/Maths/Maths/Cube.cs index c5ef00cca7..b0a2e2a3c2 100644 --- a/sources/Maths/Maths/Cube.cs +++ b/sources/Maths/Maths/Cube.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -14,7 +15,7 @@ namespace Silk.NET.Maths [DataContract] public struct Cube : IEquatable> - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { /// /// The origin. @@ -169,7 +170,7 @@ public Cube GetScaled(Vector3D scale, Vector3D anchor) /// The anchor. /// The calculated cube. public Cube GetScaled(Vector3D scale, Vector3D anchor) - where TScale : unmanaged, IFormattable, IEquatable, IComparable + where TScale : INumberBase { var convertedAnchor = anchor.As(); var min = (scale * (Origin.As() - convertedAnchor)) + convertedAnchor; @@ -235,9 +236,9 @@ public override int GetHashCode() /// /// The type to cast to /// The casted cube - public Cube As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Cube As() where TOther : INumberBase { return new(Origin.As(), Max.As()); } } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Legacy/Quaternion.cs b/sources/Maths/Maths/Legacy/Quaternion.cs index b0c46916b9..2694588fca 100644 --- a/sources/Maths/Maths/Legacy/Quaternion.cs +++ b/sources/Maths/Maths/Legacy/Quaternion.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using Silk.NET.Maths; @@ -16,7 +17,8 @@ namespace Silk.NET.Maths.Legacy [Serializable] [DataContract] public struct Quaternion - : IEquatable> where T : unmanaged, IFormattable, IEquatable, IComparable + : IEquatable> + where T : INumberBase { private const float SlerpEpsilon = 1e-6f; @@ -786,7 +788,7 @@ public static explicit operator Quaternion(Quaternion from) /// /// The type to cast to /// The casted quaternion - public Quaternion As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Quaternion As() where TOther : INumberBase { return new(Scalar.As(X), Scalar.As(Y), Scalar.As(Z), Scalar.As(W)); } diff --git a/sources/Maths/Maths/Plane.Ops.cs b/sources/Maths/Maths/Plane.Ops.cs index 24879072fb..fff64125ca 100644 --- a/sources/Maths/Maths/Plane.Ops.cs +++ b/sources/Maths/Maths/Plane.Ops.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.CompilerServices; namespace Silk.NET.Maths @@ -18,7 +19,7 @@ public static class Plane /// The Plane containing the three points. [MethodImpl((MethodImplOptions) 768)] public static Plane CreateFromVertices(Vector3D point1, Vector3D point2, Vector3D point3) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { var a = point1; var b = point2; @@ -86,7 +87,7 @@ public static Plane CreateFromVertices(Vector3D point1, Vector3D poi /// The dot product. [MethodImpl((MethodImplOptions) 768)] public static T Dot(Plane plane, Vector4D value) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => Scalar.Add( Scalar.Add( Scalar.Add(Scalar.Multiply(plane.Normal.X, value.X), @@ -99,7 +100,7 @@ public static T Dot(Plane plane, Vector4D value) /// The resulting value. [MethodImpl((MethodImplOptions) 768)] public static T DotCoordinate(Plane plane, Vector3D value) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => Scalar.Add(Vector3D.Dot(plane.Normal, value), plane.Distance); /// Returns the dot product of a specified Vector3D and the Normal vector of this Plane. @@ -108,7 +109,7 @@ public static T DotCoordinate(Plane plane, Vector3D value) /// The resulting dot product. [MethodImpl((MethodImplOptions) 768)] public static T DotNormal(Plane plane, Vector3D value) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase => Vector3D.Dot(plane.Normal, value); private const float NormalizeEpsilon = 1.192092896e-07f; // smallest such that 1.0+NormalizeEpsilon != 1.0 @@ -118,7 +119,7 @@ public static T DotNormal(Plane plane, Vector3D value) /// The normalized Plane. [MethodImpl((MethodImplOptions) 768)] public static Plane Normalize(Plane value) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { /*if (Vector.IsHardwareAccelerated) { @@ -140,7 +141,7 @@ public static Plane Normalize(Plane value) Scalar.Multiply(value.Normal.Y, value.Normal.Y)), Scalar.Multiply(value.Normal.Z, value.Normal.Z)); - if (!Scalar.GreaterThanOrEqual(Scalar.Abs(Scalar.Subtract(f, Scalar.One)), Scalar.As(NormalizeEpsilon))) + if (!Scalar.GreaterThanOrEqual(T.Abs(Scalar.Subtract(f, Scalar.One)), Scalar.As(NormalizeEpsilon))) { return value; // It already normalized, so we don't need to further process. } @@ -162,7 +163,7 @@ public static Plane Normalize(Plane value) /// The transformed Plane. [MethodImpl((MethodImplOptions) 768)] public static Plane Transform(Plane plane, Matrix4X4 matrix) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Matrix4X4.Invert(matrix, out Matrix4X4 m); @@ -182,7 +183,7 @@ public static Plane Transform(Plane plane, Matrix4X4 matrix) /// A new Plane that results from applying the rotation. [MethodImpl((MethodImplOptions) 768)] public static Plane Transform(Plane plane, Legacy.Quaternion rotation) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { // Compute rotation matrix. T x2 = Scalar.Add(rotation.X, rotation.X); diff --git a/sources/Maths/Maths/Plane.cs b/sources/Maths/Maths/Plane.cs index 83b0fccaf1..f14e3f989f 100644 --- a/sources/Maths/Maths/Plane.cs +++ b/sources/Maths/Maths/Plane.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -15,7 +16,8 @@ namespace Silk.NET.Maths [Serializable] [DataContract] public struct Plane - : IEquatable> where T : unmanaged, IFormattable, IEquatable, IComparable + : IEquatable> + where T : INumberBase { /// The normal vector of the Plane. [DataMember] @@ -173,7 +175,7 @@ public static explicit operator Plane(Plane from) /// The source matrix /// The matrix public static explicit operator Plane(Plane from) - => new((Vector3D) from.Normal, Scalar.As(from.Distance)); + => new(from.Normal.As(), short.CreateSaturating(from.Distance)); /// /// Converts a into one with a of @@ -212,9 +214,9 @@ public static explicit operator Plane(Plane from) /// /// The type to cast to /// The casted plane - public Plane As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Plane As() where TOther : INumberBase { return new(Normal.As(), Scalar.As(Distance)); } } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Ray2D.cs b/sources/Maths/Maths/Ray2D.cs index 91b181f2fd..9980748f31 100644 --- a/sources/Maths/Maths/Ray2D.cs +++ b/sources/Maths/Maths/Ray2D.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.Serialization; namespace Silk.NET.Maths @@ -14,7 +15,7 @@ namespace Silk.NET.Maths [DataContract] public struct Ray2D : IEquatable> - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { /// /// The origin of this Ray. @@ -129,9 +130,10 @@ public override int GetHashCode() /// /// The type to cast to /// The casted ray - public Ray2D As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Ray2D As() + where TOther : INumberBase { return new(Origin.As(), Direction.As()); } } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Ray3D.cs b/sources/Maths/Maths/Ray3D.cs index 14797d6756..b73feceb17 100644 --- a/sources/Maths/Maths/Ray3D.cs +++ b/sources/Maths/Maths/Ray3D.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.Serialization; namespace Silk.NET.Maths @@ -14,7 +15,7 @@ namespace Silk.NET.Maths [DataContract] public struct Ray3D : IEquatable> - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { /// /// The origin of this Ray. @@ -133,9 +134,9 @@ public override int GetHashCode() /// /// The type to cast to /// The casted ray - public Ray3D As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Ray3D As() where TOther : INumberBase { return new(Origin.As(), Direction.As()); } } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Rectangle.Ops.cs b/sources/Maths/Maths/Rectangle.Ops.cs index 4913e6523c..7dd2d6e9a0 100644 --- a/sources/Maths/Maths/Rectangle.Ops.cs +++ b/sources/Maths/Maths/Rectangle.Ops.cs @@ -1,7 +1,8 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; namespace Silk.NET.Maths { @@ -20,7 +21,7 @@ public static class Rectangle /// The type. /// The constructed rectangle. public static Rectangle FromLTRB(T left, T top, T right, T bottom) - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { Vector2D o = new(left, top); return new Rectangle(o, new Vector2D(right, bottom) - o); diff --git a/sources/Maths/Maths/Rectangle.cs b/sources/Maths/Maths/Rectangle.cs index 344d8f02a9..c00d48993d 100644 --- a/sources/Maths/Maths/Rectangle.cs +++ b/sources/Maths/Maths/Rectangle.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.Serialization; namespace Silk.NET.Maths @@ -13,7 +14,7 @@ namespace Silk.NET.Maths [DataContract] public struct Rectangle : IEquatable> - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { /// /// The origin. @@ -161,7 +162,7 @@ public Rectangle GetScaled(Vector2D scale, Vector2D anchor) /// The anchor. /// The calculated rectangle. public Rectangle GetScaled(Vector2D scale, Vector2D anchor) - where TScale : unmanaged, IFormattable, IEquatable, IComparable + where TScale : INumberBase { var convertedAnchor = anchor.As(); var min = (scale * (Origin.As() - convertedAnchor)) + convertedAnchor; @@ -227,9 +228,9 @@ public override int GetHashCode() /// /// The type to cast to /// The casted rectangle - public Rectangle As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Rectangle As() where TOther : INumberBase { return new(Origin.As(), Size.As()); } } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Sphere.cs b/sources/Maths/Maths/Sphere.cs index 5985308774..91bce6e0f2 100644 --- a/sources/Maths/Maths/Sphere.cs +++ b/sources/Maths/Maths/Sphere.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Runtime.Serialization; namespace Silk.NET.Maths @@ -12,7 +13,7 @@ namespace Silk.NET.Maths [Serializable] [DataContract] public struct Sphere - : IEquatable> where T : unmanaged, IFormattable, IEquatable, IComparable + : IEquatable> where T : INumberBase { /// /// The center. @@ -168,9 +169,9 @@ public override int GetHashCode() /// /// The type to cast to /// The casted sphere - public Sphere As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + public Sphere As() where TOther : INumberBase { return new(Center.As(), Scalar.As(Radius)); } } -} \ No newline at end of file +} From ffb7f58d0a373b6780d83b045b07323a38257f65 Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Mon, 30 Jun 2025 20:34:30 -0700 Subject: [PATCH 05/19] Fix errors. --- sources/Maths/Maths/Matrix2X4.cs | 10 ------- sources/Maths/Maths/Matrix3X2.cs | 13 ---------- sources/Maths/Maths/Matrix3X3.Ops.cs | 2 +- sources/Maths/Maths/Matrix4X2.cs | 39 ---------------------------- sources/Maths/Maths/Matrix4X4.Ops.cs | 2 +- sources/Maths/Maths/Vector2D.gen.cs | 1 - sources/Maths/Maths/Vector3D.gen.cs | 1 - sources/Maths/Maths/Vector4D.gen.cs | 1 - 8 files changed, 2 insertions(+), 67 deletions(-) diff --git a/sources/Maths/Maths/Matrix2X4.cs b/sources/Maths/Maths/Matrix2X4.cs index 51d70e9c93..c991743a0d 100644 --- a/sources/Maths/Maths/Matrix2X4.cs +++ b/sources/Maths/Maths/Matrix2X4.cs @@ -81,16 +81,6 @@ public readonly bool IsIdentity return value1.X * value2.Row1 + value1.Y * value2.Row2; } - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix2X3 operator *(Matrix2X4 value1, Matrix4X3 value2) - { - return new(value1.M11 * value2.Row1 + value2.M12 * value2.Row2 + value1.M13 * value2.Row3 + value1.M14 * value2.Row4, - value1.M21 * value2.Row1 + value2.M22 * value2.Row2 + value1.M23 * value2.Row3 + value1.M24 * value2.Row4); - } - /// Multiplies a matrix by a scalar value. /// The source matrix. /// The scaling factor. diff --git a/sources/Maths/Maths/Matrix3X2.cs b/sources/Maths/Maths/Matrix3X2.cs index 7f3224660c..f1c69cd9a8 100644 --- a/sources/Maths/Maths/Matrix3X2.cs +++ b/sources/Maths/Maths/Matrix3X2.cs @@ -81,19 +81,6 @@ public Matrix3X2(Matrix4X2 value) return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3; } - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix3X2 operator *(Matrix3X3 value1, Matrix3X2 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2 + value1.M13 * value2.Row3, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2 + value1.M33 * value2.Row3, - value1.M31 * value2.Row1 + value1.M32 * value2.Row2 + value1.M23 * value2.Row3 - ); - } - /// Scales all elements in a matrix by the given scalar factor. /// The source matrix. /// The scaling value to use. diff --git a/sources/Maths/Maths/Matrix3X3.Ops.cs b/sources/Maths/Maths/Matrix3X3.Ops.cs index 5a77409ea4..e955b5c9bb 100644 --- a/sources/Maths/Maths/Matrix3X3.Ops.cs +++ b/sources/Maths/Maths/Matrix3X3.Ops.cs @@ -15,6 +15,7 @@ public static partial class Matrix3X3 private const float BillboardEpsilon = 1e-4f; private const float DecomposeEpsilon = 0.0001f; + /* private struct CanonicalBasis where T : INumberBase { @@ -23,7 +24,6 @@ private struct CanonicalBasis public Vector3D Row2; }; - /* private struct VectorBasis where T : INumberBase { diff --git a/sources/Maths/Maths/Matrix4X2.cs b/sources/Maths/Maths/Matrix4X2.cs index 45d2b8c231..3893815a5d 100644 --- a/sources/Maths/Maths/Matrix4X2.cs +++ b/sources/Maths/Maths/Matrix4X2.cs @@ -85,45 +85,6 @@ public readonly bool IsIdentity Scalar.Equal(M31, Scalar.Zero) && Scalar.Equal(M32, Scalar.Zero) && Scalar.Equal(M41, Scalar.Zero) && Scalar.Equal(M42, Scalar.Zero); - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix2X2 operator *(Matrix2X4 value1, Matrix4X2 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2 + value1.M13 * value2.Row3 + value1.M14 * value2.Row4, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2 + value1.M23 * value2.Row3 + value1.M24 * value2.Row4 - ); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix3X2 operator *(Matrix3X4 value1, Matrix4X2 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2 + value1.M13 * value2.Row3 + value1.M14 * value2.Row4, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2 + value1.M23 * value2.Row3 + value1.M24 * value2.Row4, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2 + value1.M23 * value2.Row3 + value1.M24 * value2.Row4 - ); - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static unsafe Matrix4X2 operator *(Matrix4X4 value1, Matrix4X2 value2) - { - return new( - value1.M11 * value2.Row1 + value1.M12 * value2.Row2 + value1.M13 * value2.Row3 + value1.M14 * value2.Row4, - value1.M21 * value2.Row1 + value1.M22 * value2.Row2 + value1.M23 * value2.Row3 + value1.M24 * value2.Row4, - value1.M31 * value2.Row1 + value1.M32 * value2.Row2 + value1.M33 * value2.Row3 + value1.M34 * value2.Row4, - value1.M41 * value2.Row1 + value1.M42 * value2.Row2 + value1.M43 * value2.Row3 + value1.M44 * value2.Row4 - ); - } - /// Multiplies a vector by a matrix. /// The vector. /// The matrix. diff --git a/sources/Maths/Maths/Matrix4X4.Ops.cs b/sources/Maths/Maths/Matrix4X4.Ops.cs index 5bc49c3d06..d44381a2c8 100644 --- a/sources/Maths/Maths/Matrix4X4.Ops.cs +++ b/sources/Maths/Maths/Matrix4X4.Ops.cs @@ -20,6 +20,7 @@ public static partial class Matrix4X4 #endif private const float DecomposeEpsilon = 0.0001f; + /* private struct CanonicalBasis where T : INumberBase { @@ -28,7 +29,6 @@ private struct CanonicalBasis public Vector3D Row2; }; - /* private struct VectorBasis where T : INumberBase { diff --git a/sources/Maths/Maths/Vector2D.gen.cs b/sources/Maths/Maths/Vector2D.gen.cs index 3c9845a843..d62934f8fb 100644 --- a/sources/Maths/Maths/Vector2D.gen.cs +++ b/sources/Maths/Maths/Vector2D.gen.cs @@ -356,7 +356,6 @@ public static implicit operator (T X, T Y)(Vector2D v) => public static Vector2D operator /(Vector2D vector, T scalar) => new(vector.X / scalar, vector.Y / scalar); - } public static partial class Vector2D diff --git a/sources/Maths/Maths/Vector3D.gen.cs b/sources/Maths/Maths/Vector3D.gen.cs index e894afc9a1..f65b1522b7 100644 --- a/sources/Maths/Maths/Vector3D.gen.cs +++ b/sources/Maths/Maths/Vector3D.gen.cs @@ -395,7 +395,6 @@ public static implicit operator (T X, T Y, T Z)(Vector3D v) => public static Vector3D operator /(Vector3D vector, T scalar) => new(vector.X / scalar, vector.Y / scalar, vector.Z / scalar); - } public static partial class Vector3D diff --git a/sources/Maths/Maths/Vector4D.gen.cs b/sources/Maths/Maths/Vector4D.gen.cs index 1cecb3c459..1055a4c936 100644 --- a/sources/Maths/Maths/Vector4D.gen.cs +++ b/sources/Maths/Maths/Vector4D.gen.cs @@ -434,7 +434,6 @@ public static implicit operator (T X, T Y, T Z, T W)(Vector4D v) => public static Vector4D operator /(Vector4D vector, T scalar) => new(vector.X / scalar, vector.Y / scalar, vector.Z / scalar, vector.W / scalar); - } public static partial class Vector4D From d07c355799244a3c777a70aa5e17425e99ca124c Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Wed, 2 Jul 2025 13:11:02 -0700 Subject: [PATCH 06/19] Code-gen more matrix implememtations. --- sources/Maths/Maths/Matrix2X2.cs | 125 ------------- sources/Maths/Maths/Matrix2X2.gen.cs | 131 +++++++++++++ sources/Maths/Maths/Matrix2X3.cs | 132 ------------- sources/Maths/Maths/Matrix2X3.gen.cs | 131 +++++++++++++ sources/Maths/Maths/Matrix2X4.cs | 186 ------------------- sources/Maths/Maths/Matrix2X4.gen.cs | 131 +++++++++++++ sources/Maths/Maths/Matrix3X2.cs | 163 ---------------- sources/Maths/Maths/Matrix3X2.gen.cs | 146 +++++++++++++++ sources/Maths/Maths/Matrix3X3.cs | 149 --------------- sources/Maths/Maths/Matrix3X3.gen.cs | 146 +++++++++++++++ sources/Maths/Maths/Matrix3X4.cs | 211 --------------------- sources/Maths/Maths/Matrix3X4.gen.cs | 146 +++++++++++++++ sources/Maths/Maths/Matrix4X2.cs | 188 ------------------- sources/Maths/Maths/Matrix4X2.gen.cs | 161 ++++++++++++++++ sources/Maths/Maths/Matrix4X3.cs | 236 ----------------------- sources/Maths/Maths/Matrix4X3.gen.cs | 161 ++++++++++++++++ sources/Maths/Maths/Matrix4X4.cs | 241 ------------------------ sources/Maths/Maths/Matrix4X4.gen.cs | 161 ++++++++++++++++ sources/Maths/Maths/Matrix5X4.cs | 267 --------------------------- sources/Maths/Maths/Matrix5X4.gen.cs | 176 ++++++++++++++++++ 20 files changed, 1490 insertions(+), 1898 deletions(-) diff --git a/sources/Maths/Maths/Matrix2X2.cs b/sources/Maths/Maths/Matrix2X2.cs index 50bde7046e..ada5e31b39 100644 --- a/sources/Maths/Maths/Matrix2X2.cs +++ b/sources/Maths/Maths/Matrix2X2.cs @@ -69,15 +69,6 @@ public readonly bool IsIdentity return value1 * value2.Row1 + value1 * value2.Row2; } - /// Multiplies a matrix by a scalar value. - /// The source matrix. - /// The scaling factor. - /// The scaled matrix. - public static unsafe Matrix2X2 operator *(Matrix2X2 value1, T value2) - { - return new(value1.Row1 * value2, value1.Row2 * value2); - } - /// Calculates the determinant of the matrix. /// The determinant of the matrix. public readonly T GetDeterminant() @@ -91,122 +82,6 @@ public readonly T GetDeterminant() return Scalar.Subtract(Scalar.Multiply(a, d), Scalar.Multiply(b, c)); } - /// Returns a String representing this matrix instance. - /// The string representation. - public override readonly string ToString() - { - return string.Format(CultureInfo.CurrentCulture, "{{ {{M11:{0} M12:{1}}} {{M21:{2} M22:{3}}} }}", M11, M12, - M21, M22); - } - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X2(Matrix2X2 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), Scalar.As(from.M21), - Scalar.As(from.M22)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X2(Matrix2X2 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X2(Matrix2X2 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X2(Matrix2X2 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X2(Matrix2X2 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X2(Matrix2X2 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), Scalar.As(from.M21), - Scalar.As(from.M22)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X2(Matrix2X2 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X2(Matrix2X2 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X2(Matrix2X2 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), Scalar.As(from.M21), - Scalar.As(from.M22)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X2(Matrix2X2 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), Scalar.As(from.M21), - Scalar.As(from.M22)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X2(Matrix2X2 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X2(Matrix2X2 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), Scalar.As(from.M21), - Scalar.As(from.M22)); - /// /// Returns this matrix casted to /// diff --git a/sources/Maths/Maths/Matrix2X2.gen.cs b/sources/Maths/Maths/Matrix2X2.gen.cs index d1bffe8d59..8d49a1fdba 100644 --- a/sources/Maths/Maths/Matrix2X2.gen.cs +++ b/sources/Maths/Maths/Matrix2X2.gen.cs @@ -96,6 +96,14 @@ public ref Vector2D this[int row] [UnscopedRef] public ref T M22 => ref Row2.Y; + + /// + public override string ToString() => + string.Format( + "{{ {{M11:{0} M12:{1}}} {{M21:{2} M22:{3}}} }}", + Row1.X, Row1.Y, + Row2.X, Row2.Y); + /// [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix2X2 other && Equals(other); @@ -148,6 +156,22 @@ public Matrix2X2 Transpose() => new(-value.Row1, -value.Row2); + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix2X2 operator *(T left, Matrix2X2 right) => + new(left * right.Row1, + left * right.Row2); + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix2X2 operator *(Matrix2X2 left, T right) => + new(left.Row1 * right, + left.Row2 * right); + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -155,6 +179,113 @@ public Matrix2X2 Transpose() => public static Matrix2X2 operator *(Matrix2X2 left, Matrix2X2 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2, left.M21 * right.Row1 + left.M22 * right.Row2); + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X2(Matrix2X2 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X2(Matrix2X2 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X2(Matrix2X2 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X2(Matrix2X2 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X2(Matrix2X2 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X2(Matrix2X2 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X2(Matrix2X2 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X2(Matrix2X2 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X2(Matrix2X2 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X2(Matrix2X2 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X2(Matrix2X2 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X2(Matrix2X2 from) => + new(from.Row1.As(), + from.Row2.As()); } public static partial class Matrix2X2 diff --git a/sources/Maths/Maths/Matrix2X3.cs b/sources/Maths/Maths/Matrix2X3.cs index 63e4bc944b..884d142dd2 100644 --- a/sources/Maths/Maths/Matrix2X3.cs +++ b/sources/Maths/Maths/Matrix2X3.cs @@ -80,138 +80,6 @@ public readonly bool IsIdentity return value1.X * value2.Row1 + value1.Y * value2.Row2; } - /// Multiplies a matrix by a scalar value. - /// The source matrix. - /// The scaling factor. - /// The scaled matrix. - public static unsafe Matrix2X3 operator *(Matrix2X3 value1, T value2) - { - return new(value1.Row1 * value2, value1.Row2 * value2); - } - - /// Returns a String representing this matrix instance. - /// The string representation. - public override readonly string ToString() - { - return string.Format(CultureInfo.CurrentCulture, "{{ {{M11:{0} M12:{1} M13:{2} }} {{M21:{3} M22:{4} M23:{5} }} }}", - M11, M12, M13, - M21, M22, M23); - } - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X3(Matrix2X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), Scalar.As(from.M23)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X3(Matrix2X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X3(Matrix2X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M21), - Scalar.As(from.M22), Scalar.As(from.M23)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X3(Matrix2X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M21), - Scalar.As(from.M22), Scalar.As(from.M23)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X3(Matrix2X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X3(Matrix2X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), Scalar.As(from.M23)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X3(Matrix2X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M21), - Scalar.As(from.M22), Scalar.As(from.M23)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X3(Matrix2X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X3(Matrix2X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), Scalar.As(from.M23)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X3(Matrix2X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), Scalar.As(from.M23)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X3(Matrix2X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X3(Matrix2X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), Scalar.As(from.M23)); - /// /// Returns this matrix casted to /// diff --git a/sources/Maths/Maths/Matrix2X3.gen.cs b/sources/Maths/Maths/Matrix2X3.gen.cs index 7447bdd571..d8d87fd30b 100644 --- a/sources/Maths/Maths/Matrix2X3.gen.cs +++ b/sources/Maths/Maths/Matrix2X3.gen.cs @@ -105,6 +105,14 @@ public ref Vector3D this[int row] [UnscopedRef] public ref T M23 => ref Row2.Z; + + /// + public override string ToString() => + string.Format( + "{{ {{M11:{0} M12:{1} M13:{2}}} {{M21:{3} M22:{4} M23:{5}}} }}", + Row1.X, Row1.Y, Row1.Z, + Row2.X, Row2.Y, Row2.Z); + /// [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix2X3 other && Equals(other); @@ -158,6 +166,22 @@ public Matrix3X2 Transpose() => new(-value.Row1, -value.Row2); + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix2X3 operator *(T left, Matrix2X3 right) => + new(left * right.Row1, + left * right.Row2); + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix2X3 operator *(Matrix2X3 left, T right) => + new(left.Row1 * right, + left.Row2 * right); + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -173,6 +197,113 @@ public Matrix3X2 Transpose() => public static Matrix2X2 operator *(Matrix2X3 left, Matrix3X2 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3); + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X3(Matrix2X3 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X3(Matrix2X3 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X3(Matrix2X3 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X3(Matrix2X3 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X3(Matrix2X3 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X3(Matrix2X3 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X3(Matrix2X3 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X3(Matrix2X3 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X3(Matrix2X3 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X3(Matrix2X3 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X3(Matrix2X3 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X3(Matrix2X3 from) => + new(from.Row1.As(), + from.Row2.As()); } public static partial class Matrix2X3 diff --git a/sources/Maths/Maths/Matrix2X4.cs b/sources/Maths/Maths/Matrix2X4.cs index c991743a0d..d6d530eb34 100644 --- a/sources/Maths/Maths/Matrix2X4.cs +++ b/sources/Maths/Maths/Matrix2X4.cs @@ -81,192 +81,6 @@ public readonly bool IsIdentity return value1.X * value2.Row1 + value1.Y * value2.Row2; } - /// Multiplies a matrix by a scalar value. - /// The source matrix. - /// The scaling factor. - /// The scaled matrix. - public static unsafe Matrix2X4 operator *(Matrix2X4 value1, T value2) - { - return new(value1.Row1 * value2, value1.Row2 * value2); - } - - /// Returns a String representing this matrix instance. - /// The string representation. - public override readonly string ToString() - { - return string.Format(CultureInfo.CurrentCulture, "{{ {{M11:{0} M12:{1} M13:{2} M14:{3}}} {{M21:{4} M22:{5} M23:{6} M24:{7}}} }}", - M11, M12, M13, M14, - M21, M22, M23, M24); - } - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X4(Matrix2X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X4(Matrix2X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X4(Matrix2X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X4(Matrix2X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X4(Matrix2X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X4(Matrix2X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X4(Matrix2X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X4(Matrix2X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X4(Matrix2X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X4(Matrix2X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X4(Matrix2X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix2X4(Matrix2X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24) - ); - /// /// Returns this matrix casted to /// diff --git a/sources/Maths/Maths/Matrix2X4.gen.cs b/sources/Maths/Maths/Matrix2X4.gen.cs index 970be0f0f5..35573895a3 100644 --- a/sources/Maths/Maths/Matrix2X4.gen.cs +++ b/sources/Maths/Maths/Matrix2X4.gen.cs @@ -119,6 +119,14 @@ public ref Vector4D this[int row] [UnscopedRef] public ref T M24 => ref Row2.W; + + /// + public override string ToString() => + string.Format( + "{{ {{M11:{0} M12:{1} M13:{2} M14:{3}}} {{M21:{4} M22:{5} M23:{6} M24:{7}}} }}", + Row1.X, Row1.Y, Row1.Z, Row1.W, + Row2.X, Row2.Y, Row2.Z, Row2.W); + /// [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix2X4 other && Equals(other); @@ -173,6 +181,22 @@ public Matrix4X2 Transpose() => new(-value.Row1, -value.Row2); + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix2X4 operator *(T left, Matrix2X4 right) => + new(left * right.Row1, + left * right.Row2); + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix2X4 operator *(Matrix2X4 left, T right) => + new(left.Row1 * right, + left.Row2 * right); + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -197,6 +221,113 @@ public Matrix4X2 Transpose() => new(left.M11 * right.Row1 + left.M12 * right.Row2, left.M21 * right.Row1 + left.M22 * right.Row2, left.M31 * right.Row1 + left.M32 * right.Row2); + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X4(Matrix2X4 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X4(Matrix2X4 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X4(Matrix2X4 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X4(Matrix2X4 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X4(Matrix2X4 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X4(Matrix2X4 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X4(Matrix2X4 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X4(Matrix2X4 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X4(Matrix2X4 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X4(Matrix2X4 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X4(Matrix2X4 from) => + new(from.Row1.As(), + from.Row2.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix2X4(Matrix2X4 from) => + new(from.Row1.As(), + from.Row2.As()); } public static partial class Matrix2X4 diff --git a/sources/Maths/Maths/Matrix3X2.cs b/sources/Maths/Maths/Matrix3X2.cs index f1c69cd9a8..2ec8ed1612 100644 --- a/sources/Maths/Maths/Matrix3X2.cs +++ b/sources/Maths/Maths/Matrix3X2.cs @@ -81,15 +81,6 @@ public Matrix3X2(Matrix4X2 value) return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3; } - /// Scales all elements in a matrix by the given scalar factor. - /// The source matrix. - /// The scaling value to use. - /// The resulting matrix. - public static Matrix3X2 operator *(Matrix3X2 value1, T value2) - { - return new(value1.Row1 * value2, value1.Row2 * value2, value1.Row3 * value2); - } - /// Calculates the determinant for this matrix. /// The determinant is calculated by expanding the matrix with a third column whose values are (0,0,1). /// The determinant. @@ -114,40 +105,6 @@ public readonly T GetDeterminant() return Scalar.Subtract(Scalar.Multiply(M11, M22), Scalar.Multiply(M21, M12)); } - /// Returns a String representing this matrix instance. - /// The string representation. - public override readonly string ToString() - { - return string.Format(CultureInfo.CurrentCulture, "{{ {{M11:{0} M12:{1}}} {{M21:{2} M22:{3}}} {{M31:{4} M32:{5}}} }}", - M11, M12, - M21, M22, - M31, M32); - } - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X2(Matrix3X2 from) - => new( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X2(Matrix3X2 from) - => new( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32) - ); - /// /// Converts a into a one. /// @@ -159,127 +116,7 @@ public static explicit operator System.Numerics.Matrix3x2(Matrix3X2 from) Scalar.As(from.M21), Scalar.As(from.M22), Scalar.As(from.M31), Scalar.As(from.M32) ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X2(Matrix3X2 from) - => new( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X2(Matrix3X2 from) - => new( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X2(Matrix3X2 from) - => new( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32) - ); - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X2(Matrix3X2 from) - => new( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X2(Matrix3X2 from) - => new( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X2(Matrix3X2 from) - => new( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X2(Matrix3X2 from) - => new( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X2(Matrix3X2 from) - => new( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X2(Matrix3X2 from) - => new( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X2(Matrix3X2 from) - => new( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32) - ); - /// /// Returns this matrix casted to /// diff --git a/sources/Maths/Maths/Matrix3X2.gen.cs b/sources/Maths/Maths/Matrix3X2.gen.cs index 1caf6ea066..2bb0ed9718 100644 --- a/sources/Maths/Maths/Matrix3X2.gen.cs +++ b/sources/Maths/Maths/Matrix3X2.gen.cs @@ -109,6 +109,15 @@ public ref Vector2D this[int row] [UnscopedRef] public ref T M32 => ref Row3.Y; + + /// + public override string ToString() => + string.Format( + "{{ {{M11:{0} M12:{1}}} {{M21:{2} M22:{3}}} {{M31:{4} M32:{5}}} }}", + Row1.X, Row1.Y, + Row2.X, Row2.Y, + Row3.X, Row3.Y); + /// [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix3X2 other && Equals(other); @@ -165,6 +174,24 @@ public Matrix2X3 Transpose() => -value.Row2, -value.Row3); + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix3X2 operator *(T left, Matrix3X2 right) => + new(left * right.Row1, + left * right.Row2, + left * right.Row3); + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix3X2 operator *(Matrix3X2 left, T right) => + new(left.Row1 * right, + left.Row2 * right, + left.Row3 * right); + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -182,6 +209,125 @@ public Matrix2X3 Transpose() => new(left.M11 * right.Row1 + left.M12 * right.Row2, left.M21 * right.Row1 + left.M22 * right.Row2, left.M31 * right.Row1 + left.M32 * right.Row2); + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X2(Matrix3X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X2(Matrix3X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X2(Matrix3X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X2(Matrix3X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X2(Matrix3X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X2(Matrix3X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X2(Matrix3X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X2(Matrix3X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X2(Matrix3X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X2(Matrix3X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X2(Matrix3X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X2(Matrix3X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); } public static partial class Matrix3X2 diff --git a/sources/Maths/Maths/Matrix3X3.cs b/sources/Maths/Maths/Matrix3X3.cs index b5161c146d..69e0db0bd1 100644 --- a/sources/Maths/Maths/Matrix3X3.cs +++ b/sources/Maths/Maths/Matrix3X3.cs @@ -95,15 +95,6 @@ public readonly bool IsIdentity return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3; } - /// Multiplies a matrix by a scalar value. - /// The source matrix. - /// The scaling factor. - /// The scaled matrix. - public static unsafe Matrix3X3 operator *(Matrix3X3 value1, T value2) - { - return new(value1.Row1 * value2, value1.Row2 * value2, value1.Row3 * value2); - } - /// Calculates the determinant of the matrix. /// The determinant of the matrix. public readonly T GetDeterminant() @@ -123,146 +114,6 @@ public readonly T GetDeterminant() Scalar.Multiply(c, Scalar.Subtract(Scalar.Multiply(d, h), Scalar.Multiply(e, g)))); } - /// Returns a String representing this matrix instance. - /// The string representation. - public override readonly string ToString() - { - return string.Format(CultureInfo.CurrentCulture, "{{ {{M11:{0} M12:{1} M13:{2} }} {{M21:{3} M22:{4} M23:{5} }} {{M31:{6} M32:{7} M33:{8}}} }}", - M11, M12, M13, - M21, M22, M23, - M31, M32, M33); - } - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X3(Matrix3X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), Scalar.As(from.M33)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X3(Matrix3X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X3(Matrix3X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M21), - Scalar.As(from.M22), Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X3(Matrix3X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M21), - Scalar.As(from.M22), Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X3(Matrix3X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X3(Matrix3X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), Scalar.As(from.M33)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X3(Matrix3X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M21), - Scalar.As(from.M22), Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X3(Matrix3X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X3(Matrix3X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), Scalar.As(from.M33)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X3(Matrix3X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), Scalar.As(from.M33)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X3(Matrix3X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X3(Matrix3X3 from) - => new(Scalar.As(from.M11), Scalar.As(from.M12), Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), Scalar.As(from.M33)); - /// /// Returns this matrix casted to /// diff --git a/sources/Maths/Maths/Matrix3X3.gen.cs b/sources/Maths/Maths/Matrix3X3.gen.cs index ad3c0b5b2a..0796c2baa5 100644 --- a/sources/Maths/Maths/Matrix3X3.gen.cs +++ b/sources/Maths/Maths/Matrix3X3.gen.cs @@ -134,6 +134,15 @@ public ref Vector3D this[int row] [UnscopedRef] public ref T M33 => ref Row3.Z; + + /// + public override string ToString() => + string.Format( + "{{ {{M11:{0} M12:{1} M13:{2}}} {{M21:{3} M22:{4} M23:{5}}} {{M31:{6} M32:{7} M33:{8}}} }}", + Row1.X, Row1.Y, Row1.Z, + Row2.X, Row2.Y, Row2.Z, + Row3.X, Row3.Y, Row3.Z); + /// [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix3X3 other && Equals(other); @@ -191,6 +200,24 @@ public Matrix3X3 Transpose() => -value.Row2, -value.Row3); + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix3X3 operator *(T left, Matrix3X3 right) => + new(left * right.Row1, + left * right.Row2, + left * right.Row3); + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix3X3 operator *(Matrix3X3 left, T right) => + new(left.Row1 * right, + left.Row2 * right, + left.Row3 * right); + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -216,6 +243,125 @@ public Matrix3X3 Transpose() => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3); + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X3(Matrix3X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X3(Matrix3X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X3(Matrix3X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X3(Matrix3X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X3(Matrix3X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X3(Matrix3X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X3(Matrix3X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X3(Matrix3X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X3(Matrix3X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X3(Matrix3X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X3(Matrix3X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X3(Matrix3X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); } public static partial class Matrix3X3 diff --git a/sources/Maths/Maths/Matrix3X4.cs b/sources/Maths/Maths/Matrix3X4.cs index 966669f93b..b84ae7b298 100644 --- a/sources/Maths/Maths/Matrix3X4.cs +++ b/sources/Maths/Maths/Matrix3X4.cs @@ -98,217 +98,6 @@ public readonly bool IsIdentity return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3; } - /// Multiplies a matrix by a scalar value. - /// The source matrix. - /// The scaling factor. - /// The scaled matrix. - public static unsafe Matrix3X4 operator *(Matrix3X4 value1, T value2) - { - return new(value1.Row1 * value2, value1.Row2 * value2, value1.Row3 * value2); - } - - /// Returns a String representing this matrix instance. - /// The string representation. - public override readonly string ToString() - { - return string.Format(CultureInfo.CurrentCulture, "{{ {{M11:{0} M12:{1} M13:{2} M14:{3}}} {{M21:{4} M22:{5} M23:{6} M24:{7}}} {{M31:{8} M32:{9} M33:{10} M34:{11}}} }}", - M11, M12, M13, M14, - M21, M22, M23, M24, - M31, M32, M33, M34); - } - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X4(Matrix3X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X4(Matrix3X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X4(Matrix3X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X4(Matrix3X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X4(Matrix3X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X4(Matrix3X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X4(Matrix3X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X4(Matrix3X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X4(Matrix3X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X4(Matrix3X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X4(Matrix3X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix3X4(Matrix3X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34) - ); - /// /// Returns this matrix casted to /// diff --git a/sources/Maths/Maths/Matrix3X4.gen.cs b/sources/Maths/Maths/Matrix3X4.gen.cs index fa2463be59..e662cce318 100644 --- a/sources/Maths/Maths/Matrix3X4.gen.cs +++ b/sources/Maths/Maths/Matrix3X4.gen.cs @@ -147,6 +147,15 @@ public ref Vector4D this[int row] [UnscopedRef] public ref T M34 => ref Row3.W; + + /// + public override string ToString() => + string.Format( + "{{ {{M11:{0} M12:{1} M13:{2} M14:{3}}} {{M21:{4} M22:{5} M23:{6} M24:{7}}} {{M31:{8} M32:{9} M33:{10} M34:{11}}} }}", + Row1.X, Row1.Y, Row1.Z, Row1.W, + Row2.X, Row2.Y, Row2.Z, Row2.W, + Row3.X, Row3.Y, Row3.Z, Row3.W); + /// [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix3X4 other && Equals(other); @@ -205,6 +214,24 @@ public Matrix4X3 Transpose() => -value.Row2, -value.Row3); + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix3X4 operator *(T left, Matrix3X4 right) => + new(left * right.Row1, + left * right.Row2, + left * right.Row3); + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix3X4 operator *(Matrix3X4 left, T right) => + new(left.Row1 * right, + left.Row2 * right, + left.Row3 * right); + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -239,6 +266,125 @@ public Matrix4X3 Transpose() => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4); + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X4(Matrix3X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X4(Matrix3X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X4(Matrix3X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X4(Matrix3X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X4(Matrix3X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X4(Matrix3X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X4(Matrix3X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X4(Matrix3X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X4(Matrix3X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X4(Matrix3X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X4(Matrix3X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix3X4(Matrix3X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As()); } public static partial class Matrix3X4 diff --git a/sources/Maths/Maths/Matrix4X2.cs b/sources/Maths/Maths/Matrix4X2.cs index 3893815a5d..606ca14133 100644 --- a/sources/Maths/Maths/Matrix4X2.cs +++ b/sources/Maths/Maths/Matrix4X2.cs @@ -94,194 +94,6 @@ public readonly bool IsIdentity return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3 + value1.W * value2.Row4; } - /// Multiplies a matrix by a scalar value. - /// The source matrix. - /// The scaling factor. - /// The scaled matrix. - public static unsafe Matrix4X2 operator *(Matrix4X2 value1, T value2) - { - return new(value1.Row1 * value2, value1.Row2 * value2, value1.Row3 * value2, value1.Row4 * value2); - } - - /// Returns a String representing this matrix instance. - /// The string representation. - public override readonly string ToString() - { - return string.Format(CultureInfo.CurrentCulture, "{{ {{M11:{0} M12:{1}}} {{M21:{2} M22:{3}}} {{M31:{4} M32:{5}}} {{M41:{6} M42:{7}}} }}", - M11, M12, - M21, M22, - M31, M32, - M41, M42); - } - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X2(Matrix4X2 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M41), Scalar.As(from.M42) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X2(Matrix4X2 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M41), Scalar.As(from.M42) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X2(Matrix4X2 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M41), Scalar.As(from.M42) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X2(Matrix4X2 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M41), Scalar.As(from.M42) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X2(Matrix4X2 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M41), Scalar.As(from.M42) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X2(Matrix4X2 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M41), Scalar.As(from.M42) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X2(Matrix4X2 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M41), Scalar.As(from.M42) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X2(Matrix4X2 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M41), Scalar.As(from.M42) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X2(Matrix4X2 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M41), Scalar.As(from.M42) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X2(Matrix4X2 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M41), Scalar.As(from.M42) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X2(Matrix4X2 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M41), Scalar.As(from.M42) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X2(Matrix4X2 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M41), Scalar.As(from.M42) - ); - /// /// Returns this matrix casted to /// diff --git a/sources/Maths/Maths/Matrix4X2.gen.cs b/sources/Maths/Maths/Matrix4X2.gen.cs index 8bd1df9859..e5f3a6cff8 100644 --- a/sources/Maths/Maths/Matrix4X2.gen.cs +++ b/sources/Maths/Maths/Matrix4X2.gen.cs @@ -127,6 +127,16 @@ public ref Vector2D this[int row] [UnscopedRef] public ref T M42 => ref Row4.Y; + + /// + public override string ToString() => + string.Format( + "{{ {{M11:{0} M12:{1}}} {{M21:{2} M22:{3}}} {{M31:{4} M32:{5}}} {{M41:{6} M42:{7}}} }}", + Row1.X, Row1.Y, + Row2.X, Row2.Y, + Row3.X, Row3.Y, + Row4.X, Row4.Y); + /// [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix4X2 other && Equals(other); @@ -187,6 +197,26 @@ public Matrix2X4 Transpose() => -value.Row3, -value.Row4); + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix4X2 operator *(T left, Matrix4X2 right) => + new(left * right.Row1, + left * right.Row2, + left * right.Row3, + left * right.Row4); + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix4X2 operator *(Matrix4X2 left, T right) => + new(left.Row1 * right, + left.Row2 * right, + left.Row3 * right, + left.Row4 * right); + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -216,6 +246,137 @@ public Matrix2X4 Transpose() => left.M21 * right.Row1 + left.M22 * right.Row2, left.M31 * right.Row1 + left.M32 * right.Row2, left.M41 * right.Row1 + left.M42 * right.Row2); + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X2(Matrix4X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X2(Matrix4X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X2(Matrix4X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X2(Matrix4X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X2(Matrix4X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X2(Matrix4X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X2(Matrix4X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X2(Matrix4X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X2(Matrix4X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X2(Matrix4X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X2(Matrix4X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X2(Matrix4X2 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); } public static partial class Matrix4X2 diff --git a/sources/Maths/Maths/Matrix4X3.cs b/sources/Maths/Maths/Matrix4X3.cs index 3cfd7e313a..7e69e7d550 100644 --- a/sources/Maths/Maths/Matrix4X3.cs +++ b/sources/Maths/Maths/Matrix4X3.cs @@ -117,242 +117,6 @@ public readonly bool IsIdentity return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3 + value1.W * value2.Row4; } - /// Multiplies a matrix by a scalar value. - /// The source matrix. - /// The scaling factor. - /// The scaled matrix. - public static unsafe Matrix4X3 operator *(Matrix4X3 value1, T value2) - { - return new(value1.Row1 * value2, value1.Row2 * value2, value1.Row3 * value2, value1.Row4 * value2); - } - - /// Returns a String representing this matrix instance. - /// The string representation. - public override readonly string ToString() - { - return string.Format(CultureInfo.CurrentCulture, "{{ {{M11:{0} M12:{1} M13:{2}}} {{M21:{3} M22:{4} M23:{5}}} {{M31:{6} M32:{7} M33:{8}}} {{M41:{9} M42:{10} M43:{11}}} }}", - M11, M12, M13, - M21, M22, M23, - M31, M32, M33, - M41, M42, M43); - } - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X3(Matrix4X3 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X3(Matrix4X3 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X3(Matrix4X3 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X3(Matrix4X3 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X3(Matrix4X3 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X3(Matrix4X3 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X3(Matrix4X3 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X3(Matrix4X3 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X3(Matrix4X3 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X3(Matrix4X3 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X3(Matrix4X3 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X3(Matrix4X3 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43) - ); - /// /// Returns this matrix casted to /// diff --git a/sources/Maths/Maths/Matrix4X3.gen.cs b/sources/Maths/Maths/Matrix4X3.gen.cs index 7fcb883410..b21822d0f2 100644 --- a/sources/Maths/Maths/Matrix4X3.gen.cs +++ b/sources/Maths/Maths/Matrix4X3.gen.cs @@ -151,6 +151,16 @@ public ref Vector3D this[int row] [UnscopedRef] public ref T M43 => ref Row4.Z; + + /// + public override string ToString() => + string.Format( + "{{ {{M11:{0} M12:{1} M13:{2}}} {{M21:{3} M22:{4} M23:{5}}} {{M31:{6} M32:{7} M33:{8}}} {{M41:{9} M42:{10} M43:{11}}} }}", + Row1.X, Row1.Y, Row1.Z, + Row2.X, Row2.Y, Row2.Z, + Row3.X, Row3.Y, Row3.Z, + Row4.X, Row4.Y, Row4.Z); + /// [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix4X3 other && Equals(other); @@ -212,6 +222,26 @@ public Matrix3X4 Transpose() => -value.Row3, -value.Row4); + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix4X3 operator *(T left, Matrix4X3 right) => + new(left * right.Row1, + left * right.Row2, + left * right.Row3, + left * right.Row4); + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix4X3 operator *(Matrix4X3 left, T right) => + new(left.Row1 * right, + left.Row2 * right, + left.Row3 * right, + left.Row4 * right); + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -249,6 +279,137 @@ public Matrix3X4 Transpose() => left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3, left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3); + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X3(Matrix4X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X3(Matrix4X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X3(Matrix4X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X3(Matrix4X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X3(Matrix4X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X3(Matrix4X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X3(Matrix4X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X3(Matrix4X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X3(Matrix4X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X3(Matrix4X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X3(Matrix4X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X3(Matrix4X3 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); } public static partial class Matrix4X3 diff --git a/sources/Maths/Maths/Matrix4X4.cs b/sources/Maths/Maths/Matrix4X4.cs index 700a86cdb5..2a5149bd5b 100644 --- a/sources/Maths/Maths/Matrix4X4.cs +++ b/sources/Maths/Maths/Matrix4X4.cs @@ -97,20 +97,6 @@ public readonly bool IsIdentity value1.W * value2.Row4; } - /// Multiplies a matrix by a scalar value. - /// The source matrix. - /// The scaling factor. - /// The scaled matrix. - public static unsafe Matrix4X4 operator *(Matrix4X4 value1, T value2) - { - return new( - value1.Row1 * value2, - value1.Row2 * value2, - value1.Row3 * value2, - value1.Row4 * value2 - ); - } - /// Calculates the determinant of the matrix. /// The determinant of the matrix. public readonly T GetDeterminant() @@ -175,233 +161,6 @@ public readonly T GetDeterminant() Scalar.Multiply(g, in_jm))))); } - /// Returns a String representing this matrix instance. - /// The string representation. - public override readonly string ToString() - { - return string.Format(CultureInfo.CurrentCulture, "{{ {{M11:{0} M12:{1} M13:{2} M14:{3}}} {{M21:{4} M22:{5} M23:{6} M24:{7}}} {{M31:{8} M32:{9} M33:{10} M34:{11}}} {{M41:{12} M42:{13} M43:{14} M44:{15}}} }}", - M11, M12, M13, M14, - M21, M22, M23, M24, - M31, M32, M33, M34, - M41, M42, M43, M44); - } - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X4(Matrix4X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X4(Matrix4X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X4(Matrix4X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X4(Matrix4X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X4(Matrix4X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X4(Matrix4X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X4(Matrix4X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X4(Matrix4X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X4(Matrix4X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X4(Matrix4X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X4(Matrix4X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix4X4(Matrix4X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44) - ); - /// /// Returns this matrix casted to /// diff --git a/sources/Maths/Maths/Matrix4X4.gen.cs b/sources/Maths/Maths/Matrix4X4.gen.cs index 7fe91550bb..c93d2d3804 100644 --- a/sources/Maths/Maths/Matrix4X4.gen.cs +++ b/sources/Maths/Maths/Matrix4X4.gen.cs @@ -182,6 +182,16 @@ public ref Vector4D this[int row] [UnscopedRef] public ref T M44 => ref Row4.W; + + /// + public override string ToString() => + string.Format( + "{{ {{M11:{0} M12:{1} M13:{2} M14:{3}}} {{M21:{4} M22:{5} M23:{6} M24:{7}}} {{M31:{8} M32:{9} M33:{10} M34:{11}}} {{M41:{12} M42:{13} M43:{14} M44:{15}}} }}", + Row1.X, Row1.Y, Row1.Z, Row1.W, + Row2.X, Row2.Y, Row2.Z, Row2.W, + Row3.X, Row3.Y, Row3.Z, Row3.W, + Row4.X, Row4.Y, Row4.Z, Row4.W); + /// [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix4X4 other && Equals(other); @@ -244,6 +254,26 @@ public Matrix4X4 Transpose() => -value.Row3, -value.Row4); + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix4X4 operator *(T left, Matrix4X4 right) => + new(left * right.Row1, + left * right.Row2, + left * right.Row3, + left * right.Row4); + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix4X4 operator *(Matrix4X4 left, T right) => + new(left.Row1 * right, + left.Row2 * right, + left.Row3 * right, + left.Row4 * right); + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -290,6 +320,137 @@ public Matrix4X4 Transpose() => left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4, left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3 + left.M44 * right.Row4); + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X4(Matrix4X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X4(Matrix4X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X4(Matrix4X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X4(Matrix4X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X4(Matrix4X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X4(Matrix4X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X4(Matrix4X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X4(Matrix4X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X4(Matrix4X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X4(Matrix4X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X4(Matrix4X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix4X4(Matrix4X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As()); } public static partial class Matrix4X4 diff --git a/sources/Maths/Maths/Matrix5X4.cs b/sources/Maths/Maths/Matrix5X4.cs index b9c85c3f89..8f624e5b99 100644 --- a/sources/Maths/Maths/Matrix5X4.cs +++ b/sources/Maths/Maths/Matrix5X4.cs @@ -128,273 +128,6 @@ public readonly bool IsIdentity value1.W * value2.Row4 + value2.Row5; } - /// Multiplies a matrix by a scalar value. - /// The source matrix. - /// The scaling factor. - /// The scaled matrix. - public static unsafe Matrix5X4 operator *(Matrix5X4 value1, T value2) - { - return new( - value1.Row1 * value2, - value1.Row2 * value2, - value1.Row3 * value2, - value1.Row4 * value2, - value1.Row5 * value2 - ); - } - - /// Returns a String representing this matrix instance. - /// The string representation. - public override readonly string ToString() - { - return string.Format(CultureInfo.CurrentCulture, "{{ {{M11:{0} M12:{1} M13:{2} M14:{3}}} {{M21:{4} M22:{5} M23:{6} M24:{7}}} {{M31:{8} M32:{9} M33:{10} M34:{11}}} {{M41:{12} M42:{13} M43:{14} M44:{15}}} {{M51:{16} M52:{17} M53:{18} M54:{19}}} }}", - M11, M12, M13, M14, - M21, M22, M23, M24, - M31, M32, M33, M34, - M41, M42, M43, M44, - M51, M52, M53, M54); - } - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix5X4(Matrix5X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44), - Scalar.As(from.M51), Scalar.As(from.M52), - Scalar.As(from.M53), Scalar.As(from.M54) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix5X4(Matrix5X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44), - Scalar.As(from.M51), Scalar.As(from.M52), - Scalar.As(from.M53), Scalar.As(from.M54) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix5X4(Matrix5X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44), - Scalar.As(from.M51), Scalar.As(from.M52), - Scalar.As(from.M53), Scalar.As(from.M54) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix5X4(Matrix5X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44), - Scalar.As(from.M51), Scalar.As(from.M52), - Scalar.As(from.M53), Scalar.As(from.M54) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix5X4(Matrix5X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44), - Scalar.As(from.M51), Scalar.As(from.M52), - Scalar.As(from.M53), Scalar.As(from.M54) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix5X4(Matrix5X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44), - Scalar.As(from.M51), Scalar.As(from.M52), - Scalar.As(from.M53), Scalar.As(from.M54) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix5X4(Matrix5X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44), - Scalar.As(from.M51), Scalar.As(from.M52), - Scalar.As(from.M53), Scalar.As(from.M54) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix5X4(Matrix5X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44), - Scalar.As(from.M51), Scalar.As(from.M52), - Scalar.As(from.M53), Scalar.As(from.M54) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix5X4(Matrix5X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44), - Scalar.As(from.M51), Scalar.As(from.M52), - Scalar.As(from.M53), Scalar.As(from.M54) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix5X4(Matrix5X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44), - Scalar.As(from.M51), Scalar.As(from.M52), - Scalar.As(from.M53), Scalar.As(from.M54) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix5X4(Matrix5X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44), - Scalar.As(from.M51), Scalar.As(from.M52), - Scalar.As(from.M53), Scalar.As(from.M54) - ); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Matrix5X4(Matrix5X4 from) - => new - ( - Scalar.As(from.M11), Scalar.As(from.M12), - Scalar.As(from.M13), Scalar.As(from.M14), - Scalar.As(from.M21), Scalar.As(from.M22), - Scalar.As(from.M23), Scalar.As(from.M24), - Scalar.As(from.M31), Scalar.As(from.M32), - Scalar.As(from.M33), Scalar.As(from.M34), - Scalar.As(from.M41), Scalar.As(from.M42), - Scalar.As(from.M43), Scalar.As(from.M44), - Scalar.As(from.M51), Scalar.As(from.M52), - Scalar.As(from.M53), Scalar.As(from.M54) - ); - /// /// Returns this matrix casted to /// diff --git a/sources/Maths/Maths/Matrix5X4.gen.cs b/sources/Maths/Maths/Matrix5X4.gen.cs index c4da23f556..def96a81ab 100644 --- a/sources/Maths/Maths/Matrix5X4.gen.cs +++ b/sources/Maths/Maths/Matrix5X4.gen.cs @@ -187,6 +187,17 @@ public ref Vector4D this[int row] [UnscopedRef] public ref T M54 => ref Row5.W; + + /// + public override string ToString() => + string.Format( + "{{ {{M11:{0} M12:{1} M13:{2} M14:{3}}} {{M21:{4} M22:{5} M23:{6} M24:{7}}} {{M31:{8} M32:{9} M33:{10} M34:{11}}} {{M41:{12} M42:{13} M43:{14} M44:{15}}} {{M51:{16} M52:{17} M53:{18} M54:{19}}} }}", + Row1.X, Row1.Y, Row1.Z, Row1.W, + Row2.X, Row2.Y, Row2.Z, Row2.W, + Row3.X, Row3.Y, Row3.Z, Row3.W, + Row4.X, Row4.Y, Row4.Z, Row4.W, + Row5.X, Row5.Y, Row5.Z, Row5.W); + /// [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix5X4 other && Equals(other); @@ -246,6 +257,28 @@ public ref Vector4D this[int row] -value.Row4, -value.Row5); + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix5X4 operator *(T left, Matrix5X4 right) => + new(left * right.Row1, + left * right.Row2, + left * right.Row3, + left * right.Row4, + left * right.Row5); + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix5X4 operator *(Matrix5X4 left, T right) => + new(left.Row1 * right, + left.Row2 * right, + left.Row3 * right, + left.Row4 * right, + left.Row5 * right); + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -256,6 +289,149 @@ public ref Vector4D this[int row] left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4, left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3 + left.M44 * right.Row4, left.M51 * right.Row1 + left.M52 * right.Row2 + left.M53 * right.Row3 + left.M54 * right.Row4); + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix5X4(Matrix5X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As(), + from.Row5.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix5X4(Matrix5X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As(), + from.Row5.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix5X4(Matrix5X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As(), + from.Row5.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix5X4(Matrix5X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As(), + from.Row5.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix5X4(Matrix5X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As(), + from.Row5.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix5X4(Matrix5X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As(), + from.Row5.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix5X4(Matrix5X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As(), + from.Row5.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix5X4(Matrix5X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As(), + from.Row5.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix5X4(Matrix5X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As(), + from.Row5.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix5X4(Matrix5X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As(), + from.Row5.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix5X4(Matrix5X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As(), + from.Row5.As()); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix + /// The matrix + public static explicit operator Matrix5X4(Matrix5X4 from) => + new(from.Row1.As(), + from.Row2.As(), + from.Row3.As(), + from.Row4.As(), + from.Row5.As()); } public static partial class Matrix5X4 From 80fbbfc378d539179bf19605cadff43ff08571b2 Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Wed, 2 Jul 2025 13:24:42 -0700 Subject: [PATCH 07/19] Types that need Min/Max (e.g. Box) use INumber instead of INumberBase. INumber implies a total order opposed to INumberBase which supports e.g. Complex numbers. --- sources/Maths/Maths/Box2D.cs | 7 ++++--- sources/Maths/Maths/Box3D.cs | 5 +++-- sources/Maths/Maths/Cube.cs | 5 +++-- sources/Maths/Maths/Rectangle.Ops.cs | 2 +- sources/Maths/Maths/Rectangle.cs | 5 +++-- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/sources/Maths/Maths/Box2D.cs b/sources/Maths/Maths/Box2D.cs index a5536faf6e..f038fd5fd5 100644 --- a/sources/Maths/Maths/Box2D.cs +++ b/sources/Maths/Maths/Box2D.cs @@ -15,7 +15,7 @@ namespace Silk.NET.Maths [DataContract] public struct Box2D : IEquatable> - where T : INumberBase + where T : INumber { /// /// The min. @@ -149,7 +149,7 @@ public Box2D GetScaled(Vector2D scale, Vector2D anchor) /// The type of the scale. /// The calculated box. public Box2D GetScaled(Vector2D scale, Vector2D anchor) - where TScale : INumberBase + where TScale : INumber { return this.As().GetScaled(scale, anchor.As()).As(); } @@ -210,7 +210,8 @@ public override int GetHashCode() /// /// The type to cast to /// The casted box - public Box2D As() where TOther : INumberBase + public Box2D As() + where TOther : INumber { return new(Min.As(), Max.As()); } diff --git a/sources/Maths/Maths/Box3D.cs b/sources/Maths/Maths/Box3D.cs index f32a0afd1f..040c2b0256 100644 --- a/sources/Maths/Maths/Box3D.cs +++ b/sources/Maths/Maths/Box3D.cs @@ -15,7 +15,7 @@ namespace Silk.NET.Maths [DataContract] public struct Box3D : IEquatable> - where T : INumberBase + where T : INumber { /// /// The min. @@ -222,7 +222,8 @@ public override int GetHashCode() /// /// The type to cast to /// The casted box - public Box3D As() where TOther : INumberBase + public Box3D As() + where TOther : INumber { return new(Min.As(), Max.As()); } diff --git a/sources/Maths/Maths/Cube.cs b/sources/Maths/Maths/Cube.cs index b0a2e2a3c2..90bc620d49 100644 --- a/sources/Maths/Maths/Cube.cs +++ b/sources/Maths/Maths/Cube.cs @@ -15,7 +15,7 @@ namespace Silk.NET.Maths [DataContract] public struct Cube : IEquatable> - where T : INumberBase + where T : INumber { /// /// The origin. @@ -236,7 +236,8 @@ public override int GetHashCode() /// /// The type to cast to /// The casted cube - public Cube As() where TOther : INumberBase + public Cube As() + where TOther : INumber { return new(Origin.As(), Max.As()); } diff --git a/sources/Maths/Maths/Rectangle.Ops.cs b/sources/Maths/Maths/Rectangle.Ops.cs index 7dd2d6e9a0..cb1175a1a8 100644 --- a/sources/Maths/Maths/Rectangle.Ops.cs +++ b/sources/Maths/Maths/Rectangle.Ops.cs @@ -21,7 +21,7 @@ public static class Rectangle /// The type. /// The constructed rectangle. public static Rectangle FromLTRB(T left, T top, T right, T bottom) - where T : INumberBase + where T : INumber { Vector2D o = new(left, top); return new Rectangle(o, new Vector2D(right, bottom) - o); diff --git a/sources/Maths/Maths/Rectangle.cs b/sources/Maths/Maths/Rectangle.cs index c00d48993d..db90d7032b 100644 --- a/sources/Maths/Maths/Rectangle.cs +++ b/sources/Maths/Maths/Rectangle.cs @@ -14,7 +14,7 @@ namespace Silk.NET.Maths [DataContract] public struct Rectangle : IEquatable> - where T : INumberBase + where T : INumber { /// /// The origin. @@ -228,7 +228,8 @@ public override int GetHashCode() /// /// The type to cast to /// The casted rectangle - public Rectangle As() where TOther : INumberBase + public Rectangle As() + where TOther : INumber { return new(Origin.As(), Size.As()); } From 2a79fd860ebba7e5c8bf5db55e11360c899d9e43 Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Wed, 2 Jul 2025 13:25:13 -0700 Subject: [PATCH 08/19] Added explicit casts for vectors. --- sources/Maths/Maths/Matrix2X2.gen.cs | 48 +++++++------- sources/Maths/Maths/Matrix2X3.gen.cs | 48 +++++++------- sources/Maths/Maths/Matrix2X4.gen.cs | 48 +++++++------- sources/Maths/Maths/Matrix3X2.gen.cs | 48 +++++++------- sources/Maths/Maths/Matrix3X3.gen.cs | 48 +++++++------- sources/Maths/Maths/Matrix3X4.gen.cs | 48 +++++++------- sources/Maths/Maths/Matrix4X2.gen.cs | 48 +++++++------- sources/Maths/Maths/Matrix4X3.gen.cs | 48 +++++++------- sources/Maths/Maths/Matrix4X4.gen.cs | 48 +++++++------- sources/Maths/Maths/Matrix5X4.gen.cs | 48 +++++++------- sources/Maths/Maths/Vector2D.gen.cs | 96 ++++++++++++++++++++++++++++ sources/Maths/Maths/Vector3D.gen.cs | 96 ++++++++++++++++++++++++++++ sources/Maths/Maths/Vector4D.gen.cs | 96 ++++++++++++++++++++++++++++ 13 files changed, 528 insertions(+), 240 deletions(-) diff --git a/sources/Maths/Maths/Matrix2X2.gen.cs b/sources/Maths/Maths/Matrix2X2.gen.cs index 8d49a1fdba..d1490acf18 100644 --- a/sources/Maths/Maths/Matrix2X2.gen.cs +++ b/sources/Maths/Maths/Matrix2X2.gen.cs @@ -182,8 +182,8 @@ public Matrix2X2 Transpose() => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => new(from.Row1.As(), from.Row2.As()); @@ -191,8 +191,8 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => new(from.Row1.As(), from.Row2.As()); @@ -200,8 +200,8 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => new(from.Row1.As(), from.Row2.As()); @@ -209,8 +209,8 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => new(from.Row1.As(), from.Row2.As()); @@ -218,8 +218,8 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => new(from.Row1.As(), from.Row2.As()); @@ -227,8 +227,8 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => new(from.Row1.As(), from.Row2.As()); @@ -236,8 +236,8 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => new(from.Row1.As(), from.Row2.As()); @@ -245,8 +245,8 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => new(from.Row1.As(), from.Row2.As()); @@ -254,8 +254,8 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => new(from.Row1.As(), from.Row2.As()); @@ -263,8 +263,8 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => new(from.Row1.As(), from.Row2.As()); @@ -272,8 +272,8 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => new(from.Row1.As(), from.Row2.As()); @@ -281,8 +281,8 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => new(from.Row1.As(), from.Row2.As()); diff --git a/sources/Maths/Maths/Matrix2X3.gen.cs b/sources/Maths/Maths/Matrix2X3.gen.cs index d8d87fd30b..07f9ec51b9 100644 --- a/sources/Maths/Maths/Matrix2X3.gen.cs +++ b/sources/Maths/Maths/Matrix2X3.gen.cs @@ -200,8 +200,8 @@ public Matrix3X2 Transpose() => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => new(from.Row1.As(), from.Row2.As()); @@ -209,8 +209,8 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => new(from.Row1.As(), from.Row2.As()); @@ -218,8 +218,8 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => new(from.Row1.As(), from.Row2.As()); @@ -227,8 +227,8 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => new(from.Row1.As(), from.Row2.As()); @@ -236,8 +236,8 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => new(from.Row1.As(), from.Row2.As()); @@ -245,8 +245,8 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => new(from.Row1.As(), from.Row2.As()); @@ -254,8 +254,8 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => new(from.Row1.As(), from.Row2.As()); @@ -263,8 +263,8 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => new(from.Row1.As(), from.Row2.As()); @@ -272,8 +272,8 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => new(from.Row1.As(), from.Row2.As()); @@ -281,8 +281,8 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => new(from.Row1.As(), from.Row2.As()); @@ -290,8 +290,8 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => new(from.Row1.As(), from.Row2.As()); @@ -299,8 +299,8 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => new(from.Row1.As(), from.Row2.As()); diff --git a/sources/Maths/Maths/Matrix2X4.gen.cs b/sources/Maths/Maths/Matrix2X4.gen.cs index 35573895a3..ee07f8dfee 100644 --- a/sources/Maths/Maths/Matrix2X4.gen.cs +++ b/sources/Maths/Maths/Matrix2X4.gen.cs @@ -224,8 +224,8 @@ public Matrix4X2 Transpose() => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => new(from.Row1.As(), from.Row2.As()); @@ -233,8 +233,8 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => new(from.Row1.As(), from.Row2.As()); @@ -242,8 +242,8 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => new(from.Row1.As(), from.Row2.As()); @@ -251,8 +251,8 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => new(from.Row1.As(), from.Row2.As()); @@ -260,8 +260,8 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => new(from.Row1.As(), from.Row2.As()); @@ -269,8 +269,8 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => new(from.Row1.As(), from.Row2.As()); @@ -278,8 +278,8 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => new(from.Row1.As(), from.Row2.As()); @@ -287,8 +287,8 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => new(from.Row1.As(), from.Row2.As()); @@ -296,8 +296,8 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => new(from.Row1.As(), from.Row2.As()); @@ -305,8 +305,8 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => new(from.Row1.As(), from.Row2.As()); @@ -314,8 +314,8 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => new(from.Row1.As(), from.Row2.As()); @@ -323,8 +323,8 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => new(from.Row1.As(), from.Row2.As()); diff --git a/sources/Maths/Maths/Matrix3X2.gen.cs b/sources/Maths/Maths/Matrix3X2.gen.cs index 2bb0ed9718..3c03e4b538 100644 --- a/sources/Maths/Maths/Matrix3X2.gen.cs +++ b/sources/Maths/Maths/Matrix3X2.gen.cs @@ -212,8 +212,8 @@ public Matrix2X3 Transpose() => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -222,8 +222,8 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -232,8 +232,8 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -242,8 +242,8 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -252,8 +252,8 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -262,8 +262,8 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -272,8 +272,8 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -282,8 +282,8 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -292,8 +292,8 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -302,8 +302,8 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -312,8 +312,8 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -322,8 +322,8 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => new(from.Row1.As(), from.Row2.As(), diff --git a/sources/Maths/Maths/Matrix3X3.gen.cs b/sources/Maths/Maths/Matrix3X3.gen.cs index 0796c2baa5..6466c089d6 100644 --- a/sources/Maths/Maths/Matrix3X3.gen.cs +++ b/sources/Maths/Maths/Matrix3X3.gen.cs @@ -246,8 +246,8 @@ public Matrix3X3 Transpose() => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -256,8 +256,8 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -266,8 +266,8 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -276,8 +276,8 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -286,8 +286,8 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -296,8 +296,8 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -306,8 +306,8 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -316,8 +316,8 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -326,8 +326,8 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -336,8 +336,8 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -346,8 +346,8 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -356,8 +356,8 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => new(from.Row1.As(), from.Row2.As(), diff --git a/sources/Maths/Maths/Matrix3X4.gen.cs b/sources/Maths/Maths/Matrix3X4.gen.cs index e662cce318..ce53d29ad9 100644 --- a/sources/Maths/Maths/Matrix3X4.gen.cs +++ b/sources/Maths/Maths/Matrix3X4.gen.cs @@ -269,8 +269,8 @@ public Matrix4X3 Transpose() => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -279,8 +279,8 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -289,8 +289,8 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -299,8 +299,8 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -309,8 +309,8 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -319,8 +319,8 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -329,8 +329,8 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -339,8 +339,8 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -349,8 +349,8 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -359,8 +359,8 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -369,8 +369,8 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -379,8 +379,8 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => new(from.Row1.As(), from.Row2.As(), diff --git a/sources/Maths/Maths/Matrix4X2.gen.cs b/sources/Maths/Maths/Matrix4X2.gen.cs index e5f3a6cff8..0cda66d434 100644 --- a/sources/Maths/Maths/Matrix4X2.gen.cs +++ b/sources/Maths/Maths/Matrix4X2.gen.cs @@ -249,8 +249,8 @@ public Matrix2X4 Transpose() => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -260,8 +260,8 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -271,8 +271,8 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -282,8 +282,8 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -293,8 +293,8 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -304,8 +304,8 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -315,8 +315,8 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -326,8 +326,8 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -337,8 +337,8 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -348,8 +348,8 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -359,8 +359,8 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => new(from.Row1.As(), from.Row2.As(), @@ -370,8 +370,8 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => new(from.Row1.As(), from.Row2.As(), diff --git a/sources/Maths/Maths/Matrix4X3.gen.cs b/sources/Maths/Maths/Matrix4X3.gen.cs index b21822d0f2..f5d3add102 100644 --- a/sources/Maths/Maths/Matrix4X3.gen.cs +++ b/sources/Maths/Maths/Matrix4X3.gen.cs @@ -282,8 +282,8 @@ public Matrix3X4 Transpose() => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -293,8 +293,8 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -304,8 +304,8 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -315,8 +315,8 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -326,8 +326,8 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -337,8 +337,8 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -348,8 +348,8 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -359,8 +359,8 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -370,8 +370,8 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -381,8 +381,8 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -392,8 +392,8 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => new(from.Row1.As(), from.Row2.As(), @@ -403,8 +403,8 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => new(from.Row1.As(), from.Row2.As(), diff --git a/sources/Maths/Maths/Matrix4X4.gen.cs b/sources/Maths/Maths/Matrix4X4.gen.cs index c93d2d3804..c77c210af0 100644 --- a/sources/Maths/Maths/Matrix4X4.gen.cs +++ b/sources/Maths/Maths/Matrix4X4.gen.cs @@ -323,8 +323,8 @@ public Matrix4X4 Transpose() => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -334,8 +334,8 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -345,8 +345,8 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -356,8 +356,8 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -367,8 +367,8 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -378,8 +378,8 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -389,8 +389,8 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -400,8 +400,8 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -411,8 +411,8 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -422,8 +422,8 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -433,8 +433,8 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -444,8 +444,8 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => new(from.Row1.As(), from.Row2.As(), diff --git a/sources/Maths/Maths/Matrix5X4.gen.cs b/sources/Maths/Maths/Matrix5X4.gen.cs index def96a81ab..91ae1f4986 100644 --- a/sources/Maths/Maths/Matrix5X4.gen.cs +++ b/sources/Maths/Maths/Matrix5X4.gen.cs @@ -292,8 +292,8 @@ public override string ToString() => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -304,8 +304,8 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -316,8 +316,8 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -328,8 +328,8 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -340,8 +340,8 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -352,8 +352,8 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -364,8 +364,8 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -376,8 +376,8 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -388,8 +388,8 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -400,8 +400,8 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -412,8 +412,8 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => new(from.Row1.As(), from.Row2.As(), @@ -424,8 +424,8 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// /// Converts a matrix of into one with an underlying type of . /// - /// The source matrix - /// The matrix + /// The source matrix. + /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => new(from.Row1.As(), from.Row2.As(), diff --git a/sources/Maths/Maths/Vector2D.gen.cs b/sources/Maths/Maths/Vector2D.gen.cs index d62934f8fb..0b09be2ea6 100644 --- a/sources/Maths/Maths/Vector2D.gen.cs +++ b/sources/Maths/Maths/Vector2D.gen.cs @@ -356,6 +356,102 @@ public static implicit operator (T X, T Y)(Vector2D v) => public static Vector2D operator /(Vector2D vector, T scalar) => new(vector.X / scalar, vector.Y / scalar); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + from.As(); } public static partial class Vector2D diff --git a/sources/Maths/Maths/Vector3D.gen.cs b/sources/Maths/Maths/Vector3D.gen.cs index f65b1522b7..ac758bac66 100644 --- a/sources/Maths/Maths/Vector3D.gen.cs +++ b/sources/Maths/Maths/Vector3D.gen.cs @@ -395,6 +395,102 @@ public static implicit operator (T X, T Y, T Z)(Vector3D v) => public static Vector3D operator /(Vector3D vector, T scalar) => new(vector.X / scalar, vector.Y / scalar, vector.Z / scalar); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + from.As(); } public static partial class Vector3D diff --git a/sources/Maths/Maths/Vector4D.gen.cs b/sources/Maths/Maths/Vector4D.gen.cs index 1055a4c936..210e3a98b4 100644 --- a/sources/Maths/Maths/Vector4D.gen.cs +++ b/sources/Maths/Maths/Vector4D.gen.cs @@ -434,6 +434,102 @@ public static implicit operator (T X, T Y, T Z, T W)(Vector4D v) => public static Vector4D operator /(Vector4D vector, T scalar) => new(vector.X / scalar, vector.Y / scalar, vector.Z / scalar, vector.W / scalar); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + from.As(); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + from.As(); } public static partial class Vector4D From 5e0e7d9cd9a88f316971d3b85ed9bb4d48a924f2 Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Wed, 2 Jul 2025 14:55:53 -0700 Subject: [PATCH 09/19] Use extension properties for LengthSquared and Length. Use these for Normalize. Add DistanceSquared and Distance. --- sources/Maths/Maths/Silk.NET.Maths.csproj | 1 + sources/Maths/Maths/Vector2D.cs | 37 ++++++------------- sources/Maths/Maths/Vector2D.gen.cs | 44 ++++++++++++++++++----- sources/Maths/Maths/Vector3D.cs | 29 ++++++--------- sources/Maths/Maths/Vector3D.gen.cs | 44 ++++++++++++++++++----- sources/Maths/Maths/Vector4D.cs | 2 -- sources/Maths/Maths/Vector4D.gen.cs | 44 ++++++++++++++++++----- 7 files changed, 127 insertions(+), 74 deletions(-) diff --git a/sources/Maths/Maths/Silk.NET.Maths.csproj b/sources/Maths/Maths/Silk.NET.Maths.csproj index dbfdad1475..c4a41cabc6 100644 --- a/sources/Maths/Maths/Silk.NET.Maths.csproj +++ b/sources/Maths/Maths/Silk.NET.Maths.csproj @@ -2,6 +2,7 @@ net8.0 + preview enable true true diff --git a/sources/Maths/Maths/Vector2D.cs b/sources/Maths/Maths/Vector2D.cs index dd577a241c..2f8e1cd237 100644 --- a/sources/Maths/Maths/Vector2D.cs +++ b/sources/Maths/Maths/Vector2D.cs @@ -14,12 +14,6 @@ namespace Silk.NET.Maths /// A structure representing a 2D integer vector. public partial struct Vector2D { - /// Computes the cross product of this vector with another vector. - public T Cross(Vector2D other) => (X * other.Y) - (Y * other.X); - - /// Computes the cross product of two vectors. - public static T Cross(Vector2D left, Vector2D right) => (left.X * right.Y) - (left.Y * right.X); - // Casts /// Explicitly casts a to a . @@ -47,32 +41,21 @@ public static Vector2D LerpClamped(Vector2D a, Vector2D b, Vector2D a.X + (b.X - a.X) * T.Clamp(t.X, T.Zero, T.One), a.Y + (b.Y - a.Y) * T.Clamp(t.Y, T.Zero, T.One) ); - - // IFloatingPointIeee754 - - public static (Vector2D Sin, Vector2D Cos) SinCos(Vector2D x) => - (new(T.Sin(x.X), T.Sin(x.Y)), new(T.Cos(x.X), T.Cos(x.Y))); - - public static (Vector2D SinPi, Vector2D CosPi) SinCosPi(Vector2D x) => - (new(T.SinPi(x.X), T.SinPi(x.Y)), new(T.CosPi(x.X), T.CosPi(x.Y))); - - public static Vector2D FusedMultiplyAdd(Vector2D left, Vector2D right, Vector2D addend) => - new(T.FusedMultiplyAdd(left.X, right.X, addend.X), T.FusedMultiplyAdd(left.Y, right.Y, addend.Y)); - - public static Vector2D FusedMultiplyAdd(Vector2D left, Vector2D right, T addend) => - new(T.FusedMultiplyAdd(left.X, right.X, addend), T.FusedMultiplyAdd(left.Y, right.Y, addend)); - - public static Vector2D FusedMultiplyAdd(Vector2D left, T right, Vector2D addend) => - new(T.FusedMultiplyAdd(left.X, right, addend.X), T.FusedMultiplyAdd(left.Y, right, addend.Y)); - - public static Vector2D FusedMultiplyAdd(Vector2D left, T right, T addend) => - new(T.FusedMultiplyAdd(left.X, right, addend), T.FusedMultiplyAdd(left.Y, right, addend)); } public static partial class Vector2D { /// Computes the cross product of two vectors. public static T Cross(this Vector2D left, Vector2D right) - where T : IFloatingPointIeee754 => (left.X * right.Y) - (left.Y * right.X); + where T : INumberBase => + (left.X * right.Y) - (left.Y * right.X); + + public static (Vector2D Sin, Vector2D Cos) SinCos(this Vector2D x) + where T : INumberBase => + (new(T.Sin(x.X), T.Sin(x.Y)), new(T.Cos(x.X), T.Cos(x.Y))); + + public static (Vector2D SinPi, Vector2D CosPi) SinCosPi(this Vector2D x) + where T : INumberBase => + (new(T.SinPi(x.X), T.SinPi(x.Y)), new(T.CosPi(x.X), T.CosPi(x.Y))); } } diff --git a/sources/Maths/Maths/Vector2D.gen.cs b/sources/Maths/Maths/Vector2D.gen.cs index 0b09be2ea6..fb65471a0b 100644 --- a/sources/Maths/Maths/Vector2D.gen.cs +++ b/sources/Maths/Maths/Vector2D.gen.cs @@ -51,8 +51,6 @@ public Vector2D(ReadOnlySpan values) /// Gets the vector (0, 1). public static Vector2D UnitY => new(T.Zero, T.One); - /// Gets the squared length of the vector (dot product with itself). - public T LengthSquared => Vector2D.Dot(this, this); /// T IReadOnlyList.this[int index] => this[index]; @@ -456,6 +454,20 @@ public static explicit operator Vector2D(Vector2D from) => public static partial class Vector2D { + extension(Vector2D vector) + where T : IRootFunctions + { + /// Gets the length of the vector. + public T Length => T.Sqrt(vector.LengthSquared); + } + + extension(Vector2D vector) + where T : INumberBase + { + /// Gets the length squared of the vector. + public T LengthSquared => Vector2D.Dot(vector, vector); + } + /// Computes the dot product of two vectors. public static T Dot(this Vector2D left, Vector2D right) where T : INumberBase => @@ -469,19 +481,33 @@ public static Vector2D Reflect(Vector2D vector, Vector2D normal) return vector - (normal * (dot + dot)); } - /// Computes the length of the vector. - public static T GetLength(this Vector2D vector) - where T : IFloatingPointIeee754 => - T.Sqrt(vector.LengthSquared); - /// Normalizes a vector. public static Vector2D Normalize(this Vector2D vector) - where T : IFloatingPointIeee754 + where T : IRootFunctions { - T length = vector.GetLength(); + T length = vector.Length; return length != T.Zero ? vector / length : Vector2D.Zero; } + /// Returns the Euclidean distance between the two given points. + /// The first point. + /// The second point. + /// The distance. + public static T Distance(Vector2D value1, Vector2D value2) + where T : IRootFunctions => + T.Sqrt(DistanceSquared(value1, value2)); + + /// Returns the Euclidean distance squared between the two given points. + /// The first point. + /// The second point. + /// The distance squared. + public static T DistanceSquared(Vector2D value1, Vector2D value2) + where T : INumberBase + { + var difference = value1 - value2; + return Dot(difference, difference); + } + /// Applies to the provided arguments. /// A vector whose members will be provided for . public static Vector2D Sign(this Vector2D value) diff --git a/sources/Maths/Maths/Vector3D.cs b/sources/Maths/Maths/Vector3D.cs index d1a2cdb784..3423cd71be 100644 --- a/sources/Maths/Maths/Vector3D.cs +++ b/sources/Maths/Maths/Vector3D.cs @@ -14,24 +14,6 @@ namespace Silk.NET.Maths /// A structure representing a 3D integer vector. public partial struct Vector3D { - /// Computes the cross product of this vector with another vector. - public Vector3D Cross(Vector3D other) => - new Vector3D( - (Y * other.Z) - (Z * other.Y), - (Z * other.X) - (X * other.Z), - (X * other.Y) - (Y * other.X) - ); - - /// Computes the cross product of two vectors. - public static Vector3D Cross(Vector3D left, Vector3D right) => - new Vector3D( - (left.Y * right.Z) - (left.Z * right.Y), - (left.Z * right.X) - (left.X * right.Z), - (left.X * right.Y) - (left.Y * right.X) - ); - - // Casts - /// Explicitly casts a to a . public static explicit operator Vector3D(System.Numerics.Vector3 v) => new Vector3D((T)Convert.ChangeType(v.X, typeof(T)), (T)Convert.ChangeType(v.Y, typeof(T)), (T)Convert.ChangeType(v.Z, typeof(T))); @@ -48,4 +30,15 @@ public static (Vector3D Quotient, Vector3D Remainder) DivRem(Vector3D l return (new Vector3D(qX, qY, qZ), new Vector3D(rX, rY, rZ)); } } + + public static partial class Vector2D + { + /// Computes the cross product of two vectors. + public static Vector3D Cross(this Vector3D left, Vector3D right) + where T : INumberBase => + new Vector3D( + (left.Y * right.Z) - (left.Z * right.Y), + (left.Z * right.X) - (left.X * right.Z), + (left.X * right.Y) - (left.Y * right.X)); + } } diff --git a/sources/Maths/Maths/Vector3D.gen.cs b/sources/Maths/Maths/Vector3D.gen.cs index ac758bac66..368a08c31a 100644 --- a/sources/Maths/Maths/Vector3D.gen.cs +++ b/sources/Maths/Maths/Vector3D.gen.cs @@ -61,8 +61,6 @@ public Vector3D(ReadOnlySpan values) /// Gets the vector (0, 0, 1). public static Vector3D UnitZ => new(T.Zero, T.Zero, T.One); - /// Gets the squared length of the vector (dot product with itself). - public T LengthSquared => Vector3D.Dot(this, this); /// T IReadOnlyList.this[int index] => this[index]; @@ -495,6 +493,20 @@ public static explicit operator Vector3D(Vector3D from) => public static partial class Vector3D { + extension(Vector3D vector) + where T : IRootFunctions + { + /// Gets the length of the vector. + public T Length => T.Sqrt(vector.LengthSquared); + } + + extension(Vector3D vector) + where T : INumberBase + { + /// Gets the length squared of the vector. + public T LengthSquared => Vector3D.Dot(vector, vector); + } + /// Computes the dot product of two vectors. public static T Dot(this Vector3D left, Vector3D right) where T : INumberBase => @@ -508,19 +520,33 @@ public static Vector3D Reflect(Vector3D vector, Vector3D normal) return vector - (normal * (dot + dot)); } - /// Computes the length of the vector. - public static T GetLength(this Vector3D vector) - where T : IFloatingPointIeee754 => - T.Sqrt(vector.LengthSquared); - /// Normalizes a vector. public static Vector3D Normalize(this Vector3D vector) - where T : IFloatingPointIeee754 + where T : IRootFunctions { - T length = vector.GetLength(); + T length = vector.Length; return length != T.Zero ? vector / length : Vector3D.Zero; } + /// Returns the Euclidean distance between the two given points. + /// The first point. + /// The second point. + /// The distance. + public static T Distance(Vector3D value1, Vector3D value2) + where T : IRootFunctions => + T.Sqrt(DistanceSquared(value1, value2)); + + /// Returns the Euclidean distance squared between the two given points. + /// The first point. + /// The second point. + /// The distance squared. + public static T DistanceSquared(Vector3D value1, Vector3D value2) + where T : INumberBase + { + var difference = value1 - value2; + return Dot(difference, difference); + } + /// Applies to the provided arguments. /// A vector whose members will be provided for . public static Vector3D Sign(this Vector3D value) diff --git a/sources/Maths/Maths/Vector4D.cs b/sources/Maths/Maths/Vector4D.cs index a50f79549d..b0ce4f0345 100644 --- a/sources/Maths/Maths/Vector4D.cs +++ b/sources/Maths/Maths/Vector4D.cs @@ -13,8 +13,6 @@ namespace Silk.NET.Maths /// A structure representing a 4D integer vector. public partial struct Vector4D { - // Casts - /// Explicitly casts a System.Numerics.Vector4 to a Vector4D. public static explicit operator Vector4D(System.Numerics.Vector4 v) => new Vector4D((T)Convert.ChangeType(v.X, typeof(T)), (T)Convert.ChangeType(v.Y, typeof(T)), (T)Convert.ChangeType(v.Z, typeof(T)), (T)Convert.ChangeType(v.W, typeof(T))); diff --git a/sources/Maths/Maths/Vector4D.gen.cs b/sources/Maths/Maths/Vector4D.gen.cs index 210e3a98b4..8b433d61c2 100644 --- a/sources/Maths/Maths/Vector4D.gen.cs +++ b/sources/Maths/Maths/Vector4D.gen.cs @@ -71,8 +71,6 @@ public Vector4D(ReadOnlySpan values) /// Gets the vector (0, 0, 0, 1). public static Vector4D UnitW => new(T.Zero, T.Zero, T.Zero, T.One); - /// Gets the squared length of the vector (dot product with itself). - public T LengthSquared => Vector4D.Dot(this, this); /// T IReadOnlyList.this[int index] => this[index]; @@ -534,6 +532,20 @@ public static explicit operator Vector4D(Vector4D from) => public static partial class Vector4D { + extension(Vector4D vector) + where T : IRootFunctions + { + /// Gets the length of the vector. + public T Length => T.Sqrt(vector.LengthSquared); + } + + extension(Vector4D vector) + where T : INumberBase + { + /// Gets the length squared of the vector. + public T LengthSquared => Vector4D.Dot(vector, vector); + } + /// Computes the dot product of two vectors. public static T Dot(this Vector4D left, Vector4D right) where T : INumberBase => @@ -547,19 +559,33 @@ public static Vector4D Reflect(Vector4D vector, Vector4D normal) return vector - (normal * (dot + dot)); } - /// Computes the length of the vector. - public static T GetLength(this Vector4D vector) - where T : IFloatingPointIeee754 => - T.Sqrt(vector.LengthSquared); - /// Normalizes a vector. public static Vector4D Normalize(this Vector4D vector) - where T : IFloatingPointIeee754 + where T : IRootFunctions { - T length = vector.GetLength(); + T length = vector.Length; return length != T.Zero ? vector / length : Vector4D.Zero; } + /// Returns the Euclidean distance between the two given points. + /// The first point. + /// The second point. + /// The distance. + public static T Distance(Vector4D value1, Vector4D value2) + where T : IRootFunctions => + T.Sqrt(DistanceSquared(value1, value2)); + + /// Returns the Euclidean distance squared between the two given points. + /// The first point. + /// The second point. + /// The distance squared. + public static T DistanceSquared(Vector4D value1, Vector4D value2) + where T : INumberBase + { + var difference = value1 - value2; + return Dot(difference, difference); + } + /// Applies to the provided arguments. /// A vector whose members will be provided for . public static Vector4D Sign(this Vector4D value) From 5973151c022420dccf9ba432b80391dd792eb091 Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Wed, 2 Jul 2025 15:31:36 -0700 Subject: [PATCH 10/19] Generate more vector functions and reorganize. --- sources/Maths/Maths/Vector2D.cs | 44 ++++------------------------- sources/Maths/Maths/Vector2D.gen.cs | 27 ++++++++++++++++++ sources/Maths/Maths/Vector3D.cs | 26 ++++------------- sources/Maths/Maths/Vector3D.gen.cs | 29 +++++++++++++++++++ sources/Maths/Maths/Vector4D.cs | 24 ++++------------ sources/Maths/Maths/Vector4D.gen.cs | 31 ++++++++++++++++++++ 6 files changed, 103 insertions(+), 78 deletions(-) diff --git a/sources/Maths/Maths/Vector2D.cs b/sources/Maths/Maths/Vector2D.cs index 2f8e1cd237..5ade5f68db 100644 --- a/sources/Maths/Maths/Vector2D.cs +++ b/sources/Maths/Maths/Vector2D.cs @@ -1,46 +1,20 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections; -using System.Diagnostics.CodeAnalysis; using System.Numerics; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Text; namespace Silk.NET.Maths { /// A structure representing a 2D integer vector. public partial struct Vector2D { - // Casts - - /// Explicitly casts a to a . - public static explicit operator Vector2D(System.Numerics.Vector2 v) => + /// Explicitly casts a to a . + public static explicit operator Vector2D(Vector2 v) => new Vector2D((T)Convert.ChangeType(v.X, typeof(T)), (T)Convert.ChangeType(v.Y, typeof(T))); - /// Explicitly casts a to . - public static explicit operator System.Numerics.Vector2(Vector2D v) => - new System.Numerics.Vector2(Convert.ToSingle(v.X), Convert.ToSingle(v.Y)); - - public static (Vector2D Quotient, Vector2D Remainder) DivRem(Vector2D left, Vector2D right) - { - var (qX, rX) = T.DivRem(left.X, right.X); - var (qY, rY) = T.DivRem(left.Y, right.Y); - return (new Vector2D(qX, qY), new Vector2D(rX, rY)); - } - - /// Linearly interpolates between two vectors using a scalar t-value (clamped between 0 and 1). - public static Vector2D LerpClamped(Vector2D a, Vector2D b, T t) => - Vector2D.Lerp(a, b, T.Clamp(t, T.Zero, T.One)); - - /// Linearly interpolates between two vectors using a vector t-value (clamped between 0 and 1). - public static Vector2D LerpClamped(Vector2D a, Vector2D b, Vector2D t) => - new( - a.X + (b.X - a.X) * T.Clamp(t.X, T.Zero, T.One), - a.Y + (b.Y - a.Y) * T.Clamp(t.Y, T.Zero, T.One) - ); + /// Explicitly casts a to . + public static explicit operator Vector2(Vector2D v) => + new Vector2(Convert.ToSingle(v.X), Convert.ToSingle(v.Y)); } public static partial class Vector2D @@ -49,13 +23,5 @@ public static partial class Vector2D public static T Cross(this Vector2D left, Vector2D right) where T : INumberBase => (left.X * right.Y) - (left.Y * right.X); - - public static (Vector2D Sin, Vector2D Cos) SinCos(this Vector2D x) - where T : INumberBase => - (new(T.Sin(x.X), T.Sin(x.Y)), new(T.Cos(x.X), T.Cos(x.Y))); - - public static (Vector2D SinPi, Vector2D CosPi) SinCosPi(this Vector2D x) - where T : INumberBase => - (new(T.SinPi(x.X), T.SinPi(x.Y)), new(T.CosPi(x.X), T.CosPi(x.Y))); } } diff --git a/sources/Maths/Maths/Vector2D.gen.cs b/sources/Maths/Maths/Vector2D.gen.cs index fb65471a0b..474b209e2f 100644 --- a/sources/Maths/Maths/Vector2D.gen.cs +++ b/sources/Maths/Maths/Vector2D.gen.cs @@ -508,6 +508,33 @@ public static T DistanceSquared(Vector2D value1, Vector2D value2) return Dot(difference, difference); } + /// Linearly interpolates between two vectors using a scalar t-value (clamped between 0 and 1). + public static Vector2D LerpClamped(Vector2D a, Vector2D b, T amount) + where T : IFloatingPointIeee754 => + Lerp(a, b, T.Clamp(amount, T.Zero, T.One)); + + /// Linearly interpolates between two vectors using a vector t-value (clamped between 0 and 1). + public static Vector2D LerpClamped(Vector2D a, Vector2D b, Vector2D amount) + where T : IFloatingPointIeee754 => + new(T.Lerp(a.X, b.X, T.Clamp(amount.X, T.Zero, T.One)), + T.Lerp(a.Y, b.Y, T.Clamp(amount.Y, T.Zero, T.One))); + + public static (Vector2D Sin, Vector2D Cos) SinCos(this Vector2D x) + where T : ITrigonometricFunctions => + (new(T.Sin(x.X), T.Sin(x.Y)), new(T.Cos(x.X), T.Cos(x.Y))); + + public static (Vector2D SinPi, Vector2D CosPi) SinCosPi(this Vector2D x) + where T : ITrigonometricFunctions => + (new(T.SinPi(x.X), T.SinPi(x.Y)), new(T.CosPi(x.X), T.CosPi(x.Y))); + + public static (Vector2D Quotient, Vector2D Remainder) DivRem(Vector2D left, Vector2D right) + where T : IBinaryInteger + { + var (qX, rX) = T.DivRem(left.X, right.X); + var (qY, rY) = T.DivRem(left.Y, right.Y); + return (new Vector2D(qX, qY), new Vector2D(rX, rY)); + } + /// Applies to the provided arguments. /// A vector whose members will be provided for . public static Vector2D Sign(this Vector2D value) diff --git a/sources/Maths/Maths/Vector3D.cs b/sources/Maths/Maths/Vector3D.cs index 3423cd71be..6e70b85bd8 100644 --- a/sources/Maths/Maths/Vector3D.cs +++ b/sources/Maths/Maths/Vector3D.cs @@ -1,37 +1,23 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections; -using System.Diagnostics.CodeAnalysis; using System.Numerics; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Text; namespace Silk.NET.Maths { /// A structure representing a 3D integer vector. public partial struct Vector3D { - /// Explicitly casts a to a . - public static explicit operator Vector3D(System.Numerics.Vector3 v) => + /// Explicitly casts a to a . + public static explicit operator Vector3D(Vector3 v) => new Vector3D((T)Convert.ChangeType(v.X, typeof(T)), (T)Convert.ChangeType(v.Y, typeof(T)), (T)Convert.ChangeType(v.Z, typeof(T))); - /// Explicitly casts a to . - public static explicit operator System.Numerics.Vector3(Vector3D v) => - new System.Numerics.Vector3(Convert.ToSingle(v.X), Convert.ToSingle(v.Y), Convert.ToSingle(v.Z)); - - public static (Vector3D Quotient, Vector3D Remainder) DivRem(Vector3D left, Vector3D right) - { - var (qX, rX) = T.DivRem(left.X, right.X); - var (qY, rY) = T.DivRem(left.Y, right.Y); - var (qZ, rZ) = T.DivRem(left.Z, right.Z); - return (new Vector3D(qX, qY, qZ), new Vector3D(rX, rY, rZ)); - } + /// Explicitly casts a to . + public static explicit operator Vector3(Vector3D v) => + new Vector3(Convert.ToSingle(v.X), Convert.ToSingle(v.Y), Convert.ToSingle(v.Z)); } - public static partial class Vector2D + public static partial class Vector3D { /// Computes the cross product of two vectors. public static Vector3D Cross(this Vector3D left, Vector3D right) diff --git a/sources/Maths/Maths/Vector3D.gen.cs b/sources/Maths/Maths/Vector3D.gen.cs index 368a08c31a..e915fd65bf 100644 --- a/sources/Maths/Maths/Vector3D.gen.cs +++ b/sources/Maths/Maths/Vector3D.gen.cs @@ -547,6 +547,35 @@ public static T DistanceSquared(Vector3D value1, Vector3D value2) return Dot(difference, difference); } + /// Linearly interpolates between two vectors using a scalar t-value (clamped between 0 and 1). + public static Vector3D LerpClamped(Vector3D a, Vector3D b, T amount) + where T : IFloatingPointIeee754 => + Lerp(a, b, T.Clamp(amount, T.Zero, T.One)); + + /// Linearly interpolates between two vectors using a vector t-value (clamped between 0 and 1). + public static Vector3D LerpClamped(Vector3D a, Vector3D b, Vector3D amount) + where T : IFloatingPointIeee754 => + new(T.Lerp(a.X, b.X, T.Clamp(amount.X, T.Zero, T.One)), + T.Lerp(a.Y, b.Y, T.Clamp(amount.Y, T.Zero, T.One)), + T.Lerp(a.Z, b.Z, T.Clamp(amount.Z, T.Zero, T.One))); + + public static (Vector3D Sin, Vector3D Cos) SinCos(this Vector3D x) + where T : ITrigonometricFunctions => + (new(T.Sin(x.X), T.Sin(x.Y), T.Sin(x.Z)), new(T.Cos(x.X), T.Cos(x.Y), T.Cos(x.Z))); + + public static (Vector3D SinPi, Vector3D CosPi) SinCosPi(this Vector3D x) + where T : ITrigonometricFunctions => + (new(T.SinPi(x.X), T.SinPi(x.Y), T.SinPi(x.Z)), new(T.CosPi(x.X), T.CosPi(x.Y), T.CosPi(x.Z))); + + public static (Vector3D Quotient, Vector3D Remainder) DivRem(Vector3D left, Vector3D right) + where T : IBinaryInteger + { + var (qX, rX) = T.DivRem(left.X, right.X); + var (qY, rY) = T.DivRem(left.Y, right.Y); + var (qZ, rZ) = T.DivRem(left.Z, right.Z); + return (new Vector3D(qX, qY, qZ), new Vector3D(rX, rY, rZ)); + } + /// Applies to the provided arguments. /// A vector whose members will be provided for . public static Vector3D Sign(this Vector3D value) diff --git a/sources/Maths/Maths/Vector4D.cs b/sources/Maths/Maths/Vector4D.cs index b0ce4f0345..8a11841c66 100644 --- a/sources/Maths/Maths/Vector4D.cs +++ b/sources/Maths/Maths/Vector4D.cs @@ -1,33 +1,19 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections; -using System.Diagnostics.CodeAnalysis; using System.Numerics; -using System.Runtime.InteropServices; -using System.Text; namespace Silk.NET.Maths { /// A structure representing a 4D integer vector. public partial struct Vector4D { - /// Explicitly casts a System.Numerics.Vector4 to a Vector4D. - public static explicit operator Vector4D(System.Numerics.Vector4 v) => + /// Explicitly casts a to a . + public static explicit operator Vector4D(Vector4 v) => new Vector4D((T)Convert.ChangeType(v.X, typeof(T)), (T)Convert.ChangeType(v.Y, typeof(T)), (T)Convert.ChangeType(v.Z, typeof(T)), (T)Convert.ChangeType(v.W, typeof(T))); - /// Explicitly casts a Vector4D to System.Numerics.Vector4. - public static explicit operator System.Numerics.Vector4(Vector4D v) => - new System.Numerics.Vector4(Convert.ToSingle(v.X), Convert.ToSingle(v.Y), Convert.ToSingle(v.Z), Convert.ToSingle(v.W)); - - public static (Vector4D Quotient, Vector4D Remainder) DivRem(Vector4D left, Vector4D right) - { - var (qX, rX) = T.DivRem(left.X, right.X); - var (qY, rY) = T.DivRem(left.Y, right.Y); - var (qZ, rZ) = T.DivRem(left.Z, right.Z); - var (qW, rW) = T.DivRem(left.W, right.W); - return (new Vector4D(qX, qY, qZ, qW), new Vector4D(rX, rY, rZ, rW)); - } + /// Explicitly casts a to . + public static explicit operator Vector4(Vector4D v) => + new Vector4(Convert.ToSingle(v.X), Convert.ToSingle(v.Y), Convert.ToSingle(v.Z), Convert.ToSingle(v.W)); } } diff --git a/sources/Maths/Maths/Vector4D.gen.cs b/sources/Maths/Maths/Vector4D.gen.cs index 8b433d61c2..04cf959ede 100644 --- a/sources/Maths/Maths/Vector4D.gen.cs +++ b/sources/Maths/Maths/Vector4D.gen.cs @@ -586,6 +586,37 @@ public static T DistanceSquared(Vector4D value1, Vector4D value2) return Dot(difference, difference); } + /// Linearly interpolates between two vectors using a scalar t-value (clamped between 0 and 1). + public static Vector4D LerpClamped(Vector4D a, Vector4D b, T amount) + where T : IFloatingPointIeee754 => + Lerp(a, b, T.Clamp(amount, T.Zero, T.One)); + + /// Linearly interpolates between two vectors using a vector t-value (clamped between 0 and 1). + public static Vector4D LerpClamped(Vector4D a, Vector4D b, Vector4D amount) + where T : IFloatingPointIeee754 => + new(T.Lerp(a.X, b.X, T.Clamp(amount.X, T.Zero, T.One)), + T.Lerp(a.Y, b.Y, T.Clamp(amount.Y, T.Zero, T.One)), + T.Lerp(a.Z, b.Z, T.Clamp(amount.Z, T.Zero, T.One)), + T.Lerp(a.W, b.W, T.Clamp(amount.W, T.Zero, T.One))); + + public static (Vector4D Sin, Vector4D Cos) SinCos(this Vector4D x) + where T : ITrigonometricFunctions => + (new(T.Sin(x.X), T.Sin(x.Y), T.Sin(x.Z), T.Sin(x.W)), new(T.Cos(x.X), T.Cos(x.Y), T.Cos(x.Z), T.Cos(x.W))); + + public static (Vector4D SinPi, Vector4D CosPi) SinCosPi(this Vector4D x) + where T : ITrigonometricFunctions => + (new(T.SinPi(x.X), T.SinPi(x.Y), T.SinPi(x.Z), T.SinPi(x.W)), new(T.CosPi(x.X), T.CosPi(x.Y), T.CosPi(x.Z), T.CosPi(x.W))); + + public static (Vector4D Quotient, Vector4D Remainder) DivRem(Vector4D left, Vector4D right) + where T : IBinaryInteger + { + var (qX, rX) = T.DivRem(left.X, right.X); + var (qY, rY) = T.DivRem(left.Y, right.Y); + var (qZ, rZ) = T.DivRem(left.Z, right.Z); + var (qW, rW) = T.DivRem(left.W, right.W); + return (new Vector4D(qX, qY, qZ, qW), new Vector4D(rX, rY, rZ, rW)); + } + /// Applies to the provided arguments. /// A vector whose members will be provided for . public static Vector4D Sign(this Vector4D value) From 69be9de99547f689e869339a15d47af1efc787ee Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Wed, 2 Jul 2025 15:32:06 -0700 Subject: [PATCH 11/19] Fix type constraints. --- sources/Maths/Maths/Circle.cs | 4 ++-- sources/Maths/Maths/Matrix2X3.Ops.cs | 2 +- sources/Maths/Maths/Matrix3X3.Ops.cs | 2 +- sources/Maths/Maths/Matrix4X4.Ops.cs | 8 ++++---- sources/Maths/Maths/Sphere.cs | 6 ++++-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/sources/Maths/Maths/Circle.cs b/sources/Maths/Maths/Circle.cs index fd0a4ff342..4be7fcc35e 100644 --- a/sources/Maths/Maths/Circle.cs +++ b/sources/Maths/Maths/Circle.cs @@ -14,7 +14,7 @@ namespace Silk.NET.Maths [DataContract] public struct Circle : IEquatable> - where T : INumberBase + where T : IRootFunctions { /// /// The center. @@ -174,7 +174,7 @@ public override int GetHashCode() /// /// The type to cast to /// The casted circle - public Circle As() where TOther : INumberBase + public Circle As() where TOther : IRootFunctions { return new(Center.As(), Scalar.As(Radius)); } diff --git a/sources/Maths/Maths/Matrix2X3.Ops.cs b/sources/Maths/Maths/Matrix2X3.Ops.cs index cd5d662780..81cae99cff 100644 --- a/sources/Maths/Maths/Matrix2X3.Ops.cs +++ b/sources/Maths/Maths/Matrix2X3.Ops.cs @@ -32,7 +32,7 @@ public static Matrix2X3 Add(Matrix2X3 value1, Matrix2X3 value2) /// The forward vector of the camera. /// The created billboard matrix public static Matrix2X3 CreateBillboard(Vector3D objectPosition, Vector3D cameraPosition, Vector3D cameraUpVector, Vector3D cameraForwardVector) - where T : INumberBase + where T : IRootFunctions { Vector3D zaxis = objectPosition - cameraPosition; var norm = zaxis.LengthSquared; diff --git a/sources/Maths/Maths/Matrix3X3.Ops.cs b/sources/Maths/Maths/Matrix3X3.Ops.cs index e955b5c9bb..3f1dcf198d 100644 --- a/sources/Maths/Maths/Matrix3X3.Ops.cs +++ b/sources/Maths/Maths/Matrix3X3.Ops.cs @@ -53,7 +53,7 @@ public static Matrix3X3 Add(Matrix3X3 value1, Matrix3X3 value2) /// The forward vector of the camera. /// The created billboard matrix public static Matrix3X3 CreateBillboard(Vector3D objectPosition, Vector3D cameraPosition, Vector3D cameraUpVector, Vector3D cameraForwardVector) - where T : INumberBase + where T : IRootFunctions { Vector3D zaxis = objectPosition - cameraPosition; var norm = zaxis.LengthSquared; diff --git a/sources/Maths/Maths/Matrix4X4.Ops.cs b/sources/Maths/Maths/Matrix4X4.Ops.cs index d44381a2c8..450925695d 100644 --- a/sources/Maths/Maths/Matrix4X4.Ops.cs +++ b/sources/Maths/Maths/Matrix4X4.Ops.cs @@ -58,7 +58,7 @@ public static Matrix4X4 Add(Matrix4X4 value1, Matrix4X4 value2) /// The forward vector of the camera. /// The created billboard matrix public static Matrix4X4 CreateBillboard(Vector3D objectPosition, Vector3D cameraPosition, Vector3D cameraUpVector, Vector3D cameraForwardVector) - where T : INumberBase + where T : IRootFunctions { Vector3D zaxis = objectPosition - cameraPosition; var norm = zaxis.LengthSquared; @@ -90,7 +90,7 @@ public static Matrix4X4 CreateBillboard(Vector3D objectPosition, Vector /// Forward vector of the object. /// The created billboard matrix. public static Matrix4X4 CreateConstrainedBillboard(Vector3D objectPosition, Vector3D cameraPosition, Vector3D rotateAxis, Vector3D cameraForwardVector, Vector3D objectForwardVector) - where T : INumberBase + where T : IRootFunctions { // Treat the case when object and camera positions are too close. Vector3D faceDir = objectPosition - cameraPosition; @@ -250,7 +250,7 @@ public static Matrix4X4 CreateFromYawPitchRoll(T yaw, T pitch, T roll) /// The direction that is "up" from the camera's point of view. /// The view matrix. public static Matrix4X4 CreateLookAt(Vector3D cameraPosition, Vector3D cameraTarget, Vector3D cameraUpVector) - where T : INumberBase + where T : IRootFunctions { Vector3D zaxis = Vector3D.Normalize(cameraPosition - cameraTarget); Vector3D xaxis = Vector3D.Normalize(Vector3D.Cross(cameraUpVector, zaxis)); @@ -814,7 +814,7 @@ public static Matrix4X4 CreateTranslation(T xPosition, T yPosition, T zPos /// Upward direction of the object; usually [0, 1, 0]. /// The world matrix. public static Matrix4X4 CreateWorld(Vector3D position, Vector3D forward, Vector3D up) - where T : INumberBase + where T : IRootFunctions { Vector3D zaxis = Vector3D.Normalize(-forward); Vector3D xaxis = Vector3D.Normalize(Vector3D.Cross(up, zaxis)); diff --git a/sources/Maths/Maths/Sphere.cs b/sources/Maths/Maths/Sphere.cs index 91bce6e0f2..759a13290a 100644 --- a/sources/Maths/Maths/Sphere.cs +++ b/sources/Maths/Maths/Sphere.cs @@ -13,7 +13,8 @@ namespace Silk.NET.Maths [Serializable] [DataContract] public struct Sphere - : IEquatable> where T : INumberBase + : IEquatable> + where T : IRootFunctions { /// /// The center. @@ -169,7 +170,8 @@ public override int GetHashCode() /// /// The type to cast to /// The casted sphere - public Sphere As() where TOther : INumberBase + public Sphere As() + where TOther : IRootFunctions { return new(Center.As(), Scalar.As(Radius)); } From 75b1c5de6a3b20785330c7f5a9b3fa9c739a3d48 Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Wed, 2 Jul 2025 16:31:17 -0700 Subject: [PATCH 12/19] Overloads for casts, As, CreateChecked, CreateSaturating, and CreateTruncating. --- sources/Maths/Maths/Matrix2X2.cs | 10 - sources/Maths/Maths/Matrix2X2.gen.cs | 178 ++++++++++++++--- sources/Maths/Maths/Matrix2X3.cs | 10 - sources/Maths/Maths/Matrix2X3.gen.cs | 178 ++++++++++++++--- sources/Maths/Maths/Matrix2X4.cs | 10 - sources/Maths/Maths/Matrix2X4.gen.cs | 178 ++++++++++++++--- sources/Maths/Maths/Matrix3X2.cs | 10 - sources/Maths/Maths/Matrix3X2.gen.cs | 214 ++++++++++++++++---- sources/Maths/Maths/Matrix3X3.cs | 10 - sources/Maths/Maths/Matrix3X3.gen.cs | 214 ++++++++++++++++---- sources/Maths/Maths/Matrix3X4.cs | 10 - sources/Maths/Maths/Matrix3X4.gen.cs | 214 ++++++++++++++++---- sources/Maths/Maths/Matrix4X2.cs | 10 - sources/Maths/Maths/Matrix4X2.gen.cs | 250 ++++++++++++++++++----- sources/Maths/Maths/Matrix4X3.cs | 10 - sources/Maths/Maths/Matrix4X3.gen.cs | 250 ++++++++++++++++++----- sources/Maths/Maths/Matrix4X4.cs | 10 - sources/Maths/Maths/Matrix4X4.gen.cs | 250 ++++++++++++++++++----- sources/Maths/Maths/Matrix5X4.cs | 10 - sources/Maths/Maths/Matrix5X4.gen.cs | 286 +++++++++++++++++++++------ sources/Maths/Maths/Vector2D.gen.cs | 155 +++++++++++++-- sources/Maths/Maths/Vector3D.gen.cs | 159 ++++++++++++--- sources/Maths/Maths/Vector4D.gen.cs | 163 ++++++++++++--- 23 files changed, 2236 insertions(+), 553 deletions(-) diff --git a/sources/Maths/Maths/Matrix2X2.cs b/sources/Maths/Maths/Matrix2X2.cs index ada5e31b39..c1af4faa51 100644 --- a/sources/Maths/Maths/Matrix2X2.cs +++ b/sources/Maths/Maths/Matrix2X2.cs @@ -81,15 +81,5 @@ public readonly T GetDeterminant() return Scalar.Subtract(Scalar.Multiply(a, d), Scalar.Multiply(b, c)); } - - /// - /// Returns this matrix casted to - /// - /// The type to cast to - /// The casted matrix - public Matrix2X2 As() where TOther : INumberBase - { - return new(Row1.As(), Row2.As()); - } } } diff --git a/sources/Maths/Maths/Matrix2X2.gen.cs b/sources/Maths/Maths/Matrix2X2.gen.cs index d1490acf18..0a61042a45 100644 --- a/sources/Maths/Maths/Matrix2X2.gen.cs +++ b/sources/Maths/Maths/Matrix2X2.gen.cs @@ -114,6 +114,27 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2); + /// Converts the components of this vector to another type. + public static Matrix2X2 CreateChecked(Matrix2X2 other) + where TOther : INumberBase => + new(Vector2D.CreateChecked(other.Row1), Vector2D.CreateChecked(other.Row2)); + + /// Converts the components of this vector to another type. + public static Matrix2X2 CreateSaturating(Matrix2X2 other) + where TOther : INumberBase => + new(Vector2D.CreateSaturating(other.Row1), Vector2D.CreateSaturating(other.Row2)); + + /// Converts the components of this vector to another type. + public static Matrix2X2 CreateTruncating(Matrix2X2 other) + where TOther : INumberBase => + new(Vector2D.CreateTruncating(other.Row1), Vector2D.CreateTruncating(other.Row2)); + + /// Converts the components of this vector to another type. + [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + public Matrix2X2 As() + where TOther : INumberBase => + new(Row1.As(), Row2.As()); + /// Computes the transpose of the matrix. public Matrix2X2 Transpose() => new(new(M11, M21), @@ -179,14 +200,24 @@ public Matrix2X2 Transpose() => public static Matrix2X2 operator *(Matrix2X2 left, Matrix2X2 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2, left.M21 * right.Row1 + left.M22 * right.Row2); + /// /// Converts a matrix of into one with an underlying type of . /// /// The source matrix. /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X2(Matrix2X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -194,8 +225,17 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X2(Matrix2X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -203,8 +243,17 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X2(Matrix2X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -212,8 +261,17 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X2(Matrix2X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -221,8 +279,17 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X2(Matrix2X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -230,8 +297,17 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X2(Matrix2X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -239,8 +315,17 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X2(Matrix2X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -248,8 +333,17 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X2(Matrix2X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -257,8 +351,17 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X2(Matrix2X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -266,8 +369,17 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X2(Matrix2X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -275,8 +387,17 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X2(Matrix2X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -284,8 +405,17 @@ public static explicit operator Matrix2X2(Matrix2X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X2(Matrix2X2 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X2(Matrix2X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2)); } public static partial class Matrix2X2 diff --git a/sources/Maths/Maths/Matrix2X3.cs b/sources/Maths/Maths/Matrix2X3.cs index 884d142dd2..75e94fa6ed 100644 --- a/sources/Maths/Maths/Matrix2X3.cs +++ b/sources/Maths/Maths/Matrix2X3.cs @@ -79,15 +79,5 @@ public readonly bool IsIdentity { return value1.X * value2.Row1 + value1.Y * value2.Row2; } - - /// - /// Returns this matrix casted to - /// - /// The type to cast to - /// The casted matrix - public Matrix2X3 As() where TOther : INumberBase - { - return new(Row1.As(), Row2.As()); - } } } diff --git a/sources/Maths/Maths/Matrix2X3.gen.cs b/sources/Maths/Maths/Matrix2X3.gen.cs index 07f9ec51b9..cd3fd0c468 100644 --- a/sources/Maths/Maths/Matrix2X3.gen.cs +++ b/sources/Maths/Maths/Matrix2X3.gen.cs @@ -123,6 +123,27 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2); + /// Converts the components of this vector to another type. + public static Matrix2X3 CreateChecked(Matrix2X3 other) + where TOther : INumberBase => + new(Vector3D.CreateChecked(other.Row1), Vector3D.CreateChecked(other.Row2)); + + /// Converts the components of this vector to another type. + public static Matrix2X3 CreateSaturating(Matrix2X3 other) + where TOther : INumberBase => + new(Vector3D.CreateSaturating(other.Row1), Vector3D.CreateSaturating(other.Row2)); + + /// Converts the components of this vector to another type. + public static Matrix2X3 CreateTruncating(Matrix2X3 other) + where TOther : INumberBase => + new(Vector3D.CreateTruncating(other.Row1), Vector3D.CreateTruncating(other.Row2)); + + /// Converts the components of this vector to another type. + [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + public Matrix2X3 As() + where TOther : INumberBase => + new(Row1.As(), Row2.As()); + /// Computes the transpose of the matrix. public Matrix3X2 Transpose() => new(new(M11, M21), @@ -197,14 +218,24 @@ public Matrix3X2 Transpose() => public static Matrix2X2 operator *(Matrix2X3 left, Matrix3X2 right) => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3); + /// /// Converts a matrix of into one with an underlying type of . /// /// The source matrix. /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X3(Matrix2X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -212,8 +243,17 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X3(Matrix2X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -221,8 +261,17 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X3(Matrix2X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -230,8 +279,17 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X3(Matrix2X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -239,8 +297,17 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X3(Matrix2X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -248,8 +315,17 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X3(Matrix2X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -257,8 +333,17 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X3(Matrix2X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -266,8 +351,17 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X3(Matrix2X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -275,8 +369,17 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X3(Matrix2X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -284,8 +387,17 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X3(Matrix2X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -293,8 +405,17 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X3(Matrix2X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -302,8 +423,17 @@ public static explicit operator Matrix2X3(Matrix2X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X3(Matrix2X3 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X3(Matrix2X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2)); } public static partial class Matrix2X3 diff --git a/sources/Maths/Maths/Matrix2X4.cs b/sources/Maths/Maths/Matrix2X4.cs index d6d530eb34..fb82209033 100644 --- a/sources/Maths/Maths/Matrix2X4.cs +++ b/sources/Maths/Maths/Matrix2X4.cs @@ -80,15 +80,5 @@ public readonly bool IsIdentity { return value1.X * value2.Row1 + value1.Y * value2.Row2; } - - /// - /// Returns this matrix casted to - /// - /// The type to cast to - /// The casted matrix - public Matrix2X4 As() where TOther : INumberBase - { - return new(Row1.As(), Row2.As()); - } } } diff --git a/sources/Maths/Maths/Matrix2X4.gen.cs b/sources/Maths/Maths/Matrix2X4.gen.cs index ee07f8dfee..2e8af8f158 100644 --- a/sources/Maths/Maths/Matrix2X4.gen.cs +++ b/sources/Maths/Maths/Matrix2X4.gen.cs @@ -137,6 +137,27 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2); + /// Converts the components of this vector to another type. + public static Matrix2X4 CreateChecked(Matrix2X4 other) + where TOther : INumberBase => + new(Vector4D.CreateChecked(other.Row1), Vector4D.CreateChecked(other.Row2)); + + /// Converts the components of this vector to another type. + public static Matrix2X4 CreateSaturating(Matrix2X4 other) + where TOther : INumberBase => + new(Vector4D.CreateSaturating(other.Row1), Vector4D.CreateSaturating(other.Row2)); + + /// Converts the components of this vector to another type. + public static Matrix2X4 CreateTruncating(Matrix2X4 other) + where TOther : INumberBase => + new(Vector4D.CreateTruncating(other.Row1), Vector4D.CreateTruncating(other.Row2)); + + /// Converts the components of this vector to another type. + [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + public Matrix2X4 As() + where TOther : INumberBase => + new(Row1.As(), Row2.As()); + /// Computes the transpose of the matrix. public Matrix4X2 Transpose() => new(new(M11, M21), @@ -221,14 +242,24 @@ public Matrix4X2 Transpose() => new(left.M11 * right.Row1 + left.M12 * right.Row2, left.M21 * right.Row1 + left.M22 * right.Row2, left.M31 * right.Row1 + left.M32 * right.Row2); + /// /// Converts a matrix of into one with an underlying type of . /// /// The source matrix. /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X4(Matrix2X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -236,8 +267,17 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X4(Matrix2X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -245,8 +285,17 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X4(Matrix2X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -254,8 +303,17 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X4(Matrix2X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -263,8 +321,17 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X4(Matrix2X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -272,8 +339,17 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X4(Matrix2X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -281,8 +357,17 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X4(Matrix2X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -290,8 +375,17 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X4(Matrix2X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -299,8 +393,17 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X4(Matrix2X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -308,8 +411,17 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X4(Matrix2X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -317,8 +429,17 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X4(Matrix2X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2)); /// /// Converts a matrix of into one with an underlying type of . @@ -326,8 +447,17 @@ public static explicit operator Matrix2X4(Matrix2X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix2X4(Matrix2X4 from) => - new(from.Row1.As(), - from.Row2.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix2X4(Matrix2X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2)); } public static partial class Matrix2X4 diff --git a/sources/Maths/Maths/Matrix3X2.cs b/sources/Maths/Maths/Matrix3X2.cs index 2ec8ed1612..95bd53d619 100644 --- a/sources/Maths/Maths/Matrix3X2.cs +++ b/sources/Maths/Maths/Matrix3X2.cs @@ -116,15 +116,5 @@ public static explicit operator System.Numerics.Matrix3x2(Matrix3X2 from) Scalar.As(from.M21), Scalar.As(from.M22), Scalar.As(from.M31), Scalar.As(from.M32) ); - - /// - /// Returns this matrix casted to - /// - /// The type to cast to - /// The casted matrix - public Matrix3X2 As() where TOther : INumberBase - { - return new(Row1.As(), Row2.As(), Row3.As()); - } } } diff --git a/sources/Maths/Maths/Matrix3X2.gen.cs b/sources/Maths/Maths/Matrix3X2.gen.cs index 3c03e4b538..3afe6bdefa 100644 --- a/sources/Maths/Maths/Matrix3X2.gen.cs +++ b/sources/Maths/Maths/Matrix3X2.gen.cs @@ -128,6 +128,27 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); + /// Converts the components of this vector to another type. + public static Matrix3X2 CreateChecked(Matrix3X2 other) + where TOther : INumberBase => + new(Vector2D.CreateChecked(other.Row1), Vector2D.CreateChecked(other.Row2), Vector2D.CreateChecked(other.Row3)); + + /// Converts the components of this vector to another type. + public static Matrix3X2 CreateSaturating(Matrix3X2 other) + where TOther : INumberBase => + new(Vector2D.CreateSaturating(other.Row1), Vector2D.CreateSaturating(other.Row2), Vector2D.CreateSaturating(other.Row3)); + + /// Converts the components of this vector to another type. + public static Matrix3X2 CreateTruncating(Matrix3X2 other) + where TOther : INumberBase => + new(Vector2D.CreateTruncating(other.Row1), Vector2D.CreateTruncating(other.Row2), Vector2D.CreateTruncating(other.Row3)); + + /// Converts the components of this vector to another type. + [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + public Matrix3X2 As() + where TOther : INumberBase => + new(Row1.As(), Row2.As(), Row3.As()); + /// Computes the transpose of the matrix. public Matrix2X3 Transpose() => new(new(M11, M21, M31), @@ -209,15 +230,26 @@ public Matrix2X3 Transpose() => new(left.M11 * right.Row1 + left.M12 * right.Row2, left.M21 * right.Row1 + left.M22 * right.Row2, left.M31 * right.Row1 + left.M32 * right.Row2); + /// /// Converts a matrix of into one with an underlying type of . /// /// The source matrix. /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X2(Matrix3X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -225,9 +257,19 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X2(Matrix3X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -235,9 +277,19 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X2(Matrix3X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -245,9 +297,19 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X2(Matrix3X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -255,9 +317,19 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X2(Matrix3X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -265,9 +337,19 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X2(Matrix3X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -275,9 +357,19 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X2(Matrix3X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -285,9 +377,19 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X2(Matrix3X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -295,9 +397,19 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X2(Matrix3X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -305,9 +417,19 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X2(Matrix3X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -315,9 +437,19 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X2(Matrix3X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -325,9 +457,19 @@ public static explicit operator Matrix3X2(Matrix3X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X2(Matrix3X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X2(Matrix3X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3)); } public static partial class Matrix3X2 diff --git a/sources/Maths/Maths/Matrix3X3.cs b/sources/Maths/Maths/Matrix3X3.cs index 69e0db0bd1..27cf5a9bf6 100644 --- a/sources/Maths/Maths/Matrix3X3.cs +++ b/sources/Maths/Maths/Matrix3X3.cs @@ -113,15 +113,5 @@ public readonly T GetDeterminant() Scalar.Multiply(b, Scalar.Subtract(Scalar.Multiply(d, i), Scalar.Multiply(f, g)))), Scalar.Multiply(c, Scalar.Subtract(Scalar.Multiply(d, h), Scalar.Multiply(e, g)))); } - - /// - /// Returns this matrix casted to - /// - /// The type to cast to - /// The casted matrix - public Matrix3X3 As() where TOther : INumberBase - { - return new(Row1.As(), Row2.As(), Row3.As()); - } } } diff --git a/sources/Maths/Maths/Matrix3X3.gen.cs b/sources/Maths/Maths/Matrix3X3.gen.cs index 6466c089d6..4b039ee5b5 100644 --- a/sources/Maths/Maths/Matrix3X3.gen.cs +++ b/sources/Maths/Maths/Matrix3X3.gen.cs @@ -153,6 +153,27 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); + /// Converts the components of this vector to another type. + public static Matrix3X3 CreateChecked(Matrix3X3 other) + where TOther : INumberBase => + new(Vector3D.CreateChecked(other.Row1), Vector3D.CreateChecked(other.Row2), Vector3D.CreateChecked(other.Row3)); + + /// Converts the components of this vector to another type. + public static Matrix3X3 CreateSaturating(Matrix3X3 other) + where TOther : INumberBase => + new(Vector3D.CreateSaturating(other.Row1), Vector3D.CreateSaturating(other.Row2), Vector3D.CreateSaturating(other.Row3)); + + /// Converts the components of this vector to another type. + public static Matrix3X3 CreateTruncating(Matrix3X3 other) + where TOther : INumberBase => + new(Vector3D.CreateTruncating(other.Row1), Vector3D.CreateTruncating(other.Row2), Vector3D.CreateTruncating(other.Row3)); + + /// Converts the components of this vector to another type. + [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + public Matrix3X3 As() + where TOther : INumberBase => + new(Row1.As(), Row2.As(), Row3.As()); + /// Computes the transpose of the matrix. public Matrix3X3 Transpose() => new(new(M11, M21, M31), @@ -243,15 +264,26 @@ public Matrix3X3 Transpose() => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3); + /// /// Converts a matrix of into one with an underlying type of . /// /// The source matrix. /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X3(Matrix3X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -259,9 +291,19 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X3(Matrix3X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -269,9 +311,19 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X3(Matrix3X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -279,9 +331,19 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X3(Matrix3X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -289,9 +351,19 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X3(Matrix3X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -299,9 +371,19 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X3(Matrix3X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -309,9 +391,19 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X3(Matrix3X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -319,9 +411,19 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X3(Matrix3X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -329,9 +431,19 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X3(Matrix3X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -339,9 +451,19 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X3(Matrix3X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -349,9 +471,19 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X3(Matrix3X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -359,9 +491,19 @@ public static explicit operator Matrix3X3(Matrix3X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X3(Matrix3X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X3(Matrix3X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3)); } public static partial class Matrix3X3 diff --git a/sources/Maths/Maths/Matrix3X4.cs b/sources/Maths/Maths/Matrix3X4.cs index b84ae7b298..ed6c1c1193 100644 --- a/sources/Maths/Maths/Matrix3X4.cs +++ b/sources/Maths/Maths/Matrix3X4.cs @@ -97,15 +97,5 @@ public readonly bool IsIdentity { return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3; } - - /// - /// Returns this matrix casted to - /// - /// The type to cast to - /// The casted matrix - public Matrix3X4 As() where TOther : INumberBase - { - return new(Row1.As(), Row2.As(), Row3.As()); - } } } diff --git a/sources/Maths/Maths/Matrix3X4.gen.cs b/sources/Maths/Maths/Matrix3X4.gen.cs index ce53d29ad9..640fe89ad4 100644 --- a/sources/Maths/Maths/Matrix3X4.gen.cs +++ b/sources/Maths/Maths/Matrix3X4.gen.cs @@ -166,6 +166,27 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); + /// Converts the components of this vector to another type. + public static Matrix3X4 CreateChecked(Matrix3X4 other) + where TOther : INumberBase => + new(Vector4D.CreateChecked(other.Row1), Vector4D.CreateChecked(other.Row2), Vector4D.CreateChecked(other.Row3)); + + /// Converts the components of this vector to another type. + public static Matrix3X4 CreateSaturating(Matrix3X4 other) + where TOther : INumberBase => + new(Vector4D.CreateSaturating(other.Row1), Vector4D.CreateSaturating(other.Row2), Vector4D.CreateSaturating(other.Row3)); + + /// Converts the components of this vector to another type. + public static Matrix3X4 CreateTruncating(Matrix3X4 other) + where TOther : INumberBase => + new(Vector4D.CreateTruncating(other.Row1), Vector4D.CreateTruncating(other.Row2), Vector4D.CreateTruncating(other.Row3)); + + /// Converts the components of this vector to another type. + [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + public Matrix3X4 As() + where TOther : INumberBase => + new(Row1.As(), Row2.As(), Row3.As()); + /// Computes the transpose of the matrix. public Matrix4X3 Transpose() => new(new(M11, M21, M31), @@ -266,15 +287,26 @@ public Matrix4X3 Transpose() => new(left.M11 * right.Row1 + left.M12 * right.Row2 + left.M13 * right.Row3 + left.M14 * right.Row4, left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4); + /// /// Converts a matrix of into one with an underlying type of . /// /// The source matrix. /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X4(Matrix3X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -282,9 +314,19 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X4(Matrix3X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -292,9 +334,19 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X4(Matrix3X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -302,9 +354,19 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X4(Matrix3X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -312,9 +374,19 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X4(Matrix3X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -322,9 +394,19 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X4(Matrix3X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -332,9 +414,19 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X4(Matrix3X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -342,9 +434,19 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X4(Matrix3X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -352,9 +454,19 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X4(Matrix3X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -362,9 +474,19 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X4(Matrix3X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -372,9 +494,19 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X4(Matrix3X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3)); /// /// Converts a matrix of into one with an underlying type of . @@ -382,9 +514,19 @@ public static explicit operator Matrix3X4(Matrix3X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix3X4(Matrix3X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix3X4(Matrix3X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3)); } public static partial class Matrix3X4 diff --git a/sources/Maths/Maths/Matrix4X2.cs b/sources/Maths/Maths/Matrix4X2.cs index 606ca14133..32aa778cd5 100644 --- a/sources/Maths/Maths/Matrix4X2.cs +++ b/sources/Maths/Maths/Matrix4X2.cs @@ -93,15 +93,5 @@ public readonly bool IsIdentity { return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3 + value1.W * value2.Row4; } - - /// - /// Returns this matrix casted to - /// - /// The type to cast to - /// The casted matrix - public Matrix4X2 As() where TOther : INumberBase - { - return new(Row1.As(), Row2.As(), Row3.As(), Row4.As()); - } } } diff --git a/sources/Maths/Maths/Matrix4X2.gen.cs b/sources/Maths/Maths/Matrix4X2.gen.cs index 0cda66d434..2cad4a3085 100644 --- a/sources/Maths/Maths/Matrix4X2.gen.cs +++ b/sources/Maths/Maths/Matrix4X2.gen.cs @@ -147,6 +147,27 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); + /// Converts the components of this vector to another type. + public static Matrix4X2 CreateChecked(Matrix4X2 other) + where TOther : INumberBase => + new(Vector2D.CreateChecked(other.Row1), Vector2D.CreateChecked(other.Row2), Vector2D.CreateChecked(other.Row3), Vector2D.CreateChecked(other.Row4)); + + /// Converts the components of this vector to another type. + public static Matrix4X2 CreateSaturating(Matrix4X2 other) + where TOther : INumberBase => + new(Vector2D.CreateSaturating(other.Row1), Vector2D.CreateSaturating(other.Row2), Vector2D.CreateSaturating(other.Row3), Vector2D.CreateSaturating(other.Row4)); + + /// Converts the components of this vector to another type. + public static Matrix4X2 CreateTruncating(Matrix4X2 other) + where TOther : INumberBase => + new(Vector2D.CreateTruncating(other.Row1), Vector2D.CreateTruncating(other.Row2), Vector2D.CreateTruncating(other.Row3), Vector2D.CreateTruncating(other.Row4)); + + /// Converts the components of this vector to another type. + [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + public Matrix4X2 As() + where TOther : INumberBase => + new(Row1.As(), Row2.As(), Row3.As(), Row4.As()); + /// Computes the transpose of the matrix. public Matrix2X4 Transpose() => new(new(M11, M21, M31, M41), @@ -246,16 +267,28 @@ public Matrix2X4 Transpose() => left.M21 * right.Row1 + left.M22 * right.Row2, left.M31 * right.Row1 + left.M32 * right.Row2, left.M41 * right.Row1 + left.M42 * right.Row2); + /// /// Converts a matrix of into one with an underlying type of . /// /// The source matrix. /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3), + Vector2D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X2(Matrix4X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3), + Vector2D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -263,10 +296,21 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3), + Vector2D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X2(Matrix4X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3), + Vector2D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -274,10 +318,21 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3), + Vector2D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X2(Matrix4X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3), + Vector2D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -285,10 +340,21 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3), + Vector2D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X2(Matrix4X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3), + Vector2D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -296,10 +362,21 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3), + Vector2D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X2(Matrix4X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3), + Vector2D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -307,10 +384,21 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3), + Vector2D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X2(Matrix4X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3), + Vector2D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -318,10 +406,21 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3), + Vector2D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X2(Matrix4X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3), + Vector2D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -329,10 +428,21 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3), + Vector2D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X2(Matrix4X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3), + Vector2D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -340,10 +450,21 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3), + Vector2D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X2(Matrix4X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3), + Vector2D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -351,10 +472,21 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3), + Vector2D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X2(Matrix4X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3), + Vector2D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -362,10 +494,21 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3), + Vector2D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X2(Matrix4X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3), + Vector2D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -373,10 +516,21 @@ public static explicit operator Matrix4X2(Matrix4X2 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X2(Matrix4X2 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector2D.CreateTruncating(from.Row1), + Vector2D.CreateTruncating(from.Row2), + Vector2D.CreateTruncating(from.Row3), + Vector2D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X2(Matrix4X2 from) => + new(Vector2D.CreateChecked(from.Row1), + Vector2D.CreateChecked(from.Row2), + Vector2D.CreateChecked(from.Row3), + Vector2D.CreateChecked(from.Row4)); } public static partial class Matrix4X2 diff --git a/sources/Maths/Maths/Matrix4X3.cs b/sources/Maths/Maths/Matrix4X3.cs index 7e69e7d550..b6d740fcc5 100644 --- a/sources/Maths/Maths/Matrix4X3.cs +++ b/sources/Maths/Maths/Matrix4X3.cs @@ -116,15 +116,5 @@ public readonly bool IsIdentity { return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3 + value1.W * value2.Row4; } - - /// - /// Returns this matrix casted to - /// - /// The type to cast to - /// The casted matrix - public Matrix4X3 As() where TOther : INumberBase - { - return new(Row1.As(), Row2.As(), Row3.As(), Row4.As()); - } } } diff --git a/sources/Maths/Maths/Matrix4X3.gen.cs b/sources/Maths/Maths/Matrix4X3.gen.cs index f5d3add102..bb4c1216ff 100644 --- a/sources/Maths/Maths/Matrix4X3.gen.cs +++ b/sources/Maths/Maths/Matrix4X3.gen.cs @@ -171,6 +171,27 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); + /// Converts the components of this vector to another type. + public static Matrix4X3 CreateChecked(Matrix4X3 other) + where TOther : INumberBase => + new(Vector3D.CreateChecked(other.Row1), Vector3D.CreateChecked(other.Row2), Vector3D.CreateChecked(other.Row3), Vector3D.CreateChecked(other.Row4)); + + /// Converts the components of this vector to another type. + public static Matrix4X3 CreateSaturating(Matrix4X3 other) + where TOther : INumberBase => + new(Vector3D.CreateSaturating(other.Row1), Vector3D.CreateSaturating(other.Row2), Vector3D.CreateSaturating(other.Row3), Vector3D.CreateSaturating(other.Row4)); + + /// Converts the components of this vector to another type. + public static Matrix4X3 CreateTruncating(Matrix4X3 other) + where TOther : INumberBase => + new(Vector3D.CreateTruncating(other.Row1), Vector3D.CreateTruncating(other.Row2), Vector3D.CreateTruncating(other.Row3), Vector3D.CreateTruncating(other.Row4)); + + /// Converts the components of this vector to another type. + [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + public Matrix4X3 As() + where TOther : INumberBase => + new(Row1.As(), Row2.As(), Row3.As(), Row4.As()); + /// Computes the transpose of the matrix. public Matrix3X4 Transpose() => new(new(M11, M21, M31, M41), @@ -279,16 +300,28 @@ public Matrix3X4 Transpose() => left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3, left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3); + /// /// Converts a matrix of into one with an underlying type of . /// /// The source matrix. /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3), + Vector3D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X3(Matrix4X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3), + Vector3D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -296,10 +329,21 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3), + Vector3D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X3(Matrix4X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3), + Vector3D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -307,10 +351,21 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3), + Vector3D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X3(Matrix4X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3), + Vector3D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -318,10 +373,21 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3), + Vector3D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X3(Matrix4X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3), + Vector3D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -329,10 +395,21 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3), + Vector3D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X3(Matrix4X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3), + Vector3D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -340,10 +417,21 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3), + Vector3D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X3(Matrix4X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3), + Vector3D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -351,10 +439,21 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3), + Vector3D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X3(Matrix4X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3), + Vector3D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -362,10 +461,21 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3), + Vector3D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X3(Matrix4X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3), + Vector3D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -373,10 +483,21 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3), + Vector3D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X3(Matrix4X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3), + Vector3D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -384,10 +505,21 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3), + Vector3D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X3(Matrix4X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3), + Vector3D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -395,10 +527,21 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3), + Vector3D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X3(Matrix4X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3), + Vector3D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -406,10 +549,21 @@ public static explicit operator Matrix4X3(Matrix4X3 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X3(Matrix4X3 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector3D.CreateTruncating(from.Row1), + Vector3D.CreateTruncating(from.Row2), + Vector3D.CreateTruncating(from.Row3), + Vector3D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X3(Matrix4X3 from) => + new(Vector3D.CreateChecked(from.Row1), + Vector3D.CreateChecked(from.Row2), + Vector3D.CreateChecked(from.Row3), + Vector3D.CreateChecked(from.Row4)); } public static partial class Matrix4X3 diff --git a/sources/Maths/Maths/Matrix4X4.cs b/sources/Maths/Maths/Matrix4X4.cs index 2a5149bd5b..61118d8d30 100644 --- a/sources/Maths/Maths/Matrix4X4.cs +++ b/sources/Maths/Maths/Matrix4X4.cs @@ -160,15 +160,5 @@ public readonly T GetDeterminant() Scalar.Subtract(Scalar.Multiply(e, jo_kn), Scalar.Multiply(f, io_km)), Scalar.Multiply(g, in_jm))))); } - - /// - /// Returns this matrix casted to - /// - /// The type to cast to - /// The casted matrix - public Matrix4X4 As() where TOther : INumberBase - { - return new(Row1.As(), Row2.As(), Row3.As(), Row4.As()); - } } } diff --git a/sources/Maths/Maths/Matrix4X4.gen.cs b/sources/Maths/Maths/Matrix4X4.gen.cs index c77c210af0..046b54feda 100644 --- a/sources/Maths/Maths/Matrix4X4.gen.cs +++ b/sources/Maths/Maths/Matrix4X4.gen.cs @@ -202,6 +202,27 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); + /// Converts the components of this vector to another type. + public static Matrix4X4 CreateChecked(Matrix4X4 other) + where TOther : INumberBase => + new(Vector4D.CreateChecked(other.Row1), Vector4D.CreateChecked(other.Row2), Vector4D.CreateChecked(other.Row3), Vector4D.CreateChecked(other.Row4)); + + /// Converts the components of this vector to another type. + public static Matrix4X4 CreateSaturating(Matrix4X4 other) + where TOther : INumberBase => + new(Vector4D.CreateSaturating(other.Row1), Vector4D.CreateSaturating(other.Row2), Vector4D.CreateSaturating(other.Row3), Vector4D.CreateSaturating(other.Row4)); + + /// Converts the components of this vector to another type. + public static Matrix4X4 CreateTruncating(Matrix4X4 other) + where TOther : INumberBase => + new(Vector4D.CreateTruncating(other.Row1), Vector4D.CreateTruncating(other.Row2), Vector4D.CreateTruncating(other.Row3), Vector4D.CreateTruncating(other.Row4)); + + /// Converts the components of this vector to another type. + [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + public Matrix4X4 As() + where TOther : INumberBase => + new(Row1.As(), Row2.As(), Row3.As(), Row4.As()); + /// Computes the transpose of the matrix. public Matrix4X4 Transpose() => new(new(M11, M21, M31, M41), @@ -320,16 +341,28 @@ public Matrix4X4 Transpose() => left.M21 * right.Row1 + left.M22 * right.Row2 + left.M23 * right.Row3 + left.M24 * right.Row4, left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4, left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3 + left.M44 * right.Row4); + /// /// Converts a matrix of into one with an underlying type of . /// /// The source matrix. /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X4(Matrix4X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -337,10 +370,21 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X4(Matrix4X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -348,10 +392,21 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X4(Matrix4X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -359,10 +414,21 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X4(Matrix4X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -370,10 +436,21 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X4(Matrix4X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -381,10 +458,21 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X4(Matrix4X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -392,10 +480,21 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X4(Matrix4X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -403,10 +502,21 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X4(Matrix4X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -414,10 +524,21 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X4(Matrix4X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -425,10 +546,21 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X4(Matrix4X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -436,10 +568,21 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X4(Matrix4X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4)); /// /// Converts a matrix of into one with an underlying type of . @@ -447,10 +590,21 @@ public static explicit operator Matrix4X4(Matrix4X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix4X4(Matrix4X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix4X4(Matrix4X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4)); } public static partial class Matrix4X4 diff --git a/sources/Maths/Maths/Matrix5X4.cs b/sources/Maths/Maths/Matrix5X4.cs index 8f624e5b99..71ab1fd0eb 100644 --- a/sources/Maths/Maths/Matrix5X4.cs +++ b/sources/Maths/Maths/Matrix5X4.cs @@ -127,15 +127,5 @@ public readonly bool IsIdentity return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3 + value1.W * value2.Row4 + value2.Row5; } - - /// - /// Returns this matrix casted to - /// - /// The type to cast to - /// The casted matrix - public Matrix5X4 As() where TOther : INumberBase - { - return new(Row1.As(), Row2.As(), Row3.As(), Row4.As(), Row5.As()); - } } } diff --git a/sources/Maths/Maths/Matrix5X4.gen.cs b/sources/Maths/Maths/Matrix5X4.gen.cs index 91ae1f4986..a294471477 100644 --- a/sources/Maths/Maths/Matrix5X4.gen.cs +++ b/sources/Maths/Maths/Matrix5X4.gen.cs @@ -208,6 +208,27 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4, Row5); + /// Converts the components of this vector to another type. + public static Matrix5X4 CreateChecked(Matrix5X4 other) + where TOther : INumberBase => + new(Vector4D.CreateChecked(other.Row1), Vector4D.CreateChecked(other.Row2), Vector4D.CreateChecked(other.Row3), Vector4D.CreateChecked(other.Row4), Vector4D.CreateChecked(other.Row5)); + + /// Converts the components of this vector to another type. + public static Matrix5X4 CreateSaturating(Matrix5X4 other) + where TOther : INumberBase => + new(Vector4D.CreateSaturating(other.Row1), Vector4D.CreateSaturating(other.Row2), Vector4D.CreateSaturating(other.Row3), Vector4D.CreateSaturating(other.Row4), Vector4D.CreateSaturating(other.Row5)); + + /// Converts the components of this vector to another type. + public static Matrix5X4 CreateTruncating(Matrix5X4 other) + where TOther : INumberBase => + new(Vector4D.CreateTruncating(other.Row1), Vector4D.CreateTruncating(other.Row2), Vector4D.CreateTruncating(other.Row3), Vector4D.CreateTruncating(other.Row4), Vector4D.CreateTruncating(other.Row5)); + + /// Converts the components of this vector to another type. + [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + public Matrix5X4 As() + where TOther : INumberBase => + new(Row1.As(), Row2.As(), Row3.As(), Row4.As(), Row5.As()); + /// Returns a boolean indicating whether the given two matrices are equal. /// The first matrix to compare. /// The second matrix to compare. @@ -289,17 +310,30 @@ public override string ToString() => left.M31 * right.Row1 + left.M32 * right.Row2 + left.M33 * right.Row3 + left.M34 * right.Row4, left.M41 * right.Row1 + left.M42 * right.Row2 + left.M43 * right.Row3 + left.M44 * right.Row4, left.M51 * right.Row1 + left.M52 * right.Row2 + left.M53 * right.Row3 + left.M54 * right.Row4); + /// /// Converts a matrix of into one with an underlying type of . /// /// The source matrix. /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As(), - from.Row5.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4), + Vector4D.CreateTruncating(from.Row5)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix5X4(Matrix5X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4), + Vector4D.CreateChecked(from.Row5)); /// /// Converts a matrix of into one with an underlying type of . @@ -307,11 +341,23 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As(), - from.Row5.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4), + Vector4D.CreateTruncating(from.Row5)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix5X4(Matrix5X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4), + Vector4D.CreateChecked(from.Row5)); /// /// Converts a matrix of into one with an underlying type of . @@ -319,11 +365,23 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As(), - from.Row5.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4), + Vector4D.CreateTruncating(from.Row5)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix5X4(Matrix5X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4), + Vector4D.CreateChecked(from.Row5)); /// /// Converts a matrix of into one with an underlying type of . @@ -331,11 +389,23 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As(), - from.Row5.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4), + Vector4D.CreateTruncating(from.Row5)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix5X4(Matrix5X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4), + Vector4D.CreateChecked(from.Row5)); /// /// Converts a matrix of into one with an underlying type of . @@ -343,11 +413,23 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As(), - from.Row5.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4), + Vector4D.CreateTruncating(from.Row5)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix5X4(Matrix5X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4), + Vector4D.CreateChecked(from.Row5)); /// /// Converts a matrix of into one with an underlying type of . @@ -355,11 +437,23 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As(), - from.Row5.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4), + Vector4D.CreateTruncating(from.Row5)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix5X4(Matrix5X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4), + Vector4D.CreateChecked(from.Row5)); /// /// Converts a matrix of into one with an underlying type of . @@ -367,11 +461,23 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As(), - from.Row5.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4), + Vector4D.CreateTruncating(from.Row5)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix5X4(Matrix5X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4), + Vector4D.CreateChecked(from.Row5)); /// /// Converts a matrix of into one with an underlying type of . @@ -379,11 +485,23 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As(), - from.Row5.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4), + Vector4D.CreateTruncating(from.Row5)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix5X4(Matrix5X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4), + Vector4D.CreateChecked(from.Row5)); /// /// Converts a matrix of into one with an underlying type of . @@ -391,11 +509,23 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As(), - from.Row5.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4), + Vector4D.CreateTruncating(from.Row5)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix5X4(Matrix5X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4), + Vector4D.CreateChecked(from.Row5)); /// /// Converts a matrix of into one with an underlying type of . @@ -403,11 +533,23 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As(), - from.Row5.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4), + Vector4D.CreateTruncating(from.Row5)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix5X4(Matrix5X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4), + Vector4D.CreateChecked(from.Row5)); /// /// Converts a matrix of into one with an underlying type of . @@ -415,11 +557,23 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As(), - from.Row5.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4), + Vector4D.CreateTruncating(from.Row5)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix5X4(Matrix5X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4), + Vector4D.CreateChecked(from.Row5)); /// /// Converts a matrix of into one with an underlying type of . @@ -427,11 +581,23 @@ public static explicit operator Matrix5X4(Matrix5X4 from) => /// The source matrix. /// The matrix. public static explicit operator Matrix5X4(Matrix5X4 from) => - new(from.Row1.As(), - from.Row2.As(), - from.Row3.As(), - from.Row4.As(), - from.Row5.As()); + new(Vector4D.CreateTruncating(from.Row1), + Vector4D.CreateTruncating(from.Row2), + Vector4D.CreateTruncating(from.Row3), + Vector4D.CreateTruncating(from.Row4), + Vector4D.CreateTruncating(from.Row5)); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator checked Matrix5X4(Matrix5X4 from) => + new(Vector4D.CreateChecked(from.Row1), + Vector4D.CreateChecked(from.Row2), + Vector4D.CreateChecked(from.Row3), + Vector4D.CreateChecked(from.Row4), + Vector4D.CreateChecked(from.Row5)); } public static partial class Matrix5X4 diff --git a/sources/Maths/Maths/Vector2D.gen.cs b/sources/Maths/Maths/Vector2D.gen.cs index 474b209e2f..09e6b203bc 100644 --- a/sources/Maths/Maths/Vector2D.gen.cs +++ b/sources/Maths/Maths/Vector2D.gen.cs @@ -300,19 +300,26 @@ static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IForm /// public override int GetHashCode() => HashCode.Combine(X, Y); - /// Desconstructs a vector into its components. - /// The X component. - /// The Y component. - public void Deconstruct(out T x, out T y) - { - x = X; - y = Y; - } + /// Converts the components of this vector to another type. + public static Vector2D CreateChecked(Vector2D source) + where TOther : INumberBase => + new(T.CreateChecked(source.X), T.CreateChecked(source.Y)); + + /// Converts the components of this vector to another type. + public static Vector2D CreateSaturating(Vector2D source) + where TOther : INumberBase => + new(T.CreateSaturating(source.X), T.CreateSaturating(source.Y)); /// Converts the components of this vector to another type. + public static Vector2D CreateTruncating(Vector2D source) + where TOther : INumberBase => + new(T.CreateTruncating(source.X), T.CreateTruncating(source.Y)); + + /// Converts the components of this vector to another type. + [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating, or a cast instead.", error: false)] public Vector2D As() where TOther : INumberBase => - new(TOther.CreateSaturating(X), TOther.CreateSaturating(Y)); + Vector2D.CreateTruncating(this); /// Implicitly casts a to a . public static implicit operator Vector2D((T X, T Y) v) => @@ -361,7 +368,15 @@ public static implicit operator (T X, T Y)(Vector2D v) => /// The source vector. /// The vector. public static explicit operator Vector2D(Vector2D from) => - from.As(); + Vector2D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector2D(Vector2D from) => + Vector2D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -369,7 +384,15 @@ public static explicit operator Vector2D(Vector2D from) => /// The source vector. /// The vector. public static explicit operator Vector2D(Vector2D from) => - from.As(); + Vector2D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector2D(Vector2D from) => + Vector2D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -377,7 +400,15 @@ public static explicit operator Vector2D(Vector2D from) => /// The source vector. /// The vector. public static explicit operator Vector2D(Vector2D from) => - from.As(); + Vector2D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector2D(Vector2D from) => + Vector2D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -385,7 +416,15 @@ public static explicit operator Vector2D(Vector2D from) => /// The source vector. /// The vector. public static explicit operator Vector2D(Vector2D from) => - from.As(); + Vector2D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector2D(Vector2D from) => + Vector2D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -393,7 +432,15 @@ public static explicit operator Vector2D(Vector2D from) => /// The source vector. /// The vector. public static explicit operator Vector2D(Vector2D from) => - from.As(); + Vector2D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector2D(Vector2D from) => + Vector2D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -401,7 +448,15 @@ public static explicit operator Vector2D(Vector2D from) => /// The source vector. /// The vector. public static explicit operator Vector2D(Vector2D from) => - from.As(); + Vector2D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector2D(Vector2D from) => + Vector2D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -409,7 +464,15 @@ public static explicit operator Vector2D(Vector2D from) => /// The source vector. /// The vector. public static explicit operator Vector2D(Vector2D from) => - from.As(); + Vector2D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector2D(Vector2D from) => + Vector2D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -417,7 +480,15 @@ public static explicit operator Vector2D(Vector2D from) => /// The source vector. /// The vector. public static explicit operator Vector2D(Vector2D from) => - from.As(); + Vector2D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector2D(Vector2D from) => + Vector2D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -425,7 +496,15 @@ public static explicit operator Vector2D(Vector2D from) => /// The source vector. /// The vector. public static explicit operator Vector2D(Vector2D from) => - from.As(); + Vector2D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector2D(Vector2D from) => + Vector2D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -433,7 +512,15 @@ public static explicit operator Vector2D(Vector2D from) => /// The source vector. /// The vector. public static explicit operator Vector2D(Vector2D from) => - from.As(); + Vector2D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector2D(Vector2D from) => + Vector2D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -441,7 +528,15 @@ public static explicit operator Vector2D(Vector2D from) => /// The source vector. /// The vector. public static explicit operator Vector2D(Vector2D from) => - from.As(); + Vector2D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector2D(Vector2D from) => + Vector2D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -449,7 +544,15 @@ public static explicit operator Vector2D(Vector2D from) => /// The source vector. /// The vector. public static explicit operator Vector2D(Vector2D from) => - from.As(); + Vector2D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector2D(Vector2D from) => + Vector2D.CreateChecked(from); } public static partial class Vector2D @@ -468,6 +571,16 @@ public static partial class Vector2D public T LengthSquared => Vector2D.Dot(vector, vector); } + /// Desconstructs a vector into its components. + /// The X component. + /// The Y component. + public static void Deconstruct(this Vector2D vector, out T x, out T y) + where T : INumberBase + { + x = vector.X; + y = vector.Y; + } + /// Computes the dot product of two vectors. public static T Dot(this Vector2D left, Vector2D right) where T : INumberBase => diff --git a/sources/Maths/Maths/Vector3D.gen.cs b/sources/Maths/Maths/Vector3D.gen.cs index e915fd65bf..cb34c6f13f 100644 --- a/sources/Maths/Maths/Vector3D.gen.cs +++ b/sources/Maths/Maths/Vector3D.gen.cs @@ -337,21 +337,26 @@ static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IForm /// public override int GetHashCode() => HashCode.Combine(X, Y, Z); - /// Desconstructs a vector into its components. - /// The X component. - /// The Y component. - /// The Z component. - public void Deconstruct(out T x, out T y, out T z) - { - x = X; - y = Y; - z = Z; - } + /// Converts the components of this vector to another type. + public static Vector3D CreateChecked(Vector3D source) + where TOther : INumberBase => + new(T.CreateChecked(source.X), T.CreateChecked(source.Y), T.CreateChecked(source.Z)); + + /// Converts the components of this vector to another type. + public static Vector3D CreateSaturating(Vector3D source) + where TOther : INumberBase => + new(T.CreateSaturating(source.X), T.CreateSaturating(source.Y), T.CreateSaturating(source.Z)); + + /// Converts the components of this vector to another type. + public static Vector3D CreateTruncating(Vector3D source) + where TOther : INumberBase => + new(T.CreateTruncating(source.X), T.CreateTruncating(source.Y), T.CreateTruncating(source.Z)); /// Converts the components of this vector to another type. + [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating, or a cast instead.", error: false)] public Vector3D As() where TOther : INumberBase => - new(TOther.CreateSaturating(X), TOther.CreateSaturating(Y), TOther.CreateSaturating(Z)); + Vector3D.CreateTruncating(this); /// Implicitly casts a to a . public static implicit operator Vector3D((T X, T Y, T Z) v) => @@ -400,7 +405,15 @@ public static implicit operator (T X, T Y, T Z)(Vector3D v) => /// The source vector. /// The vector. public static explicit operator Vector3D(Vector3D from) => - from.As(); + Vector3D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector3D(Vector3D from) => + Vector3D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -408,7 +421,15 @@ public static explicit operator Vector3D(Vector3D from) => /// The source vector. /// The vector. public static explicit operator Vector3D(Vector3D from) => - from.As(); + Vector3D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector3D(Vector3D from) => + Vector3D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -416,7 +437,15 @@ public static explicit operator Vector3D(Vector3D from) => /// The source vector. /// The vector. public static explicit operator Vector3D(Vector3D from) => - from.As(); + Vector3D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector3D(Vector3D from) => + Vector3D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -424,7 +453,15 @@ public static explicit operator Vector3D(Vector3D from) => /// The source vector. /// The vector. public static explicit operator Vector3D(Vector3D from) => - from.As(); + Vector3D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector3D(Vector3D from) => + Vector3D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -432,7 +469,15 @@ public static explicit operator Vector3D(Vector3D from) => /// The source vector. /// The vector. public static explicit operator Vector3D(Vector3D from) => - from.As(); + Vector3D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector3D(Vector3D from) => + Vector3D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -440,7 +485,15 @@ public static explicit operator Vector3D(Vector3D from) => /// The source vector. /// The vector. public static explicit operator Vector3D(Vector3D from) => - from.As(); + Vector3D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector3D(Vector3D from) => + Vector3D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -448,7 +501,15 @@ public static explicit operator Vector3D(Vector3D from) => /// The source vector. /// The vector. public static explicit operator Vector3D(Vector3D from) => - from.As(); + Vector3D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector3D(Vector3D from) => + Vector3D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -456,7 +517,15 @@ public static explicit operator Vector3D(Vector3D from) => /// The source vector. /// The vector. public static explicit operator Vector3D(Vector3D from) => - from.As(); + Vector3D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector3D(Vector3D from) => + Vector3D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -464,7 +533,15 @@ public static explicit operator Vector3D(Vector3D from) => /// The source vector. /// The vector. public static explicit operator Vector3D(Vector3D from) => - from.As(); + Vector3D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector3D(Vector3D from) => + Vector3D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -472,7 +549,15 @@ public static explicit operator Vector3D(Vector3D from) => /// The source vector. /// The vector. public static explicit operator Vector3D(Vector3D from) => - from.As(); + Vector3D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector3D(Vector3D from) => + Vector3D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -480,7 +565,15 @@ public static explicit operator Vector3D(Vector3D from) => /// The source vector. /// The vector. public static explicit operator Vector3D(Vector3D from) => - from.As(); + Vector3D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector3D(Vector3D from) => + Vector3D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -488,7 +581,15 @@ public static explicit operator Vector3D(Vector3D from) => /// The source vector. /// The vector. public static explicit operator Vector3D(Vector3D from) => - from.As(); + Vector3D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector3D(Vector3D from) => + Vector3D.CreateChecked(from); } public static partial class Vector3D @@ -507,6 +608,18 @@ public static partial class Vector3D public T LengthSquared => Vector3D.Dot(vector, vector); } + /// Desconstructs a vector into its components. + /// The X component. + /// The Y component. + /// The Z component. + public static void Deconstruct(this Vector3D vector, out T x, out T y, out T z) + where T : INumberBase + { + x = vector.X; + y = vector.Y; + z = vector.Z; + } + /// Computes the dot product of two vectors. public static T Dot(this Vector3D left, Vector3D right) where T : INumberBase => diff --git a/sources/Maths/Maths/Vector4D.gen.cs b/sources/Maths/Maths/Vector4D.gen.cs index 04cf959ede..bfdfbecb07 100644 --- a/sources/Maths/Maths/Vector4D.gen.cs +++ b/sources/Maths/Maths/Vector4D.gen.cs @@ -374,23 +374,26 @@ static bool IParsable>.TryParse([NotNullWhen(true)] string? s, IForm /// public override int GetHashCode() => HashCode.Combine(X, Y, Z, W); - /// Desconstructs a vector into its components. - /// The X component. - /// The Y component. - /// The Z component. - /// The W component. - public void Deconstruct(out T x, out T y, out T z, out T w) - { - x = X; - y = Y; - z = Z; - w = W; - } + /// Converts the components of this vector to another type. + public static Vector4D CreateChecked(Vector4D source) + where TOther : INumberBase => + new(T.CreateChecked(source.X), T.CreateChecked(source.Y), T.CreateChecked(source.Z), T.CreateChecked(source.W)); + + /// Converts the components of this vector to another type. + public static Vector4D CreateSaturating(Vector4D source) + where TOther : INumberBase => + new(T.CreateSaturating(source.X), T.CreateSaturating(source.Y), T.CreateSaturating(source.Z), T.CreateSaturating(source.W)); /// Converts the components of this vector to another type. + public static Vector4D CreateTruncating(Vector4D source) + where TOther : INumberBase => + new(T.CreateTruncating(source.X), T.CreateTruncating(source.Y), T.CreateTruncating(source.Z), T.CreateTruncating(source.W)); + + /// Converts the components of this vector to another type. + [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating, or a cast instead.", error: false)] public Vector4D As() where TOther : INumberBase => - new(TOther.CreateSaturating(X), TOther.CreateSaturating(Y), TOther.CreateSaturating(Z), TOther.CreateSaturating(W)); + Vector4D.CreateTruncating(this); /// Implicitly casts a to a . public static implicit operator Vector4D((T X, T Y, T Z, T W) v) => @@ -439,7 +442,15 @@ public static implicit operator (T X, T Y, T Z, T W)(Vector4D v) => /// The source vector. /// The vector. public static explicit operator Vector4D(Vector4D from) => - from.As(); + Vector4D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector4D(Vector4D from) => + Vector4D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -447,7 +458,15 @@ public static explicit operator Vector4D(Vector4D from) => /// The source vector. /// The vector. public static explicit operator Vector4D(Vector4D from) => - from.As(); + Vector4D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector4D(Vector4D from) => + Vector4D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -455,7 +474,15 @@ public static explicit operator Vector4D(Vector4D from) => /// The source vector. /// The vector. public static explicit operator Vector4D(Vector4D from) => - from.As(); + Vector4D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector4D(Vector4D from) => + Vector4D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -463,7 +490,15 @@ public static explicit operator Vector4D(Vector4D from) => /// The source vector. /// The vector. public static explicit operator Vector4D(Vector4D from) => - from.As(); + Vector4D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector4D(Vector4D from) => + Vector4D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -471,7 +506,15 @@ public static explicit operator Vector4D(Vector4D from) => /// The source vector. /// The vector. public static explicit operator Vector4D(Vector4D from) => - from.As(); + Vector4D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector4D(Vector4D from) => + Vector4D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -479,7 +522,15 @@ public static explicit operator Vector4D(Vector4D from) => /// The source vector. /// The vector. public static explicit operator Vector4D(Vector4D from) => - from.As(); + Vector4D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector4D(Vector4D from) => + Vector4D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -487,7 +538,15 @@ public static explicit operator Vector4D(Vector4D from) => /// The source vector. /// The vector. public static explicit operator Vector4D(Vector4D from) => - from.As(); + Vector4D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector4D(Vector4D from) => + Vector4D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -495,7 +554,15 @@ public static explicit operator Vector4D(Vector4D from) => /// The source vector. /// The vector. public static explicit operator Vector4D(Vector4D from) => - from.As(); + Vector4D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector4D(Vector4D from) => + Vector4D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -503,7 +570,15 @@ public static explicit operator Vector4D(Vector4D from) => /// The source vector. /// The vector. public static explicit operator Vector4D(Vector4D from) => - from.As(); + Vector4D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector4D(Vector4D from) => + Vector4D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -511,7 +586,15 @@ public static explicit operator Vector4D(Vector4D from) => /// The source vector. /// The vector. public static explicit operator Vector4D(Vector4D from) => - from.As(); + Vector4D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector4D(Vector4D from) => + Vector4D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -519,7 +602,15 @@ public static explicit operator Vector4D(Vector4D from) => /// The source vector. /// The vector. public static explicit operator Vector4D(Vector4D from) => - from.As(); + Vector4D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector4D(Vector4D from) => + Vector4D.CreateChecked(from); /// /// Converts a vector of into one with an underlying type of . @@ -527,7 +618,15 @@ public static explicit operator Vector4D(Vector4D from) => /// The source vector. /// The vector. public static explicit operator Vector4D(Vector4D from) => - from.As(); + Vector4D.CreateTruncating(from); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator checked Vector4D(Vector4D from) => + Vector4D.CreateChecked(from); } public static partial class Vector4D @@ -546,6 +645,20 @@ public static partial class Vector4D public T LengthSquared => Vector4D.Dot(vector, vector); } + /// Desconstructs a vector into its components. + /// The X component. + /// The Y component. + /// The Z component. + /// The W component. + public static void Deconstruct(this Vector4D vector, out T x, out T y, out T z, out T w) + where T : INumberBase + { + x = vector.X; + y = vector.Y; + z = vector.Z; + w = vector.W; + } + /// Computes the dot product of two vectors. public static T Dot(this Vector4D left, Vector4D right) where T : INumberBase => From ac8e94ef8cfef1e8c0e16cf60840b3880e69936c Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Wed, 2 Jul 2025 16:47:12 -0700 Subject: [PATCH 13/19] Handle IsIdentity and GetDeterminant errors. --- sources/Maths/Maths/Matrix2X2.cs | 10 ++-------- sources/Maths/Maths/Matrix2X2.gen.cs | 4 ++++ sources/Maths/Maths/Matrix2X3.cs | 6 +----- sources/Maths/Maths/Matrix2X4.cs | 7 +------ sources/Maths/Maths/Matrix3X2.cs | 4 +++- sources/Maths/Maths/Matrix3X3.cs | 15 +++------------ sources/Maths/Maths/Matrix3X3.gen.cs | 4 ++++ sources/Maths/Maths/Matrix3X4.cs | 9 +-------- sources/Maths/Maths/Matrix4X2.cs | 7 +------ sources/Maths/Maths/Matrix4X3.cs | 9 +-------- sources/Maths/Maths/Matrix4X4.cs | 21 ++++----------------- sources/Maths/Maths/Matrix4X4.gen.cs | 4 ++++ sources/Maths/Maths/Matrix5X4.cs | 13 +------------ 13 files changed, 30 insertions(+), 83 deletions(-) diff --git a/sources/Maths/Maths/Matrix2X2.cs b/sources/Maths/Maths/Matrix2X2.cs index c1af4faa51..5085e8de98 100644 --- a/sources/Maths/Maths/Matrix2X2.cs +++ b/sources/Maths/Maths/Matrix2X2.cs @@ -54,12 +54,6 @@ public Matrix2X2(Matrix4X2 value) Row2 = new(value.M21, value.M22); } - /// Returns whether the matrix is the identity matrix. - public readonly bool IsIdentity - => Scalar.Equal(M11, Scalar.One) && - Scalar.Equal(M22, Scalar.One) && // Check diagonal element first for early out. - Scalar.Equal(M12, Scalar.Zero) && Scalar.Equal(M21, Scalar.Zero); - /// Multiplies a vector by a matrix. /// The vector. /// The matrix. @@ -76,8 +70,8 @@ public readonly T GetDeterminant() // | a b | // | c d | = ad - bc - T a = M11, b = M12; - T d = M21, c = M22; + T a = Row1.X, b = Row1.Y; + T d = Row2.X, c = Row1.Y; return Scalar.Subtract(Scalar.Multiply(a, d), Scalar.Multiply(b, c)); } diff --git a/sources/Maths/Maths/Matrix2X2.gen.cs b/sources/Maths/Maths/Matrix2X2.gen.cs index 0a61042a45..16706b400d 100644 --- a/sources/Maths/Maths/Matrix2X2.gen.cs +++ b/sources/Maths/Maths/Matrix2X2.gen.cs @@ -14,6 +14,10 @@ public partial struct Matrix2X2 : new(T.MultiplicativeIdentity, T.Zero), new(T.Zero, T.MultiplicativeIdentity)); + /// Returns whether the matrix is the identity matrix. + [IgnoreDataMember] + public readonly bool IsIdentity => this == Identity; + /// The 1st row of the matrix represented as a vector. [IgnoreDataMember] public Vector2D Row1; diff --git a/sources/Maths/Maths/Matrix2X3.cs b/sources/Maths/Maths/Matrix2X3.cs index 75e94fa6ed..6309127676 100644 --- a/sources/Maths/Maths/Matrix2X3.cs +++ b/sources/Maths/Maths/Matrix2X3.cs @@ -65,11 +65,7 @@ public Matrix2X3(Matrix4X2 value) /// Returns whether the matrix is the identity matrix. [IgnoreDataMember] - public readonly bool IsIdentity - => Scalar.Equal(M11, Scalar.One) && - Scalar.Equal(M22, Scalar.One) && // Check diagonal element first for early out. - Scalar.Equal(M12, Scalar.Zero) && Scalar.Equal(M13, Scalar.Zero) && - Scalar.Equal(M21, Scalar.Zero) && Scalar.Equal(M23, Scalar.Zero); + public readonly bool IsIdentity => this == Identity; /// Multiplies a vector by a matrix. /// The vector. diff --git a/sources/Maths/Maths/Matrix2X4.cs b/sources/Maths/Maths/Matrix2X4.cs index fb82209033..72401a53c5 100644 --- a/sources/Maths/Maths/Matrix2X4.cs +++ b/sources/Maths/Maths/Matrix2X4.cs @@ -65,12 +65,7 @@ public Matrix2X4(Matrix4X2 value) /// Returns whether the matrix is the identity matrix. [IgnoreDataMember] - public readonly bool IsIdentity - => Scalar.Equal(M11, Scalar.One) && - Scalar.Equal(M22, Scalar.One) && // Check diagonal element first for early out. - Scalar.Equal(M12, Scalar.Zero) && Scalar.Equal(M13, Scalar.Zero) && - Scalar.Equal(M14, Scalar.Zero) && Scalar.Equal(M21, Scalar.Zero) && - Scalar.Equal(M23, Scalar.Zero) && Scalar.Equal(M24, Scalar.Zero); + public readonly bool IsIdentity => this == Identity; /// Multiplies a vector by a matrix. /// The vector. diff --git a/sources/Maths/Maths/Matrix3X2.cs b/sources/Maths/Maths/Matrix3X2.cs index 95bd53d619..fe2716e323 100644 --- a/sources/Maths/Maths/Matrix3X2.cs +++ b/sources/Maths/Maths/Matrix3X2.cs @@ -102,7 +102,9 @@ public readonly T GetDeterminant() // // Collapse out the constants and oh look, this is just a 2x2 determinant! - return Scalar.Subtract(Scalar.Multiply(M11, M22), Scalar.Multiply(M21, M12)); + return Scalar.Subtract( + Scalar.Multiply(Row1.X, Row2.Y), + Scalar.Multiply(Row2.X, Row1.Y)); } /// diff --git a/sources/Maths/Maths/Matrix3X3.cs b/sources/Maths/Maths/Matrix3X3.cs index 27cf5a9bf6..39fff98e60 100644 --- a/sources/Maths/Maths/Matrix3X3.cs +++ b/sources/Maths/Maths/Matrix3X3.cs @@ -77,15 +77,6 @@ public Matrix3X3(Matrix4X4 value) Row3 = new(value.M31, value.M32, value.M33); } - /// Returns whether the matrix is the identity matrix. - [IgnoreDataMember] - public readonly bool IsIdentity - => Scalar.Equal(M11, Scalar.One) && Scalar.Equal(M22, Scalar.One) && - Scalar.Equal(M33, Scalar.One) && // Check diagonal element first for early out. - Scalar.Equal(M12, Scalar.Zero) && Scalar.Equal(M13, Scalar.Zero) && - Scalar.Equal(M21, Scalar.Zero) && Scalar.Equal(M23, Scalar.Zero) && - Scalar.Equal(M31, Scalar.Zero) && Scalar.Equal(M32, Scalar.Zero); - /// Multiplies a vector by a matrix. /// The vector. /// The matrix. @@ -103,9 +94,9 @@ public readonly T GetDeterminant() // | d e f | = ( a ( ei - fh ) - b ( di - fg ) + c ( dh - eg ) ) // | g h i | - T a = M11, b = M12, c = M13; - T d = M21, e = M22, f = M23; - T g = M31, h = M32, i = M33; + T a = Row1.X, b = Row1.Y, c = Row1.Z; + T d = Row2.X, e = Row2.Y, f = Row2.Z; + T g = Row3.X, h = Row3.Y, i = Row3.Z; return Scalar.Add( Scalar.Subtract( diff --git a/sources/Maths/Maths/Matrix3X3.gen.cs b/sources/Maths/Maths/Matrix3X3.gen.cs index 4b039ee5b5..33e2f9db96 100644 --- a/sources/Maths/Maths/Matrix3X3.gen.cs +++ b/sources/Maths/Maths/Matrix3X3.gen.cs @@ -15,6 +15,10 @@ public partial struct Matrix3X3 : new(T.Zero, T.MultiplicativeIdentity, T.Zero), new(T.Zero, T.Zero, T.MultiplicativeIdentity)); + /// Returns whether the matrix is the identity matrix. + [IgnoreDataMember] + public readonly bool IsIdentity => this == Identity; + /// The 1st row of the matrix represented as a vector. [IgnoreDataMember] public Vector3D Row1; diff --git a/sources/Maths/Maths/Matrix3X4.cs b/sources/Maths/Maths/Matrix3X4.cs index ed6c1c1193..84076d5572 100644 --- a/sources/Maths/Maths/Matrix3X4.cs +++ b/sources/Maths/Maths/Matrix3X4.cs @@ -80,14 +80,7 @@ public Matrix3X4(Matrix4X2 value) /// Returns whether the matrix is the identity matrix. [IgnoreDataMember] - public readonly bool IsIdentity - => Scalar.Equal(M11, Scalar.One) && Scalar.Equal(M22, Scalar.One) && - Scalar.Equal(M33, Scalar.One) && // Check diagonal element first for early out. - Scalar.Equal(M12, Scalar.Zero) && Scalar.Equal(M13, Scalar.Zero) && - Scalar.Equal(M14, Scalar.Zero) && Scalar.Equal(M21, Scalar.Zero) && - Scalar.Equal(M23, Scalar.Zero) && Scalar.Equal(M24, Scalar.Zero) && - Scalar.Equal(M31, Scalar.Zero) && Scalar.Equal(M32, Scalar.Zero) && - Scalar.Equal(M34, Scalar.Zero); + public readonly bool IsIdentity => this == Identity; /// Multiplies a vector by a matrix. /// The vector. diff --git a/sources/Maths/Maths/Matrix4X2.cs b/sources/Maths/Maths/Matrix4X2.cs index 32aa778cd5..6086ca84b4 100644 --- a/sources/Maths/Maths/Matrix4X2.cs +++ b/sources/Maths/Maths/Matrix4X2.cs @@ -78,12 +78,7 @@ public Matrix4X2(Matrix2X4 value) /// Returns whether the matrix is the identity matrix. [IgnoreDataMember] - public readonly bool IsIdentity - => Scalar.Equal(M11, Scalar.One) && - Scalar.Equal(M22, Scalar.One) && // Check diagonal element first for early out. - Scalar.Equal(M12, Scalar.Zero) && Scalar.Equal(M21, Scalar.Zero) && - Scalar.Equal(M31, Scalar.Zero) && Scalar.Equal(M32, Scalar.Zero) && - Scalar.Equal(M41, Scalar.Zero) && Scalar.Equal(M42, Scalar.Zero); + public readonly bool IsIdentity => this == Identity; /// Multiplies a vector by a matrix. /// The vector. diff --git a/sources/Maths/Maths/Matrix4X3.cs b/sources/Maths/Maths/Matrix4X3.cs index b6d740fcc5..1611662778 100644 --- a/sources/Maths/Maths/Matrix4X3.cs +++ b/sources/Maths/Maths/Matrix4X3.cs @@ -99,14 +99,7 @@ public Matrix4X3(Matrix4X4 value) /// Returns whether the matrix is the identity matrix. [IgnoreDataMember] - public readonly bool IsIdentity - => Scalar.Equal(M11, Scalar.One) && Scalar.Equal(M22, Scalar.One) && - Scalar.Equal(M33, Scalar.One) && // Check diagonal element first for early out. - Scalar.Equal(M12, Scalar.Zero) && Scalar.Equal(M13, Scalar.Zero) && - Scalar.Equal(M21, Scalar.Zero) && Scalar.Equal(M23, Scalar.Zero) && - Scalar.Equal(M31, Scalar.Zero) && Scalar.Equal(M32, Scalar.Zero) && - Scalar.Equal(M41, Scalar.Zero) && Scalar.Equal(M42, Scalar.Zero) && - Scalar.Equal(M43, Scalar.Zero); + public readonly bool IsIdentity => this == Identity; /// Multiplies a vector by a matrix. /// The vector. diff --git a/sources/Maths/Maths/Matrix4X4.cs b/sources/Maths/Maths/Matrix4X4.cs index 61118d8d30..c951ad86b9 100644 --- a/sources/Maths/Maths/Matrix4X4.cs +++ b/sources/Maths/Maths/Matrix4X4.cs @@ -74,19 +74,6 @@ public Matrix4X4(Matrix4X2 value) Row4 = new(value.M41, value.M42, default, Scalar.One); } - /// Returns whether the matrix is the identity matrix. - [IgnoreDataMember] - public readonly bool IsIdentity - => Scalar.Equal(M11, Scalar.One) && Scalar.Equal(M22, Scalar.One) && - Scalar.Equal(M33, Scalar.One) && - Scalar.Equal(M44, Scalar.One) && // Check diagonal element first for early out. - Scalar.Equal(M12, Scalar.Zero) && Scalar.Equal(M13, Scalar.Zero) && - Scalar.Equal(M14, Scalar.Zero) && Scalar.Equal(M21, Scalar.Zero) && - Scalar.Equal(M23, Scalar.Zero) && Scalar.Equal(M24, Scalar.Zero) && - Scalar.Equal(M31, Scalar.Zero) && Scalar.Equal(M32, Scalar.Zero) && - Scalar.Equal(M34, Scalar.Zero) && Scalar.Equal(M41, Scalar.Zero) && - Scalar.Equal(M42, Scalar.Zero) && Scalar.Equal(M43, Scalar.Zero); - /// Multiplies a vector by a matrix. /// The vector. /// The matrix. @@ -128,10 +115,10 @@ public readonly T GetDeterminant() // add: 6 + 8 + 3 = 17 // mul: 12 + 16 = 28 - T a = M11, b = M12, c = M13, d = M14; - T e = M21, f = M22, g = M23, h = M24; - T i = M31, j = M32, k = M33, l = M34; - T m = M41, n = M42, o = M43, p = M44; + T a = Row1.X, b = Row1.Y, c = Row1.Z, d = Row1.W; + T e = Row2.X, f = Row2.Y, g = Row2.Z, h = Row2.W; + T i = Row3.X, j = Row3.Y, k = Row3.Z, l = Row3.W; + T m = Row4.X, n = Row4.Y, o = Row4.Z, p = Row4.W; T kp_lo = Scalar.Subtract(Scalar.Multiply(k, p), Scalar.Multiply(l, o)); T jp_ln = Scalar.Subtract(Scalar.Multiply(j, p), Scalar.Multiply(l, n)); diff --git a/sources/Maths/Maths/Matrix4X4.gen.cs b/sources/Maths/Maths/Matrix4X4.gen.cs index 046b54feda..5346ae1daf 100644 --- a/sources/Maths/Maths/Matrix4X4.gen.cs +++ b/sources/Maths/Maths/Matrix4X4.gen.cs @@ -16,6 +16,10 @@ public partial struct Matrix4X4 : new(T.Zero, T.Zero, T.MultiplicativeIdentity, T.Zero), new(T.Zero, T.Zero, T.Zero, T.MultiplicativeIdentity)); + /// Returns whether the matrix is the identity matrix. + [IgnoreDataMember] + public readonly bool IsIdentity => this == Identity; + /// The 1st row of the matrix represented as a vector. [IgnoreDataMember] public Vector4D Row1; diff --git a/sources/Maths/Maths/Matrix5X4.cs b/sources/Maths/Maths/Matrix5X4.cs index 71ab1fd0eb..0d6e940a43 100644 --- a/sources/Maths/Maths/Matrix5X4.cs +++ b/sources/Maths/Maths/Matrix5X4.cs @@ -105,18 +105,7 @@ public Matrix5X4(Matrix4X2 value) /// Returns whether the matrix is the identity matrix. [IgnoreDataMember] - public readonly bool IsIdentity - => Scalar.Equal(M11, Scalar.One) && Scalar.Equal(M22, Scalar.One) && - Scalar.Equal(M33, Scalar.One) && - Scalar.Equal(M44, Scalar.One) && // Check diagonal element first for early out. - Scalar.Equal(M12, Scalar.Zero) && Scalar.Equal(M13, Scalar.Zero) && - Scalar.Equal(M14, Scalar.Zero) && Scalar.Equal(M21, Scalar.Zero) && - Scalar.Equal(M23, Scalar.Zero) && Scalar.Equal(M24, Scalar.Zero) && - Scalar.Equal(M31, Scalar.Zero) && Scalar.Equal(M32, Scalar.Zero) && - Scalar.Equal(M34, Scalar.Zero) && Scalar.Equal(M41, Scalar.Zero) && - Scalar.Equal(M42, Scalar.Zero) && Scalar.Equal(M43, Scalar.Zero) && - Scalar.Equal(M51, Scalar.Zero) && Scalar.Equal(M52, Scalar.Zero) && - Scalar.Equal(M53, Scalar.Zero) && Scalar.Equal(M54, Scalar.Zero); + public readonly bool IsIdentity => this == Identity; /// Multiplies a vector by a matrix. /// The vector. From f71206cc6cb9313b7b6c9f978b6a1b08289d8eb6 Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Wed, 2 Jul 2025 16:58:16 -0700 Subject: [PATCH 14/19] Use T.Zero instead of default to avoid NRE. --- sources/Maths/Maths/Matrix2X3.cs | 8 +++--- sources/Maths/Maths/Matrix2X4.cs | 20 +++++++-------- sources/Maths/Maths/Matrix3X3.cs | 12 ++++----- sources/Maths/Maths/Matrix3X4.cs | 30 +++++++++++----------- sources/Maths/Maths/Matrix4X3.cs | 12 ++++----- sources/Maths/Maths/Matrix4X4.Ops.cs | 12 ++++----- sources/Maths/Maths/Matrix4X4.cs | 32 +++++++++++------------ sources/Maths/Maths/Matrix5X4.cs | 38 ++++++++++++++-------------- 8 files changed, 82 insertions(+), 82 deletions(-) diff --git a/sources/Maths/Maths/Matrix2X3.cs b/sources/Maths/Maths/Matrix2X3.cs index 6309127676..e1e4df98a8 100644 --- a/sources/Maths/Maths/Matrix2X3.cs +++ b/sources/Maths/Maths/Matrix2X3.cs @@ -24,8 +24,8 @@ public partial struct Matrix2X3 /// The source . public Matrix2X3(Matrix3X2 value) { - Row1 = new(value.M11, value.M12, default); - Row2 = new(value.M21, value.M22, default); + Row1 = new(value.M11, value.M12, T.Zero); + Row2 = new(value.M21, value.M22, T.Zero); } /// Constructs a from the given . @@ -56,8 +56,8 @@ public Matrix2X3(Matrix2X4 value) /// The source . public Matrix2X3(Matrix4X2 value) { - Row1 = new Vector3D(value.M11, value.M12, default); - Row2 = new Vector3D(value.M21, value.M22, default); + Row1 = new Vector3D(value.M11, value.M12, T.Zero); + Row2 = new Vector3D(value.M21, value.M22, T.Zero); } /// Returns the multiplicative identity matrix. diff --git a/sources/Maths/Maths/Matrix2X4.cs b/sources/Maths/Maths/Matrix2X4.cs index 72401a53c5..838b0902cb 100644 --- a/sources/Maths/Maths/Matrix2X4.cs +++ b/sources/Maths/Maths/Matrix2X4.cs @@ -16,24 +16,24 @@ public partial struct Matrix2X4 { private static readonly Matrix2X4 _identity = new ( - Scalar.One, Scalar.Zero, Scalar.Zero, Scalar.Zero, - Scalar.Zero, Scalar.One, Scalar.Zero, Scalar.Zero + T.One, T.Zero, T.Zero, T.Zero, + T.Zero, T.One, T.Zero, T.Zero ); /// Constructs a from the given . /// The source . public Matrix2X4(Matrix3X2 value) { - Row1 = new(value.M11, value.M12, default, default); - Row2 = new(value.M21, value.M22, default, default); + Row1 = new(value.M11, value.M12, T.Zero, T.Zero); + Row2 = new(value.M21, value.M22, T.Zero, T.Zero); } /// Constructs a from the given Matrix4x3. /// The source Matrix4x3. public Matrix2X4(Matrix4X3 value) { - Row1 = new(value.M11, value.M12, value.M13, default); - Row2 = new(value.M21, value.M22, value.M23, default); + Row1 = new(value.M11, value.M12, value.M13, T.Zero); + Row2 = new(value.M21, value.M22, value.M23, T.Zero); } /// Constructs a from the given . @@ -48,16 +48,16 @@ public Matrix2X4(Matrix3X4 value) /// The source . public Matrix2X4(Matrix3X3 value) { - Row1 = new(value.M11, value.M12, value.M13, default); - Row2 = new(value.M21, value.M22, value.M23, default); + Row1 = new(value.M11, value.M12, value.M13, T.Zero); + Row2 = new(value.M21, value.M22, value.M23, T.Zero); } /// Constructs a Matrix2x4 from the given . /// The source . public Matrix2X4(Matrix4X2 value) { - Row1 = new(value.M11, value.M12, default, default); - Row2 = new(value.M21, value.M22, default, default); + Row1 = new(value.M11, value.M12, T.Zero, T.Zero); + Row2 = new(value.M21, value.M22, T.Zero, T.Zero); } /// Returns the multiplicative identity matrix. diff --git a/sources/Maths/Maths/Matrix3X3.cs b/sources/Maths/Maths/Matrix3X3.cs index 39fff98e60..d98120c478 100644 --- a/sources/Maths/Maths/Matrix3X3.cs +++ b/sources/Maths/Maths/Matrix3X3.cs @@ -18,9 +18,9 @@ public partial struct Matrix3X3 /// The source . public Matrix3X3(Matrix3X2 value) { - Row1 = new(value.M11, value.M12, default); - Row2 = new(value.M21, value.M22, default); - Row3 = new(value.M31, value.M32, Scalar.One); + Row1 = new(value.M11, value.M12, T.Zero); + Row2 = new(value.M21, value.M22, T.Zero); + Row3 = new(value.M31, value.M32, T.One); } /// Constructs a from the given . @@ -63,9 +63,9 @@ public Matrix3X3(Matrix2X4 value) /// The source . public Matrix3X3(Matrix4X2 value) { - Row1 = new(value.M11, value.M12, default); - Row2 = new(value.M21, value.M22, default); - Row3 = new(value.M31, value.M32, Scalar.One); + Row1 = new(value.M11, value.M12, T.Zero); + Row2 = new(value.M21, value.M22, T.Zero); + Row3 = new(value.M31, value.M32, T.One); } /// Constructs a from the given . diff --git a/sources/Maths/Maths/Matrix3X4.cs b/sources/Maths/Maths/Matrix3X4.cs index 84076d5572..82ed67a171 100644 --- a/sources/Maths/Maths/Matrix3X4.cs +++ b/sources/Maths/Maths/Matrix3X4.cs @@ -16,27 +16,27 @@ public partial struct Matrix3X4 { private static readonly Matrix3X4 _identity = new ( - Scalar.One, Scalar.Zero, Scalar.Zero, Scalar.Zero, - Scalar.Zero, Scalar.One, Scalar.Zero, Scalar.Zero, - Scalar.Zero, Scalar.Zero, Scalar.One, Scalar.Zero + T.One, T.Zero, T.Zero, T.Zero, + T.Zero, T.One, T.Zero, T.Zero, + T.Zero, T.Zero, T.One, T.Zero ); /// Constructs a from the given . /// The source . public Matrix3X4(Matrix3X2 value) { - Row1 = new(value.M11, value.M12, default, default); - Row2 = new(value.M21, value.M22, default, default); - Row3 = new(value.M31, value.M32, Scalar.One, default); + Row1 = new(value.M11, value.M12, T.Zero, T.Zero); + Row2 = new(value.M21, value.M22, T.Zero, T.Zero); + Row3 = new(value.M31, value.M32, T.One, T.Zero); } /// Constructs a from the given . /// The source . public Matrix3X4(Matrix4X3 value) { - Row1 = new(value.M11, value.M12, value.M13, default); - Row2 = new(value.M21, value.M22, value.M23, default); - Row3 = new(value.M31, value.M32, value.M33, default); + Row1 = new(value.M11, value.M12, value.M13, T.Zero); + Row2 = new(value.M21, value.M22, value.M23, T.Zero); + Row3 = new(value.M31, value.M32, value.M33, T.Zero); } /// Constructs a from the given . @@ -52,9 +52,9 @@ public Matrix3X4(Matrix3X4 value) /// The source . public Matrix3X4(Matrix3X3 value) { - Row1 = new(value.M11, value.M12, value.M13, default); - Row2 = new(value.M21, value.M22, value.M23, default); - Row3 = new(value.M31, value.M32, value.M33, default); + Row1 = new(value.M11, value.M12, value.M13, T.Zero); + Row2 = new(value.M21, value.M22, value.M23, T.Zero); + Row3 = new(value.M31, value.M32, value.M33, T.Zero); } /// Constructs a from the given . @@ -70,9 +70,9 @@ public Matrix3X4(Matrix2X4 value) /// The source . public Matrix3X4(Matrix4X2 value) { - Row1 = new(value.M11, value.M12, default, default); - Row2 = new(value.M21, value.M22, default, default); - Row3 = new(value.M31, value.M32, Scalar.One, default); + Row1 = new(value.M11, value.M12, T.Zero, T.Zero); + Row2 = new(value.M21, value.M22, T.Zero, T.Zero); + Row3 = new(value.M31, value.M32, T.One, T.Zero); } /// Returns the multiplicative identity matrix. diff --git a/sources/Maths/Maths/Matrix4X3.cs b/sources/Maths/Maths/Matrix4X3.cs index 1611662778..607aa46115 100644 --- a/sources/Maths/Maths/Matrix4X3.cs +++ b/sources/Maths/Maths/Matrix4X3.cs @@ -28,10 +28,10 @@ public partial struct Matrix4X3 /// The source . public Matrix4X3(Matrix3X2 value) { - Row1 = new(value.M11, value.M12, default); - Row2 = new(value.M21, value.M22, default); + Row1 = new(value.M11, value.M12, T.Zero); + Row2 = new(value.M21, value.M22, T.Zero); Row3 = Vector3D.UnitZ; - Row4 = new(value.M31, value.M32, default); + Row4 = new(value.M31, value.M32, T.Zero); } /// Constructs a from the given . @@ -78,9 +78,9 @@ public Matrix4X3(Matrix2X4 value) /// The source . public Matrix4X3(Matrix4X2 value) { - Row1 = new(value.M11, value.M12, default); - Row2 = new(value.M21, value.M22, default); - Row3 = new(value.M31, value.M32, default); + Row1 = new(value.M11, value.M12, T.Zero); + Row2 = new(value.M21, value.M22, T.Zero); + Row3 = new(value.M31, value.M32, T.Zero); Row4 = new(value.M41, value.M42, Scalar.One); } diff --git a/sources/Maths/Maths/Matrix4X4.Ops.cs b/sources/Maths/Maths/Matrix4X4.Ops.cs index 450925695d..83e8e3dc15 100644 --- a/sources/Maths/Maths/Matrix4X4.Ops.cs +++ b/sources/Maths/Maths/Matrix4X4.Ops.cs @@ -76,9 +76,9 @@ public static Matrix4X4 CreateBillboard(Vector3D objectPosition, Vector Vector3D yaxis = Vector3D.Cross(zaxis, xaxis); return new( - new(xaxis, default), - new(yaxis, default), - new(zaxis, default), + new(xaxis, T.Zero), + new(yaxis, T.Zero), + new(zaxis, T.Zero), new(objectPosition, Scalar.One)); } @@ -137,9 +137,9 @@ public static Matrix4X4 CreateConstrainedBillboard(Vector3D objectPosit } return new( - new(xaxis, default), - new(yaxis, default), - new(zaxis, default), + new(xaxis, T.Zero), + new(yaxis, T.Zero), + new(zaxis, T.Zero), new(objectPosition, Scalar.One)); } diff --git a/sources/Maths/Maths/Matrix4X4.cs b/sources/Maths/Maths/Matrix4X4.cs index c951ad86b9..b9e06be306 100644 --- a/sources/Maths/Maths/Matrix4X4.cs +++ b/sources/Maths/Maths/Matrix4X4.cs @@ -18,20 +18,20 @@ public partial struct Matrix4X4 /// The source . public Matrix4X4(Matrix3X2 value) { - Row1 = new(value.M11, value.M12, default, default); - Row2 = new(value.M21, value.M22, default, default); - Row4 = new(value.M31, value.M32, default, Scalar.One); - Row3 = new(default, default, Scalar.One, default); + Row1 = new(value.M11, value.M12, T.Zero, T.Zero); + Row2 = new(value.M21, value.M22, T.Zero, T.Zero); + Row4 = new(value.M31, value.M32, T.Zero, T.One); + Row3 = new(T.Zero, T.Zero, T.One, T.Zero); } /// Constructs a from the given . /// The source . public Matrix4X4(Matrix4X3 value) { - Row1 = new(value.M11, value.M12, value.M13, default); - Row2 = new(value.M21, value.M22, value.M23, default); - Row3 = new(value.M31, value.M32, value.M33, default); - Row4 = new(value.M41, value.M42, value.M43, Scalar.One); + Row1 = new(value.M11, value.M12, value.M13, T.Zero); + Row2 = new(value.M21, value.M22, value.M23, T.Zero); + Row3 = new(value.M31, value.M32, value.M33, T.Zero); + Row4 = new(value.M41, value.M42, value.M43, T.One); } /// Constructs a from the given . @@ -48,10 +48,10 @@ public Matrix4X4(Matrix3X4 value) /// The source . public Matrix4X4(Matrix3X3 value) { - Row1 = new(value.M11, value.M12, value.M13, default); - Row2 = new(value.M21, value.M22, value.M23, default); - Row4 = new(value.M31, value.M32, value.M33, Scalar.One); - Row3 = new(default, default, Scalar.One, default); + Row1 = new(value.M11, value.M12, value.M13, T.Zero); + Row2 = new(value.M21, value.M22, value.M23, T.Zero); + Row4 = new(value.M31, value.M32, value.M33, T.One); + Row3 = new(T.Zero, T.Zero, T.One, T.Zero); } /// Constructs a from the given . @@ -68,10 +68,10 @@ public Matrix4X4(Matrix2X4 value) /// The source . public Matrix4X4(Matrix4X2 value) { - Row1 = new(value.M11, value.M12, default, default); - Row2 = new(value.M21, value.M22, default, default); - Row3 = new(value.M31, value.M32, Scalar.One, default); - Row4 = new(value.M41, value.M42, default, Scalar.One); + Row1 = new(value.M11, value.M12, T.Zero, T.Zero); + Row2 = new(value.M21, value.M22, T.Zero, T.Zero); + Row3 = new(value.M31, value.M32, T.One, T.Zero); + Row4 = new(value.M41, value.M42, T.Zero, T.One); } /// Multiplies a vector by a matrix. diff --git a/sources/Maths/Maths/Matrix5X4.cs b/sources/Maths/Maths/Matrix5X4.cs index 0d6e940a43..555c6582b7 100644 --- a/sources/Maths/Maths/Matrix5X4.cs +++ b/sources/Maths/Maths/Matrix5X4.cs @@ -16,20 +16,20 @@ public partial struct Matrix5X4 { private static readonly Matrix5X4 _identity = new ( - Scalar.One, Scalar.Zero, Scalar.Zero, Scalar.Zero, - Scalar.Zero, Scalar.One, Scalar.Zero, Scalar.Zero, - Scalar.Zero, Scalar.Zero, Scalar.One, Scalar.Zero, - Scalar.Zero, Scalar.Zero, Scalar.Zero, Scalar.One, - Scalar.Zero, Scalar.Zero, Scalar.Zero, Scalar.Zero + T.One, T.Zero, T.Zero, T.Zero, + T.Zero, T.One, T.Zero, T.Zero, + T.Zero, T.Zero, T.One, T.Zero, + T.Zero, T.Zero, T.Zero, T.One, + T.Zero, T.Zero, T.Zero, T.Zero ); /// Constructs a from the given . /// The source . public Matrix5X4(Matrix3X2 value) { - Row1 = new(value.M11, value.M12, default, default); - Row2 = new(value.M21, value.M22, default, default); - Row5 = new(value.M31, value.M32, default, default); + Row1 = new(value.M11, value.M12, T.Zero, T.Zero); + Row2 = new(value.M21, value.M22, T.Zero, T.Zero); + Row5 = new(value.M31, value.M32, T.Zero, T.Zero); Row3 = Vector4D.UnitZ; Row4 = Vector4D.UnitW; } @@ -49,10 +49,10 @@ public Matrix5X4(Matrix4X4 value) /// The source . public Matrix5X4(Matrix4X3 value) { - Row1 = new(value.M11, value.M12, value.M13, default); - Row2 = new(value.M21, value.M22, value.M23, default); - Row3 = new(value.M31, value.M32, value.M33, default); - Row4 = new(value.M41, value.M42, value.M43, Scalar.One); + Row1 = new(value.M11, value.M12, value.M13, T.Zero); + Row2 = new(value.M21, value.M22, value.M23, T.Zero); + Row3 = new(value.M31, value.M32, value.M33, T.Zero); + Row4 = new(value.M41, value.M42, value.M43, T.One); Row5 = default; } @@ -71,9 +71,9 @@ public Matrix5X4(Matrix3X4 value) /// The source . public Matrix5X4(Matrix3X3 value) { - Row1 = new(value.M11, value.M12, value.M13, default); - Row2 = new(value.M21, value.M22, value.M23, default); - Row5 = new(value.M31, value.M32, value.M33, default); + Row1 = new(value.M11, value.M12, value.M13, T.Zero); + Row2 = new(value.M21, value.M22, value.M23, T.Zero); + Row5 = new(value.M31, value.M32, value.M33, T.Zero); Row3 = Vector4D.UnitZ; Row4 = Vector4D.UnitW; } @@ -93,10 +93,10 @@ public Matrix5X4(Matrix2X4 value) /// The source . public Matrix5X4(Matrix4X2 value) { - Row1 = new(value.M11, value.M12, default, default); - Row2 = new(value.M21, value.M22, default, default); - Row3 = new(value.M31, value.M32, Scalar.One, default); - Row4 = new(value.M41, value.M42, default, Scalar.One); + Row1 = new(value.M11, value.M12, T.Zero, T.Zero); + Row2 = new(value.M21, value.M22, T.Zero, T.Zero); + Row3 = new(value.M31, value.M32, T.One, T.Zero); + Row4 = new(value.M41, value.M42, T.Zero, T.One); Row5 = default; } From 0345ba56312fad178a192a82f63544ad3fcfea0d Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Wed, 2 Jul 2025 19:41:03 -0700 Subject: [PATCH 15/19] Code-gen multiply operators. --- sources/Maths/Maths/Matrix2X2.Ops.cs | 81 ------------------ sources/Maths/Maths/Matrix2X2.cs | 9 -- sources/Maths/Maths/Matrix2X2.gen.cs | 113 ++++++++++++++++++++++++- sources/Maths/Maths/Matrix2X3.Ops.cs | 74 ---------------- sources/Maths/Maths/Matrix2X3.cs | 9 -- sources/Maths/Maths/Matrix2X3.gen.cs | 121 ++++++++++++++++++++++++++- sources/Maths/Maths/Matrix2X4.Ops.cs | 91 -------------------- sources/Maths/Maths/Matrix2X4.cs | 9 -- sources/Maths/Maths/Matrix2X4.gen.cs | 121 ++++++++++++++++++++++++++- sources/Maths/Maths/Matrix3X2.Ops.cs | 80 ------------------ sources/Maths/Maths/Matrix3X2.cs | 9 -- sources/Maths/Maths/Matrix3X2.gen.cs | 121 ++++++++++++++++++++++++++- sources/Maths/Maths/Matrix3X3.Ops.cs | 94 --------------------- sources/Maths/Maths/Matrix3X3.cs | 9 -- sources/Maths/Maths/Matrix3X3.gen.cs | 113 ++++++++++++++++++++++++- sources/Maths/Maths/Matrix3X4.Ops.cs | 98 ---------------------- sources/Maths/Maths/Matrix3X4.cs | 9 -- sources/Maths/Maths/Matrix3X4.gen.cs | 121 ++++++++++++++++++++++++++- sources/Maths/Maths/Matrix4X2.Ops.cs | 91 -------------------- sources/Maths/Maths/Matrix4X2.cs | 9 -- sources/Maths/Maths/Matrix4X2.gen.cs | 121 ++++++++++++++++++++++++++- sources/Maths/Maths/Matrix4X3.Ops.cs | 97 --------------------- sources/Maths/Maths/Matrix4X3.cs | 9 -- sources/Maths/Maths/Matrix4X3.gen.cs | 121 ++++++++++++++++++++++++++- sources/Maths/Maths/Matrix4X4.Ops.cs | 73 ---------------- sources/Maths/Maths/Matrix4X4.cs | 10 --- sources/Maths/Maths/Matrix4X4.gen.cs | 121 ++++++++++++++++++++++++++- sources/Maths/Maths/Matrix5X4.Ops.cs | 37 -------- sources/Maths/Maths/Matrix5X4.gen.cs | 51 ++++++++++- sources/Maths/Maths/Vector2D.gen.cs | 16 ++++ sources/Maths/Maths/Vector3D.gen.cs | 16 ++++ sources/Maths/Maths/Vector4D.gen.cs | 16 ++++ 32 files changed, 1162 insertions(+), 908 deletions(-) delete mode 100644 sources/Maths/Maths/Matrix2X2.Ops.cs delete mode 100644 sources/Maths/Maths/Matrix2X4.Ops.cs delete mode 100644 sources/Maths/Maths/Matrix3X4.Ops.cs delete mode 100644 sources/Maths/Maths/Matrix4X3.Ops.cs diff --git a/sources/Maths/Maths/Matrix2X2.Ops.cs b/sources/Maths/Maths/Matrix2X2.Ops.cs deleted file mode 100644 index e7f5828da8..0000000000 --- a/sources/Maths/Maths/Matrix2X2.Ops.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Numerics; -using System.Runtime.CompilerServices; - -namespace Silk.NET.Maths -{ - /// - /// Methods for working with - /// - public static partial class Matrix2X2 - { - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X2 Add(Matrix2X2 value1, Matrix2X2 value2) - where T : INumberBase - { - return value1 + value2; - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X2 Multiply(Matrix2X2 value1, Matrix2X2 value2) - where T : INumberBase => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X2 Multiply(Matrix3X2 value1, Matrix2X2 value2) - where T : INumberBase => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X3 Multiply(Matrix2X2 value1, Matrix2X3 value2) - where T : INumberBase => value1 * value2; - - /// Multiplies a matrix by a scalar value. - /// The source matrix. - /// The scaling factor. - /// The scaled matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X2 Multiply(Matrix2X2 value1, T value2) - where T : INumberBase => value1 * value2; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Multiply(Vector2D value1, Matrix2X2 value2) - where T : INumberBase => value1 * value2; - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X2 Negate(Matrix2X2 value) - where T : INumberBase => -value; - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X2 Subtract(Matrix2X2 value1, Matrix2X2 value2) - where T : INumberBase => value1 - value2; - } -} diff --git a/sources/Maths/Maths/Matrix2X2.cs b/sources/Maths/Maths/Matrix2X2.cs index 5085e8de98..25d3a702ca 100644 --- a/sources/Maths/Maths/Matrix2X2.cs +++ b/sources/Maths/Maths/Matrix2X2.cs @@ -54,15 +54,6 @@ public Matrix2X2(Matrix4X2 value) Row2 = new(value.M21, value.M22); } - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - public static unsafe Vector2D operator *(Vector2D value1, Matrix2X2 value2) - { - return value1 * value2.Row1 + value1 * value2.Row2; - } - /// Calculates the determinant of the matrix. /// The determinant of the matrix. public readonly T GetDeterminant() diff --git a/sources/Maths/Maths/Matrix2X2.gen.cs b/sources/Maths/Maths/Matrix2X2.gen.cs index 16706b400d..154f2572ba 100644 --- a/sources/Maths/Maths/Matrix2X2.gen.cs +++ b/sources/Maths/Maths/Matrix2X2.gen.cs @@ -109,7 +109,6 @@ public override string ToString() => Row2.X, Row2.Y); /// - [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix2X2 other && Equals(other); /// @@ -197,6 +196,20 @@ public Matrix2X2 Transpose() => new(left.Row1 * right, left.Row2 * right); + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector2D operator *(Vector2D rowVector, Matrix2X2 matrix) => + rowVector.X * matrix.Row1 + rowVector.Y * matrix.Row2; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector2D operator *(Matrix2X2 matrix, Vector2D columnVector) => + matrix.Column1 * columnVector.X + matrix.Column2 * columnVector.Y; + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -422,6 +435,9 @@ public static explicit operator checked Matrix2X2(Matrix2X2 from) => Vector2D.CreateChecked(from.Row2)); } + /// + /// Methods for working with + /// public static partial class Matrix2X2 { /// Linearly interpolates between the corresponding values of two matrices. @@ -433,5 +449,100 @@ public static Matrix2X2 Lerp(Matrix2X2 value1, Matrix2X2 value2, T a where T : IFloatingPointIeee754 => new(Vector2D.Lerp(value1.Row1, value2.Row1, amount), Vector2D.Lerp(value1.Row2, value2.Row2, amount)); + + /// Adds two matrices together. + /// The first source matrix. + /// The second source matrix. + /// The result of the addition. + public static Matrix2X2 Add(Matrix2X2 left, Matrix2X2 right) + where T : INumberBase => + left + right; + + /// Returns a negated copy of the specified matrix. + /// The source matrix. + /// The negated matrix. + public static Matrix2X2 Negate(Matrix2X2 value) + where T : INumberBase + => -value; + + /// Subtracts the second matrix from the first. + /// The first source matrix. + /// The second source matrix. + /// The result of the subtraction. + public static Matrix2X2 Subtract(Matrix2X2 left, Matrix2X2 right) + where T : INumberBase + => left - right; + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix2X2 Multiply(Matrix2X2 left, T right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix2X2 Multiply(T left, Matrix2X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector2D Multiply(Vector2D rowVector, Matrix2X2 matrix) + where T : INumberBase => + rowVector * matrix; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector2D Multiply(Matrix2X2 matrix, Vector2D columnVector) + where T : INumberBase => + matrix * columnVector; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X2 Multiply(Matrix2X2 left, Matrix2X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X3 Multiply(Matrix2X2 left, Matrix2X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X4 Multiply(Matrix2X2 left, Matrix2X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X2 Multiply(Matrix3X2 left, Matrix2X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X2 Multiply(Matrix4X2 left, Matrix2X2 right) + where T : INumberBase => + left * right; } } diff --git a/sources/Maths/Maths/Matrix2X3.Ops.cs b/sources/Maths/Maths/Matrix2X3.Ops.cs index 81cae99cff..d9cd1234fc 100644 --- a/sources/Maths/Maths/Matrix2X3.Ops.cs +++ b/sources/Maths/Maths/Matrix2X3.Ops.cs @@ -14,17 +14,6 @@ public static partial class Matrix2X3 { private const float BillboardEpsilon = 1e-4f; - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X3 Add(Matrix2X3 value1, Matrix2X3 value2) - where T : INumberBase - { - return value1 + value2; - } - /// Creates a spherical billboard that rotates around a specified object position. /// Position of the object the billboard will rotate around. /// Position of the camera. @@ -145,69 +134,6 @@ public static Matrix2X3 CreateFromYawPitchRoll(T yaw, T pitch, T roll) return CreateFromQuaternion(q); } - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X3 Multiply(Matrix2X3 value1, Matrix3X3 value2) - where T : INumberBase - => value1 * value2; - - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X2 Multiply(Matrix2X3 value1, Matrix3X2 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X3 Multiply(Matrix2X2 value1, Matrix2X3 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by a scalar value. - /// The source matrix. - /// The scaling factor. - /// The scaled matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X3 Multiply(Matrix2X3 value1, T value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Multiply(Vector2D value1, Matrix2X3 value2) - where T : INumberBase - => value1 * value2; - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X3 Negate(Matrix2X3 value) - where T : INumberBase - => -value; - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X3 Subtract(Matrix2X3 value1, Matrix2X3 value2) - where T : INumberBase - => value1 - value2; - /// Transforms the given matrix by applying the given Quaternion rotation. /// The source matrix to transform. /// The rotation to apply. diff --git a/sources/Maths/Maths/Matrix2X3.cs b/sources/Maths/Maths/Matrix2X3.cs index e1e4df98a8..1f9c06fc6e 100644 --- a/sources/Maths/Maths/Matrix2X3.cs +++ b/sources/Maths/Maths/Matrix2X3.cs @@ -66,14 +66,5 @@ public Matrix2X3(Matrix4X2 value) /// Returns whether the matrix is the identity matrix. [IgnoreDataMember] public readonly bool IsIdentity => this == Identity; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - public static unsafe Vector3D operator *(Vector2D value1, Matrix2X3 value2) - { - return value1.X * value2.Row1 + value1.Y * value2.Row2; - } } } diff --git a/sources/Maths/Maths/Matrix2X3.gen.cs b/sources/Maths/Maths/Matrix2X3.gen.cs index cd3fd0c468..c5d7f73970 100644 --- a/sources/Maths/Maths/Matrix2X3.gen.cs +++ b/sources/Maths/Maths/Matrix2X3.gen.cs @@ -114,7 +114,6 @@ public override string ToString() => Row2.X, Row2.Y, Row2.Z); /// - [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix2X3 other && Equals(other); /// @@ -203,6 +202,20 @@ public Matrix3X2 Transpose() => new(left.Row1 * right, left.Row2 * right); + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector3D operator *(Vector2D rowVector, Matrix2X3 matrix) => + rowVector.X * matrix.Row1 + rowVector.Y * matrix.Row2; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector2D operator *(Matrix2X3 matrix, Vector3D columnVector) => + matrix.Column1 * columnVector.X + matrix.Column2 * columnVector.Y + matrix.Column3 * columnVector.Z; + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -436,6 +449,9 @@ public static explicit operator checked Matrix2X3(Matrix2X3 from) => Vector3D.CreateChecked(from.Row2)); } + /// + /// Methods for working with + /// public static partial class Matrix2X3 { /// Linearly interpolates between the corresponding values of two matrices. @@ -447,5 +463,108 @@ public static Matrix2X3 Lerp(Matrix2X3 value1, Matrix2X3 value2, T a where T : IFloatingPointIeee754 => new(Vector3D.Lerp(value1.Row1, value2.Row1, amount), Vector3D.Lerp(value1.Row2, value2.Row2, amount)); + + /// Adds two matrices together. + /// The first source matrix. + /// The second source matrix. + /// The result of the addition. + public static Matrix2X3 Add(Matrix2X3 left, Matrix2X3 right) + where T : INumberBase => + left + right; + + /// Returns a negated copy of the specified matrix. + /// The source matrix. + /// The negated matrix. + public static Matrix2X3 Negate(Matrix2X3 value) + where T : INumberBase + => -value; + + /// Subtracts the second matrix from the first. + /// The first source matrix. + /// The second source matrix. + /// The result of the subtraction. + public static Matrix2X3 Subtract(Matrix2X3 left, Matrix2X3 right) + where T : INumberBase + => left - right; + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix2X3 Multiply(Matrix2X3 left, T right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix2X3 Multiply(T left, Matrix2X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector3D Multiply(Vector2D rowVector, Matrix2X3 matrix) + where T : INumberBase => + rowVector * matrix; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector2D Multiply(Matrix2X3 matrix, Vector3D columnVector) + where T : INumberBase => + matrix * columnVector; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X3 Multiply(Matrix2X2 left, Matrix2X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X2 Multiply(Matrix2X3 left, Matrix3X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X3 Multiply(Matrix2X3 left, Matrix3X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X4 Multiply(Matrix2X3 left, Matrix3X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X3 Multiply(Matrix3X2 left, Matrix2X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X3 Multiply(Matrix4X2 left, Matrix2X3 right) + where T : INumberBase => + left * right; } } diff --git a/sources/Maths/Maths/Matrix2X4.Ops.cs b/sources/Maths/Maths/Matrix2X4.Ops.cs deleted file mode 100644 index 4d0f06cbd4..0000000000 --- a/sources/Maths/Maths/Matrix2X4.Ops.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Numerics; -using System.Runtime.CompilerServices; - -namespace Silk.NET.Maths -{ - /// - /// Methods for working with - /// - public static partial class Matrix2X4 - { - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X4 Add(Matrix2X4 value1, Matrix2X4 value2) - where T : INumberBase - { - return value1 + value2; - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X4 Multiply(Matrix2X4 value1, Matrix4X4 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X3 Multiply(Matrix2X4 value1, Matrix4X3 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X2 Multiply(Matrix2X4 value1, Matrix4X2 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X4 Multiply(Matrix4X2 value1, Matrix2X4 value2) - where T : INumberBase - => value1 * value2; - - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X4 Multiply(Matrix3X2 value1, Matrix2X4 value2) - where T : INumberBase - => value1 * value2; - - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X4 Multiply(Matrix2X2 value1, Matrix2X4 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Multiply(Vector2D value1, Matrix2X4 value2) - where T : INumberBase - => value1 * value2; - } -} diff --git a/sources/Maths/Maths/Matrix2X4.cs b/sources/Maths/Maths/Matrix2X4.cs index 838b0902cb..447aa4fac4 100644 --- a/sources/Maths/Maths/Matrix2X4.cs +++ b/sources/Maths/Maths/Matrix2X4.cs @@ -66,14 +66,5 @@ public Matrix2X4(Matrix4X2 value) /// Returns whether the matrix is the identity matrix. [IgnoreDataMember] public readonly bool IsIdentity => this == Identity; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - public static unsafe Vector4D operator *(Vector2D value1, Matrix2X4 value2) - { - return value1.X * value2.Row1 + value1.Y * value2.Row2; - } } } diff --git a/sources/Maths/Maths/Matrix2X4.gen.cs b/sources/Maths/Maths/Matrix2X4.gen.cs index 2e8af8f158..c9f0301392 100644 --- a/sources/Maths/Maths/Matrix2X4.gen.cs +++ b/sources/Maths/Maths/Matrix2X4.gen.cs @@ -128,7 +128,6 @@ public override string ToString() => Row2.X, Row2.Y, Row2.Z, Row2.W); /// - [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix2X4 other && Equals(other); /// @@ -218,6 +217,20 @@ public Matrix4X2 Transpose() => new(left.Row1 * right, left.Row2 * right); + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector4D operator *(Vector2D rowVector, Matrix2X4 matrix) => + rowVector.X * matrix.Row1 + rowVector.Y * matrix.Row2; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector2D operator *(Matrix2X4 matrix, Vector4D columnVector) => + matrix.Column1 * columnVector.X + matrix.Column2 * columnVector.Y + matrix.Column3 * columnVector.Z + matrix.Column4 * columnVector.W; + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -460,6 +473,9 @@ public static explicit operator checked Matrix2X4(Matrix2X4 from) => Vector4D.CreateChecked(from.Row2)); } + /// + /// Methods for working with + /// public static partial class Matrix2X4 { /// Linearly interpolates between the corresponding values of two matrices. @@ -471,5 +487,108 @@ public static Matrix2X4 Lerp(Matrix2X4 value1, Matrix2X4 value2, T a where T : IFloatingPointIeee754 => new(Vector4D.Lerp(value1.Row1, value2.Row1, amount), Vector4D.Lerp(value1.Row2, value2.Row2, amount)); + + /// Adds two matrices together. + /// The first source matrix. + /// The second source matrix. + /// The result of the addition. + public static Matrix2X4 Add(Matrix2X4 left, Matrix2X4 right) + where T : INumberBase => + left + right; + + /// Returns a negated copy of the specified matrix. + /// The source matrix. + /// The negated matrix. + public static Matrix2X4 Negate(Matrix2X4 value) + where T : INumberBase + => -value; + + /// Subtracts the second matrix from the first. + /// The first source matrix. + /// The second source matrix. + /// The result of the subtraction. + public static Matrix2X4 Subtract(Matrix2X4 left, Matrix2X4 right) + where T : INumberBase + => left - right; + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix2X4 Multiply(Matrix2X4 left, T right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix2X4 Multiply(T left, Matrix2X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector4D Multiply(Vector2D rowVector, Matrix2X4 matrix) + where T : INumberBase => + rowVector * matrix; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector2D Multiply(Matrix2X4 matrix, Vector4D columnVector) + where T : INumberBase => + matrix * columnVector; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X4 Multiply(Matrix2X2 left, Matrix2X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X2 Multiply(Matrix2X4 left, Matrix4X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X3 Multiply(Matrix2X4 left, Matrix4X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X4 Multiply(Matrix2X4 left, Matrix4X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X4 Multiply(Matrix3X2 left, Matrix2X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X4 Multiply(Matrix4X2 left, Matrix2X4 right) + where T : INumberBase => + left * right; } } diff --git a/sources/Maths/Maths/Matrix3X2.Ops.cs b/sources/Maths/Maths/Matrix3X2.Ops.cs index 4f5194fe0a..34096ae04d 100644 --- a/sources/Maths/Maths/Matrix3X2.Ops.cs +++ b/sources/Maths/Maths/Matrix3X2.Ops.cs @@ -18,15 +18,6 @@ public static partial class Matrix3X2 private const float RotationEpsilon = 0.001f * ((float) Math.PI) / 180f; // 0.1% of a degree #endif - /// Adds each matrix element in value1 with its corresponding element in value2. - /// The first source matrix. - /// The second source matrix. - /// The matrix containing the summed values. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X2 Add(Matrix3X2 value1, Matrix3X2 value2) - where T : INumberBase - => value1 + value2; - /// Creates a rotation matrix using the given rotation in radians. /// The amount of rotation, in radians. /// A rotation matrix. @@ -413,76 +404,5 @@ public static bool Invert(Matrix3X2 matrix, out Matrix3X2 result) return true; } - - /// Multiplies two matrices together and returns the resulting matrix. - /// The first source matrix. - /// The second source matrix. - /// The product matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X2 Multiply(Matrix3X2 value1, Matrix2X2 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Multiply(Vector3D value1, Matrix3X2 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies two matrices together and returns the resulting matrix. - /// The first source matrix. - /// The second source matrix. - /// The product matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X3 Multiply(Matrix3X2 value1, Matrix2X3 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies two matrices together and returns the resulting matrix. - /// The first source matrix. - /// The second source matrix. - /// The product matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X2 Multiply(Matrix2X3 value1, Matrix3X2 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies two matrices together and returns the resulting matrix. - /// The first source matrix. - /// The second source matrix. - /// The product matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X3 Multiply(Matrix2X3 value1, Matrix3X3 value2) - where T : INumberBase - => value1 * value2; - - /// Scales all elements in a matrix by the given scalar factor. - /// The source matrix. - /// The scaling value to use. - /// The resulting matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X2 Multiply(Matrix3X2 value1, T value2) - where T : INumberBase - => value1 * value2; - - /// Negates the given matrix by multiplying all values by -1. - /// The source matrix. - /// The negated matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X2 Negate(Matrix3X2 value) - where T : INumberBase - => -value; - - /// Subtracts each matrix element in value2 from its corresponding element in value1. - /// The first source matrix. - /// The second source matrix. - /// The matrix containing the resulting values. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X2 Subtract(Matrix3X2 value1, Matrix3X2 value2) - where T : INumberBase - => value1 - value2; } } diff --git a/sources/Maths/Maths/Matrix3X2.cs b/sources/Maths/Maths/Matrix3X2.cs index fe2716e323..6f618c2e69 100644 --- a/sources/Maths/Maths/Matrix3X2.cs +++ b/sources/Maths/Maths/Matrix3X2.cs @@ -72,15 +72,6 @@ public Matrix3X2(Matrix4X2 value) [IgnoreDataMember] public readonly bool IsIdentity => this == Identity; - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - public static unsafe Vector2D operator *(Vector3D value1, Matrix3X2 value2) - { - return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3; - } - /// Calculates the determinant for this matrix. /// The determinant is calculated by expanding the matrix with a third column whose values are (0,0,1). /// The determinant. diff --git a/sources/Maths/Maths/Matrix3X2.gen.cs b/sources/Maths/Maths/Matrix3X2.gen.cs index 3afe6bdefa..5f8f13123e 100644 --- a/sources/Maths/Maths/Matrix3X2.gen.cs +++ b/sources/Maths/Maths/Matrix3X2.gen.cs @@ -119,7 +119,6 @@ public override string ToString() => Row3.X, Row3.Y); /// - [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix3X2 other && Equals(other); /// @@ -213,6 +212,20 @@ public Matrix2X3 Transpose() => left.Row2 * right, left.Row3 * right); + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector2D operator *(Vector3D rowVector, Matrix3X2 matrix) => + rowVector.X * matrix.Row1 + rowVector.Y * matrix.Row2 + rowVector.Z * matrix.Row3; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector3D operator *(Matrix3X2 matrix, Vector2D columnVector) => + matrix.Column1 * columnVector.X + matrix.Column2 * columnVector.Y; + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -472,6 +485,9 @@ public static explicit operator checked Matrix3X2(Matrix3X2 from) => Vector2D.CreateChecked(from.Row3)); } + /// + /// Methods for working with + /// public static partial class Matrix3X2 { /// Linearly interpolates between the corresponding values of two matrices. @@ -484,5 +500,108 @@ public static Matrix3X2 Lerp(Matrix3X2 value1, Matrix3X2 value2, T a new(Vector2D.Lerp(value1.Row1, value2.Row1, amount), Vector2D.Lerp(value1.Row2, value2.Row2, amount), Vector2D.Lerp(value1.Row3, value2.Row3, amount)); + + /// Adds two matrices together. + /// The first source matrix. + /// The second source matrix. + /// The result of the addition. + public static Matrix3X2 Add(Matrix3X2 left, Matrix3X2 right) + where T : INumberBase => + left + right; + + /// Returns a negated copy of the specified matrix. + /// The source matrix. + /// The negated matrix. + public static Matrix3X2 Negate(Matrix3X2 value) + where T : INumberBase + => -value; + + /// Subtracts the second matrix from the first. + /// The first source matrix. + /// The second source matrix. + /// The result of the subtraction. + public static Matrix3X2 Subtract(Matrix3X2 left, Matrix3X2 right) + where T : INumberBase + => left - right; + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix3X2 Multiply(Matrix3X2 left, T right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix3X2 Multiply(T left, Matrix3X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector2D Multiply(Vector3D rowVector, Matrix3X2 matrix) + where T : INumberBase => + rowVector * matrix; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector3D Multiply(Matrix3X2 matrix, Vector2D columnVector) + where T : INumberBase => + matrix * columnVector; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X2 Multiply(Matrix2X3 left, Matrix3X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X2 Multiply(Matrix3X2 left, Matrix2X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X3 Multiply(Matrix3X2 left, Matrix2X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X4 Multiply(Matrix3X2 left, Matrix2X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X2 Multiply(Matrix3X3 left, Matrix3X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X2 Multiply(Matrix4X3 left, Matrix3X2 right) + where T : INumberBase => + left * right; } } diff --git a/sources/Maths/Maths/Matrix3X3.Ops.cs b/sources/Maths/Maths/Matrix3X3.Ops.cs index 3f1dcf198d..c90d00d352 100644 --- a/sources/Maths/Maths/Matrix3X3.Ops.cs +++ b/sources/Maths/Maths/Matrix3X3.Ops.cs @@ -35,17 +35,6 @@ private struct VectorBasis } */ - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X3 Add(Matrix3X3 value1, Matrix3X3 value2) - where T : INumberBase - { - return value1 + value2; - } - /// Creates a spherical billboard that rotates around a specified object position. /// Position of the object the billboard will rotate around. /// Position of the camera. @@ -287,89 +276,6 @@ public static Matrix3X3 CreateScale(T scale) return result; } - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X3 Multiply(Matrix3X3 value1, Matrix3X3 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X3 Multiply(Matrix2X3 value1, Matrix3X3 value2) - where T : INumberBase - => value1 * value2; - - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X2 Multiply(Matrix3X3 value1, Matrix3X2 value2) - where T : INumberBase - => value1 * value2; - - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X3 Multiply(Matrix4X3 value1, Matrix3X3 value2) - where T : INumberBase - => value1 * value2; - - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X4 Multiply(Matrix3X3 value1, Matrix3X4 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by a scalar value. - /// The source matrix. - /// The scaling factor. - /// The scaled matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X3 Multiply(Matrix3X3 value1, T value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Multiply(Vector3D value1, Matrix3X3 value2) - where T : INumberBase - => value1 * value2; - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X3 Negate(Matrix3X3 value) - where T : INumberBase - => -value; - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X3 Subtract(Matrix3X3 value1, Matrix3X3 value2) - where T : INumberBase - => value1 - value2; - /* /// Attempts to extract the scale, translation, and rotation components from the given scale/rotation/translation matrix. /// If successful, the out parameters will contained the extracted values. diff --git a/sources/Maths/Maths/Matrix3X3.cs b/sources/Maths/Maths/Matrix3X3.cs index d98120c478..492bc49f43 100644 --- a/sources/Maths/Maths/Matrix3X3.cs +++ b/sources/Maths/Maths/Matrix3X3.cs @@ -77,15 +77,6 @@ public Matrix3X3(Matrix4X4 value) Row3 = new(value.M31, value.M32, value.M33); } - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - public static unsafe Vector3D operator *(Vector3D value1, Matrix3X3 value2) - { - return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3; - } - /// Calculates the determinant of the matrix. /// The determinant of the matrix. public readonly T GetDeterminant() diff --git a/sources/Maths/Maths/Matrix3X3.gen.cs b/sources/Maths/Maths/Matrix3X3.gen.cs index 33e2f9db96..adf07c2f0a 100644 --- a/sources/Maths/Maths/Matrix3X3.gen.cs +++ b/sources/Maths/Maths/Matrix3X3.gen.cs @@ -148,7 +148,6 @@ public override string ToString() => Row3.X, Row3.Y, Row3.Z); /// - [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix3X3 other && Equals(other); /// @@ -243,6 +242,20 @@ public Matrix3X3 Transpose() => left.Row2 * right, left.Row3 * right); + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector3D operator *(Vector3D rowVector, Matrix3X3 matrix) => + rowVector.X * matrix.Row1 + rowVector.Y * matrix.Row2 + rowVector.Z * matrix.Row3; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector3D operator *(Matrix3X3 matrix, Vector3D columnVector) => + matrix.Column1 * columnVector.X + matrix.Column2 * columnVector.Y + matrix.Column3 * columnVector.Z; + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -510,6 +523,9 @@ public static explicit operator checked Matrix3X3(Matrix3X3 from) => Vector3D.CreateChecked(from.Row3)); } + /// + /// Methods for working with + /// public static partial class Matrix3X3 { /// Linearly interpolates between the corresponding values of two matrices. @@ -522,5 +538,100 @@ public static Matrix3X3 Lerp(Matrix3X3 value1, Matrix3X3 value2, T a new(Vector3D.Lerp(value1.Row1, value2.Row1, amount), Vector3D.Lerp(value1.Row2, value2.Row2, amount), Vector3D.Lerp(value1.Row3, value2.Row3, amount)); + + /// Adds two matrices together. + /// The first source matrix. + /// The second source matrix. + /// The result of the addition. + public static Matrix3X3 Add(Matrix3X3 left, Matrix3X3 right) + where T : INumberBase => + left + right; + + /// Returns a negated copy of the specified matrix. + /// The source matrix. + /// The negated matrix. + public static Matrix3X3 Negate(Matrix3X3 value) + where T : INumberBase + => -value; + + /// Subtracts the second matrix from the first. + /// The first source matrix. + /// The second source matrix. + /// The result of the subtraction. + public static Matrix3X3 Subtract(Matrix3X3 left, Matrix3X3 right) + where T : INumberBase + => left - right; + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix3X3 Multiply(Matrix3X3 left, T right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix3X3 Multiply(T left, Matrix3X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector3D Multiply(Vector3D rowVector, Matrix3X3 matrix) + where T : INumberBase => + rowVector * matrix; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector3D Multiply(Matrix3X3 matrix, Vector3D columnVector) + where T : INumberBase => + matrix * columnVector; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X3 Multiply(Matrix2X3 left, Matrix3X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X2 Multiply(Matrix3X3 left, Matrix3X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X3 Multiply(Matrix3X3 left, Matrix3X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X4 Multiply(Matrix3X3 left, Matrix3X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X3 Multiply(Matrix4X3 left, Matrix3X3 right) + where T : INumberBase => + left * right; } } diff --git a/sources/Maths/Maths/Matrix3X4.Ops.cs b/sources/Maths/Maths/Matrix3X4.Ops.cs deleted file mode 100644 index ae25df3fb3..0000000000 --- a/sources/Maths/Maths/Matrix3X4.Ops.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Numerics; -using System.Runtime.CompilerServices; - -namespace Silk.NET.Maths -{ - /// - /// Methods for working with - /// - public static partial class Matrix3X4 - { - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X4 Add(Matrix3X4 value1, Matrix3X4 value2) - where T : INumberBase - { - return value1 + value2; - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X3 Multiply(Matrix3X4 value1, Matrix4X3 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X4 Multiply(Matrix3X4 value1, Matrix4X4 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X4 Multiply(Matrix3X3 value1, Matrix3X4 value2) - where T : INumberBase - => value1 * value2; - - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X4 Multiply(Matrix4X3 value1, Matrix3X4 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by a scalar value. - /// The source matrix. - /// The scaling factor. - /// The scaled matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X4 Multiply(Matrix3X4 value1, T value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Multiply(Vector3D value1, Matrix3X4 value2) - where T : INumberBase - => value1 * value2; - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X4 Negate(Matrix3X4 value) - where T : INumberBase - => -value; - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X4 Subtract(Matrix3X4 value1, Matrix3X4 value2) - where T : INumberBase - => value1 - value2; - } -} diff --git a/sources/Maths/Maths/Matrix3X4.cs b/sources/Maths/Maths/Matrix3X4.cs index 82ed67a171..1143215c6a 100644 --- a/sources/Maths/Maths/Matrix3X4.cs +++ b/sources/Maths/Maths/Matrix3X4.cs @@ -81,14 +81,5 @@ public Matrix3X4(Matrix4X2 value) /// Returns whether the matrix is the identity matrix. [IgnoreDataMember] public readonly bool IsIdentity => this == Identity; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - public static unsafe Vector4D operator *(Vector3D value1, Matrix3X4 value2) - { - return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3; - } } } diff --git a/sources/Maths/Maths/Matrix3X4.gen.cs b/sources/Maths/Maths/Matrix3X4.gen.cs index 640fe89ad4..93e590bbcf 100644 --- a/sources/Maths/Maths/Matrix3X4.gen.cs +++ b/sources/Maths/Maths/Matrix3X4.gen.cs @@ -157,7 +157,6 @@ public override string ToString() => Row3.X, Row3.Y, Row3.Z, Row3.W); /// - [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix3X4 other && Equals(other); /// @@ -253,6 +252,20 @@ public Matrix4X3 Transpose() => left.Row2 * right, left.Row3 * right); + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector4D operator *(Vector3D rowVector, Matrix3X4 matrix) => + rowVector.X * matrix.Row1 + rowVector.Y * matrix.Row2 + rowVector.Z * matrix.Row3; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector3D operator *(Matrix3X4 matrix, Vector4D columnVector) => + matrix.Column1 * columnVector.X + matrix.Column2 * columnVector.Y + matrix.Column3 * columnVector.Z + matrix.Column4 * columnVector.W; + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -529,6 +542,9 @@ public static explicit operator checked Matrix3X4(Matrix3X4 from) => Vector4D.CreateChecked(from.Row3)); } + /// + /// Methods for working with + /// public static partial class Matrix3X4 { /// Linearly interpolates between the corresponding values of two matrices. @@ -541,5 +557,108 @@ public static Matrix3X4 Lerp(Matrix3X4 value1, Matrix3X4 value2, T a new(Vector4D.Lerp(value1.Row1, value2.Row1, amount), Vector4D.Lerp(value1.Row2, value2.Row2, amount), Vector4D.Lerp(value1.Row3, value2.Row3, amount)); + + /// Adds two matrices together. + /// The first source matrix. + /// The second source matrix. + /// The result of the addition. + public static Matrix3X4 Add(Matrix3X4 left, Matrix3X4 right) + where T : INumberBase => + left + right; + + /// Returns a negated copy of the specified matrix. + /// The source matrix. + /// The negated matrix. + public static Matrix3X4 Negate(Matrix3X4 value) + where T : INumberBase + => -value; + + /// Subtracts the second matrix from the first. + /// The first source matrix. + /// The second source matrix. + /// The result of the subtraction. + public static Matrix3X4 Subtract(Matrix3X4 left, Matrix3X4 right) + where T : INumberBase + => left - right; + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix3X4 Multiply(Matrix3X4 left, T right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix3X4 Multiply(T left, Matrix3X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector4D Multiply(Vector3D rowVector, Matrix3X4 matrix) + where T : INumberBase => + rowVector * matrix; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector3D Multiply(Matrix3X4 matrix, Vector4D columnVector) + where T : INumberBase => + matrix * columnVector; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X4 Multiply(Matrix2X3 left, Matrix3X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X4 Multiply(Matrix3X3 left, Matrix3X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X2 Multiply(Matrix3X4 left, Matrix4X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X3 Multiply(Matrix3X4 left, Matrix4X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X4 Multiply(Matrix3X4 left, Matrix4X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X4 Multiply(Matrix4X3 left, Matrix3X4 right) + where T : INumberBase => + left * right; } } diff --git a/sources/Maths/Maths/Matrix4X2.Ops.cs b/sources/Maths/Maths/Matrix4X2.Ops.cs index 697280fe63..d6a6d59f00 100644 --- a/sources/Maths/Maths/Matrix4X2.Ops.cs +++ b/sources/Maths/Maths/Matrix4X2.Ops.cs @@ -12,97 +12,6 @@ namespace Silk.NET.Maths /// public static partial class Matrix4X2 { - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X2 Add(Matrix4X2 value1, Matrix4X2 value2) - where T : INumberBase - { - return value1 + value2; - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X2 Multiply(Matrix4X2 value1, Matrix2X2 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X3 Multiply(Matrix4X2 value1, Matrix2X3 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X4 Multiply(Matrix4X2 value1, Matrix2X4 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X2 Multiply(Matrix2X4 value1, Matrix4X2 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X2 Multiply(Matrix3X4 value1, Matrix4X2 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector2D Multiply(Vector4D value1, Matrix4X2 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X2 Multiply(Matrix4X4 value1, Matrix4X2 value2) - where T : INumberBase - => value1 * value2; - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X2 Negate(Matrix4X2 value) - where T : INumberBase - => -value; - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X2 Subtract(Matrix4X2 value1, Matrix4X2 value2) - where T : INumberBase - => value1 - value2; - /*[MethodImpl((MethodImplOptions)768)] private static Vector128 Permute(Vector128 value, byte control) where T : INumberBase diff --git a/sources/Maths/Maths/Matrix4X2.cs b/sources/Maths/Maths/Matrix4X2.cs index 6086ca84b4..4fab060824 100644 --- a/sources/Maths/Maths/Matrix4X2.cs +++ b/sources/Maths/Maths/Matrix4X2.cs @@ -79,14 +79,5 @@ public Matrix4X2(Matrix2X4 value) /// Returns whether the matrix is the identity matrix. [IgnoreDataMember] public readonly bool IsIdentity => this == Identity; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - public static unsafe Vector2D operator *(Vector4D value1, Matrix4X2 value2) - { - return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3 + value1.W * value2.Row4; - } } } diff --git a/sources/Maths/Maths/Matrix4X2.gen.cs b/sources/Maths/Maths/Matrix4X2.gen.cs index 2cad4a3085..eb6b0133c9 100644 --- a/sources/Maths/Maths/Matrix4X2.gen.cs +++ b/sources/Maths/Maths/Matrix4X2.gen.cs @@ -138,7 +138,6 @@ public override string ToString() => Row4.X, Row4.Y); /// - [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix4X2 other && Equals(other); /// @@ -238,6 +237,20 @@ public Matrix2X4 Transpose() => left.Row3 * right, left.Row4 * right); + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector2D operator *(Vector4D rowVector, Matrix4X2 matrix) => + rowVector.X * matrix.Row1 + rowVector.Y * matrix.Row2 + rowVector.Z * matrix.Row3 + rowVector.W * matrix.Row4; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector4D operator *(Matrix4X2 matrix, Vector2D columnVector) => + matrix.Column1 * columnVector.X + matrix.Column2 * columnVector.Y; + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -533,6 +546,9 @@ public static explicit operator checked Matrix4X2(Matrix4X2 from) => Vector2D.CreateChecked(from.Row4)); } + /// + /// Methods for working with + /// public static partial class Matrix4X2 { /// Linearly interpolates between the corresponding values of two matrices. @@ -546,5 +562,108 @@ public static Matrix4X2 Lerp(Matrix4X2 value1, Matrix4X2 value2, T a Vector2D.Lerp(value1.Row2, value2.Row2, amount), Vector2D.Lerp(value1.Row3, value2.Row3, amount), Vector2D.Lerp(value1.Row4, value2.Row4, amount)); + + /// Adds two matrices together. + /// The first source matrix. + /// The second source matrix. + /// The result of the addition. + public static Matrix4X2 Add(Matrix4X2 left, Matrix4X2 right) + where T : INumberBase => + left + right; + + /// Returns a negated copy of the specified matrix. + /// The source matrix. + /// The negated matrix. + public static Matrix4X2 Negate(Matrix4X2 value) + where T : INumberBase + => -value; + + /// Subtracts the second matrix from the first. + /// The first source matrix. + /// The second source matrix. + /// The result of the subtraction. + public static Matrix4X2 Subtract(Matrix4X2 left, Matrix4X2 right) + where T : INumberBase + => left - right; + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix4X2 Multiply(Matrix4X2 left, T right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix4X2 Multiply(T left, Matrix4X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector2D Multiply(Vector4D rowVector, Matrix4X2 matrix) + where T : INumberBase => + rowVector * matrix; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector4D Multiply(Matrix4X2 matrix, Vector2D columnVector) + where T : INumberBase => + matrix * columnVector; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X2 Multiply(Matrix2X4 left, Matrix4X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X2 Multiply(Matrix3X4 left, Matrix4X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X2 Multiply(Matrix4X2 left, Matrix2X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X3 Multiply(Matrix4X2 left, Matrix2X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X4 Multiply(Matrix4X2 left, Matrix2X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X2 Multiply(Matrix4X4 left, Matrix4X2 right) + where T : INumberBase => + left * right; } } diff --git a/sources/Maths/Maths/Matrix4X3.Ops.cs b/sources/Maths/Maths/Matrix4X3.Ops.cs deleted file mode 100644 index 807192cc85..0000000000 --- a/sources/Maths/Maths/Matrix4X3.Ops.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Numerics; -using System.Runtime.CompilerServices; - -namespace Silk.NET.Maths -{ - /// - /// Methods for working with - /// - public static partial class Matrix4X3 - { - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X3 Add(Matrix4X3 value1, Matrix4X3 value2) - where T : INumberBase - { - return value1 + value2; - } - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X3 Multiply(Matrix4X3 value1, Matrix3X3 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X4 Multiply(Matrix4X3 value1, Matrix3X4 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X3 Multiply(Matrix4X4 value1, Matrix4X3 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix3X3 Multiply(Matrix3X4 value1, Matrix4X3 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by a scalar value. - /// The source matrix. - /// The scaling factor. - /// The scaled matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X3 Multiply(Matrix4X3 value1, T value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector3D Multiply(Vector4D value1, Matrix4X3 value2) - where T : INumberBase - => value1 * value2; - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X3 Negate(Matrix4X3 value) - where T : INumberBase - => -value; - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X3 Subtract(Matrix4X3 value1, Matrix4X3 value2) - where T : INumberBase - => value1 - value2; - } -} diff --git a/sources/Maths/Maths/Matrix4X3.cs b/sources/Maths/Maths/Matrix4X3.cs index 607aa46115..bbda207d29 100644 --- a/sources/Maths/Maths/Matrix4X3.cs +++ b/sources/Maths/Maths/Matrix4X3.cs @@ -100,14 +100,5 @@ public Matrix4X3(Matrix4X4 value) /// Returns whether the matrix is the identity matrix. [IgnoreDataMember] public readonly bool IsIdentity => this == Identity; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - public static unsafe Vector3D operator *(Vector4D value1, Matrix4X3 value2) - { - return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3 + value1.W * value2.Row4; - } } } diff --git a/sources/Maths/Maths/Matrix4X3.gen.cs b/sources/Maths/Maths/Matrix4X3.gen.cs index bb4c1216ff..5dbf30c452 100644 --- a/sources/Maths/Maths/Matrix4X3.gen.cs +++ b/sources/Maths/Maths/Matrix4X3.gen.cs @@ -162,7 +162,6 @@ public override string ToString() => Row4.X, Row4.Y, Row4.Z); /// - [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix4X3 other && Equals(other); /// @@ -263,6 +262,20 @@ public Matrix3X4 Transpose() => left.Row3 * right, left.Row4 * right); + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector3D operator *(Vector4D rowVector, Matrix4X3 matrix) => + rowVector.X * matrix.Row1 + rowVector.Y * matrix.Row2 + rowVector.Z * matrix.Row3 + rowVector.W * matrix.Row4; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector4D operator *(Matrix4X3 matrix, Vector3D columnVector) => + matrix.Column1 * columnVector.X + matrix.Column2 * columnVector.Y + matrix.Column3 * columnVector.Z; + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -566,6 +579,9 @@ public static explicit operator checked Matrix4X3(Matrix4X3 from) => Vector3D.CreateChecked(from.Row4)); } + /// + /// Methods for working with + /// public static partial class Matrix4X3 { /// Linearly interpolates between the corresponding values of two matrices. @@ -579,5 +595,108 @@ public static Matrix4X3 Lerp(Matrix4X3 value1, Matrix4X3 value2, T a Vector3D.Lerp(value1.Row2, value2.Row2, amount), Vector3D.Lerp(value1.Row3, value2.Row3, amount), Vector3D.Lerp(value1.Row4, value2.Row4, amount)); + + /// Adds two matrices together. + /// The first source matrix. + /// The second source matrix. + /// The result of the addition. + public static Matrix4X3 Add(Matrix4X3 left, Matrix4X3 right) + where T : INumberBase => + left + right; + + /// Returns a negated copy of the specified matrix. + /// The source matrix. + /// The negated matrix. + public static Matrix4X3 Negate(Matrix4X3 value) + where T : INumberBase + => -value; + + /// Subtracts the second matrix from the first. + /// The first source matrix. + /// The second source matrix. + /// The result of the subtraction. + public static Matrix4X3 Subtract(Matrix4X3 left, Matrix4X3 right) + where T : INumberBase + => left - right; + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix4X3 Multiply(Matrix4X3 left, T right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix4X3 Multiply(T left, Matrix4X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector3D Multiply(Vector4D rowVector, Matrix4X3 matrix) + where T : INumberBase => + rowVector * matrix; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector4D Multiply(Matrix4X3 matrix, Vector3D columnVector) + where T : INumberBase => + matrix * columnVector; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X3 Multiply(Matrix2X4 left, Matrix4X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X3 Multiply(Matrix3X4 left, Matrix4X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X2 Multiply(Matrix4X3 left, Matrix3X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X3 Multiply(Matrix4X3 left, Matrix3X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X4 Multiply(Matrix4X3 left, Matrix3X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X3 Multiply(Matrix4X4 left, Matrix4X3 right) + where T : INumberBase => + left * right; } } diff --git a/sources/Maths/Maths/Matrix4X4.Ops.cs b/sources/Maths/Maths/Matrix4X4.Ops.cs index 83e8e3dc15..f8c605f21c 100644 --- a/sources/Maths/Maths/Matrix4X4.Ops.cs +++ b/sources/Maths/Maths/Matrix4X4.Ops.cs @@ -40,17 +40,6 @@ private struct VectorBasis } */ - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X4 Add(Matrix4X4 value1, Matrix4X4 value2) - where T : INumberBase - { - return value1 + value2; - } - /// Creates a spherical billboard that rotates around a specified object position. /// Position of the object the billboard will rotate around. /// Position of the camera. @@ -1192,68 +1181,6 @@ static bool SoftwareFallback(Matrix4X4 matrix, out Matrix4X4 result) } } - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X4 Multiply(Matrix4X4 value1, Matrix4X4 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Vector4D Multiply(Vector4D value1, Matrix4X4 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix2X4 Multiply(Matrix2X4 value1, Matrix4X4 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X2 Multiply(Matrix4X4 value1, Matrix4X2 value2) - where T : INumberBase - => value1 * value2; - - /// Multiplies a matrix by a scalar value. - /// The source matrix. - /// The scaling factor. - /// The scaled matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X4 Multiply(Matrix4X4 value1, T value2) - where T : INumberBase - => value1 * value2; - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X4 Negate(Matrix4X4 value) - where T : INumberBase - => -value; - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X4 Subtract(Matrix4X4 value1, Matrix4X4 value2) - where T : INumberBase - => value1 - value2; - /*[MethodImpl((MethodImplOptions)768)] private static Vector128 Permute(Vector128 value, byte control) { diff --git a/sources/Maths/Maths/Matrix4X4.cs b/sources/Maths/Maths/Matrix4X4.cs index b9e06be306..2cd9f69e41 100644 --- a/sources/Maths/Maths/Matrix4X4.cs +++ b/sources/Maths/Maths/Matrix4X4.cs @@ -74,16 +74,6 @@ public Matrix4X4(Matrix4X2 value) Row4 = new(value.M41, value.M42, T.Zero, T.One); } - /// Multiplies a vector by a matrix. - /// The vector. - /// The matrix. - /// The result of the multiplication. - public static unsafe Vector4D operator *(Vector4D value1, Matrix4X4 value2) - { - return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3 + - value1.W * value2.Row4; - } - /// Calculates the determinant of the matrix. /// The determinant of the matrix. public readonly T GetDeterminant() diff --git a/sources/Maths/Maths/Matrix4X4.gen.cs b/sources/Maths/Maths/Matrix4X4.gen.cs index 5346ae1daf..b2ffa73373 100644 --- a/sources/Maths/Maths/Matrix4X4.gen.cs +++ b/sources/Maths/Maths/Matrix4X4.gen.cs @@ -197,7 +197,6 @@ public override string ToString() => Row4.X, Row4.Y, Row4.Z, Row4.W); /// - [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix4X4 other && Equals(other); /// @@ -299,6 +298,20 @@ public Matrix4X4 Transpose() => left.Row3 * right, left.Row4 * right); + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector4D operator *(Vector4D rowVector, Matrix4X4 matrix) => + rowVector.X * matrix.Row1 + rowVector.Y * matrix.Row2 + rowVector.Z * matrix.Row3 + rowVector.W * matrix.Row4; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector4D operator *(Matrix4X4 matrix, Vector4D columnVector) => + matrix.Column1 * columnVector.X + matrix.Column2 * columnVector.Y + matrix.Column3 * columnVector.Z + matrix.Column4 * columnVector.W; + /// Multiplies a matrix by another matrix. /// The first source matrix. /// The second source matrix. @@ -611,6 +624,9 @@ public static explicit operator checked Matrix4X4(Matrix4X4 from) => Vector4D.CreateChecked(from.Row4)); } + /// + /// Methods for working with + /// public static partial class Matrix4X4 { /// Linearly interpolates between the corresponding values of two matrices. @@ -624,5 +640,108 @@ public static Matrix4X4 Lerp(Matrix4X4 value1, Matrix4X4 value2, T a Vector4D.Lerp(value1.Row2, value2.Row2, amount), Vector4D.Lerp(value1.Row3, value2.Row3, amount), Vector4D.Lerp(value1.Row4, value2.Row4, amount)); + + /// Adds two matrices together. + /// The first source matrix. + /// The second source matrix. + /// The result of the addition. + public static Matrix4X4 Add(Matrix4X4 left, Matrix4X4 right) + where T : INumberBase => + left + right; + + /// Returns a negated copy of the specified matrix. + /// The source matrix. + /// The negated matrix. + public static Matrix4X4 Negate(Matrix4X4 value) + where T : INumberBase + => -value; + + /// Subtracts the second matrix from the first. + /// The first source matrix. + /// The second source matrix. + /// The result of the subtraction. + public static Matrix4X4 Subtract(Matrix4X4 left, Matrix4X4 right) + where T : INumberBase + => left - right; + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix4X4 Multiply(Matrix4X4 left, T right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix4X4 Multiply(T left, Matrix4X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix, expressed as a row vector. + /// The second source matrix. + /// The result of the multiplication as a column vector. + public static Vector4D Multiply(Vector4D rowVector, Matrix4X4 matrix) + where T : INumberBase => + rowVector * matrix; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix, expressed as a column vector. + /// The result of the multiplication as a row vector. + public static Vector4D Multiply(Matrix4X4 matrix, Vector4D columnVector) + where T : INumberBase => + matrix * columnVector; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix2X4 Multiply(Matrix2X4 left, Matrix4X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix3X4 Multiply(Matrix3X4 left, Matrix4X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X2 Multiply(Matrix4X4 left, Matrix4X2 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X3 Multiply(Matrix4X4 left, Matrix4X3 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix4X4 Multiply(Matrix4X4 left, Matrix4X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix5X4 Multiply(Matrix5X4 left, Matrix4X4 right) + where T : INumberBase => + left * right; } } diff --git a/sources/Maths/Maths/Matrix5X4.Ops.cs b/sources/Maths/Maths/Matrix5X4.Ops.cs index 032181692f..65c6170be8 100644 --- a/sources/Maths/Maths/Matrix5X4.Ops.cs +++ b/sources/Maths/Maths/Matrix5X4.Ops.cs @@ -12,17 +12,6 @@ namespace Silk.NET.Maths /// public static partial class Matrix5X4 { - /// Adds two matrices together. - /// The first source matrix. - /// The second source matrix. - /// The resulting matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix5X4 Add(Matrix5X4 value1, Matrix5X4 value2) - where T : INumberBase - { - return value1 + value2; - } - /// Multiplies a vector by a matrix. /// The vector. /// The matrix. @@ -31,31 +20,5 @@ public static Matrix5X4 Add(Matrix5X4 value1, Matrix5X4 value2) public static Vector4D Multiply(Vector4D value1, Matrix5X4 value2) where T : INumberBase => value1 * value2; - - /// Multiplies a matrix by a scalar value. - /// The source matrix. - /// The scaling factor. - /// The scaled matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix5X4 Multiply(Matrix5X4 value1, T value2) - where T : INumberBase - => value1 * value2; - - /// Returns a new matrix with the negated elements of the given matrix. - /// The source matrix. - /// The negated matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix5X4 Negate(Matrix5X4 value) - where T : INumberBase - => -value; - - /// Subtracts the second matrix from the first. - /// The first source matrix. - /// The second source matrix. - /// The result of the subtraction. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix5X4 Subtract(Matrix5X4 value1, Matrix5X4 value2) - where T : INumberBase - => value1 - value2; } } diff --git a/sources/Maths/Maths/Matrix5X4.gen.cs b/sources/Maths/Maths/Matrix5X4.gen.cs index a294471477..af2e8a312e 100644 --- a/sources/Maths/Maths/Matrix5X4.gen.cs +++ b/sources/Maths/Maths/Matrix5X4.gen.cs @@ -199,7 +199,6 @@ public override string ToString() => Row5.X, Row5.Y, Row5.Z, Row5.W); /// - [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] public override bool Equals(object? obj) => obj is Matrix5X4 other && Equals(other); /// @@ -600,6 +599,9 @@ public static explicit operator checked Matrix5X4(Matrix5X4 from) => Vector4D.CreateChecked(from.Row5)); } + /// + /// Methods for working with + /// public static partial class Matrix5X4 { /// Linearly interpolates between the corresponding values of two matrices. @@ -614,5 +616,52 @@ public static Matrix5X4 Lerp(Matrix5X4 value1, Matrix5X4 value2, T a Vector4D.Lerp(value1.Row3, value2.Row3, amount), Vector4D.Lerp(value1.Row4, value2.Row4, amount), Vector4D.Lerp(value1.Row5, value2.Row5, amount)); + + /// Adds two matrices together. + /// The first source matrix. + /// The second source matrix. + /// The result of the addition. + public static Matrix5X4 Add(Matrix5X4 left, Matrix5X4 right) + where T : INumberBase => + left + right; + + /// Returns a negated copy of the specified matrix. + /// The source matrix. + /// The negated matrix. + public static Matrix5X4 Negate(Matrix5X4 value) + where T : INumberBase + => -value; + + /// Subtracts the second matrix from the first. + /// The first source matrix. + /// The second source matrix. + /// The result of the subtraction. + public static Matrix5X4 Subtract(Matrix5X4 left, Matrix5X4 right) + where T : INumberBase + => left - right; + + /// Multiplies a matrix by a scalar value. + /// The source matrix. + /// The scaling factor. + /// The scaled matrix. + public static Matrix5X4 Multiply(Matrix5X4 left, T right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by a scalar value. + /// The scaling factor. + /// The source matrix. + /// The scaled matrix. + public static Matrix5X4 Multiply(T left, Matrix5X4 right) + where T : INumberBase => + left * right; + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + public static Matrix5X4 Multiply(Matrix5X4 left, Matrix4X4 right) + where T : INumberBase => + left * right; } } diff --git a/sources/Maths/Maths/Vector2D.gen.cs b/sources/Maths/Maths/Vector2D.gen.cs index 09e6b203bc..3d7286547d 100644 --- a/sources/Maths/Maths/Vector2D.gen.cs +++ b/sources/Maths/Maths/Vector2D.gen.cs @@ -648,6 +648,22 @@ public static (Vector2D Quotient, Vector2D Remainder) DivRem(Vector2D(qX, qY), new Vector2D(rX, rY)); } + /// Multiplies a vector by a scalar value. + /// The source vector. + /// The scaling factor. + /// The scaled vector. + public static Vector2D Multiply(Vector2D left, T right) + where T : INumberBase => + left * right; + + /// Multiplies a vector by a scalar value. + /// The scaling factor. + /// The source vector. + /// The scaled vector. + public static Vector2D Multiply(T left, Vector2D right) + where T : INumberBase => + left * right; + /// Applies to the provided arguments. /// A vector whose members will be provided for . public static Vector2D Sign(this Vector2D value) diff --git a/sources/Maths/Maths/Vector3D.gen.cs b/sources/Maths/Maths/Vector3D.gen.cs index cb34c6f13f..b6572cd47f 100644 --- a/sources/Maths/Maths/Vector3D.gen.cs +++ b/sources/Maths/Maths/Vector3D.gen.cs @@ -689,6 +689,22 @@ public static (Vector3D Quotient, Vector3D Remainder) DivRem(Vector3D(qX, qY, qZ), new Vector3D(rX, rY, rZ)); } + /// Multiplies a vector by a scalar value. + /// The source vector. + /// The scaling factor. + /// The scaled vector. + public static Vector3D Multiply(Vector3D left, T right) + where T : INumberBase => + left * right; + + /// Multiplies a vector by a scalar value. + /// The scaling factor. + /// The source vector. + /// The scaled vector. + public static Vector3D Multiply(T left, Vector3D right) + where T : INumberBase => + left * right; + /// Applies to the provided arguments. /// A vector whose members will be provided for . public static Vector3D Sign(this Vector3D value) diff --git a/sources/Maths/Maths/Vector4D.gen.cs b/sources/Maths/Maths/Vector4D.gen.cs index bfdfbecb07..ed84851eb8 100644 --- a/sources/Maths/Maths/Vector4D.gen.cs +++ b/sources/Maths/Maths/Vector4D.gen.cs @@ -730,6 +730,22 @@ public static (Vector4D Quotient, Vector4D Remainder) DivRem(Vector4D(qX, qY, qZ, qW), new Vector4D(rX, rY, rZ, rW)); } + /// Multiplies a vector by a scalar value. + /// The source vector. + /// The scaling factor. + /// The scaled vector. + public static Vector4D Multiply(Vector4D left, T right) + where T : INumberBase => + left * right; + + /// Multiplies a vector by a scalar value. + /// The scaling factor. + /// The source vector. + /// The scaled vector. + public static Vector4D Multiply(T left, Vector4D right) + where T : INumberBase => + left * right; + /// Applies to the provided arguments. /// A vector whose members will be provided for . public static Vector4D Sign(this Vector4D value) From 9497be81c0f6d4d91a0655a29cc4b4d3a128ddb8 Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Wed, 2 Jul 2025 19:56:09 -0700 Subject: [PATCH 16/19] Recovered Old Quaternion implementation. --- sources/Maths/Maths/Matrix2X3.Ops.cs | 12 +- sources/Maths/Maths/Matrix3X3.Ops.cs | 12 +- sources/Maths/Maths/Matrix4X4.Ops.cs | 12 +- sources/Maths/Maths/Plane.Ops.cs | 4 +- .../Quaternion.cs => Quaternion.Old.cs} | 261 ++++-------------- sources/Maths/Maths/Quaternion.cs | 36 ++- 6 files changed, 99 insertions(+), 238 deletions(-) rename sources/Maths/Maths/{Legacy/Quaternion.cs => Quaternion.Old.cs} (69%) diff --git a/sources/Maths/Maths/Matrix2X3.Ops.cs b/sources/Maths/Maths/Matrix2X3.Ops.cs index d9cd1234fc..fdd180d1ce 100644 --- a/sources/Maths/Maths/Matrix2X3.Ops.cs +++ b/sources/Maths/Maths/Matrix2X3.Ops.cs @@ -94,8 +94,8 @@ public static Matrix2X3 CreateFromAxisAngle(Vector3D axis, T angle) /// Creates a rotation matrix from the given Quaternion rotation value. /// The source Quaternion. /// The rotation matrix. - public static Matrix2X3 CreateFromQuaternion(Silk.NET.Maths.Legacy.Quaternion quaternion) - where T : INumberBase + public static Matrix2X3 CreateFromQuaternion(Quaternion quaternion) + where T : ITrigonometricFunctions { Matrix2X3 result = Matrix2X3.Identity; @@ -128,9 +128,9 @@ public static Matrix2X3 CreateFromQuaternion(Silk.NET.Maths.Legacy.Quatern /// Angle of rotation, in radians, around the Z-axis. /// The rotation matrix. public static Matrix2X3 CreateFromYawPitchRoll(T yaw, T pitch, T roll) - where T : INumberBase + where T : ITrigonometricFunctions { - Legacy.Quaternion q = Legacy.Quaternion.CreateFromYawPitchRoll(yaw, pitch, roll); + var q = Quaternion.CreateFromYawPitchRoll(yaw, pitch, roll); return CreateFromQuaternion(q); } @@ -138,8 +138,8 @@ public static Matrix2X3 CreateFromYawPitchRoll(T yaw, T pitch, T roll) /// The source matrix to transform. /// The rotation to apply. /// The transformed matrix. - public static Matrix2X3 Transform(Matrix2X3 value, Legacy.Quaternion rotation) - where T : INumberBase + public static Matrix2X3 Transform(Matrix2X3 value, Quaternion rotation) + where T : ITrigonometricFunctions { // Compute rotation matrix. T x2 = Scalar.Add(rotation.X, rotation.X); diff --git a/sources/Maths/Maths/Matrix3X3.Ops.cs b/sources/Maths/Maths/Matrix3X3.Ops.cs index c90d00d352..2cdcb433e6 100644 --- a/sources/Maths/Maths/Matrix3X3.Ops.cs +++ b/sources/Maths/Maths/Matrix3X3.Ops.cs @@ -119,8 +119,8 @@ public static Matrix3X3 CreateFromAxisAngle(Vector3D axis, T angle) /// Creates a rotation matrix from the given Quaternion rotation value. /// The source Quaternion. /// The rotation matrix. - public static Matrix3X3 CreateFromQuaternion(Silk.NET.Maths.Legacy.Quaternion quaternion) - where T : INumberBase + public static Matrix3X3 CreateFromQuaternion(Quaternion quaternion) + where T : ITrigonometricFunctions { Matrix3X3 result = Matrix3X3.Identity; @@ -157,9 +157,9 @@ public static Matrix3X3 CreateFromQuaternion(Silk.NET.Maths.Legacy.Quatern /// Angle of rotation, in radians, around the Z-axis. /// The rotation matrix. public static Matrix3X3 CreateFromYawPitchRoll(T yaw, T pitch, T roll) - where T : INumberBase + where T : ITrigonometricFunctions { - Legacy.Quaternion q = Legacy.Quaternion.CreateFromYawPitchRoll(yaw, pitch, roll); + var q = Quaternion.CreateFromYawPitchRoll(yaw, pitch, roll); return CreateFromQuaternion(q); } @@ -475,8 +475,8 @@ public static bool Decompose(Matrix3X3 matrix, out Vector3D scale, out /// The source matrix to transform. /// The rotation to apply. /// The transformed matrix. - public static Matrix3X3 Transform(Matrix3X3 value, Legacy.Quaternion rotation) - where T : INumberBase + public static Matrix3X3 Transform(Matrix3X3 value, Quaternion rotation) + where T : ITrigonometricFunctions { // Compute rotation matrix. T x2 = Scalar.Add(rotation.X, rotation.X); diff --git a/sources/Maths/Maths/Matrix4X4.Ops.cs b/sources/Maths/Maths/Matrix4X4.Ops.cs index f8c605f21c..fffd21652b 100644 --- a/sources/Maths/Maths/Matrix4X4.Ops.cs +++ b/sources/Maths/Maths/Matrix4X4.Ops.cs @@ -189,8 +189,8 @@ public static Matrix4X4 CreateFromAxisAngle(Vector3D axis, T angle) /// Creates a rotation matrix from the given Quaternion rotation value. /// The source Quaternion. /// The rotation matrix. - public static Matrix4X4 CreateFromQuaternion(Silk.NET.Maths.Legacy.Quaternion quaternion) - where T : INumberBase + public static Matrix4X4 CreateFromQuaternion(Quaternion quaternion) + where T : ITrigonometricFunctions { Matrix4X4 result = Matrix4X4.Identity; @@ -227,9 +227,9 @@ public static Matrix4X4 CreateFromQuaternion(Silk.NET.Maths.Legacy.Quatern /// Angle of rotation, in radians, around the Z-axis. /// The rotation matrix. public static Matrix4X4 CreateFromYawPitchRoll(T yaw, T pitch, T roll) - where T : INumberBase + where T : ITrigonometricFunctions { - Legacy.Quaternion q = Legacy.Quaternion.CreateFromYawPitchRoll(yaw, pitch, roll); + var q = Quaternion.CreateFromYawPitchRoll(yaw, pitch, roll); return CreateFromQuaternion(q); } @@ -1404,8 +1404,8 @@ public static bool Decompose(Matrix4X4 matrix, out Vector3D scale, out /// The source matrix to transform. /// The rotation to apply. /// The transformed matrix. - public static Matrix4X4 Transform(Matrix4X4 value, Legacy.Quaternion rotation) - where T : INumberBase + public static Matrix4X4 Transform(Matrix4X4 value, Quaternion rotation) + where T : ITrigonometricFunctions { // Compute rotation matrix. T x2 = Scalar.Add(rotation.X, rotation.X); diff --git a/sources/Maths/Maths/Plane.Ops.cs b/sources/Maths/Maths/Plane.Ops.cs index fff64125ca..279f4200bf 100644 --- a/sources/Maths/Maths/Plane.Ops.cs +++ b/sources/Maths/Maths/Plane.Ops.cs @@ -182,8 +182,8 @@ public static Plane Transform(Plane plane, Matrix4X4 matrix) /// The Quaternion rotation to apply to the Plane. /// A new Plane that results from applying the rotation. [MethodImpl((MethodImplOptions) 768)] - public static Plane Transform(Plane plane, Legacy.Quaternion rotation) - where T : INumberBase + public static Plane Transform(Plane plane, Quaternion rotation) + where T : ITrigonometricFunctions { // Compute rotation matrix. T x2 = Scalar.Add(rotation.X, rotation.X); diff --git a/sources/Maths/Maths/Legacy/Quaternion.cs b/sources/Maths/Maths/Quaternion.Old.cs similarity index 69% rename from sources/Maths/Maths/Legacy/Quaternion.cs rename to sources/Maths/Maths/Quaternion.Old.cs index 2694588fca..9a4c29648b 100644 --- a/sources/Maths/Maths/Legacy/Quaternion.cs +++ b/sources/Maths/Maths/Quaternion.Old.cs @@ -8,7 +8,7 @@ using System.Runtime.Serialization; using Silk.NET.Maths; -namespace Silk.NET.Maths.Legacy +namespace Silk.NET.Maths { /// /// Represents a vector that is used to encode three-dimensional physical rotations. @@ -16,41 +16,10 @@ namespace Silk.NET.Maths.Legacy /// The type used to store values. [Serializable] [DataContract] - public struct Quaternion - : IEquatable> - where T : INumberBase + public partial struct Quaternion { private const float SlerpEpsilon = 1e-6f; - /// Specifies the X-value of the vector component of the Quaternion. - [DataMember] - public T X; - - /// Specifies the Y-value of the vector component of the Quaternion. - [DataMember] - public T Y; - - /// Specifies the Z-value of the vector component of the Quaternion. - [DataMember] - public T Z; - - /// Specifies the rotation component of the Quaternion. - [DataMember] - public T W; - - /// Constructs a Quaternion from the given components. - /// The X component of the Quaternion. - /// The Y component of the Quaternion. - /// The Z component of the Quaternion. - /// The W component of the Quaternion. - public Quaternion(T x, T y, T z, T w) - { - X = x; - Y = y; - Z = z; - W = w; - } - /// Constructs a Quaternion from the given vector and rotation parts. /// The vector part of the Quaternion. /// The rotation part of the Quaternion. @@ -62,9 +31,6 @@ public Quaternion(Vector3D vectorPart, T scalarPart) W = scalarPart; } - /// Returns a Quaternion representing no rotation. - public static Quaternion Identity => new(Scalar.Zero, Scalar.Zero, Scalar.Zero, Scalar.One); - /// Returns whether the Quaternion is the identity Quaternion. [IgnoreDataMember] public readonly bool IsIdentity => this == Identity; @@ -104,22 +70,22 @@ public Quaternion(Vector3D vectorPart, T scalarPart) Scalar.Add( Scalar.Add(Scalar.Multiply(value2.X, value2.X), Scalar.Multiply(value2.Y, value2.Y)), Scalar.Multiply(value2.Z, value2.Z)), Scalar.Multiply(value2.W, value2.W)); - T invNorm = Scalar.Reciprocal(ls); + var invNorm = Scalar.Reciprocal(ls); - T q2x = Scalar.Negate(Scalar.Multiply(value2.X, invNorm)); - T q2y = Scalar.Negate(Scalar.Multiply(value2.Y, invNorm)); - T q2z = Scalar.Negate(Scalar.Multiply(value2.Z, invNorm)); - T q2w = Scalar.Multiply(value2.W, invNorm); + var q2x = Scalar.Negate(Scalar.Multiply(value2.X, invNorm)); + var q2y = Scalar.Negate(Scalar.Multiply(value2.Y, invNorm)); + var q2z = Scalar.Negate(Scalar.Multiply(value2.Z, invNorm)); + var q2w = Scalar.Multiply(value2.W, invNorm); //------------------------------------- // Multiply part. // cross(av, bv) - T cx = Scalar.Subtract(Scalar.Multiply(q1y, q2z), Scalar.Multiply(q1z, q2y)); - T cy = Scalar.Subtract(Scalar.Multiply(q1z, q2x), Scalar.Multiply(q1x, q2z)); - T cz = Scalar.Subtract(Scalar.Multiply(q1x, q2y), Scalar.Multiply(q1y, q2x)); + var cx = Scalar.Subtract(Scalar.Multiply(q1y, q2z), Scalar.Multiply(q1z, q2y)); + var cy = Scalar.Subtract(Scalar.Multiply(q1z, q2x), Scalar.Multiply(q1x, q2z)); + var cz = Scalar.Subtract(Scalar.Multiply(q1x, q2y), Scalar.Multiply(q1y, q2x)); - T dot = Scalar.Add(Scalar.Add(Scalar.Multiply(q1x, q2x), Scalar.Multiply(q1y, q2y)), + var dot = Scalar.Add(Scalar.Add(Scalar.Multiply(q1x, q2x), Scalar.Multiply(q1y, q2y)), Scalar.Multiply(q1z, q2z)); ans.X = Scalar.Add(Scalar.Add(Scalar.Multiply(q1x, q2w), Scalar.Multiply(q2x, q1w)), cx); @@ -130,23 +96,6 @@ public Quaternion(Vector3D vectorPart, T scalarPart) return ans; } - /// Returns a boolean indicating whether the two given Quaternions are equal. - /// The first Quaternion to compare. - /// The second Quaternion to compare. - /// True if the Quaternions are equal; False otherwise. - public static bool operator ==(Quaternion value1, Quaternion value2) - => Scalar.Equal(value1.X, value2.X) - && Scalar.Equal(value1.Y, value2.Y) - && Scalar.Equal(value1.Z, value2.Z) - && Scalar.Equal(value1.W, value2.W); - - /// Returns a boolean indicating whether the two given Quaternions are not equal. - /// The first Quaternion to compare. - /// The second Quaternion to compare. - /// True if the Quaternions are not equal; False if they are equal. - public static bool operator !=(Quaternion value1, Quaternion value2) - => !(value1 == value2); - /// Multiplies two Quaternions together. /// The Quaternion on the left side of the multiplication. /// The Quaternion on the right side of the multiplication. @@ -166,11 +115,11 @@ public Quaternion(Vector3D vectorPart, T scalarPart) T q2w = value2.W; // cross(av, bv) - T cx = Scalar.Subtract(Scalar.Multiply(q1y, q2z), Scalar.Multiply(q1z, q2y)); - T cy = Scalar.Subtract(Scalar.Multiply(q1z, q2x), Scalar.Multiply(q1x, q2z)); - T cz = Scalar.Subtract(Scalar.Multiply(q1x, q2y), Scalar.Multiply(q1y, q2x)); + var cx = Scalar.Subtract(Scalar.Multiply(q1y, q2z), Scalar.Multiply(q1z, q2y)); + var cy = Scalar.Subtract(Scalar.Multiply(q1z, q2x), Scalar.Multiply(q1x, q2z)); + var cz = Scalar.Subtract(Scalar.Multiply(q1x, q2y), Scalar.Multiply(q1y, q2x)); - T dot = Scalar.Add(Scalar.Add(Scalar.Multiply(q1x, q2x), Scalar.Multiply(q1y, q2y)), + var dot = Scalar.Add(Scalar.Add(Scalar.Multiply(q1x, q2x), Scalar.Multiply(q1y, q2y)), Scalar.Multiply(q1z, q2z)); ans.X = Scalar.Add(Scalar.Add(Scalar.Multiply(q1x, q2w), Scalar.Multiply(q2x, q1w)), cx); @@ -257,11 +206,11 @@ public static Quaternion Concatenate(Quaternion value1, Quaternion valu T q2w = value1.W; // cross(av, bv) - T cx = Scalar.Subtract(Scalar.Multiply(q1y, q2z), Scalar.Multiply(q1z, q2y)); - T cy = Scalar.Subtract(Scalar.Multiply(q1z, q2x), Scalar.Multiply(q1x, q2z)); - T cz = Scalar.Subtract(Scalar.Multiply(q1x, q2y), Scalar.Multiply(q1y, q2x)); + var cx = Scalar.Subtract(Scalar.Multiply(q1y, q2z), Scalar.Multiply(q1z, q2y)); + var cy = Scalar.Subtract(Scalar.Multiply(q1z, q2x), Scalar.Multiply(q1x, q2z)); + var cz = Scalar.Subtract(Scalar.Multiply(q1x, q2y), Scalar.Multiply(q1y, q2x)); - T dot = Scalar.Add(Scalar.Add(Scalar.Multiply(q1x, q2x), Scalar.Multiply(q1y, q2y)), + var dot = Scalar.Add(Scalar.Add(Scalar.Multiply(q1x, q2x), Scalar.Multiply(q1y, q2y)), Scalar.Multiply(q1z, q2z)); ans.X = Scalar.Add(Scalar.Add(Scalar.Multiply(q1x, q2w), Scalar.Multiply(q2x, q1w)), cx); @@ -296,9 +245,9 @@ public static Quaternion CreateFromAxisAngle(Vector3D axis, T angle) { Quaternion ans; - T halfAngle = Scalar.Divide(angle, Scalar.Two); - T s = Scalar.Sin(halfAngle); - T c = Scalar.Cos(halfAngle); + var halfAngle = Scalar.Divide(angle, Scalar.Two); + var s = Scalar.Sin(halfAngle); + var c = Scalar.Cos(halfAngle); ans.X = Scalar.Multiply(axis.X, s); ans.Y = Scalar.Multiply(axis.Y, s); @@ -313,13 +262,13 @@ public static Quaternion CreateFromAxisAngle(Vector3D axis, T angle) /// The created Quaternion. public static Quaternion CreateFromRotationMatrix(Matrix4X4 matrix) { - T trace = Scalar.Add(Scalar.Add(matrix.M11, matrix.M22), matrix.M33); + var trace = Scalar.Add(Scalar.Add(matrix.M11, matrix.M22), matrix.M33); Quaternion q = default; if (Scalar.GreaterThan(trace, Scalar.Zero)) { - T s = Scalar.Sqrt(Scalar.Add(trace, Scalar.One)); + var s = Scalar.Sqrt(Scalar.Add(trace, Scalar.One)); q.W = Scalar.Divide(s, Scalar.Two); s = Scalar.Reciprocal(Scalar.Multiply(Scalar.Two, s)); q.X = Scalar.Multiply(Scalar.Subtract(matrix.M23, matrix.M32), s); @@ -330,8 +279,8 @@ public static Quaternion CreateFromRotationMatrix(Matrix4X4 matrix) { if (Scalar.GreaterThanOrEqual(matrix.M11, matrix.M22) && Scalar.GreaterThanOrEqual(matrix.M11, matrix.M33)) { - T s = Scalar.Sqrt(Scalar.Subtract(Scalar.Subtract(Scalar.Add(Scalar.One, matrix.M11), matrix.M22), matrix.M33)); - T invS = Scalar.Reciprocal(Scalar.Multiply(Scalar.Two, s)); + var s = Scalar.Sqrt(Scalar.Subtract(Scalar.Subtract(Scalar.Add(Scalar.One, matrix.M11), matrix.M22), matrix.M33)); + var invS = Scalar.Reciprocal(Scalar.Multiply(Scalar.Two, s)); q.X = Scalar.Divide(s, Scalar.Two); q.Y = Scalar.Multiply(Scalar.Add(matrix.M12, matrix.M21), invS); q.Z = Scalar.Multiply(Scalar.Add(matrix.M13, matrix.M31), invS); @@ -339,8 +288,8 @@ public static Quaternion CreateFromRotationMatrix(Matrix4X4 matrix) } else if (Scalar.GreaterThan(matrix.M22, matrix.M33)) { - T s = Scalar.Sqrt(Scalar.Subtract(Scalar.Subtract(Scalar.Add(Scalar.One, matrix.M22), matrix.M11), matrix.M33)); - T invS = Scalar.Reciprocal(Scalar.Multiply(Scalar.Two, s)); + var s = Scalar.Sqrt(Scalar.Subtract(Scalar.Subtract(Scalar.Add(Scalar.One, matrix.M22), matrix.M11), matrix.M33)); + var invS = Scalar.Reciprocal(Scalar.Multiply(Scalar.Two, s)); q.X = Scalar.Multiply(Scalar.Add(matrix.M21, matrix.M12), invS); q.Y = Scalar.Divide(s, Scalar.Two); q.Z = Scalar.Multiply(Scalar.Add(matrix.M32, matrix.M23), invS); @@ -348,8 +297,8 @@ public static Quaternion CreateFromRotationMatrix(Matrix4X4 matrix) } else { - T s = Scalar.Sqrt(Scalar.Subtract(Scalar.Subtract(Scalar.Add(Scalar.One, matrix.M33), matrix.M11), matrix.M22)); - T invS = Scalar.Reciprocal(Scalar.Multiply(Scalar.Two, s)); + var s = Scalar.Sqrt(Scalar.Subtract(Scalar.Subtract(Scalar.Add(Scalar.One, matrix.M33), matrix.M11), matrix.M22)); + var invS = Scalar.Reciprocal(Scalar.Multiply(Scalar.Two, s)); q.X = Scalar.Multiply(Scalar.Add(matrix.M31, matrix.M13), invS); q.Y = Scalar.Multiply(Scalar.Add(matrix.M32, matrix.M23), invS); q.Z = Scalar.Divide(s, Scalar.Two); @@ -365,13 +314,13 @@ public static Quaternion CreateFromRotationMatrix(Matrix4X4 matrix) /// The created Quaternion. public static Quaternion CreateFromRotationMatrix(Matrix3X3 matrix) { - T trace = Scalar.Add(Scalar.Add(matrix.M11, matrix.M22), matrix.M33); + var trace = Scalar.Add(Scalar.Add(matrix.M11, matrix.M22), matrix.M33); Quaternion q = default; if (Scalar.GreaterThan(trace, Scalar.Zero)) { - T s = Scalar.Sqrt(Scalar.Add(trace, Scalar.One)); + var s = Scalar.Sqrt(Scalar.Add(trace, Scalar.One)); q.W = Scalar.Divide(s, Scalar.Two); s = Scalar.Reciprocal(Scalar.Multiply(Scalar.Two, s)); q.X = Scalar.Multiply(Scalar.Subtract(matrix.M23, matrix.M32), s); @@ -382,8 +331,8 @@ public static Quaternion CreateFromRotationMatrix(Matrix3X3 matrix) { if (Scalar.GreaterThanOrEqual(matrix.M11, matrix.M22) && Scalar.GreaterThanOrEqual(matrix.M11, matrix.M33)) { - T s = Scalar.Sqrt(Scalar.Subtract(Scalar.Subtract(Scalar.Add(Scalar.One, matrix.M11), matrix.M22), matrix.M33)); - T invS = Scalar.Reciprocal(Scalar.Multiply(Scalar.Two, s)); + var s = Scalar.Sqrt(Scalar.Subtract(Scalar.Subtract(Scalar.Add(Scalar.One, matrix.M11), matrix.M22), matrix.M33)); + var invS = Scalar.Reciprocal(Scalar.Multiply(Scalar.Two, s)); q.X = Scalar.Divide(s, Scalar.Two); q.Y = Scalar.Multiply(Scalar.Add(matrix.M12, matrix.M21), invS); q.Z = Scalar.Multiply(Scalar.Add(matrix.M13, matrix.M31), invS); @@ -391,8 +340,8 @@ public static Quaternion CreateFromRotationMatrix(Matrix3X3 matrix) } else if (Scalar.GreaterThan(matrix.M22, matrix.M33)) { - T s = Scalar.Sqrt(Scalar.Subtract(Scalar.Subtract(Scalar.Add(Scalar.One, matrix.M22), matrix.M11), matrix.M33)); - T invS = Scalar.Reciprocal(Scalar.Multiply(Scalar.Two, s)); + var s = Scalar.Sqrt(Scalar.Subtract(Scalar.Subtract(Scalar.Add(Scalar.One, matrix.M22), matrix.M11), matrix.M33)); + var invS = Scalar.Reciprocal(Scalar.Multiply(Scalar.Two, s)); q.X = Scalar.Multiply(Scalar.Add(matrix.M21, matrix.M12), invS); q.Y = Scalar.Divide(s, Scalar.Two); q.Z = Scalar.Multiply(Scalar.Add(matrix.M32, matrix.M23), invS); @@ -400,8 +349,8 @@ public static Quaternion CreateFromRotationMatrix(Matrix3X3 matrix) } else { - T s = Scalar.Sqrt(Scalar.Subtract(Scalar.Subtract(Scalar.Add(Scalar.One, matrix.M33), matrix.M11), matrix.M22)); - T invS = Scalar.Reciprocal(Scalar.Multiply(Scalar.Two, s)); + var s = Scalar.Sqrt(Scalar.Subtract(Scalar.Subtract(Scalar.Add(Scalar.One, matrix.M33), matrix.M11), matrix.M22)); + var invS = Scalar.Reciprocal(Scalar.Multiply(Scalar.Two, s)); q.X = Scalar.Multiply(Scalar.Add(matrix.M31, matrix.M13), invS); q.Y = Scalar.Multiply(Scalar.Add(matrix.M32, matrix.M23), invS); q.Z = Scalar.Divide(s, Scalar.Two); @@ -423,15 +372,15 @@ public static Quaternion CreateFromYawPitchRoll(T yaw, T pitch, T roll) // pitch upward, then yaw to face into the new heading T sr, cr, sp, cp, sy, cy; - T halfRoll = Scalar.Divide(roll, Scalar.Two); + var halfRoll = Scalar.Divide(roll, Scalar.Two); sr = Scalar.Sin(halfRoll); cr = Scalar.Cos(halfRoll); - T halfPitch = Scalar.Divide(pitch, Scalar.Two); + var halfPitch = Scalar.Divide(pitch, Scalar.Two); sp = Scalar.Sin(halfPitch); cp = Scalar.Cos(halfPitch); - T halfYaw = Scalar.Divide(yaw, Scalar.Two); + var halfYaw = Scalar.Divide(yaw, Scalar.Two); sy = Scalar.Sin(halfYaw); cy = Scalar.Cos(halfYaw); @@ -477,7 +426,7 @@ public static Quaternion Inverse(Quaternion value) Quaternion ans; T ls = Scalar.Add(Scalar.Add(Scalar.Add(Scalar.Multiply(value.X, value.X), Scalar.Multiply(value.Y, value.Y)), Scalar.Multiply(value.Z, value.Z)), Scalar.Multiply(value.W, value.W)); - T invNorm = Scalar.Reciprocal(ls); + var invNorm = Scalar.Reciprocal(ls); ans.X = Scalar.Negate(Scalar.Multiply(value.X, invNorm)); ans.Y = Scalar.Negate(Scalar.Multiply(value.Y, invNorm)); @@ -494,8 +443,8 @@ public static Quaternion Inverse(Quaternion value) /// The interpolated Quaternion. public static Quaternion Lerp(Quaternion quaternion1, Quaternion quaternion2, T amount) { - T t = amount; - T t1 = Scalar.Subtract(Scalar.One, t); + var t = amount; + var t1 = Scalar.Subtract(Scalar.One, t); Quaternion r = default; @@ -523,7 +472,7 @@ public static Quaternion Lerp(Quaternion quaternion1, Quaternion quater // Normalize it. T ls = Scalar.Add(Scalar.Add(Scalar.Add(Scalar.Multiply(r.X, r.X), Scalar.Multiply(r.Y, r.Y)), Scalar.Multiply(r.Z, r.Z)), Scalar.Multiply(r.W, r.W)); - T invNorm = Scalar.Reciprocal(Scalar.Sqrt(ls)); + var invNorm = Scalar.Reciprocal(Scalar.Sqrt(ls)); r.X = Scalar.Multiply(r.X, invNorm); r.Y = Scalar.Multiply(r.Y, invNorm); @@ -564,7 +513,7 @@ public static Quaternion Normalize(Quaternion value) Quaternion ans; T ls = Scalar.Add(Scalar.Add(Scalar.Add(Scalar.Multiply(value.X, value.X), Scalar.Multiply(value.Y, value.Y)), Scalar.Multiply(value.Z, value.Z)), Scalar.Multiply(value.W, value.W)); - T invNorm = Scalar.Reciprocal(Scalar.Sqrt(ls)); + var invNorm = Scalar.Reciprocal(Scalar.Sqrt(ls)); ans.X = Scalar.Multiply(value.X, invNorm); ans.Y = Scalar.Multiply(value.Y, invNorm); @@ -581,11 +530,11 @@ public static Quaternion Normalize(Quaternion value) /// The interpolated Quaternion. public static Quaternion Slerp(Quaternion quaternion1, Quaternion quaternion2, T amount) { - T t = amount; + var t = amount; T cosOmega = Scalar.Add(Scalar.Add(Scalar.Add(Scalar.Multiply(quaternion1.X, quaternion2.X), Scalar.Multiply(quaternion1.Y, quaternion2.Y)), Scalar.Multiply(quaternion1.Z, quaternion2.Z)), Scalar.Multiply(quaternion1.W, quaternion2.W)); - bool flip = false; + var flip = false; if (!Scalar.GreaterThanOrEqual(cosOmega, Scalar.Zero)) { @@ -603,11 +552,11 @@ public static Quaternion Slerp(Quaternion quaternion1, Quaternion quate } else { - T omega = Scalar.Acos(cosOmega); - T invSinOmega = Scalar.Reciprocal(Scalar.Sin(omega)); + var omega = Scalar.Acos(cosOmega); + var invSinOmega = Scalar.Reciprocal(Scalar.Sin(omega)); s1 = Scalar.Multiply(Scalar.Sin(Scalar.Multiply(Scalar.Subtract(Scalar.One, t), omega)), invSinOmega); - s2 = (flip) + s2 = flip ? Scalar.Negate(Scalar.Multiply(Scalar.Sin(Scalar.Multiply(t, omega)), invSinOmega)) : Scalar.Multiply(Scalar.Sin(Scalar.Multiply(t, omega)), invSinOmega); } @@ -630,25 +579,6 @@ public static Quaternion Slerp(Quaternion quaternion1, Quaternion quate public static Quaternion Subtract(Quaternion value1, Quaternion value2) => value1 - value2; - /// Returns a boolean indicating whether the given Object is equal to this Quaternion instance. - /// The Object to compare against. - /// True if the Object is equal to this Quaternion; False otherwise. - public override readonly bool Equals(object? obj) - => (obj is Quaternion other) && Equals(other); - - /// Returns a boolean indicating whether the given Quaternion is equal to this Quaternion instance. - /// The Quaternion to compare this instance to. - /// True if the other Quaternion is equal to this instance; False otherwise. - public readonly bool Equals(Quaternion other) - => this == other; - - /// Returns the hash code for this instance. - /// The hash code. - public override readonly int GetHashCode() - { - return unchecked(X.GetHashCode() + Y.GetHashCode() + Z.GetHashCode() + W.GetHashCode()); - } - /// Calculates the length of the Quaternion. /// The computed length of the Quaternion. public readonly T Length() @@ -685,14 +615,14 @@ public static explicit operator Quaternion(Quaternion from) Scalar.As(from.W)); /// - /// Converts a into + /// Converts a into /// /// The source quaternion /// The quaternion - public static explicit operator System.Numerics.Quaternion(Quaternion from) + public static explicit operator Quaternion(Quaternion from) => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), Scalar.As(from.W)); - + /// /// Converts a into one with a of /// @@ -702,93 +632,12 @@ public static explicit operator Quaternion(Quaternion from) => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), Scalar.As(from.W)); - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Quaternion(Quaternion from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Quaternion(Quaternion from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Quaternion(Quaternion from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Quaternion(Quaternion from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Quaternion(Quaternion from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Quaternion(Quaternion from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Quaternion(Quaternion from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Quaternion(Quaternion from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - - /// - /// Converts a into one with a of - /// - /// The source matrix - /// The matrix - public static explicit operator Quaternion(Quaternion from) - => new(Scalar.As(from.X), Scalar.As(from.Y), Scalar.As(from.Z), - Scalar.As(from.W)); - /// /// Returns this quaternion casted to /// /// The type to cast to /// The casted quaternion - public Quaternion As() where TOther : INumberBase + public Quaternion As() where TOther : ITrigonometricFunctions { return new(Scalar.As(X), Scalar.As(Y), Scalar.As(Z), Scalar.As(W)); } diff --git a/sources/Maths/Maths/Quaternion.cs b/sources/Maths/Maths/Quaternion.cs index cbc9253039..16f3b69527 100644 --- a/sources/Maths/Maths/Quaternion.cs +++ b/sources/Maths/Maths/Quaternion.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Numerics; +using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; @@ -13,27 +14,31 @@ namespace Silk.NET.Maths /// /// Represents a four-dimensional vector used to encode 3D rotations. /// - public struct Quaternion : + public partial struct Quaternion : IEquatable> - where T : IFloatingPointIeee754 + where T : ITrigonometricFunctions { /// Specifies the X-value of the vector component of the Quaternion. + [DataMember] public T X; /// Specifies the Y-value of the vector component of the Quaternion. + [DataMember] public T Y; /// Specifies the Z-value of the vector component of the Quaternion. + [DataMember] public T Z; - /// Specifies the W-value of the scalar component of the Quaternion. + /// Specifies the rotation (W) component of the Quaternion. + [DataMember] public T W; /// Constructs a Quaternion from the given components. - /// The X component of the Quaternion. - /// The Y component of the Quaternion. - /// The Z component of the Quaternion. - /// The W component of the Quaternion. + /// The X-component of the Quaternion. + /// The Y-component of the Quaternion. + /// The Z-component of the Quaternion. + /// The rotation (W) component of the Quaternion. public Quaternion(T x, T y, T z, T w) { X = x; @@ -58,7 +63,7 @@ public Quaternion(T x, T y, T z, T w) // TODO: Vector4F/Vector3F constructors /// Returns a representing no rotation. - public static Quaternion Identity => new Quaternion(Scalar.Zero, Scalar.Zero, Scalar.Zero, Scalar.One); + public static Quaternion Identity { get; } = new Quaternion(Scalar.Zero, Scalar.Zero, Scalar.Zero, Scalar.One); /// Returns a boolean indicating whether the given Object is equal to this instance. public override bool Equals(object? obj) => @@ -69,15 +74,22 @@ public bool Equals(Quaternion other) => this == other; /// Returns the hash code for this instance. + /// The hash code. public override int GetHashCode() => HashCode.Combine(X, Y, Z, W); + /// Returns a boolean indicating whether the two given Quaternions are not equal. + /// The first Quaternion to compare. + /// The second Quaternion to compare. + /// True if the Quaternions are not equal; False if they are equal. + public static bool operator !=(Quaternion left, Quaternion right) => + !(left == right); - // Equality Operators + /// Returns a boolean indicating whether the two given Quaternions are equal. + /// The first Quaternion to compare. + /// The second Quaternion to compare. + /// True if the Quaternions are equal; False otherwise. public static bool operator ==(Quaternion left, Quaternion right) => left.X == right.X && left.Y == right.Y && left.Z == right.Z && left.W == right.W; - - public static bool operator !=(Quaternion left, Quaternion right) => - !(left == right); } } From 9aa76de914047ff21649e4836a53321e967d8535 Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Wed, 2 Jul 2025 20:22:50 -0700 Subject: [PATCH 17/19] Fix Obsolete warnings. --- sources/Maths/Maths/Box2D.cs | 36 +++++++++++++++++++++++++++- sources/Maths/Maths/Box3D.cs | 9 +++---- sources/Maths/Maths/Circle.cs | 3 ++- sources/Maths/Maths/Cube.cs | 11 +++++---- sources/Maths/Maths/Matrix2X2.gen.cs | 25 +++++++++++++++---- sources/Maths/Maths/Matrix2X3.gen.cs | 25 +++++++++++++++---- sources/Maths/Maths/Matrix2X4.gen.cs | 25 +++++++++++++++---- sources/Maths/Maths/Matrix3X2.gen.cs | 25 +++++++++++++++---- sources/Maths/Maths/Matrix3X3.gen.cs | 25 +++++++++++++++---- sources/Maths/Maths/Matrix3X4.gen.cs | 25 +++++++++++++++---- sources/Maths/Maths/Matrix4X2.gen.cs | 25 +++++++++++++++---- sources/Maths/Maths/Matrix4X3.gen.cs | 25 +++++++++++++++---- sources/Maths/Maths/Matrix4X4.gen.cs | 25 +++++++++++++++---- sources/Maths/Maths/Matrix5X4.gen.cs | 25 +++++++++++++++---- sources/Maths/Maths/Plane.cs | 3 ++- sources/Maths/Maths/Ray2D.cs | 3 ++- sources/Maths/Maths/Ray3D.cs | 3 ++- sources/Maths/Maths/Rectangle.cs | 11 +++++---- sources/Maths/Maths/Sphere.cs | 1 + sources/Maths/Maths/Vector2D.gen.cs | 18 +++++++++++++- sources/Maths/Maths/Vector3D.gen.cs | 18 +++++++++++++- sources/Maths/Maths/Vector4D.gen.cs | 18 +++++++++++++- 22 files changed, 312 insertions(+), 72 deletions(-) diff --git a/sources/Maths/Maths/Box2D.cs b/sources/Maths/Maths/Box2D.cs index f038fd5fd5..c468e2fa48 100644 --- a/sources/Maths/Maths/Box2D.cs +++ b/sources/Maths/Maths/Box2D.cs @@ -151,7 +151,7 @@ public Box2D GetScaled(Vector2D scale, Vector2D anchor) public Box2D GetScaled(Vector2D scale, Vector2D anchor) where TScale : INumber { - return this.As().GetScaled(scale, anchor.As()).As(); + return this.AsTruncating().GetScaled(scale, anchor.AsTruncating()).AsTruncating(); } /// @@ -210,10 +210,44 @@ public override int GetHashCode() /// /// The type to cast to /// The casted box + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Box2D As() where TOther : INumber { return new(Min.As(), Max.As()); } + + /// + /// Returns this box casted to + /// + /// The type to cast to + /// The casted box + public Box2D AsChecked() + where TOther : INumber + { + return new(Min.AsChecked(), Max.AsChecked()); + } + + /// + /// Returns this box casted to + /// + /// The type to cast to + /// The casted box + public Box2D AsSaturating() + where TOther : INumber + { + return new(Min.AsSaturating(), Max.AsSaturating()); + } + + /// + /// Returns this box casted to + /// + /// The type to cast to + /// The casted box + public Box2D AsTruncating() + where TOther : INumber + { + return new(Min.AsTruncating(), Max.AsTruncating()); + } } } diff --git a/sources/Maths/Maths/Box3D.cs b/sources/Maths/Maths/Box3D.cs index 040c2b0256..4e50cfb16a 100644 --- a/sources/Maths/Maths/Box3D.cs +++ b/sources/Maths/Maths/Box3D.cs @@ -160,10 +160,10 @@ public Box3D GetScaled(Vector3D scale, Vector3D anchor) public Box3D GetScaled(Vector3D scale, Vector3D anchor) where TScale : INumberBase { - var convertedAnchor = anchor.As(); - var min = (scale * (Min.As() - convertedAnchor)) + convertedAnchor; - var max = (scale * (Max.As() - convertedAnchor)) + convertedAnchor; - return new Box3D(min.As(), max.As()); + var convertedAnchor = anchor.AsTruncating(); + var min = (scale * (Min.AsTruncating() - convertedAnchor)) + convertedAnchor; + var max = (scale * (Max.AsTruncating() - convertedAnchor)) + convertedAnchor; + return new Box3D(min.AsTruncating(), max.AsTruncating()); } /// @@ -222,6 +222,7 @@ public override int GetHashCode() /// /// The type to cast to /// The casted box + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Box3D As() where TOther : INumber { diff --git a/sources/Maths/Maths/Circle.cs b/sources/Maths/Maths/Circle.cs index 4be7fcc35e..53e37c049e 100644 --- a/sources/Maths/Maths/Circle.cs +++ b/sources/Maths/Maths/Circle.cs @@ -168,12 +168,13 @@ public override int GetHashCode() { return !value1.Equals(value2); } - + /// /// Returns this circle casted to /// /// The type to cast to /// The casted circle + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Circle As() where TOther : IRootFunctions { return new(Center.As(), Scalar.As(Radius)); diff --git a/sources/Maths/Maths/Cube.cs b/sources/Maths/Maths/Cube.cs index 90bc620d49..bdc61f267e 100644 --- a/sources/Maths/Maths/Cube.cs +++ b/sources/Maths/Maths/Cube.cs @@ -172,10 +172,10 @@ public Cube GetScaled(Vector3D scale, Vector3D anchor) public Cube GetScaled(Vector3D scale, Vector3D anchor) where TScale : INumberBase { - var convertedAnchor = anchor.As(); - var min = (scale * (Origin.As() - convertedAnchor)) + convertedAnchor; - var max = (scale * (Max.As() - convertedAnchor)) + convertedAnchor; - return new(min.As(), (max - min).As()); + var convertedAnchor = anchor.AsTruncating(); + var min = (scale * (Origin.AsTruncating() - convertedAnchor)) + convertedAnchor; + var max = (scale * (Max.AsTruncating() - convertedAnchor)) + convertedAnchor; + return new(min.AsTruncating(), (max - min).AsTruncating()); } /// @@ -230,12 +230,13 @@ public override int GetHashCode() { return !value1.Equals(value2); } - + /// /// Returns this circle casted to /// /// The type to cast to /// The casted cube + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Cube As() where TOther : INumber { diff --git a/sources/Maths/Maths/Matrix2X2.gen.cs b/sources/Maths/Maths/Matrix2X2.gen.cs index 154f2572ba..c78d2f83c9 100644 --- a/sources/Maths/Maths/Matrix2X2.gen.cs +++ b/sources/Maths/Maths/Matrix2X2.gen.cs @@ -117,27 +117,42 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix2X2 CreateChecked(Matrix2X2 other) where TOther : INumberBase => new(Vector2D.CreateChecked(other.Row1), Vector2D.CreateChecked(other.Row2)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix2X2 CreateSaturating(Matrix2X2 other) where TOther : INumberBase => new(Vector2D.CreateSaturating(other.Row1), Vector2D.CreateSaturating(other.Row2)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix2X2 CreateTruncating(Matrix2X2 other) where TOther : INumberBase => new(Vector2D.CreateTruncating(other.Row1), Vector2D.CreateTruncating(other.Row2)); - /// Converts the components of this vector to another type. - [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + /// Converts the components of this matrix to another type. + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Matrix2X2 As() where TOther : INumberBase => new(Row1.As(), Row2.As()); + /// Converts the components of this matrix to another type. + public Matrix2X2 AsChecked() + where TOther : INumberBase => + Matrix2X2.CreateChecked(this); + + /// Converts the components of this matrix to another type. + public Matrix2X2 AsSaturating() + where TOther : INumberBase => + Matrix2X2.CreateSaturating(this); + + /// Converts the components of this matrix to another type. + public Matrix2X2 AsTruncating() + where TOther : INumberBase => + Matrix2X2.CreateTruncating(this); + /// Computes the transpose of the matrix. public Matrix2X2 Transpose() => new(new(M11, M21), diff --git a/sources/Maths/Maths/Matrix2X3.gen.cs b/sources/Maths/Maths/Matrix2X3.gen.cs index c5d7f73970..f0a222eaae 100644 --- a/sources/Maths/Maths/Matrix2X3.gen.cs +++ b/sources/Maths/Maths/Matrix2X3.gen.cs @@ -122,27 +122,42 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix2X3 CreateChecked(Matrix2X3 other) where TOther : INumberBase => new(Vector3D.CreateChecked(other.Row1), Vector3D.CreateChecked(other.Row2)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix2X3 CreateSaturating(Matrix2X3 other) where TOther : INumberBase => new(Vector3D.CreateSaturating(other.Row1), Vector3D.CreateSaturating(other.Row2)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix2X3 CreateTruncating(Matrix2X3 other) where TOther : INumberBase => new(Vector3D.CreateTruncating(other.Row1), Vector3D.CreateTruncating(other.Row2)); - /// Converts the components of this vector to another type. - [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + /// Converts the components of this matrix to another type. + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Matrix2X3 As() where TOther : INumberBase => new(Row1.As(), Row2.As()); + /// Converts the components of this matrix to another type. + public Matrix2X3 AsChecked() + where TOther : INumberBase => + Matrix2X3.CreateChecked(this); + + /// Converts the components of this matrix to another type. + public Matrix2X3 AsSaturating() + where TOther : INumberBase => + Matrix2X3.CreateSaturating(this); + + /// Converts the components of this matrix to another type. + public Matrix2X3 AsTruncating() + where TOther : INumberBase => + Matrix2X3.CreateTruncating(this); + /// Computes the transpose of the matrix. public Matrix3X2 Transpose() => new(new(M11, M21), diff --git a/sources/Maths/Maths/Matrix2X4.gen.cs b/sources/Maths/Maths/Matrix2X4.gen.cs index c9f0301392..ea7aed2896 100644 --- a/sources/Maths/Maths/Matrix2X4.gen.cs +++ b/sources/Maths/Maths/Matrix2X4.gen.cs @@ -136,27 +136,42 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix2X4 CreateChecked(Matrix2X4 other) where TOther : INumberBase => new(Vector4D.CreateChecked(other.Row1), Vector4D.CreateChecked(other.Row2)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix2X4 CreateSaturating(Matrix2X4 other) where TOther : INumberBase => new(Vector4D.CreateSaturating(other.Row1), Vector4D.CreateSaturating(other.Row2)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix2X4 CreateTruncating(Matrix2X4 other) where TOther : INumberBase => new(Vector4D.CreateTruncating(other.Row1), Vector4D.CreateTruncating(other.Row2)); - /// Converts the components of this vector to another type. - [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + /// Converts the components of this matrix to another type. + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Matrix2X4 As() where TOther : INumberBase => new(Row1.As(), Row2.As()); + /// Converts the components of this matrix to another type. + public Matrix2X4 AsChecked() + where TOther : INumberBase => + Matrix2X4.CreateChecked(this); + + /// Converts the components of this matrix to another type. + public Matrix2X4 AsSaturating() + where TOther : INumberBase => + Matrix2X4.CreateSaturating(this); + + /// Converts the components of this matrix to another type. + public Matrix2X4 AsTruncating() + where TOther : INumberBase => + Matrix2X4.CreateTruncating(this); + /// Computes the transpose of the matrix. public Matrix4X2 Transpose() => new(new(M11, M21), diff --git a/sources/Maths/Maths/Matrix3X2.gen.cs b/sources/Maths/Maths/Matrix3X2.gen.cs index 5f8f13123e..8f27467b3a 100644 --- a/sources/Maths/Maths/Matrix3X2.gen.cs +++ b/sources/Maths/Maths/Matrix3X2.gen.cs @@ -127,27 +127,42 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix3X2 CreateChecked(Matrix3X2 other) where TOther : INumberBase => new(Vector2D.CreateChecked(other.Row1), Vector2D.CreateChecked(other.Row2), Vector2D.CreateChecked(other.Row3)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix3X2 CreateSaturating(Matrix3X2 other) where TOther : INumberBase => new(Vector2D.CreateSaturating(other.Row1), Vector2D.CreateSaturating(other.Row2), Vector2D.CreateSaturating(other.Row3)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix3X2 CreateTruncating(Matrix3X2 other) where TOther : INumberBase => new(Vector2D.CreateTruncating(other.Row1), Vector2D.CreateTruncating(other.Row2), Vector2D.CreateTruncating(other.Row3)); - /// Converts the components of this vector to another type. - [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + /// Converts the components of this matrix to another type. + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Matrix3X2 As() where TOther : INumberBase => new(Row1.As(), Row2.As(), Row3.As()); + /// Converts the components of this matrix to another type. + public Matrix3X2 AsChecked() + where TOther : INumberBase => + Matrix3X2.CreateChecked(this); + + /// Converts the components of this matrix to another type. + public Matrix3X2 AsSaturating() + where TOther : INumberBase => + Matrix3X2.CreateSaturating(this); + + /// Converts the components of this matrix to another type. + public Matrix3X2 AsTruncating() + where TOther : INumberBase => + Matrix3X2.CreateTruncating(this); + /// Computes the transpose of the matrix. public Matrix2X3 Transpose() => new(new(M11, M21, M31), diff --git a/sources/Maths/Maths/Matrix3X3.gen.cs b/sources/Maths/Maths/Matrix3X3.gen.cs index adf07c2f0a..5718ab5f6c 100644 --- a/sources/Maths/Maths/Matrix3X3.gen.cs +++ b/sources/Maths/Maths/Matrix3X3.gen.cs @@ -156,27 +156,42 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix3X3 CreateChecked(Matrix3X3 other) where TOther : INumberBase => new(Vector3D.CreateChecked(other.Row1), Vector3D.CreateChecked(other.Row2), Vector3D.CreateChecked(other.Row3)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix3X3 CreateSaturating(Matrix3X3 other) where TOther : INumberBase => new(Vector3D.CreateSaturating(other.Row1), Vector3D.CreateSaturating(other.Row2), Vector3D.CreateSaturating(other.Row3)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix3X3 CreateTruncating(Matrix3X3 other) where TOther : INumberBase => new(Vector3D.CreateTruncating(other.Row1), Vector3D.CreateTruncating(other.Row2), Vector3D.CreateTruncating(other.Row3)); - /// Converts the components of this vector to another type. - [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + /// Converts the components of this matrix to another type. + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Matrix3X3 As() where TOther : INumberBase => new(Row1.As(), Row2.As(), Row3.As()); + /// Converts the components of this matrix to another type. + public Matrix3X3 AsChecked() + where TOther : INumberBase => + Matrix3X3.CreateChecked(this); + + /// Converts the components of this matrix to another type. + public Matrix3X3 AsSaturating() + where TOther : INumberBase => + Matrix3X3.CreateSaturating(this); + + /// Converts the components of this matrix to another type. + public Matrix3X3 AsTruncating() + where TOther : INumberBase => + Matrix3X3.CreateTruncating(this); + /// Computes the transpose of the matrix. public Matrix3X3 Transpose() => new(new(M11, M21, M31), diff --git a/sources/Maths/Maths/Matrix3X4.gen.cs b/sources/Maths/Maths/Matrix3X4.gen.cs index 93e590bbcf..202f179523 100644 --- a/sources/Maths/Maths/Matrix3X4.gen.cs +++ b/sources/Maths/Maths/Matrix3X4.gen.cs @@ -165,27 +165,42 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix3X4 CreateChecked(Matrix3X4 other) where TOther : INumberBase => new(Vector4D.CreateChecked(other.Row1), Vector4D.CreateChecked(other.Row2), Vector4D.CreateChecked(other.Row3)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix3X4 CreateSaturating(Matrix3X4 other) where TOther : INumberBase => new(Vector4D.CreateSaturating(other.Row1), Vector4D.CreateSaturating(other.Row2), Vector4D.CreateSaturating(other.Row3)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix3X4 CreateTruncating(Matrix3X4 other) where TOther : INumberBase => new(Vector4D.CreateTruncating(other.Row1), Vector4D.CreateTruncating(other.Row2), Vector4D.CreateTruncating(other.Row3)); - /// Converts the components of this vector to another type. - [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + /// Converts the components of this matrix to another type. + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Matrix3X4 As() where TOther : INumberBase => new(Row1.As(), Row2.As(), Row3.As()); + /// Converts the components of this matrix to another type. + public Matrix3X4 AsChecked() + where TOther : INumberBase => + Matrix3X4.CreateChecked(this); + + /// Converts the components of this matrix to another type. + public Matrix3X4 AsSaturating() + where TOther : INumberBase => + Matrix3X4.CreateSaturating(this); + + /// Converts the components of this matrix to another type. + public Matrix3X4 AsTruncating() + where TOther : INumberBase => + Matrix3X4.CreateTruncating(this); + /// Computes the transpose of the matrix. public Matrix4X3 Transpose() => new(new(M11, M21, M31), diff --git a/sources/Maths/Maths/Matrix4X2.gen.cs b/sources/Maths/Maths/Matrix4X2.gen.cs index eb6b0133c9..7fa9e127b0 100644 --- a/sources/Maths/Maths/Matrix4X2.gen.cs +++ b/sources/Maths/Maths/Matrix4X2.gen.cs @@ -146,27 +146,42 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix4X2 CreateChecked(Matrix4X2 other) where TOther : INumberBase => new(Vector2D.CreateChecked(other.Row1), Vector2D.CreateChecked(other.Row2), Vector2D.CreateChecked(other.Row3), Vector2D.CreateChecked(other.Row4)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix4X2 CreateSaturating(Matrix4X2 other) where TOther : INumberBase => new(Vector2D.CreateSaturating(other.Row1), Vector2D.CreateSaturating(other.Row2), Vector2D.CreateSaturating(other.Row3), Vector2D.CreateSaturating(other.Row4)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix4X2 CreateTruncating(Matrix4X2 other) where TOther : INumberBase => new(Vector2D.CreateTruncating(other.Row1), Vector2D.CreateTruncating(other.Row2), Vector2D.CreateTruncating(other.Row3), Vector2D.CreateTruncating(other.Row4)); - /// Converts the components of this vector to another type. - [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + /// Converts the components of this matrix to another type. + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Matrix4X2 As() where TOther : INumberBase => new(Row1.As(), Row2.As(), Row3.As(), Row4.As()); + /// Converts the components of this matrix to another type. + public Matrix4X2 AsChecked() + where TOther : INumberBase => + Matrix4X2.CreateChecked(this); + + /// Converts the components of this matrix to another type. + public Matrix4X2 AsSaturating() + where TOther : INumberBase => + Matrix4X2.CreateSaturating(this); + + /// Converts the components of this matrix to another type. + public Matrix4X2 AsTruncating() + where TOther : INumberBase => + Matrix4X2.CreateTruncating(this); + /// Computes the transpose of the matrix. public Matrix2X4 Transpose() => new(new(M11, M21, M31, M41), diff --git a/sources/Maths/Maths/Matrix4X3.gen.cs b/sources/Maths/Maths/Matrix4X3.gen.cs index 5dbf30c452..47e77e6519 100644 --- a/sources/Maths/Maths/Matrix4X3.gen.cs +++ b/sources/Maths/Maths/Matrix4X3.gen.cs @@ -170,27 +170,42 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix4X3 CreateChecked(Matrix4X3 other) where TOther : INumberBase => new(Vector3D.CreateChecked(other.Row1), Vector3D.CreateChecked(other.Row2), Vector3D.CreateChecked(other.Row3), Vector3D.CreateChecked(other.Row4)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix4X3 CreateSaturating(Matrix4X3 other) where TOther : INumberBase => new(Vector3D.CreateSaturating(other.Row1), Vector3D.CreateSaturating(other.Row2), Vector3D.CreateSaturating(other.Row3), Vector3D.CreateSaturating(other.Row4)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix4X3 CreateTruncating(Matrix4X3 other) where TOther : INumberBase => new(Vector3D.CreateTruncating(other.Row1), Vector3D.CreateTruncating(other.Row2), Vector3D.CreateTruncating(other.Row3), Vector3D.CreateTruncating(other.Row4)); - /// Converts the components of this vector to another type. - [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + /// Converts the components of this matrix to another type. + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Matrix4X3 As() where TOther : INumberBase => new(Row1.As(), Row2.As(), Row3.As(), Row4.As()); + /// Converts the components of this matrix to another type. + public Matrix4X3 AsChecked() + where TOther : INumberBase => + Matrix4X3.CreateChecked(this); + + /// Converts the components of this matrix to another type. + public Matrix4X3 AsSaturating() + where TOther : INumberBase => + Matrix4X3.CreateSaturating(this); + + /// Converts the components of this matrix to another type. + public Matrix4X3 AsTruncating() + where TOther : INumberBase => + Matrix4X3.CreateTruncating(this); + /// Computes the transpose of the matrix. public Matrix3X4 Transpose() => new(new(M11, M21, M31, M41), diff --git a/sources/Maths/Maths/Matrix4X4.gen.cs b/sources/Maths/Maths/Matrix4X4.gen.cs index b2ffa73373..49bae4e98a 100644 --- a/sources/Maths/Maths/Matrix4X4.gen.cs +++ b/sources/Maths/Maths/Matrix4X4.gen.cs @@ -205,27 +205,42 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix4X4 CreateChecked(Matrix4X4 other) where TOther : INumberBase => new(Vector4D.CreateChecked(other.Row1), Vector4D.CreateChecked(other.Row2), Vector4D.CreateChecked(other.Row3), Vector4D.CreateChecked(other.Row4)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix4X4 CreateSaturating(Matrix4X4 other) where TOther : INumberBase => new(Vector4D.CreateSaturating(other.Row1), Vector4D.CreateSaturating(other.Row2), Vector4D.CreateSaturating(other.Row3), Vector4D.CreateSaturating(other.Row4)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix4X4 CreateTruncating(Matrix4X4 other) where TOther : INumberBase => new(Vector4D.CreateTruncating(other.Row1), Vector4D.CreateTruncating(other.Row2), Vector4D.CreateTruncating(other.Row3), Vector4D.CreateTruncating(other.Row4)); - /// Converts the components of this vector to another type. - [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + /// Converts the components of this matrix to another type. + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Matrix4X4 As() where TOther : INumberBase => new(Row1.As(), Row2.As(), Row3.As(), Row4.As()); + /// Converts the components of this matrix to another type. + public Matrix4X4 AsChecked() + where TOther : INumberBase => + Matrix4X4.CreateChecked(this); + + /// Converts the components of this matrix to another type. + public Matrix4X4 AsSaturating() + where TOther : INumberBase => + Matrix4X4.CreateSaturating(this); + + /// Converts the components of this matrix to another type. + public Matrix4X4 AsTruncating() + where TOther : INumberBase => + Matrix4X4.CreateTruncating(this); + /// Computes the transpose of the matrix. public Matrix4X4 Transpose() => new(new(M11, M21, M31, M41), diff --git a/sources/Maths/Maths/Matrix5X4.gen.cs b/sources/Maths/Maths/Matrix5X4.gen.cs index af2e8a312e..7d95ce484a 100644 --- a/sources/Maths/Maths/Matrix5X4.gen.cs +++ b/sources/Maths/Maths/Matrix5X4.gen.cs @@ -207,27 +207,42 @@ public override string ToString() => /// public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4, Row5); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix5X4 CreateChecked(Matrix5X4 other) where TOther : INumberBase => new(Vector4D.CreateChecked(other.Row1), Vector4D.CreateChecked(other.Row2), Vector4D.CreateChecked(other.Row3), Vector4D.CreateChecked(other.Row4), Vector4D.CreateChecked(other.Row5)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix5X4 CreateSaturating(Matrix5X4 other) where TOther : INumberBase => new(Vector4D.CreateSaturating(other.Row1), Vector4D.CreateSaturating(other.Row2), Vector4D.CreateSaturating(other.Row3), Vector4D.CreateSaturating(other.Row4), Vector4D.CreateSaturating(other.Row5)); - /// Converts the components of this vector to another type. + /// Converts the components of this matrix to another type. public static Matrix5X4 CreateTruncating(Matrix5X4 other) where TOther : INumberBase => new(Vector4D.CreateTruncating(other.Row1), Vector4D.CreateTruncating(other.Row2), Vector4D.CreateTruncating(other.Row3), Vector4D.CreateTruncating(other.Row4), Vector4D.CreateTruncating(other.Row5)); - /// Converts the components of this vector to another type. - [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating or cast instead.", error: false)] + /// Converts the components of this matrix to another type. + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Matrix5X4 As() where TOther : INumberBase => new(Row1.As(), Row2.As(), Row3.As(), Row4.As(), Row5.As()); + /// Converts the components of this matrix to another type. + public Matrix5X4 AsChecked() + where TOther : INumberBase => + Matrix5X4.CreateChecked(this); + + /// Converts the components of this matrix to another type. + public Matrix5X4 AsSaturating() + where TOther : INumberBase => + Matrix5X4.CreateSaturating(this); + + /// Converts the components of this matrix to another type. + public Matrix5X4 AsTruncating() + where TOther : INumberBase => + Matrix5X4.CreateTruncating(this); + /// Returns a boolean indicating whether the given two matrices are equal. /// The first matrix to compare. /// The second matrix to compare. diff --git a/sources/Maths/Maths/Plane.cs b/sources/Maths/Maths/Plane.cs index f14e3f989f..39a7164f86 100644 --- a/sources/Maths/Maths/Plane.cs +++ b/sources/Maths/Maths/Plane.cs @@ -175,7 +175,7 @@ public static explicit operator Plane(Plane from) /// The source matrix /// The matrix public static explicit operator Plane(Plane from) - => new(from.Normal.As(), short.CreateSaturating(from.Distance)); + => new(from.Normal.AsSaturating(), short.CreateSaturating(from.Distance)); /// /// Converts a into one with a of @@ -214,6 +214,7 @@ public static explicit operator Plane(Plane from) /// /// The type to cast to /// The casted plane + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Plane As() where TOther : INumberBase { return new(Normal.As(), Scalar.As(Distance)); diff --git a/sources/Maths/Maths/Ray2D.cs b/sources/Maths/Maths/Ray2D.cs index 9980748f31..00b09dbcfe 100644 --- a/sources/Maths/Maths/Ray2D.cs +++ b/sources/Maths/Maths/Ray2D.cs @@ -124,12 +124,13 @@ public override int GetHashCode() { return !value1.Equals(value2); } - + /// /// Returns this ray casted to /// /// The type to cast to /// The casted ray + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Ray2D As() where TOther : INumberBase { diff --git a/sources/Maths/Maths/Ray3D.cs b/sources/Maths/Maths/Ray3D.cs index b73feceb17..44f14aab0f 100644 --- a/sources/Maths/Maths/Ray3D.cs +++ b/sources/Maths/Maths/Ray3D.cs @@ -128,12 +128,13 @@ public override int GetHashCode() { return !value1.Equals(value2); } - + /// /// Returns this ray casted to /// /// The type to cast to /// The casted ray + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Ray3D As() where TOther : INumberBase { return new(Origin.As(), Direction.As()); diff --git a/sources/Maths/Maths/Rectangle.cs b/sources/Maths/Maths/Rectangle.cs index db90d7032b..86198c30b8 100644 --- a/sources/Maths/Maths/Rectangle.cs +++ b/sources/Maths/Maths/Rectangle.cs @@ -164,10 +164,10 @@ public Rectangle GetScaled(Vector2D scale, Vector2D anchor) public Rectangle GetScaled(Vector2D scale, Vector2D anchor) where TScale : INumberBase { - var convertedAnchor = anchor.As(); - var min = (scale * (Origin.As() - convertedAnchor)) + convertedAnchor; - var max = (scale * (Max.As() - convertedAnchor)) + convertedAnchor; - return new(min.As(), (max - min).As()); + var convertedAnchor = anchor.AsTruncating(); + var min = (scale * (Origin.AsTruncating() - convertedAnchor)) + convertedAnchor; + var max = (scale * (Max.AsTruncating() - convertedAnchor)) + convertedAnchor; + return new(min.AsTruncating(), (max - min).AsTruncating()); } /// @@ -222,12 +222,13 @@ public override int GetHashCode() { return !value1.Equals(value2); } - + /// /// Returns this rectangle casted to /// /// The type to cast to /// The casted rectangle + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Rectangle As() where TOther : INumber { diff --git a/sources/Maths/Maths/Sphere.cs b/sources/Maths/Maths/Sphere.cs index 759a13290a..7c44cf801c 100644 --- a/sources/Maths/Maths/Sphere.cs +++ b/sources/Maths/Maths/Sphere.cs @@ -170,6 +170,7 @@ public override int GetHashCode() /// /// The type to cast to /// The casted sphere + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Sphere As() where TOther : IRootFunctions { diff --git a/sources/Maths/Maths/Vector2D.gen.cs b/sources/Maths/Maths/Vector2D.gen.cs index 3d7286547d..45d3b22c9e 100644 --- a/sources/Maths/Maths/Vector2D.gen.cs +++ b/sources/Maths/Maths/Vector2D.gen.cs @@ -316,11 +316,26 @@ public static Vector2D CreateTruncating(Vector2D source) new(T.CreateTruncating(source.X), T.CreateTruncating(source.Y)); /// Converts the components of this vector to another type. - [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating, or a cast instead.", error: false)] + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Vector2D As() where TOther : INumberBase => Vector2D.CreateTruncating(this); + /// Converts the components of this vector to another type. + public Vector2D AsChecked() + where TOther : INumberBase => + Vector2D.CreateChecked(this); + + /// Converts the components of this vector to another type. + public Vector2D AsSaturating() + where TOther : INumberBase => + Vector2D.CreateSaturating(this); + + /// Converts the components of this vector to another type. + public Vector2D AsTruncating() + where TOther : INumberBase => + Vector2D.CreateTruncating(this); + /// Implicitly casts a to a . public static implicit operator Vector2D((T X, T Y) v) => new(v.X, v.Y); @@ -572,6 +587,7 @@ public static partial class Vector2D } /// Desconstructs a vector into its components. + /// The vector to deconstruct. /// The X component. /// The Y component. public static void Deconstruct(this Vector2D vector, out T x, out T y) diff --git a/sources/Maths/Maths/Vector3D.gen.cs b/sources/Maths/Maths/Vector3D.gen.cs index b6572cd47f..2cf015c394 100644 --- a/sources/Maths/Maths/Vector3D.gen.cs +++ b/sources/Maths/Maths/Vector3D.gen.cs @@ -353,11 +353,26 @@ public static Vector3D CreateTruncating(Vector3D source) new(T.CreateTruncating(source.X), T.CreateTruncating(source.Y), T.CreateTruncating(source.Z)); /// Converts the components of this vector to another type. - [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating, or a cast instead.", error: false)] + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Vector3D As() where TOther : INumberBase => Vector3D.CreateTruncating(this); + /// Converts the components of this vector to another type. + public Vector3D AsChecked() + where TOther : INumberBase => + Vector3D.CreateChecked(this); + + /// Converts the components of this vector to another type. + public Vector3D AsSaturating() + where TOther : INumberBase => + Vector3D.CreateSaturating(this); + + /// Converts the components of this vector to another type. + public Vector3D AsTruncating() + where TOther : INumberBase => + Vector3D.CreateTruncating(this); + /// Implicitly casts a to a . public static implicit operator Vector3D((T X, T Y, T Z) v) => new(v.X, v.Y, v.Z); @@ -609,6 +624,7 @@ public static partial class Vector3D } /// Desconstructs a vector into its components. + /// The vector to deconstruct. /// The X component. /// The Y component. /// The Z component. diff --git a/sources/Maths/Maths/Vector4D.gen.cs b/sources/Maths/Maths/Vector4D.gen.cs index ed84851eb8..ecd849ca15 100644 --- a/sources/Maths/Maths/Vector4D.gen.cs +++ b/sources/Maths/Maths/Vector4D.gen.cs @@ -390,11 +390,26 @@ public static Vector4D CreateTruncating(Vector4D source) new(T.CreateTruncating(source.X), T.CreateTruncating(source.Y), T.CreateTruncating(source.Z), T.CreateTruncating(source.W)); /// Converts the components of this vector to another type. - [Obsolete("Use CreateChecked, CreateSaturating, CreateTruncating, or a cast instead.", error: false)] + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] public Vector4D As() where TOther : INumberBase => Vector4D.CreateTruncating(this); + /// Converts the components of this vector to another type. + public Vector4D AsChecked() + where TOther : INumberBase => + Vector4D.CreateChecked(this); + + /// Converts the components of this vector to another type. + public Vector4D AsSaturating() + where TOther : INumberBase => + Vector4D.CreateSaturating(this); + + /// Converts the components of this vector to another type. + public Vector4D AsTruncating() + where TOther : INumberBase => + Vector4D.CreateTruncating(this); + /// Implicitly casts a to a . public static implicit operator Vector4D((T X, T Y, T Z, T W) v) => new(v.X, v.Y, v.Z, v.W); @@ -646,6 +661,7 @@ public static partial class Vector4D } /// Desconstructs a vector into its components. + /// The vector to deconstruct. /// The X component. /// The Y component. /// The Z component. From 2d6c95bee1de0bb6d09eb97e9ee8dc2a3ec2bef4 Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Wed, 2 Jul 2025 20:59:46 -0700 Subject: [PATCH 18/19] XML Doc Comments. --- sources/Maths/Maths/Matrix2X2.gen.cs | 2 +- sources/Maths/Maths/Matrix2X3.gen.cs | 2 +- sources/Maths/Maths/Matrix2X4.gen.cs | 2 +- sources/Maths/Maths/Matrix3X2.gen.cs | 2 +- sources/Maths/Maths/Matrix3X3.gen.cs | 2 +- sources/Maths/Maths/Matrix3X4.gen.cs | 2 +- sources/Maths/Maths/Matrix4X2.gen.cs | 2 +- sources/Maths/Maths/Matrix4X3.gen.cs | 2 +- sources/Maths/Maths/Matrix4X4.gen.cs | 2 +- sources/Maths/Maths/Matrix5X4.gen.cs | 2 +- sources/Maths/Maths/Vector2D.gen.cs | 54 ++++++++++++++++++++++++++++ sources/Maths/Maths/Vector3D.gen.cs | 54 ++++++++++++++++++++++++++++ sources/Maths/Maths/Vector4D.gen.cs | 54 ++++++++++++++++++++++++++++ 13 files changed, 172 insertions(+), 10 deletions(-) diff --git a/sources/Maths/Maths/Matrix2X2.gen.cs b/sources/Maths/Maths/Matrix2X2.gen.cs index c78d2f83c9..36d8a000cb 100644 --- a/sources/Maths/Maths/Matrix2X2.gen.cs +++ b/sources/Maths/Maths/Matrix2X2.gen.cs @@ -451,7 +451,7 @@ public static explicit operator checked Matrix2X2(Matrix2X2 from) => } /// - /// Methods for working with + /// Methods for working with . /// public static partial class Matrix2X2 { diff --git a/sources/Maths/Maths/Matrix2X3.gen.cs b/sources/Maths/Maths/Matrix2X3.gen.cs index f0a222eaae..bff4862b07 100644 --- a/sources/Maths/Maths/Matrix2X3.gen.cs +++ b/sources/Maths/Maths/Matrix2X3.gen.cs @@ -465,7 +465,7 @@ public static explicit operator checked Matrix2X3(Matrix2X3 from) => } /// - /// Methods for working with + /// Methods for working with . /// public static partial class Matrix2X3 { diff --git a/sources/Maths/Maths/Matrix2X4.gen.cs b/sources/Maths/Maths/Matrix2X4.gen.cs index ea7aed2896..708458f69b 100644 --- a/sources/Maths/Maths/Matrix2X4.gen.cs +++ b/sources/Maths/Maths/Matrix2X4.gen.cs @@ -489,7 +489,7 @@ public static explicit operator checked Matrix2X4(Matrix2X4 from) => } /// - /// Methods for working with + /// Methods for working with . /// public static partial class Matrix2X4 { diff --git a/sources/Maths/Maths/Matrix3X2.gen.cs b/sources/Maths/Maths/Matrix3X2.gen.cs index 8f27467b3a..792f84ebaa 100644 --- a/sources/Maths/Maths/Matrix3X2.gen.cs +++ b/sources/Maths/Maths/Matrix3X2.gen.cs @@ -501,7 +501,7 @@ public static explicit operator checked Matrix3X2(Matrix3X2 from) => } /// - /// Methods for working with + /// Methods for working with . /// public static partial class Matrix3X2 { diff --git a/sources/Maths/Maths/Matrix3X3.gen.cs b/sources/Maths/Maths/Matrix3X3.gen.cs index 5718ab5f6c..8bc8ec7c86 100644 --- a/sources/Maths/Maths/Matrix3X3.gen.cs +++ b/sources/Maths/Maths/Matrix3X3.gen.cs @@ -539,7 +539,7 @@ public static explicit operator checked Matrix3X3(Matrix3X3 from) => } /// - /// Methods for working with + /// Methods for working with . /// public static partial class Matrix3X3 { diff --git a/sources/Maths/Maths/Matrix3X4.gen.cs b/sources/Maths/Maths/Matrix3X4.gen.cs index 202f179523..2df43ee04c 100644 --- a/sources/Maths/Maths/Matrix3X4.gen.cs +++ b/sources/Maths/Maths/Matrix3X4.gen.cs @@ -558,7 +558,7 @@ public static explicit operator checked Matrix3X4(Matrix3X4 from) => } /// - /// Methods for working with + /// Methods for working with . /// public static partial class Matrix3X4 { diff --git a/sources/Maths/Maths/Matrix4X2.gen.cs b/sources/Maths/Maths/Matrix4X2.gen.cs index 7fa9e127b0..3b147c1b97 100644 --- a/sources/Maths/Maths/Matrix4X2.gen.cs +++ b/sources/Maths/Maths/Matrix4X2.gen.cs @@ -562,7 +562,7 @@ public static explicit operator checked Matrix4X2(Matrix4X2 from) => } /// - /// Methods for working with + /// Methods for working with . /// public static partial class Matrix4X2 { diff --git a/sources/Maths/Maths/Matrix4X3.gen.cs b/sources/Maths/Maths/Matrix4X3.gen.cs index 47e77e6519..85ef245f27 100644 --- a/sources/Maths/Maths/Matrix4X3.gen.cs +++ b/sources/Maths/Maths/Matrix4X3.gen.cs @@ -595,7 +595,7 @@ public static explicit operator checked Matrix4X3(Matrix4X3 from) => } /// - /// Methods for working with + /// Methods for working with . /// public static partial class Matrix4X3 { diff --git a/sources/Maths/Maths/Matrix4X4.gen.cs b/sources/Maths/Maths/Matrix4X4.gen.cs index 49bae4e98a..0fcdce95cf 100644 --- a/sources/Maths/Maths/Matrix4X4.gen.cs +++ b/sources/Maths/Maths/Matrix4X4.gen.cs @@ -640,7 +640,7 @@ public static explicit operator checked Matrix4X4(Matrix4X4 from) => } /// - /// Methods for working with + /// Methods for working with . /// public static partial class Matrix4X4 { diff --git a/sources/Maths/Maths/Matrix5X4.gen.cs b/sources/Maths/Maths/Matrix5X4.gen.cs index 7d95ce484a..6da344fa18 100644 --- a/sources/Maths/Maths/Matrix5X4.gen.cs +++ b/sources/Maths/Maths/Matrix5X4.gen.cs @@ -615,7 +615,7 @@ public static explicit operator checked Matrix5X4(Matrix5X4 from) => } /// - /// Methods for working with + /// Methods for working with . /// public static partial class Matrix5X4 { diff --git a/sources/Maths/Maths/Vector2D.gen.cs b/sources/Maths/Maths/Vector2D.gen.cs index 45d3b22c9e..79b4f1297d 100644 --- a/sources/Maths/Maths/Vector2D.gen.cs +++ b/sources/Maths/Maths/Vector2D.gen.cs @@ -344,36 +344,78 @@ public static implicit operator Vector2D((T X, T Y) v) => public static implicit operator (T X, T Y)(Vector2D v) => (v.X, v.Y); + /// Returns the given vector. + /// The source vector. + /// The source vector. public static Vector2D operator +(Vector2D vector) => vector; + /// Negates a given vector. + /// The source vector. + /// The negated vector. public static Vector2D operator -(Vector2D vector) => new(-vector.X, -vector.Y); + /// Adds two vectors together. + /// The first source vector. + /// The second source vector. + /// The summed vector. public static Vector2D operator +(Vector2D left, Vector2D right) => new(left.X + right.X, left.Y + right.Y); + /// Subtracts the second vector from the first. + /// The first source vector. + /// The second source vector. + /// The difference vector. public static Vector2D operator -(Vector2D left, Vector2D right) => new(left.X - right.X, left.Y - right.Y); + /// Multiplies two vectors together. + /// The first source vector. + /// The second source vector. + /// The product vector. public static Vector2D operator *(Vector2D left, Vector2D right) => new(left.X * right.X, left.Y * right.Y); + /// Divides the first vector by the second. + /// The first source vector. + /// The second source vector. + /// The vector resulting from the division. public static Vector2D operator /(Vector2D left, Vector2D right) => new(left.X / right.X, left.Y / right.Y); + /// Adds a scalar to the components of a vector. + /// The source vector. + /// The scalar value. + /// The offset vector. public static Vector2D operator +(Vector2D vector, T scalar) => new(vector.X + scalar, vector.Y + scalar); + /// Subtracts a scalar from the components of a vector. + /// The source vector. + /// The scalar value. + /// The offset vector. public static Vector2D operator -(Vector2D vector, T scalar) => new(vector.X - scalar, vector.Y - scalar); + /// Multiplies a vector by the given scalar. + /// The source vector. + /// The scalar value. + /// The scaled vector. public static Vector2D operator *(Vector2D vector, T scalar) => new(vector.X * scalar, vector.Y * scalar); + /// Multiplies a vector by the given scalar. + /// The scalar value. + /// The source vector. + /// The scaled vector. public static Vector2D operator *(T scalar, Vector2D vector) => new(scalar * vector.X, scalar * vector.Y); + /// Divides the vector by the given scalar. + /// The source vector. + /// The scalar value. + /// The result of the division. public static Vector2D operator /(Vector2D vector, T scalar) => new(vector.X / scalar, vector.Y / scalar); @@ -570,8 +612,12 @@ public static explicit operator checked Vector2D(Vector2D from) => Vector2D.CreateChecked(from); } + /// + /// Methods for working with . + /// public static partial class Vector2D { + /// Extensions for vectors with elements implementing . extension(Vector2D vector) where T : IRootFunctions { @@ -579,6 +625,7 @@ public static partial class Vector2D public T Length => T.Sqrt(vector.LengthSquared); } + /// Extensions for vectors with elements implementing . extension(Vector2D vector) where T : INumberBase { @@ -648,14 +695,21 @@ public static Vector2D LerpClamped(Vector2D a, Vector2D b, Vector2D< new(T.Lerp(a.X, b.X, T.Clamp(amount.X, T.Zero, T.One)), T.Lerp(a.Y, b.Y, T.Clamp(amount.Y, T.Zero, T.One))); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static (Vector2D Sin, Vector2D Cos) SinCos(this Vector2D x) where T : ITrigonometricFunctions => (new(T.Sin(x.X), T.Sin(x.Y)), new(T.Cos(x.X), T.Cos(x.Y))); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static (Vector2D SinPi, Vector2D CosPi) SinCosPi(this Vector2D x) where T : ITrigonometricFunctions => (new(T.SinPi(x.X), T.SinPi(x.Y)), new(T.CosPi(x.X), T.CosPi(x.Y))); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . public static (Vector2D Quotient, Vector2D Remainder) DivRem(Vector2D left, Vector2D right) where T : IBinaryInteger { diff --git a/sources/Maths/Maths/Vector3D.gen.cs b/sources/Maths/Maths/Vector3D.gen.cs index 2cf015c394..769dd516b2 100644 --- a/sources/Maths/Maths/Vector3D.gen.cs +++ b/sources/Maths/Maths/Vector3D.gen.cs @@ -381,36 +381,78 @@ public static implicit operator Vector3D((T X, T Y, T Z) v) => public static implicit operator (T X, T Y, T Z)(Vector3D v) => (v.X, v.Y, v.Z); + /// Returns the given vector. + /// The source vector. + /// The source vector. public static Vector3D operator +(Vector3D vector) => vector; + /// Negates a given vector. + /// The source vector. + /// The negated vector. public static Vector3D operator -(Vector3D vector) => new(-vector.X, -vector.Y, -vector.Z); + /// Adds two vectors together. + /// The first source vector. + /// The second source vector. + /// The summed vector. public static Vector3D operator +(Vector3D left, Vector3D right) => new(left.X + right.X, left.Y + right.Y, left.Z + right.Z); + /// Subtracts the second vector from the first. + /// The first source vector. + /// The second source vector. + /// The difference vector. public static Vector3D operator -(Vector3D left, Vector3D right) => new(left.X - right.X, left.Y - right.Y, left.Z - right.Z); + /// Multiplies two vectors together. + /// The first source vector. + /// The second source vector. + /// The product vector. public static Vector3D operator *(Vector3D left, Vector3D right) => new(left.X * right.X, left.Y * right.Y, left.Z * right.Z); + /// Divides the first vector by the second. + /// The first source vector. + /// The second source vector. + /// The vector resulting from the division. public static Vector3D operator /(Vector3D left, Vector3D right) => new(left.X / right.X, left.Y / right.Y, left.Z / right.Z); + /// Adds a scalar to the components of a vector. + /// The source vector. + /// The scalar value. + /// The offset vector. public static Vector3D operator +(Vector3D vector, T scalar) => new(vector.X + scalar, vector.Y + scalar, vector.Z + scalar); + /// Subtracts a scalar from the components of a vector. + /// The source vector. + /// The scalar value. + /// The offset vector. public static Vector3D operator -(Vector3D vector, T scalar) => new(vector.X - scalar, vector.Y - scalar, vector.Z - scalar); + /// Multiplies a vector by the given scalar. + /// The source vector. + /// The scalar value. + /// The scaled vector. public static Vector3D operator *(Vector3D vector, T scalar) => new(vector.X * scalar, vector.Y * scalar, vector.Z * scalar); + /// Multiplies a vector by the given scalar. + /// The scalar value. + /// The source vector. + /// The scaled vector. public static Vector3D operator *(T scalar, Vector3D vector) => new(scalar * vector.X, scalar * vector.Y, scalar * vector.Z); + /// Divides the vector by the given scalar. + /// The source vector. + /// The scalar value. + /// The result of the division. public static Vector3D operator /(Vector3D vector, T scalar) => new(vector.X / scalar, vector.Y / scalar, vector.Z / scalar); @@ -607,8 +649,12 @@ public static explicit operator checked Vector3D(Vector3D from) => Vector3D.CreateChecked(from); } + /// + /// Methods for working with . + /// public static partial class Vector3D { + /// Extensions for vectors with elements implementing . extension(Vector3D vector) where T : IRootFunctions { @@ -616,6 +662,7 @@ public static partial class Vector3D public T Length => T.Sqrt(vector.LengthSquared); } + /// Extensions for vectors with elements implementing . extension(Vector3D vector) where T : INumberBase { @@ -688,14 +735,21 @@ public static Vector3D LerpClamped(Vector3D a, Vector3D b, Vector3D< T.Lerp(a.Y, b.Y, T.Clamp(amount.Y, T.Zero, T.One)), T.Lerp(a.Z, b.Z, T.Clamp(amount.Z, T.Zero, T.One))); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static (Vector3D Sin, Vector3D Cos) SinCos(this Vector3D x) where T : ITrigonometricFunctions => (new(T.Sin(x.X), T.Sin(x.Y), T.Sin(x.Z)), new(T.Cos(x.X), T.Cos(x.Y), T.Cos(x.Z))); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static (Vector3D SinPi, Vector3D CosPi) SinCosPi(this Vector3D x) where T : ITrigonometricFunctions => (new(T.SinPi(x.X), T.SinPi(x.Y), T.SinPi(x.Z)), new(T.CosPi(x.X), T.CosPi(x.Y), T.CosPi(x.Z))); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . public static (Vector3D Quotient, Vector3D Remainder) DivRem(Vector3D left, Vector3D right) where T : IBinaryInteger { diff --git a/sources/Maths/Maths/Vector4D.gen.cs b/sources/Maths/Maths/Vector4D.gen.cs index ecd849ca15..6f7e2d978c 100644 --- a/sources/Maths/Maths/Vector4D.gen.cs +++ b/sources/Maths/Maths/Vector4D.gen.cs @@ -418,36 +418,78 @@ public static implicit operator Vector4D((T X, T Y, T Z, T W) v) => public static implicit operator (T X, T Y, T Z, T W)(Vector4D v) => (v.X, v.Y, v.Z, v.W); + /// Returns the given vector. + /// The source vector. + /// The source vector. public static Vector4D operator +(Vector4D vector) => vector; + /// Negates a given vector. + /// The source vector. + /// The negated vector. public static Vector4D operator -(Vector4D vector) => new(-vector.X, -vector.Y, -vector.Z, -vector.W); + /// Adds two vectors together. + /// The first source vector. + /// The second source vector. + /// The summed vector. public static Vector4D operator +(Vector4D left, Vector4D right) => new(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W); + /// Subtracts the second vector from the first. + /// The first source vector. + /// The second source vector. + /// The difference vector. public static Vector4D operator -(Vector4D left, Vector4D right) => new(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W); + /// Multiplies two vectors together. + /// The first source vector. + /// The second source vector. + /// The product vector. public static Vector4D operator *(Vector4D left, Vector4D right) => new(left.X * right.X, left.Y * right.Y, left.Z * right.Z, left.W * right.W); + /// Divides the first vector by the second. + /// The first source vector. + /// The second source vector. + /// The vector resulting from the division. public static Vector4D operator /(Vector4D left, Vector4D right) => new(left.X / right.X, left.Y / right.Y, left.Z / right.Z, left.W / right.W); + /// Adds a scalar to the components of a vector. + /// The source vector. + /// The scalar value. + /// The offset vector. public static Vector4D operator +(Vector4D vector, T scalar) => new(vector.X + scalar, vector.Y + scalar, vector.Z + scalar, vector.W + scalar); + /// Subtracts a scalar from the components of a vector. + /// The source vector. + /// The scalar value. + /// The offset vector. public static Vector4D operator -(Vector4D vector, T scalar) => new(vector.X - scalar, vector.Y - scalar, vector.Z - scalar, vector.W - scalar); + /// Multiplies a vector by the given scalar. + /// The source vector. + /// The scalar value. + /// The scaled vector. public static Vector4D operator *(Vector4D vector, T scalar) => new(vector.X * scalar, vector.Y * scalar, vector.Z * scalar, vector.W * scalar); + /// Multiplies a vector by the given scalar. + /// The scalar value. + /// The source vector. + /// The scaled vector. public static Vector4D operator *(T scalar, Vector4D vector) => new(scalar * vector.X, scalar * vector.Y, scalar * vector.Z, scalar * vector.W); + /// Divides the vector by the given scalar. + /// The source vector. + /// The scalar value. + /// The result of the division. public static Vector4D operator /(Vector4D vector, T scalar) => new(vector.X / scalar, vector.Y / scalar, vector.Z / scalar, vector.W / scalar); @@ -644,8 +686,12 @@ public static explicit operator checked Vector4D(Vector4D from) => Vector4D.CreateChecked(from); } + /// + /// Methods for working with . + /// public static partial class Vector4D { + /// Extensions for vectors with elements implementing . extension(Vector4D vector) where T : IRootFunctions { @@ -653,6 +699,7 @@ public static partial class Vector4D public T Length => T.Sqrt(vector.LengthSquared); } + /// Extensions for vectors with elements implementing . extension(Vector4D vector) where T : INumberBase { @@ -728,14 +775,21 @@ public static Vector4D LerpClamped(Vector4D a, Vector4D b, Vector4D< T.Lerp(a.Z, b.Z, T.Clamp(amount.Z, T.Zero, T.One)), T.Lerp(a.W, b.W, T.Clamp(amount.W, T.Zero, T.One))); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static (Vector4D Sin, Vector4D Cos) SinCos(this Vector4D x) where T : ITrigonometricFunctions => (new(T.Sin(x.X), T.Sin(x.Y), T.Sin(x.Z), T.Sin(x.W)), new(T.Cos(x.X), T.Cos(x.Y), T.Cos(x.Z), T.Cos(x.W))); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . public static (Vector4D SinPi, Vector4D CosPi) SinCosPi(this Vector4D x) where T : ITrigonometricFunctions => (new(T.SinPi(x.X), T.SinPi(x.Y), T.SinPi(x.Z), T.SinPi(x.W)), new(T.CosPi(x.X), T.CosPi(x.Y), T.CosPi(x.Z), T.CosPi(x.W))); + /// Applies to the provided arguments. + /// A vector whose members will be provided for . + /// A vector whose members will be provided for . public static (Vector4D Quotient, Vector4D Remainder) DivRem(Vector4D left, Vector4D right) where T : IBinaryInteger { From 1c2b6f87becb358dd0c44f1e2c79437c490ec684 Mon Sep 17 00:00:00 2001 From: John Gietzen Date: Wed, 2 Jul 2025 21:15:23 -0700 Subject: [PATCH 19/19] Reset APIs. --- .../PublicAPI/net8.0/PublicAPI.Shipped.txt | 1418 ------------- .../PublicAPI/net8.0/PublicAPI.Unshipped.txt | 1872 +++++++++++++++++ 2 files changed, 1872 insertions(+), 1418 deletions(-) diff --git a/sources/Maths/Maths/PublicAPI/net8.0/PublicAPI.Shipped.txt b/sources/Maths/Maths/PublicAPI/net8.0/PublicAPI.Shipped.txt index 3552eec334..7dc5c58110 100644 --- a/sources/Maths/Maths/PublicAPI/net8.0/PublicAPI.Shipped.txt +++ b/sources/Maths/Maths/PublicAPI/net8.0/PublicAPI.Shipped.txt @@ -1,1419 +1 @@ #nullable enable -override Silk.NET.Maths.Box2D.Equals(object? obj) -> bool -override Silk.NET.Maths.Box2D.GetHashCode() -> int -override Silk.NET.Maths.Box3D.Equals(object? obj) -> bool -override Silk.NET.Maths.Box3D.GetHashCode() -> int -override Silk.NET.Maths.Circle.Equals(object? obj) -> bool -override Silk.NET.Maths.Circle.GetHashCode() -> int -override Silk.NET.Maths.Cube.Equals(object? obj) -> bool -override Silk.NET.Maths.Cube.GetHashCode() -> int -override Silk.NET.Maths.Matrix2X2.Equals(object? obj) -> bool -override Silk.NET.Maths.Matrix2X2.GetHashCode() -> int -override Silk.NET.Maths.Matrix2X2.ToString() -> string! -override Silk.NET.Maths.Matrix2X3.Equals(object? obj) -> bool -override Silk.NET.Maths.Matrix2X3.GetHashCode() -> int -override Silk.NET.Maths.Matrix2X3.ToString() -> string! -override Silk.NET.Maths.Matrix2X4.Equals(object? obj) -> bool -override Silk.NET.Maths.Matrix2X4.GetHashCode() -> int -override Silk.NET.Maths.Matrix2X4.ToString() -> string! -override Silk.NET.Maths.Matrix3X2.Equals(object? obj) -> bool -override Silk.NET.Maths.Matrix3X2.GetHashCode() -> int -override Silk.NET.Maths.Matrix3X2.ToString() -> string! -override Silk.NET.Maths.Matrix3X3.Equals(object? obj) -> bool -override Silk.NET.Maths.Matrix3X3.GetHashCode() -> int -override Silk.NET.Maths.Matrix3X3.ToString() -> string! -override Silk.NET.Maths.Matrix3X4.Equals(object? obj) -> bool -override Silk.NET.Maths.Matrix3X4.GetHashCode() -> int -override Silk.NET.Maths.Matrix3X4.ToString() -> string! -override Silk.NET.Maths.Matrix4X2.Equals(object? obj) -> bool -override Silk.NET.Maths.Matrix4X2.GetHashCode() -> int -override Silk.NET.Maths.Matrix4X2.ToString() -> string! -override Silk.NET.Maths.Matrix4X3.Equals(object? obj) -> bool -override Silk.NET.Maths.Matrix4X3.GetHashCode() -> int -override Silk.NET.Maths.Matrix4X3.ToString() -> string! -override Silk.NET.Maths.Matrix4X4.Equals(object? obj) -> bool -override Silk.NET.Maths.Matrix4X4.GetHashCode() -> int -override Silk.NET.Maths.Matrix4X4.ToString() -> string! -override Silk.NET.Maths.Matrix5X4.Equals(object? obj) -> bool -override Silk.NET.Maths.Matrix5X4.GetHashCode() -> int -override Silk.NET.Maths.Matrix5X4.ToString() -> string! -override Silk.NET.Maths.Plane.Equals(object? obj) -> bool -override Silk.NET.Maths.Plane.GetHashCode() -> int -override Silk.NET.Maths.Plane.ToString() -> string! -override Silk.NET.Maths.Quaternion.Equals(object? obj) -> bool -override Silk.NET.Maths.Quaternion.GetHashCode() -> int -override Silk.NET.Maths.Quaternion.ToString() -> string! -override Silk.NET.Maths.Ray2D.Equals(object? obj) -> bool -override Silk.NET.Maths.Ray2D.GetHashCode() -> int -override Silk.NET.Maths.Ray3D.Equals(object? obj) -> bool -override Silk.NET.Maths.Ray3D.GetHashCode() -> int -override Silk.NET.Maths.Rectangle.Equals(object? obj) -> bool -override Silk.NET.Maths.Rectangle.GetHashCode() -> int -override Silk.NET.Maths.Sphere.Equals(object? obj) -> bool -override Silk.NET.Maths.Sphere.GetHashCode() -> int -override Silk.NET.Maths.Vector2D.Equals(object? obj) -> bool -override Silk.NET.Maths.Vector2D.GetHashCode() -> int -override Silk.NET.Maths.Vector2D.ToString() -> string! -override Silk.NET.Maths.Vector3D.Equals(object? obj) -> bool -override Silk.NET.Maths.Vector3D.GetHashCode() -> int -override Silk.NET.Maths.Vector3D.ToString() -> string! -override Silk.NET.Maths.Vector4D.Equals(object? obj) -> bool -override Silk.NET.Maths.Vector4D.GetHashCode() -> int -override Silk.NET.Maths.Vector4D.ToString() -> string! -Silk.NET.Maths.Box2D -Silk.NET.Maths.Box2D.As() -> Silk.NET.Maths.Box2D -Silk.NET.Maths.Box2D.Box2D() -> void -Silk.NET.Maths.Box2D.Box2D(Silk.NET.Maths.Vector2D min, Silk.NET.Maths.Vector2D max) -> void -Silk.NET.Maths.Box2D.Box2D(Silk.NET.Maths.Vector2D min, T maxX, T maxY) -> void -Silk.NET.Maths.Box2D.Box2D(T minX, T minY, Silk.NET.Maths.Vector2D max) -> void -Silk.NET.Maths.Box2D.Box2D(T minX, T minY, T maxX, T maxY) -> void -Silk.NET.Maths.Box2D.Center.get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Box2D.Contains(Silk.NET.Maths.Box2D other) -> bool -Silk.NET.Maths.Box2D.Contains(Silk.NET.Maths.Vector2D point) -> bool -Silk.NET.Maths.Box2D.Equals(Silk.NET.Maths.Box2D other) -> bool -Silk.NET.Maths.Box2D.GetDistanceToNearestEdge(Silk.NET.Maths.Vector2D point) -> T -Silk.NET.Maths.Box2D.GetInflated(Silk.NET.Maths.Vector2D point) -> Silk.NET.Maths.Box2D -Silk.NET.Maths.Box2D.GetScaled(Silk.NET.Maths.Vector2D scale, Silk.NET.Maths.Vector2D anchor) -> Silk.NET.Maths.Box2D -Silk.NET.Maths.Box2D.GetScaled(Silk.NET.Maths.Vector2D scale, Silk.NET.Maths.Vector2D anchor) -> Silk.NET.Maths.Box2D -Silk.NET.Maths.Box2D.GetTranslated(Silk.NET.Maths.Vector2D distance) -> Silk.NET.Maths.Box2D -Silk.NET.Maths.Box2D.Max -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Box2D.Min -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Box2D.Size.get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Box3D -Silk.NET.Maths.Box3D.As() -> Silk.NET.Maths.Box3D -Silk.NET.Maths.Box3D.Box3D() -> void -Silk.NET.Maths.Box3D.Box3D(Silk.NET.Maths.Vector3D min, Silk.NET.Maths.Vector3D max) -> void -Silk.NET.Maths.Box3D.Box3D(Silk.NET.Maths.Vector3D min, T maxX, T maxY, T maxZ) -> void -Silk.NET.Maths.Box3D.Box3D(T minX, T minY, T minZ, Silk.NET.Maths.Vector3D max) -> void -Silk.NET.Maths.Box3D.Box3D(T minX, T minY, T minZ, T maxX, T maxY, T maxZ) -> void -Silk.NET.Maths.Box3D.Center.get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Box3D.Contains(Silk.NET.Maths.Box3D other) -> bool -Silk.NET.Maths.Box3D.Contains(Silk.NET.Maths.Vector3D point) -> bool -Silk.NET.Maths.Box3D.Equals(Silk.NET.Maths.Box3D other) -> bool -Silk.NET.Maths.Box3D.GetDistanceToNearestEdge(Silk.NET.Maths.Vector3D point) -> T -Silk.NET.Maths.Box3D.GetInflated(Silk.NET.Maths.Vector3D point) -> Silk.NET.Maths.Box3D -Silk.NET.Maths.Box3D.GetScaled(Silk.NET.Maths.Vector3D scale, Silk.NET.Maths.Vector3D anchor) -> Silk.NET.Maths.Box3D -Silk.NET.Maths.Box3D.GetScaled(Silk.NET.Maths.Vector3D scale, Silk.NET.Maths.Vector3D anchor) -> Silk.NET.Maths.Box3D -Silk.NET.Maths.Box3D.GetTranslated(Silk.NET.Maths.Vector3D distance) -> Silk.NET.Maths.Box3D -Silk.NET.Maths.Box3D.Max -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Box3D.Min -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Box3D.Size.get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Circle -Silk.NET.Maths.Circle.As() -> Silk.NET.Maths.Circle -Silk.NET.Maths.Circle.Center -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Circle.Circle() -> void -Silk.NET.Maths.Circle.Circle(Silk.NET.Maths.Vector2D center, T radius) -> void -Silk.NET.Maths.Circle.Circle(T centerX, T centerY, T radius) -> void -Silk.NET.Maths.Circle.Circumference.get -> T -Silk.NET.Maths.Circle.Contains(Silk.NET.Maths.Circle other) -> bool -Silk.NET.Maths.Circle.Contains(Silk.NET.Maths.Vector2D point) -> bool -Silk.NET.Maths.Circle.Diameter.get -> T -Silk.NET.Maths.Circle.Equals(Silk.NET.Maths.Circle other) -> bool -Silk.NET.Maths.Circle.GetDistanceToNearestEdge(Silk.NET.Maths.Vector2D point) -> T -Silk.NET.Maths.Circle.GetDistanceToNearestEdgeSquared(Silk.NET.Maths.Vector2D point) -> T -Silk.NET.Maths.Circle.GetInflated(Silk.NET.Maths.Vector2D point) -> Silk.NET.Maths.Circle -Silk.NET.Maths.Circle.GetTranslated(Silk.NET.Maths.Vector2D distance) -> Silk.NET.Maths.Circle -Silk.NET.Maths.Circle.Radius -> T -Silk.NET.Maths.Circle.SquaredRadius.get -> T -Silk.NET.Maths.Cube -Silk.NET.Maths.Cube.As() -> Silk.NET.Maths.Cube -Silk.NET.Maths.Cube.Center.get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Cube.Contains(Silk.NET.Maths.Cube other) -> bool -Silk.NET.Maths.Cube.Contains(Silk.NET.Maths.Vector3D point) -> bool -Silk.NET.Maths.Cube.Cube() -> void -Silk.NET.Maths.Cube.Cube(Silk.NET.Maths.Vector3D origin, Silk.NET.Maths.Vector3D size) -> void -Silk.NET.Maths.Cube.Cube(Silk.NET.Maths.Vector3D origin, T sizeX, T sizeY, T sizeZ) -> void -Silk.NET.Maths.Cube.Cube(T originX, T originY, T originZ, Silk.NET.Maths.Vector3D size) -> void -Silk.NET.Maths.Cube.Cube(T originX, T originY, T originZ, T sizeX, T sizeY, T sizeZ) -> void -Silk.NET.Maths.Cube.Equals(Silk.NET.Maths.Cube other) -> bool -Silk.NET.Maths.Cube.GetDistanceToNearestEdge(Silk.NET.Maths.Vector3D point) -> T -Silk.NET.Maths.Cube.GetInflated(Silk.NET.Maths.Vector3D point) -> Silk.NET.Maths.Cube -Silk.NET.Maths.Cube.GetScaled(Silk.NET.Maths.Vector3D scale, Silk.NET.Maths.Vector3D anchor) -> Silk.NET.Maths.Cube -Silk.NET.Maths.Cube.GetScaled(Silk.NET.Maths.Vector3D scale, Silk.NET.Maths.Vector3D anchor) -> Silk.NET.Maths.Cube -Silk.NET.Maths.Cube.GetTranslated(Silk.NET.Maths.Vector3D distance) -> Silk.NET.Maths.Cube -Silk.NET.Maths.Cube.HalfSize.get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Cube.Max.get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Cube.Origin -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Cube.Size -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix2X2 -Silk.NET.Maths.Matrix2X2 -Silk.NET.Maths.Matrix2X2.As() -> Silk.NET.Maths.Matrix2X2 -Silk.NET.Maths.Matrix2X2.Column1.get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix2X2.Column2.get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix2X2.Equals(Silk.NET.Maths.Matrix2X2 other) -> bool -Silk.NET.Maths.Matrix2X2.GetDeterminant() -> T -Silk.NET.Maths.Matrix2X2.IsIdentity.get -> bool -Silk.NET.Maths.Matrix2X2.M11.get -> T -Silk.NET.Maths.Matrix2X2.M11.set -> void -Silk.NET.Maths.Matrix2X2.M12.get -> T -Silk.NET.Maths.Matrix2X2.M12.set -> void -Silk.NET.Maths.Matrix2X2.M21.get -> T -Silk.NET.Maths.Matrix2X2.M21.set -> void -Silk.NET.Maths.Matrix2X2.M22.get -> T -Silk.NET.Maths.Matrix2X2.M22.set -> void -Silk.NET.Maths.Matrix2X2.Matrix2X2() -> void -Silk.NET.Maths.Matrix2X2.Matrix2X2(Silk.NET.Maths.Matrix2X4 value) -> void -Silk.NET.Maths.Matrix2X2.Matrix2X2(Silk.NET.Maths.Matrix3X2 value) -> void -Silk.NET.Maths.Matrix2X2.Matrix2X2(Silk.NET.Maths.Matrix3X4 value) -> void -Silk.NET.Maths.Matrix2X2.Matrix2X2(Silk.NET.Maths.Matrix4X2 value) -> void -Silk.NET.Maths.Matrix2X2.Matrix2X2(Silk.NET.Maths.Matrix4X3 value) -> void -Silk.NET.Maths.Matrix2X2.Matrix2X2(Silk.NET.Maths.Vector2D row1, Silk.NET.Maths.Vector2D row2) -> void -Silk.NET.Maths.Matrix2X2.Matrix2X2(T m11, T m12, T m21, T m22) -> void -Silk.NET.Maths.Matrix2X2.Row1 -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix2X2.Row2 -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix2X2.this[int x, int y].get -> T -Silk.NET.Maths.Matrix2X2.this[int x].get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix2X3 -Silk.NET.Maths.Matrix2X3 -Silk.NET.Maths.Matrix2X3.As() -> Silk.NET.Maths.Matrix2X3 -Silk.NET.Maths.Matrix2X3.Column1.get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix2X3.Column2.get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix2X3.Column3.get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix2X3.Equals(Silk.NET.Maths.Matrix2X3 other) -> bool -Silk.NET.Maths.Matrix2X3.IsIdentity.get -> bool -Silk.NET.Maths.Matrix2X3.M11.get -> T -Silk.NET.Maths.Matrix2X3.M11.set -> void -Silk.NET.Maths.Matrix2X3.M12.get -> T -Silk.NET.Maths.Matrix2X3.M12.set -> void -Silk.NET.Maths.Matrix2X3.M13.get -> T -Silk.NET.Maths.Matrix2X3.M13.set -> void -Silk.NET.Maths.Matrix2X3.M21.get -> T -Silk.NET.Maths.Matrix2X3.M21.set -> void -Silk.NET.Maths.Matrix2X3.M22.get -> T -Silk.NET.Maths.Matrix2X3.M22.set -> void -Silk.NET.Maths.Matrix2X3.M23.get -> T -Silk.NET.Maths.Matrix2X3.M23.set -> void -Silk.NET.Maths.Matrix2X3.Matrix2X3() -> void -Silk.NET.Maths.Matrix2X3.Matrix2X3(Silk.NET.Maths.Matrix2X4 value) -> void -Silk.NET.Maths.Matrix2X3.Matrix2X3(Silk.NET.Maths.Matrix3X2 value) -> void -Silk.NET.Maths.Matrix2X3.Matrix2X3(Silk.NET.Maths.Matrix3X4 value) -> void -Silk.NET.Maths.Matrix2X3.Matrix2X3(Silk.NET.Maths.Matrix4X2 value) -> void -Silk.NET.Maths.Matrix2X3.Matrix2X3(Silk.NET.Maths.Matrix4X3 value) -> void -Silk.NET.Maths.Matrix2X3.Matrix2X3(Silk.NET.Maths.Vector3D row1, Silk.NET.Maths.Vector3D row2) -> void -Silk.NET.Maths.Matrix2X3.Matrix2X3(T m11, T m12, T m13, T m21, T m22, T m23) -> void -Silk.NET.Maths.Matrix2X3.Row1 -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix2X3.Row2 -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix2X3.this[int x, int y].get -> T -Silk.NET.Maths.Matrix2X3.this[int x].get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix2X4 -Silk.NET.Maths.Matrix2X4 -Silk.NET.Maths.Matrix2X4.As() -> Silk.NET.Maths.Matrix2X4 -Silk.NET.Maths.Matrix2X4.Column1.get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix2X4.Column2.get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix2X4.Column3.get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix2X4.Column4.get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix2X4.Equals(Silk.NET.Maths.Matrix2X4 other) -> bool -Silk.NET.Maths.Matrix2X4.IsIdentity.get -> bool -Silk.NET.Maths.Matrix2X4.M11.get -> T -Silk.NET.Maths.Matrix2X4.M11.set -> void -Silk.NET.Maths.Matrix2X4.M12.get -> T -Silk.NET.Maths.Matrix2X4.M12.set -> void -Silk.NET.Maths.Matrix2X4.M13.get -> T -Silk.NET.Maths.Matrix2X4.M13.set -> void -Silk.NET.Maths.Matrix2X4.M14.get -> T -Silk.NET.Maths.Matrix2X4.M14.set -> void -Silk.NET.Maths.Matrix2X4.M21.get -> T -Silk.NET.Maths.Matrix2X4.M21.set -> void -Silk.NET.Maths.Matrix2X4.M22.get -> T -Silk.NET.Maths.Matrix2X4.M22.set -> void -Silk.NET.Maths.Matrix2X4.M23.get -> T -Silk.NET.Maths.Matrix2X4.M23.set -> void -Silk.NET.Maths.Matrix2X4.M24.get -> T -Silk.NET.Maths.Matrix2X4.M24.set -> void -Silk.NET.Maths.Matrix2X4.Matrix2X4() -> void -Silk.NET.Maths.Matrix2X4.Matrix2X4(Silk.NET.Maths.Matrix3X2 value) -> void -Silk.NET.Maths.Matrix2X4.Matrix2X4(Silk.NET.Maths.Matrix3X3 value) -> void -Silk.NET.Maths.Matrix2X4.Matrix2X4(Silk.NET.Maths.Matrix3X4 value) -> void -Silk.NET.Maths.Matrix2X4.Matrix2X4(Silk.NET.Maths.Matrix4X2 value) -> void -Silk.NET.Maths.Matrix2X4.Matrix2X4(Silk.NET.Maths.Matrix4X3 value) -> void -Silk.NET.Maths.Matrix2X4.Matrix2X4(Silk.NET.Maths.Vector4D row1, Silk.NET.Maths.Vector4D row2) -> void -Silk.NET.Maths.Matrix2X4.Matrix2X4(T m11, T m12, T m13, T m14, T m21, T m22, T m23, T m24) -> void -Silk.NET.Maths.Matrix2X4.Row1 -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix2X4.Row2 -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix2X4.this[int x, int j].get -> T -Silk.NET.Maths.Matrix2X4.this[int x].get -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix3X2 -Silk.NET.Maths.Matrix3X2 -Silk.NET.Maths.Matrix3X2.As() -> Silk.NET.Maths.Matrix3X2 -Silk.NET.Maths.Matrix3X2.Column1.get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix3X2.Column2.get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix3X2.Equals(Silk.NET.Maths.Matrix3X2 other) -> bool -Silk.NET.Maths.Matrix3X2.GetDeterminant() -> T -Silk.NET.Maths.Matrix3X2.IsIdentity.get -> bool -Silk.NET.Maths.Matrix3X2.M11.get -> T -Silk.NET.Maths.Matrix3X2.M11.set -> void -Silk.NET.Maths.Matrix3X2.M12.get -> T -Silk.NET.Maths.Matrix3X2.M12.set -> void -Silk.NET.Maths.Matrix3X2.M21.get -> T -Silk.NET.Maths.Matrix3X2.M21.set -> void -Silk.NET.Maths.Matrix3X2.M22.get -> T -Silk.NET.Maths.Matrix3X2.M22.set -> void -Silk.NET.Maths.Matrix3X2.M31.get -> T -Silk.NET.Maths.Matrix3X2.M31.set -> void -Silk.NET.Maths.Matrix3X2.M32.get -> T -Silk.NET.Maths.Matrix3X2.M32.set -> void -Silk.NET.Maths.Matrix3X2.Matrix3X2() -> void -Silk.NET.Maths.Matrix3X2.Matrix3X2(Silk.NET.Maths.Matrix2X4 value) -> void -Silk.NET.Maths.Matrix3X2.Matrix3X2(Silk.NET.Maths.Matrix3X3 value) -> void -Silk.NET.Maths.Matrix3X2.Matrix3X2(Silk.NET.Maths.Matrix3X4 value) -> void -Silk.NET.Maths.Matrix3X2.Matrix3X2(Silk.NET.Maths.Matrix4X2 value) -> void -Silk.NET.Maths.Matrix3X2.Matrix3X2(Silk.NET.Maths.Matrix4X3 value) -> void -Silk.NET.Maths.Matrix3X2.Matrix3X2(Silk.NET.Maths.Vector2D row1, Silk.NET.Maths.Vector2D row2, Silk.NET.Maths.Vector2D row3) -> void -Silk.NET.Maths.Matrix3X2.Matrix3X2(T m11, T m12, T m21, T m22, T m31, T m32) -> void -Silk.NET.Maths.Matrix3X2.Row1 -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix3X2.Row2 -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix3X2.Row3 -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix3X2.this[int x, int y].get -> T -Silk.NET.Maths.Matrix3X2.this[int x].get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix3X3 -Silk.NET.Maths.Matrix3X3 -Silk.NET.Maths.Matrix3X3.As() -> Silk.NET.Maths.Matrix3X3 -Silk.NET.Maths.Matrix3X3.Column1.get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix3X3.Column2.get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix3X3.Column3.get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix3X3.Equals(Silk.NET.Maths.Matrix3X3 other) -> bool -Silk.NET.Maths.Matrix3X3.GetDeterminant() -> T -Silk.NET.Maths.Matrix3X3.IsIdentity.get -> bool -Silk.NET.Maths.Matrix3X3.M11.get -> T -Silk.NET.Maths.Matrix3X3.M11.set -> void -Silk.NET.Maths.Matrix3X3.M12.get -> T -Silk.NET.Maths.Matrix3X3.M12.set -> void -Silk.NET.Maths.Matrix3X3.M13.get -> T -Silk.NET.Maths.Matrix3X3.M13.set -> void -Silk.NET.Maths.Matrix3X3.M21.get -> T -Silk.NET.Maths.Matrix3X3.M21.set -> void -Silk.NET.Maths.Matrix3X3.M22.get -> T -Silk.NET.Maths.Matrix3X3.M22.set -> void -Silk.NET.Maths.Matrix3X3.M23.get -> T -Silk.NET.Maths.Matrix3X3.M23.set -> void -Silk.NET.Maths.Matrix3X3.M31.get -> T -Silk.NET.Maths.Matrix3X3.M31.set -> void -Silk.NET.Maths.Matrix3X3.M32.get -> T -Silk.NET.Maths.Matrix3X3.M32.set -> void -Silk.NET.Maths.Matrix3X3.M33.get -> T -Silk.NET.Maths.Matrix3X3.M33.set -> void -Silk.NET.Maths.Matrix3X3.Matrix3X3() -> void -Silk.NET.Maths.Matrix3X3.Matrix3X3(Silk.NET.Maths.Matrix2X4 value) -> void -Silk.NET.Maths.Matrix3X3.Matrix3X3(Silk.NET.Maths.Matrix3X2 value) -> void -Silk.NET.Maths.Matrix3X3.Matrix3X3(Silk.NET.Maths.Matrix3X3 value) -> void -Silk.NET.Maths.Matrix3X3.Matrix3X3(Silk.NET.Maths.Matrix3X4 value) -> void -Silk.NET.Maths.Matrix3X3.Matrix3X3(Silk.NET.Maths.Matrix4X2 value) -> void -Silk.NET.Maths.Matrix3X3.Matrix3X3(Silk.NET.Maths.Matrix4X3 value) -> void -Silk.NET.Maths.Matrix3X3.Matrix3X3(Silk.NET.Maths.Matrix4X4 value) -> void -Silk.NET.Maths.Matrix3X3.Matrix3X3(Silk.NET.Maths.Vector3D row1, Silk.NET.Maths.Vector3D row2, Silk.NET.Maths.Vector3D row3) -> void -Silk.NET.Maths.Matrix3X3.Matrix3X3(T m11, T m12, T m13, T m21, T m22, T m23, T m31, T m32, T m33) -> void -Silk.NET.Maths.Matrix3X3.Row1 -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix3X3.Row2 -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix3X3.Row3 -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix3X3.this[int x, int i].get -> T -Silk.NET.Maths.Matrix3X3.this[int x].get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix3X4 -Silk.NET.Maths.Matrix3X4 -Silk.NET.Maths.Matrix3X4.As() -> Silk.NET.Maths.Matrix3X4 -Silk.NET.Maths.Matrix3X4.Column1.get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix3X4.Column2.get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix3X4.Column3.get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix3X4.Column4.get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix3X4.Equals(Silk.NET.Maths.Matrix3X4 other) -> bool -Silk.NET.Maths.Matrix3X4.IsIdentity.get -> bool -Silk.NET.Maths.Matrix3X4.M11.get -> T -Silk.NET.Maths.Matrix3X4.M11.set -> void -Silk.NET.Maths.Matrix3X4.M12.get -> T -Silk.NET.Maths.Matrix3X4.M12.set -> void -Silk.NET.Maths.Matrix3X4.M13.get -> T -Silk.NET.Maths.Matrix3X4.M13.set -> void -Silk.NET.Maths.Matrix3X4.M14.get -> T -Silk.NET.Maths.Matrix3X4.M14.set -> void -Silk.NET.Maths.Matrix3X4.M21.get -> T -Silk.NET.Maths.Matrix3X4.M21.set -> void -Silk.NET.Maths.Matrix3X4.M22.get -> T -Silk.NET.Maths.Matrix3X4.M22.set -> void -Silk.NET.Maths.Matrix3X4.M23.get -> T -Silk.NET.Maths.Matrix3X4.M23.set -> void -Silk.NET.Maths.Matrix3X4.M24.get -> T -Silk.NET.Maths.Matrix3X4.M24.set -> void -Silk.NET.Maths.Matrix3X4.M31.get -> T -Silk.NET.Maths.Matrix3X4.M31.set -> void -Silk.NET.Maths.Matrix3X4.M32.get -> T -Silk.NET.Maths.Matrix3X4.M32.set -> void -Silk.NET.Maths.Matrix3X4.M33.get -> T -Silk.NET.Maths.Matrix3X4.M33.set -> void -Silk.NET.Maths.Matrix3X4.M34.get -> T -Silk.NET.Maths.Matrix3X4.M34.set -> void -Silk.NET.Maths.Matrix3X4.Matrix3X4() -> void -Silk.NET.Maths.Matrix3X4.Matrix3X4(Silk.NET.Maths.Matrix2X4 value) -> void -Silk.NET.Maths.Matrix3X4.Matrix3X4(Silk.NET.Maths.Matrix3X2 value) -> void -Silk.NET.Maths.Matrix3X4.Matrix3X4(Silk.NET.Maths.Matrix3X3 value) -> void -Silk.NET.Maths.Matrix3X4.Matrix3X4(Silk.NET.Maths.Matrix3X4 value) -> void -Silk.NET.Maths.Matrix3X4.Matrix3X4(Silk.NET.Maths.Matrix4X2 value) -> void -Silk.NET.Maths.Matrix3X4.Matrix3X4(Silk.NET.Maths.Matrix4X3 value) -> void -Silk.NET.Maths.Matrix3X4.Matrix3X4(Silk.NET.Maths.Vector4D row1, Silk.NET.Maths.Vector4D row2, Silk.NET.Maths.Vector4D row3) -> void -Silk.NET.Maths.Matrix3X4.Matrix3X4(T m11, T m12, T m13, T m14, T m21, T m22, T m23, T m24, T m31, T m32, T m33, T m34) -> void -Silk.NET.Maths.Matrix3X4.Row1 -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix3X4.Row2 -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix3X4.Row3 -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix3X4.this[int x, int y].get -> T -Silk.NET.Maths.Matrix3X4.this[int x].get -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix4X2 -Silk.NET.Maths.Matrix4X2 -Silk.NET.Maths.Matrix4X2.As() -> Silk.NET.Maths.Matrix4X2 -Silk.NET.Maths.Matrix4X2.Column1.get -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix4X2.Column2.get -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix4X2.Equals(Silk.NET.Maths.Matrix4X2 other) -> bool -Silk.NET.Maths.Matrix4X2.IsIdentity.get -> bool -Silk.NET.Maths.Matrix4X2.M11.get -> T -Silk.NET.Maths.Matrix4X2.M11.set -> void -Silk.NET.Maths.Matrix4X2.M12.get -> T -Silk.NET.Maths.Matrix4X2.M12.set -> void -Silk.NET.Maths.Matrix4X2.M21.get -> T -Silk.NET.Maths.Matrix4X2.M21.set -> void -Silk.NET.Maths.Matrix4X2.M22.get -> T -Silk.NET.Maths.Matrix4X2.M22.set -> void -Silk.NET.Maths.Matrix4X2.M31.get -> T -Silk.NET.Maths.Matrix4X2.M31.set -> void -Silk.NET.Maths.Matrix4X2.M32.get -> T -Silk.NET.Maths.Matrix4X2.M32.set -> void -Silk.NET.Maths.Matrix4X2.M41.get -> T -Silk.NET.Maths.Matrix4X2.M41.set -> void -Silk.NET.Maths.Matrix4X2.M42.get -> T -Silk.NET.Maths.Matrix4X2.M42.set -> void -Silk.NET.Maths.Matrix4X2.Matrix4X2() -> void -Silk.NET.Maths.Matrix4X2.Matrix4X2(Silk.NET.Maths.Matrix2X4 value) -> void -Silk.NET.Maths.Matrix4X2.Matrix4X2(Silk.NET.Maths.Matrix3X2 value) -> void -Silk.NET.Maths.Matrix4X2.Matrix4X2(Silk.NET.Maths.Matrix3X3 value) -> void -Silk.NET.Maths.Matrix4X2.Matrix4X2(Silk.NET.Maths.Matrix3X4 value) -> void -Silk.NET.Maths.Matrix4X2.Matrix4X2(Silk.NET.Maths.Matrix4X3 value) -> void -Silk.NET.Maths.Matrix4X2.Matrix4X2(Silk.NET.Maths.Vector2D row1, Silk.NET.Maths.Vector2D row2, Silk.NET.Maths.Vector2D row3, Silk.NET.Maths.Vector2D row4) -> void -Silk.NET.Maths.Matrix4X2.Matrix4X2(T m11, T m12, T m21, T m22, T m31, T m32, T m41, T m42) -> void -Silk.NET.Maths.Matrix4X2.Row1 -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix4X2.Row2 -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix4X2.Row3 -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix4X2.Row4 -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix4X2.this[int x, int y].get -> T -Silk.NET.Maths.Matrix4X2.this[int x].get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Matrix4X3 -Silk.NET.Maths.Matrix4X3 -Silk.NET.Maths.Matrix4X3.As() -> Silk.NET.Maths.Matrix4X3 -Silk.NET.Maths.Matrix4X3.Column1.get -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix4X3.Column2.get -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix4X3.Column3.get -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix4X3.Equals(Silk.NET.Maths.Matrix4X3 other) -> bool -Silk.NET.Maths.Matrix4X3.IsIdentity.get -> bool -Silk.NET.Maths.Matrix4X3.M11.get -> T -Silk.NET.Maths.Matrix4X3.M11.set -> void -Silk.NET.Maths.Matrix4X3.M12.get -> T -Silk.NET.Maths.Matrix4X3.M12.set -> void -Silk.NET.Maths.Matrix4X3.M13.get -> T -Silk.NET.Maths.Matrix4X3.M13.set -> void -Silk.NET.Maths.Matrix4X3.M21.get -> T -Silk.NET.Maths.Matrix4X3.M21.set -> void -Silk.NET.Maths.Matrix4X3.M22.get -> T -Silk.NET.Maths.Matrix4X3.M22.set -> void -Silk.NET.Maths.Matrix4X3.M23.get -> T -Silk.NET.Maths.Matrix4X3.M23.set -> void -Silk.NET.Maths.Matrix4X3.M31.get -> T -Silk.NET.Maths.Matrix4X3.M31.set -> void -Silk.NET.Maths.Matrix4X3.M32.get -> T -Silk.NET.Maths.Matrix4X3.M32.set -> void -Silk.NET.Maths.Matrix4X3.M33.get -> T -Silk.NET.Maths.Matrix4X3.M33.set -> void -Silk.NET.Maths.Matrix4X3.M41.get -> T -Silk.NET.Maths.Matrix4X3.M41.set -> void -Silk.NET.Maths.Matrix4X3.M42.get -> T -Silk.NET.Maths.Matrix4X3.M42.set -> void -Silk.NET.Maths.Matrix4X3.M43.get -> T -Silk.NET.Maths.Matrix4X3.M43.set -> void -Silk.NET.Maths.Matrix4X3.Matrix4X3() -> void -Silk.NET.Maths.Matrix4X3.Matrix4X3(Silk.NET.Maths.Matrix2X4 value) -> void -Silk.NET.Maths.Matrix4X3.Matrix4X3(Silk.NET.Maths.Matrix3X2 value) -> void -Silk.NET.Maths.Matrix4X3.Matrix4X3(Silk.NET.Maths.Matrix3X3 value) -> void -Silk.NET.Maths.Matrix4X3.Matrix4X3(Silk.NET.Maths.Matrix3X4 value) -> void -Silk.NET.Maths.Matrix4X3.Matrix4X3(Silk.NET.Maths.Matrix4X2 value) -> void -Silk.NET.Maths.Matrix4X3.Matrix4X3(Silk.NET.Maths.Matrix4X3 value) -> void -Silk.NET.Maths.Matrix4X3.Matrix4X3(Silk.NET.Maths.Matrix4X4 value) -> void -Silk.NET.Maths.Matrix4X3.Matrix4X3(Silk.NET.Maths.Vector3D row1, Silk.NET.Maths.Vector3D row2, Silk.NET.Maths.Vector3D row3, Silk.NET.Maths.Vector3D row4) -> void -Silk.NET.Maths.Matrix4X3.Matrix4X3(T m11, T m12, T m13, T m21, T m22, T m23, T m31, T m32, T m33, T m41, T m42, T m43) -> void -Silk.NET.Maths.Matrix4X3.Row1 -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix4X3.Row2 -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix4X3.Row3 -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix4X3.Row4 -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix4X3.this[int x, int i].get -> T -Silk.NET.Maths.Matrix4X3.this[int x].get -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Matrix4X4 -Silk.NET.Maths.Matrix4X4 -Silk.NET.Maths.Matrix4X4.As() -> Silk.NET.Maths.Matrix4X4 -Silk.NET.Maths.Matrix4X4.Column1.get -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix4X4.Column2.get -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix4X4.Column3.get -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix4X4.Column4.get -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix4X4.Equals(Silk.NET.Maths.Matrix4X4 other) -> bool -Silk.NET.Maths.Matrix4X4.GetDeterminant() -> T -Silk.NET.Maths.Matrix4X4.IsIdentity.get -> bool -Silk.NET.Maths.Matrix4X4.M11.get -> T -Silk.NET.Maths.Matrix4X4.M11.set -> void -Silk.NET.Maths.Matrix4X4.M12.get -> T -Silk.NET.Maths.Matrix4X4.M12.set -> void -Silk.NET.Maths.Matrix4X4.M13.get -> T -Silk.NET.Maths.Matrix4X4.M13.set -> void -Silk.NET.Maths.Matrix4X4.M14.get -> T -Silk.NET.Maths.Matrix4X4.M14.set -> void -Silk.NET.Maths.Matrix4X4.M21.get -> T -Silk.NET.Maths.Matrix4X4.M21.set -> void -Silk.NET.Maths.Matrix4X4.M22.get -> T -Silk.NET.Maths.Matrix4X4.M22.set -> void -Silk.NET.Maths.Matrix4X4.M23.get -> T -Silk.NET.Maths.Matrix4X4.M23.set -> void -Silk.NET.Maths.Matrix4X4.M24.get -> T -Silk.NET.Maths.Matrix4X4.M24.set -> void -Silk.NET.Maths.Matrix4X4.M31.get -> T -Silk.NET.Maths.Matrix4X4.M31.set -> void -Silk.NET.Maths.Matrix4X4.M32.get -> T -Silk.NET.Maths.Matrix4X4.M32.set -> void -Silk.NET.Maths.Matrix4X4.M33.get -> T -Silk.NET.Maths.Matrix4X4.M33.set -> void -Silk.NET.Maths.Matrix4X4.M34.get -> T -Silk.NET.Maths.Matrix4X4.M34.set -> void -Silk.NET.Maths.Matrix4X4.M41.get -> T -Silk.NET.Maths.Matrix4X4.M41.set -> void -Silk.NET.Maths.Matrix4X4.M42.get -> T -Silk.NET.Maths.Matrix4X4.M42.set -> void -Silk.NET.Maths.Matrix4X4.M43.get -> T -Silk.NET.Maths.Matrix4X4.M43.set -> void -Silk.NET.Maths.Matrix4X4.M44.get -> T -Silk.NET.Maths.Matrix4X4.M44.set -> void -Silk.NET.Maths.Matrix4X4.Matrix4X4() -> void -Silk.NET.Maths.Matrix4X4.Matrix4X4(Silk.NET.Maths.Matrix2X4 value) -> void -Silk.NET.Maths.Matrix4X4.Matrix4X4(Silk.NET.Maths.Matrix3X2 value) -> void -Silk.NET.Maths.Matrix4X4.Matrix4X4(Silk.NET.Maths.Matrix3X3 value) -> void -Silk.NET.Maths.Matrix4X4.Matrix4X4(Silk.NET.Maths.Matrix3X4 value) -> void -Silk.NET.Maths.Matrix4X4.Matrix4X4(Silk.NET.Maths.Matrix4X2 value) -> void -Silk.NET.Maths.Matrix4X4.Matrix4X4(Silk.NET.Maths.Matrix4X3 value) -> void -Silk.NET.Maths.Matrix4X4.Matrix4X4(Silk.NET.Maths.Vector4D row1, Silk.NET.Maths.Vector4D row2, Silk.NET.Maths.Vector4D row3, Silk.NET.Maths.Vector4D row4) -> void -Silk.NET.Maths.Matrix4X4.Matrix4X4(T m11, T m12, T m13, T m14, T m21, T m22, T m23, T m24, T m31, T m32, T m33, T m34, T m41, T m42, T m43, T m44) -> void -Silk.NET.Maths.Matrix4X4.Row1 -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix4X4.Row2 -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix4X4.Row3 -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix4X4.Row4 -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix4X4.this[int x, int y].get -> T -Silk.NET.Maths.Matrix4X4.this[int x].get -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix5X4 -Silk.NET.Maths.Matrix5X4 -Silk.NET.Maths.Matrix5X4.As() -> Silk.NET.Maths.Matrix5X4 -Silk.NET.Maths.Matrix5X4.Equals(Silk.NET.Maths.Matrix5X4 other) -> bool -Silk.NET.Maths.Matrix5X4.IsIdentity.get -> bool -Silk.NET.Maths.Matrix5X4.M11.get -> T -Silk.NET.Maths.Matrix5X4.M11.set -> void -Silk.NET.Maths.Matrix5X4.M12.get -> T -Silk.NET.Maths.Matrix5X4.M12.set -> void -Silk.NET.Maths.Matrix5X4.M13.get -> T -Silk.NET.Maths.Matrix5X4.M13.set -> void -Silk.NET.Maths.Matrix5X4.M14.get -> T -Silk.NET.Maths.Matrix5X4.M14.set -> void -Silk.NET.Maths.Matrix5X4.M21.get -> T -Silk.NET.Maths.Matrix5X4.M21.set -> void -Silk.NET.Maths.Matrix5X4.M22.get -> T -Silk.NET.Maths.Matrix5X4.M22.set -> void -Silk.NET.Maths.Matrix5X4.M23.get -> T -Silk.NET.Maths.Matrix5X4.M23.set -> void -Silk.NET.Maths.Matrix5X4.M24.get -> T -Silk.NET.Maths.Matrix5X4.M24.set -> void -Silk.NET.Maths.Matrix5X4.M31.get -> T -Silk.NET.Maths.Matrix5X4.M31.set -> void -Silk.NET.Maths.Matrix5X4.M32.get -> T -Silk.NET.Maths.Matrix5X4.M32.set -> void -Silk.NET.Maths.Matrix5X4.M33.get -> T -Silk.NET.Maths.Matrix5X4.M33.set -> void -Silk.NET.Maths.Matrix5X4.M34.get -> T -Silk.NET.Maths.Matrix5X4.M34.set -> void -Silk.NET.Maths.Matrix5X4.M41.get -> T -Silk.NET.Maths.Matrix5X4.M41.set -> void -Silk.NET.Maths.Matrix5X4.M42.get -> T -Silk.NET.Maths.Matrix5X4.M42.set -> void -Silk.NET.Maths.Matrix5X4.M43.get -> T -Silk.NET.Maths.Matrix5X4.M43.set -> void -Silk.NET.Maths.Matrix5X4.M44.get -> T -Silk.NET.Maths.Matrix5X4.M44.set -> void -Silk.NET.Maths.Matrix5X4.M51.get -> T -Silk.NET.Maths.Matrix5X4.M51.set -> void -Silk.NET.Maths.Matrix5X4.M52.get -> T -Silk.NET.Maths.Matrix5X4.M52.set -> void -Silk.NET.Maths.Matrix5X4.M53.get -> T -Silk.NET.Maths.Matrix5X4.M53.set -> void -Silk.NET.Maths.Matrix5X4.M54.get -> T -Silk.NET.Maths.Matrix5X4.M54.set -> void -Silk.NET.Maths.Matrix5X4.Matrix5X4() -> void -Silk.NET.Maths.Matrix5X4.Matrix5X4(Silk.NET.Maths.Matrix2X4 value) -> void -Silk.NET.Maths.Matrix5X4.Matrix5X4(Silk.NET.Maths.Matrix3X2 value) -> void -Silk.NET.Maths.Matrix5X4.Matrix5X4(Silk.NET.Maths.Matrix3X3 value) -> void -Silk.NET.Maths.Matrix5X4.Matrix5X4(Silk.NET.Maths.Matrix3X4 value) -> void -Silk.NET.Maths.Matrix5X4.Matrix5X4(Silk.NET.Maths.Matrix4X2 value) -> void -Silk.NET.Maths.Matrix5X4.Matrix5X4(Silk.NET.Maths.Matrix4X3 value) -> void -Silk.NET.Maths.Matrix5X4.Matrix5X4(Silk.NET.Maths.Matrix4X4 value) -> void -Silk.NET.Maths.Matrix5X4.Matrix5X4(Silk.NET.Maths.Vector4D row1, Silk.NET.Maths.Vector4D row2, Silk.NET.Maths.Vector4D row3, Silk.NET.Maths.Vector4D row4, Silk.NET.Maths.Vector4D row5) -> void -Silk.NET.Maths.Matrix5X4.Matrix5X4(T m11, T m12, T m13, T m14, T m21, T m22, T m23, T m24, T m31, T m32, T m33, T m34, T m41, T m42, T m43, T m44, T m51, T m52, T m53, T m54) -> void -Silk.NET.Maths.Matrix5X4.Row1 -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix5X4.Row2 -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix5X4.Row3 -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix5X4.Row4 -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix5X4.Row5 -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Matrix5X4.this[int x, int y].get -> T -Silk.NET.Maths.Matrix5X4.this[int x].get -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Plane -Silk.NET.Maths.Plane -Silk.NET.Maths.Plane.As() -> Silk.NET.Maths.Plane -Silk.NET.Maths.Plane.Distance -> T -Silk.NET.Maths.Plane.Equals(Silk.NET.Maths.Plane other) -> bool -Silk.NET.Maths.Plane.Normal -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Plane.Plane() -> void -Silk.NET.Maths.Plane.Plane(Silk.NET.Maths.Vector3D normal, T distance) -> void -Silk.NET.Maths.Plane.Plane(Silk.NET.Maths.Vector4D value) -> void -Silk.NET.Maths.Plane.Plane(T x, T y, T z, T distance) -> void -Silk.NET.Maths.Quaternion -Silk.NET.Maths.Quaternion.As() -> Silk.NET.Maths.Quaternion -Silk.NET.Maths.Quaternion.Equals(Silk.NET.Maths.Quaternion other) -> bool -Silk.NET.Maths.Quaternion.IsIdentity.get -> bool -Silk.NET.Maths.Quaternion.Length() -> T -Silk.NET.Maths.Quaternion.LengthSquared() -> T -Silk.NET.Maths.Quaternion.Quaternion() -> void -Silk.NET.Maths.Quaternion.Quaternion(Silk.NET.Maths.Vector3D vectorPart, T scalarPart) -> void -Silk.NET.Maths.Quaternion.Quaternion(T x, T y, T z, T w) -> void -Silk.NET.Maths.Quaternion.W -> T -Silk.NET.Maths.Quaternion.X -> T -Silk.NET.Maths.Quaternion.Y -> T -Silk.NET.Maths.Quaternion.Z -> T -Silk.NET.Maths.Ray2D -Silk.NET.Maths.Ray2D.As() -> Silk.NET.Maths.Ray2D -Silk.NET.Maths.Ray2D.Direction -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Ray2D.Equals(Silk.NET.Maths.Ray2D other) -> bool -Silk.NET.Maths.Ray2D.GetPoint(T distance) -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Ray2D.Origin -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Ray2D.Ray2D() -> void -Silk.NET.Maths.Ray2D.Ray2D(Silk.NET.Maths.Vector2D origin, Silk.NET.Maths.Vector2D direction) -> void -Silk.NET.Maths.Ray2D.Ray2D(Silk.NET.Maths.Vector2D origin, T directionX, T directionY) -> void -Silk.NET.Maths.Ray2D.Ray2D(T originX, T originY, Silk.NET.Maths.Vector2D direction) -> void -Silk.NET.Maths.Ray2D.Ray2D(T originX, T originY, T directionX, T directionY) -> void -Silk.NET.Maths.Ray3D -Silk.NET.Maths.Ray3D.As() -> Silk.NET.Maths.Ray3D -Silk.NET.Maths.Ray3D.Direction -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Ray3D.Equals(Silk.NET.Maths.Ray3D other) -> bool -Silk.NET.Maths.Ray3D.GetPoint(T distance) -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Ray3D.Origin -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Ray3D.Ray3D() -> void -Silk.NET.Maths.Ray3D.Ray3D(Silk.NET.Maths.Vector3D origin, Silk.NET.Maths.Vector3D direction) -> void -Silk.NET.Maths.Ray3D.Ray3D(Silk.NET.Maths.Vector3D origin, T directionX, T directionY, T directionZ) -> void -Silk.NET.Maths.Ray3D.Ray3D(T originX, T originY, T originZ, Silk.NET.Maths.Vector3D direction) -> void -Silk.NET.Maths.Ray3D.Ray3D(T originX, T originY, T originZ, T directionX, T directionY, T directionZ) -> void -Silk.NET.Maths.Rectangle -Silk.NET.Maths.Rectangle -Silk.NET.Maths.Rectangle.As() -> Silk.NET.Maths.Rectangle -Silk.NET.Maths.Rectangle.Center.get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Rectangle.Contains(Silk.NET.Maths.Rectangle other) -> bool -Silk.NET.Maths.Rectangle.Contains(Silk.NET.Maths.Vector2D point) -> bool -Silk.NET.Maths.Rectangle.Equals(Silk.NET.Maths.Rectangle other) -> bool -Silk.NET.Maths.Rectangle.GetDistanceToNearestEdge(Silk.NET.Maths.Vector2D point) -> T -Silk.NET.Maths.Rectangle.GetInflated(Silk.NET.Maths.Vector2D point) -> Silk.NET.Maths.Rectangle -Silk.NET.Maths.Rectangle.GetScaled(Silk.NET.Maths.Vector2D scale, Silk.NET.Maths.Vector2D anchor) -> Silk.NET.Maths.Rectangle -Silk.NET.Maths.Rectangle.GetScaled(Silk.NET.Maths.Vector2D scale, Silk.NET.Maths.Vector2D anchor) -> Silk.NET.Maths.Rectangle -Silk.NET.Maths.Rectangle.GetTranslated(Silk.NET.Maths.Vector2D distance) -> Silk.NET.Maths.Rectangle -Silk.NET.Maths.Rectangle.HalfSize.get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Rectangle.Max.get -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Rectangle.Origin -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Rectangle.Rectangle() -> void -Silk.NET.Maths.Rectangle.Rectangle(Silk.NET.Maths.Vector2D origin, Silk.NET.Maths.Vector2D size) -> void -Silk.NET.Maths.Rectangle.Rectangle(Silk.NET.Maths.Vector2D origin, T sizeX, T sizeY) -> void -Silk.NET.Maths.Rectangle.Rectangle(T originX, T originY, Silk.NET.Maths.Vector2D size) -> void -Silk.NET.Maths.Rectangle.Rectangle(T originX, T originY, T sizeX, T sizeY) -> void -Silk.NET.Maths.Rectangle.Size -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Scalar -Silk.NET.Maths.Scalar -Silk.NET.Maths.Sphere -Silk.NET.Maths.Sphere.As() -> Silk.NET.Maths.Sphere -Silk.NET.Maths.Sphere.Center -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Sphere.Contains(Silk.NET.Maths.Sphere other) -> bool -Silk.NET.Maths.Sphere.Contains(Silk.NET.Maths.Vector3D point) -> bool -Silk.NET.Maths.Sphere.Diameter.get -> T -Silk.NET.Maths.Sphere.Equals(Silk.NET.Maths.Sphere other) -> bool -Silk.NET.Maths.Sphere.GetDistanceToNearestEdge(Silk.NET.Maths.Vector3D point) -> T -Silk.NET.Maths.Sphere.GetDistanceToNearestEdgeSquared(Silk.NET.Maths.Vector3D point) -> T -Silk.NET.Maths.Sphere.GetInflated(Silk.NET.Maths.Vector3D point) -> Silk.NET.Maths.Sphere -Silk.NET.Maths.Sphere.GetTranslated(Silk.NET.Maths.Vector3D distance) -> Silk.NET.Maths.Sphere -Silk.NET.Maths.Sphere.Radius -> T -Silk.NET.Maths.Sphere.Sphere() -> void -Silk.NET.Maths.Sphere.Sphere(Silk.NET.Maths.Vector3D center, T radius) -> void -Silk.NET.Maths.Sphere.Sphere(T centerX, T centerY, T centerZ, T radius) -> void -Silk.NET.Maths.Sphere.SquaredRadius.get -> T -Silk.NET.Maths.SystemNumericsExtensions -Silk.NET.Maths.Vector2D -Silk.NET.Maths.Vector2D -Silk.NET.Maths.Vector2D.As() -> Silk.NET.Maths.Vector2D -Silk.NET.Maths.Vector2D.CopyTo(T[]? array) -> void -Silk.NET.Maths.Vector2D.CopyTo(T[]? array, int index) -> void -Silk.NET.Maths.Vector2D.Equals(Silk.NET.Maths.Vector2D other) -> bool -Silk.NET.Maths.Vector2D.Length.get -> T -Silk.NET.Maths.Vector2D.LengthSquared.get -> T -Silk.NET.Maths.Vector2D.this[int i].get -> T -Silk.NET.Maths.Vector2D.ToString(string? format) -> string! -Silk.NET.Maths.Vector2D.ToString(string? format, System.IFormatProvider? formatProvider) -> string! -Silk.NET.Maths.Vector2D.Vector2D() -> void -Silk.NET.Maths.Vector2D.Vector2D(T value) -> void -Silk.NET.Maths.Vector2D.Vector2D(T x, T y) -> void -Silk.NET.Maths.Vector2D.X -> T -Silk.NET.Maths.Vector2D.Y -> T -Silk.NET.Maths.Vector3D -Silk.NET.Maths.Vector3D -Silk.NET.Maths.Vector3D.As() -> Silk.NET.Maths.Vector3D -Silk.NET.Maths.Vector3D.CopyTo(T[]? array) -> void -Silk.NET.Maths.Vector3D.CopyTo(T[]? array, int index) -> void -Silk.NET.Maths.Vector3D.Equals(Silk.NET.Maths.Vector3D other) -> bool -Silk.NET.Maths.Vector3D.Length.get -> T -Silk.NET.Maths.Vector3D.LengthSquared.get -> T -Silk.NET.Maths.Vector3D.this[int i].get -> T -Silk.NET.Maths.Vector3D.ToString(string? format) -> string! -Silk.NET.Maths.Vector3D.ToString(string? format, System.IFormatProvider? formatProvider) -> string! -Silk.NET.Maths.Vector3D.Vector3D() -> void -Silk.NET.Maths.Vector3D.Vector3D(Silk.NET.Maths.Vector2D value, T z) -> void -Silk.NET.Maths.Vector3D.Vector3D(T value) -> void -Silk.NET.Maths.Vector3D.Vector3D(T x, T y, T z) -> void -Silk.NET.Maths.Vector3D.X -> T -Silk.NET.Maths.Vector3D.Y -> T -Silk.NET.Maths.Vector3D.Z -> T -Silk.NET.Maths.Vector4D -Silk.NET.Maths.Vector4D -Silk.NET.Maths.Vector4D.As() -> Silk.NET.Maths.Vector4D -Silk.NET.Maths.Vector4D.CopyTo(T[]? array) -> void -Silk.NET.Maths.Vector4D.CopyTo(T[]? array, int index) -> void -Silk.NET.Maths.Vector4D.Equals(Silk.NET.Maths.Vector4D other) -> bool -Silk.NET.Maths.Vector4D.Length.get -> T -Silk.NET.Maths.Vector4D.LengthSquared.get -> T -Silk.NET.Maths.Vector4D.this[int i].get -> T -Silk.NET.Maths.Vector4D.ToString(string? format) -> string! -Silk.NET.Maths.Vector4D.ToString(string? format, System.IFormatProvider? formatProvider) -> string! -Silk.NET.Maths.Vector4D.Vector4D() -> void -Silk.NET.Maths.Vector4D.Vector4D(Silk.NET.Maths.Vector2D value, T z, T w) -> void -Silk.NET.Maths.Vector4D.Vector4D(Silk.NET.Maths.Vector3D value, T w) -> void -Silk.NET.Maths.Vector4D.Vector4D(T value) -> void -Silk.NET.Maths.Vector4D.Vector4D(T x, T y, T z, T w) -> void -Silk.NET.Maths.Vector4D.W -> T -Silk.NET.Maths.Vector4D.X -> T -Silk.NET.Maths.Vector4D.Y -> T -Silk.NET.Maths.Vector4D.Z -> T -static readonly Silk.NET.Maths.Scalar.DegreesPerRadian -> T -static readonly Silk.NET.Maths.Scalar.E -> T -static readonly Silk.NET.Maths.Scalar.Epsilon -> T -static readonly Silk.NET.Maths.Scalar.MaxValue -> T -static readonly Silk.NET.Maths.Scalar.MinusOne -> T -static readonly Silk.NET.Maths.Scalar.MinusTwo -> T -static readonly Silk.NET.Maths.Scalar.MinValue -> T -static readonly Silk.NET.Maths.Scalar.NaN -> T -static readonly Silk.NET.Maths.Scalar.NegativeInfinity -> T -static readonly Silk.NET.Maths.Scalar.One -> T -static readonly Silk.NET.Maths.Scalar.Pi -> T -static readonly Silk.NET.Maths.Scalar.PiOver2 -> T -static readonly Silk.NET.Maths.Scalar.PositiveInfinity -> T -static readonly Silk.NET.Maths.Scalar.RadiansPerDegree -> T -static readonly Silk.NET.Maths.Scalar.Tau -> T -static readonly Silk.NET.Maths.Scalar.Two -> T -static readonly Silk.NET.Maths.Scalar.Zero -> T -static Silk.NET.Maths.Box2D.operator !=(Silk.NET.Maths.Box2D value1, Silk.NET.Maths.Box2D value2) -> bool -static Silk.NET.Maths.Box2D.operator ==(Silk.NET.Maths.Box2D value1, Silk.NET.Maths.Box2D value2) -> bool -static Silk.NET.Maths.Box3D.operator !=(Silk.NET.Maths.Box3D value1, Silk.NET.Maths.Box3D value2) -> bool -static Silk.NET.Maths.Box3D.operator ==(Silk.NET.Maths.Box3D value1, Silk.NET.Maths.Box3D value2) -> bool -static Silk.NET.Maths.Circle.operator !=(Silk.NET.Maths.Circle value1, Silk.NET.Maths.Circle value2) -> bool -static Silk.NET.Maths.Circle.operator ==(Silk.NET.Maths.Circle value1, Silk.NET.Maths.Circle value2) -> bool -static Silk.NET.Maths.Cube.operator !=(Silk.NET.Maths.Cube value1, Silk.NET.Maths.Cube value2) -> bool -static Silk.NET.Maths.Cube.operator ==(Silk.NET.Maths.Cube value1, Silk.NET.Maths.Cube value2) -> bool -static Silk.NET.Maths.Matrix2X2.Add(Silk.NET.Maths.Matrix2X2 value1, Silk.NET.Maths.Matrix2X2 value2) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.Lerp(Silk.NET.Maths.Matrix2X2 matrix1, Silk.NET.Maths.Matrix2X2 matrix2, T amount) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.Multiply(Silk.NET.Maths.Matrix2X2 value1, Silk.NET.Maths.Matrix2X2 value2) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.Multiply(Silk.NET.Maths.Matrix2X2 value1, Silk.NET.Maths.Matrix2X3 value2) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X2.Multiply(Silk.NET.Maths.Matrix2X2 value1, T value2) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.Multiply(Silk.NET.Maths.Matrix3X2 value1, Silk.NET.Maths.Matrix2X2 value2) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix2X2.Multiply(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Matrix2X2 value2) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Matrix2X2.Negate(Silk.NET.Maths.Matrix2X2 value) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.Subtract(Silk.NET.Maths.Matrix2X2 value1, Silk.NET.Maths.Matrix2X2 value2) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.Identity.get -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.operator !=(Silk.NET.Maths.Matrix2X2 value1, Silk.NET.Maths.Matrix2X2 value2) -> bool -static Silk.NET.Maths.Matrix2X2.operator *(Silk.NET.Maths.Matrix2X2 value1, Silk.NET.Maths.Matrix2X2 value2) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.operator *(Silk.NET.Maths.Matrix2X2 value1, T value2) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.operator *(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Matrix2X2 value2) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Matrix2X2.operator +(Silk.NET.Maths.Matrix2X2 value1, Silk.NET.Maths.Matrix2X2 value2) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.operator -(Silk.NET.Maths.Matrix2X2 value) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.operator -(Silk.NET.Maths.Matrix2X2 value1, Silk.NET.Maths.Matrix2X2 value2) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X2.operator ==(Silk.NET.Maths.Matrix2X2 value1, Silk.NET.Maths.Matrix2X2 value2) -> bool -static Silk.NET.Maths.Matrix2X3.Add(Silk.NET.Maths.Matrix2X3 value1, Silk.NET.Maths.Matrix2X3 value2) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.CreateBillboard(Silk.NET.Maths.Vector3D objectPosition, Silk.NET.Maths.Vector3D cameraPosition, Silk.NET.Maths.Vector3D cameraUpVector, Silk.NET.Maths.Vector3D cameraForwardVector) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.CreateFromAxisAngle(Silk.NET.Maths.Vector3D axis, T angle) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.CreateFromQuaternion(Silk.NET.Maths.Quaternion quaternion) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.CreateFromYawPitchRoll(T yaw, T pitch, T roll) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.Lerp(Silk.NET.Maths.Matrix2X3 matrix1, Silk.NET.Maths.Matrix2X3 matrix2, T amount) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.Multiply(Silk.NET.Maths.Matrix2X2 value1, Silk.NET.Maths.Matrix2X3 value2) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.Multiply(Silk.NET.Maths.Matrix2X3 value1, Silk.NET.Maths.Matrix3X2 value2) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X3.Multiply(Silk.NET.Maths.Matrix2X3 value1, Silk.NET.Maths.Matrix3X3 value2) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.Multiply(Silk.NET.Maths.Matrix2X3 value1, T value2) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.Multiply(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Matrix2X3 value2) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Matrix2X3.Negate(Silk.NET.Maths.Matrix2X3 value) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.Subtract(Silk.NET.Maths.Matrix2X3 value1, Silk.NET.Maths.Matrix2X3 value2) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.Transform(Silk.NET.Maths.Matrix2X3 value, Silk.NET.Maths.Quaternion rotation) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.Identity.get -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.operator !=(Silk.NET.Maths.Matrix2X3 value1, Silk.NET.Maths.Matrix2X3 value2) -> bool -static Silk.NET.Maths.Matrix2X3.operator *(Silk.NET.Maths.Matrix2X2 value1, Silk.NET.Maths.Matrix2X3 value2) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.operator *(Silk.NET.Maths.Matrix2X3 value1, Silk.NET.Maths.Matrix3X2 value2) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X3.operator *(Silk.NET.Maths.Matrix2X3 value1, Silk.NET.Maths.Matrix3X3 value2) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.operator *(Silk.NET.Maths.Matrix2X3 value1, T value2) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.operator *(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Matrix2X3 value2) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Matrix2X3.operator +(Silk.NET.Maths.Matrix2X3 value1, Silk.NET.Maths.Matrix2X3 value2) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.operator -(Silk.NET.Maths.Matrix2X3 value) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.operator -(Silk.NET.Maths.Matrix2X3 value1, Silk.NET.Maths.Matrix2X3 value2) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X3.operator ==(Silk.NET.Maths.Matrix2X3 value1, Silk.NET.Maths.Matrix2X3 value2) -> bool -static Silk.NET.Maths.Matrix2X4.Add(Silk.NET.Maths.Matrix2X4 value1, Silk.NET.Maths.Matrix2X4 value2) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.Lerp(Silk.NET.Maths.Matrix2X4 matrix1, Silk.NET.Maths.Matrix2X4 matrix2, T amount) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.Multiply(Silk.NET.Maths.Matrix2X2 value1, Silk.NET.Maths.Matrix2X4 value2) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.Multiply(Silk.NET.Maths.Matrix2X4 value1, Silk.NET.Maths.Matrix4X2 value2) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix2X4.Multiply(Silk.NET.Maths.Matrix2X4 value1, Silk.NET.Maths.Matrix4X3 value2) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X4.Multiply(Silk.NET.Maths.Matrix2X4 value1, Silk.NET.Maths.Matrix4X4 value2) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.Multiply(Silk.NET.Maths.Matrix3X2 value1, Silk.NET.Maths.Matrix2X4 value2) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix2X4.Multiply(Silk.NET.Maths.Matrix4X2 value1, Silk.NET.Maths.Matrix2X4 value2) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix2X4.Multiply(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Matrix2X4 value2) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.Identity.get -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.operator !=(Silk.NET.Maths.Matrix2X4 value1, Silk.NET.Maths.Matrix2X4 value2) -> bool -static Silk.NET.Maths.Matrix2X4.operator *(Silk.NET.Maths.Matrix2X2 value1, Silk.NET.Maths.Matrix2X4 value2) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.operator *(Silk.NET.Maths.Matrix2X4 value1, Silk.NET.Maths.Matrix4X3 value2) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix2X4.operator *(Silk.NET.Maths.Matrix2X4 value1, Silk.NET.Maths.Matrix4X4 value2) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.operator *(Silk.NET.Maths.Matrix2X4 value1, T value2) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.operator *(Silk.NET.Maths.Matrix3X2 value1, Silk.NET.Maths.Matrix2X4 value2) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix2X4.operator *(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Matrix2X4 value2) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Matrix2X4.operator +(Silk.NET.Maths.Matrix2X4 value1, Silk.NET.Maths.Matrix2X4 value2) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.operator -(Silk.NET.Maths.Matrix2X4 value) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.operator -(Silk.NET.Maths.Matrix2X4 value1, Silk.NET.Maths.Matrix2X4 value2) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix2X4.operator ==(Silk.NET.Maths.Matrix2X4 value1, Silk.NET.Maths.Matrix2X4 value2) -> bool -static Silk.NET.Maths.Matrix3X2.Add(Silk.NET.Maths.Matrix3X2 value1, Silk.NET.Maths.Matrix3X2 value2) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.CreateRotation(T radians) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.CreateRotation(T radians, Silk.NET.Maths.Vector2D centerPoint) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.CreateScale(Silk.NET.Maths.Vector2D scales) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.CreateScale(Silk.NET.Maths.Vector2D scales, Silk.NET.Maths.Vector2D centerPoint) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.CreateScale(T scale) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.CreateScale(T scale, Silk.NET.Maths.Vector2D centerPoint) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.CreateScale(T xScale, T yScale) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.CreateScale(T xScale, T yScale, Silk.NET.Maths.Vector2D centerPoint) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.CreateSkew(T radiansX, T radiansY) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.CreateSkew(T radiansX, T radiansY, Silk.NET.Maths.Vector2D centerPoint) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.CreateTranslation(Silk.NET.Maths.Vector2D position) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.CreateTranslation(T xPosition, T yPosition) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.Invert(Silk.NET.Maths.Matrix3X2 matrix, out Silk.NET.Maths.Matrix3X2 result) -> bool -static Silk.NET.Maths.Matrix3X2.Lerp(Silk.NET.Maths.Matrix3X2 matrix1, Silk.NET.Maths.Matrix3X2 matrix2, T amount) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.Multiply(Silk.NET.Maths.Matrix2X3 value1, Silk.NET.Maths.Matrix3X2 value2) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix3X2.Multiply(Silk.NET.Maths.Matrix2X3 value1, Silk.NET.Maths.Matrix3X3 value2) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix3X2.Multiply(Silk.NET.Maths.Matrix3X2 value1, Silk.NET.Maths.Matrix2X2 value2) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.Multiply(Silk.NET.Maths.Matrix3X2 value1, Silk.NET.Maths.Matrix2X3 value2) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X2.Multiply(Silk.NET.Maths.Matrix3X2 value1, T value2) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.Multiply(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Matrix3X2 value2) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Matrix3X2.Negate(Silk.NET.Maths.Matrix3X2 value) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.Subtract(Silk.NET.Maths.Matrix3X2 value1, Silk.NET.Maths.Matrix3X2 value2) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.explicit operator System.Numerics.Matrix3x2(Silk.NET.Maths.Matrix3X2 from) -> System.Numerics.Matrix3x2 -static Silk.NET.Maths.Matrix3X2.Identity.get -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.operator !=(Silk.NET.Maths.Matrix3X2 value1, Silk.NET.Maths.Matrix3X2 value2) -> bool -static Silk.NET.Maths.Matrix3X2.operator *(Silk.NET.Maths.Matrix3X2 value1, Silk.NET.Maths.Matrix2X2 value2) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.operator *(Silk.NET.Maths.Matrix3X2 value1, Silk.NET.Maths.Matrix2X3 value2) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X2.operator *(Silk.NET.Maths.Matrix3X2 value1, T value2) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.operator *(Silk.NET.Maths.Matrix3X3 value1, Silk.NET.Maths.Matrix3X2 value2) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.operator *(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Matrix3X2 value2) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Matrix3X2.operator +(Silk.NET.Maths.Matrix3X2 value1, Silk.NET.Maths.Matrix3X2 value2) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.operator -(Silk.NET.Maths.Matrix3X2 value) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.operator -(Silk.NET.Maths.Matrix3X2 value1, Silk.NET.Maths.Matrix3X2 value2) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X2.operator ==(Silk.NET.Maths.Matrix3X2 value1, Silk.NET.Maths.Matrix3X2 value2) -> bool -static Silk.NET.Maths.Matrix3X3.Add(Silk.NET.Maths.Matrix3X3 value1, Silk.NET.Maths.Matrix3X3 value2) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.CreateBillboard(Silk.NET.Maths.Vector3D objectPosition, Silk.NET.Maths.Vector3D cameraPosition, Silk.NET.Maths.Vector3D cameraUpVector, Silk.NET.Maths.Vector3D cameraForwardVector) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.CreateFromAxisAngle(Silk.NET.Maths.Vector3D axis, T angle) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.CreateFromQuaternion(Silk.NET.Maths.Quaternion quaternion) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.CreateFromYawPitchRoll(T yaw, T pitch, T roll) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.CreateRotationX(T radians) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.CreateRotationY(T radians) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.CreateRotationZ(T radians) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.CreateScale(Silk.NET.Maths.Vector3D scales) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.CreateScale(T scale) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.CreateScale(T xScale, T yScale, T zScale) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.Decompose(Silk.NET.Maths.Matrix3X3 matrix, out Silk.NET.Maths.Vector3D scale, out Silk.NET.Maths.Quaternion rotation) -> bool -static Silk.NET.Maths.Matrix3X3.Lerp(Silk.NET.Maths.Matrix3X3 matrix1, Silk.NET.Maths.Matrix3X3 matrix2, T amount) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.Multiply(Silk.NET.Maths.Matrix2X3 value1, Silk.NET.Maths.Matrix3X3 value2) -> Silk.NET.Maths.Matrix2X3 -static Silk.NET.Maths.Matrix3X3.Multiply(Silk.NET.Maths.Matrix3X3 value1, Silk.NET.Maths.Matrix3X2 value2) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix3X3.Multiply(Silk.NET.Maths.Matrix3X3 value1, Silk.NET.Maths.Matrix3X3 value2) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.Multiply(Silk.NET.Maths.Matrix3X3 value1, Silk.NET.Maths.Matrix3X4 value2) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X3.Multiply(Silk.NET.Maths.Matrix3X3 value1, T value2) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.Multiply(Silk.NET.Maths.Matrix4X3 value1, Silk.NET.Maths.Matrix3X3 value2) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix3X3.Multiply(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Matrix3X3 value2) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Matrix3X3.Negate(Silk.NET.Maths.Matrix3X3 value) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.Subtract(Silk.NET.Maths.Matrix3X3 value1, Silk.NET.Maths.Matrix3X3 value2) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.Transform(Silk.NET.Maths.Matrix3X3 value, Silk.NET.Maths.Quaternion rotation) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.Transpose(Silk.NET.Maths.Matrix3X3 matrix) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.Identity.get -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.operator !=(Silk.NET.Maths.Matrix3X3 value1, Silk.NET.Maths.Matrix3X3 value2) -> bool -static Silk.NET.Maths.Matrix3X3.operator *(Silk.NET.Maths.Matrix3X3 value1, Silk.NET.Maths.Matrix3X3 value2) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.operator *(Silk.NET.Maths.Matrix3X3 value1, T value2) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.operator *(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Matrix3X3 value2) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Matrix3X3.operator +(Silk.NET.Maths.Matrix3X3 value1, Silk.NET.Maths.Matrix3X3 value2) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.operator -(Silk.NET.Maths.Matrix3X3 value) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.operator -(Silk.NET.Maths.Matrix3X3 value1, Silk.NET.Maths.Matrix3X3 value2) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X3.operator ==(Silk.NET.Maths.Matrix3X3 value1, Silk.NET.Maths.Matrix3X3 value2) -> bool -static Silk.NET.Maths.Matrix3X4.Add(Silk.NET.Maths.Matrix3X4 value1, Silk.NET.Maths.Matrix3X4 value2) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.Lerp(Silk.NET.Maths.Matrix3X4 matrix1, Silk.NET.Maths.Matrix3X4 matrix2, T amount) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.Multiply(Silk.NET.Maths.Matrix3X3 value1, Silk.NET.Maths.Matrix3X4 value2) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.Multiply(Silk.NET.Maths.Matrix3X4 value1, Silk.NET.Maths.Matrix4X3 value2) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X4.Multiply(Silk.NET.Maths.Matrix3X4 value1, Silk.NET.Maths.Matrix4X4 value2) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.Multiply(Silk.NET.Maths.Matrix3X4 value1, T value2) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.Multiply(Silk.NET.Maths.Matrix4X3 value1, Silk.NET.Maths.Matrix3X4 value2) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix3X4.Multiply(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Matrix3X4 value2) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Matrix3X4.Negate(Silk.NET.Maths.Matrix3X4 value) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.Subtract(Silk.NET.Maths.Matrix3X4 value1, Silk.NET.Maths.Matrix3X4 value2) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.Identity.get -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.operator !=(Silk.NET.Maths.Matrix3X4 value1, Silk.NET.Maths.Matrix3X4 value2) -> bool -static Silk.NET.Maths.Matrix3X4.operator *(Silk.NET.Maths.Matrix3X3 value1, Silk.NET.Maths.Matrix3X4 value2) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.operator *(Silk.NET.Maths.Matrix3X4 value1, Silk.NET.Maths.Matrix4X3 value2) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix3X4.operator *(Silk.NET.Maths.Matrix3X4 value1, T value2) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.operator *(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Matrix3X4 value2) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Matrix3X4.operator +(Silk.NET.Maths.Matrix3X4 value1, Silk.NET.Maths.Matrix3X4 value2) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.operator -(Silk.NET.Maths.Matrix3X4 value) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.operator -(Silk.NET.Maths.Matrix3X4 value1, Silk.NET.Maths.Matrix3X4 value2) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix3X4.operator ==(Silk.NET.Maths.Matrix3X4 value1, Silk.NET.Maths.Matrix3X4 value2) -> bool -static Silk.NET.Maths.Matrix4X2.Add(Silk.NET.Maths.Matrix4X2 value1, Silk.NET.Maths.Matrix4X2 value2) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.Lerp(Silk.NET.Maths.Matrix4X2 matrix1, Silk.NET.Maths.Matrix4X2 matrix2, T amount) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.Multiply(Silk.NET.Maths.Matrix2X4 value1, Silk.NET.Maths.Matrix4X2 value2) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix4X2.Multiply(Silk.NET.Maths.Matrix3X4 value1, Silk.NET.Maths.Matrix4X2 value2) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix4X2.Multiply(Silk.NET.Maths.Matrix4X2 value1, Silk.NET.Maths.Matrix2X2 value2) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.Multiply(Silk.NET.Maths.Matrix4X2 value1, Silk.NET.Maths.Matrix2X3 value2) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X2.Multiply(Silk.NET.Maths.Matrix4X2 value1, Silk.NET.Maths.Matrix2X4 value2) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X2.Multiply(Silk.NET.Maths.Matrix4X4 value1, Silk.NET.Maths.Matrix4X2 value2) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.Multiply(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Matrix4X2 value2) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Matrix4X2.Negate(Silk.NET.Maths.Matrix4X2 value) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.Subtract(Silk.NET.Maths.Matrix4X2 value1, Silk.NET.Maths.Matrix4X2 value2) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.Identity.get -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.operator !=(Silk.NET.Maths.Matrix4X2 value1, Silk.NET.Maths.Matrix4X2 value2) -> bool -static Silk.NET.Maths.Matrix4X2.operator *(Silk.NET.Maths.Matrix2X4 value1, Silk.NET.Maths.Matrix4X2 value2) -> Silk.NET.Maths.Matrix2X2 -static Silk.NET.Maths.Matrix4X2.operator *(Silk.NET.Maths.Matrix3X4 value1, Silk.NET.Maths.Matrix4X2 value2) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.Matrix4X2.operator *(Silk.NET.Maths.Matrix4X2 value1, Silk.NET.Maths.Matrix2X2 value2) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.operator *(Silk.NET.Maths.Matrix4X2 value1, Silk.NET.Maths.Matrix2X3 value2) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X2.operator *(Silk.NET.Maths.Matrix4X2 value1, Silk.NET.Maths.Matrix2X4 value2) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X2.operator *(Silk.NET.Maths.Matrix4X2 value1, T value2) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.operator *(Silk.NET.Maths.Matrix4X4 value1, Silk.NET.Maths.Matrix4X2 value2) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.operator *(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Matrix4X2 value2) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Matrix4X2.operator +(Silk.NET.Maths.Matrix4X2 value1, Silk.NET.Maths.Matrix4X2 value2) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.operator -(Silk.NET.Maths.Matrix4X2 value) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.operator -(Silk.NET.Maths.Matrix4X2 value1, Silk.NET.Maths.Matrix4X2 value2) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X2.operator ==(Silk.NET.Maths.Matrix4X2 value1, Silk.NET.Maths.Matrix4X2 value2) -> bool -static Silk.NET.Maths.Matrix4X3.Add(Silk.NET.Maths.Matrix4X3 value1, Silk.NET.Maths.Matrix4X3 value2) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.Lerp(Silk.NET.Maths.Matrix4X3 matrix1, Silk.NET.Maths.Matrix4X3 matrix2, T amount) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.Multiply(Silk.NET.Maths.Matrix3X4 value1, Silk.NET.Maths.Matrix4X3 value2) -> Silk.NET.Maths.Matrix3X3 -static Silk.NET.Maths.Matrix4X3.Multiply(Silk.NET.Maths.Matrix4X3 value1, Silk.NET.Maths.Matrix3X3 value2) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.Multiply(Silk.NET.Maths.Matrix4X3 value1, Silk.NET.Maths.Matrix3X4 value2) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X3.Multiply(Silk.NET.Maths.Matrix4X3 value1, T value2) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.Multiply(Silk.NET.Maths.Matrix4X4 value1, Silk.NET.Maths.Matrix4X3 value2) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.Multiply(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Matrix4X3 value2) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Matrix4X3.Negate(Silk.NET.Maths.Matrix4X3 value) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.Subtract(Silk.NET.Maths.Matrix4X3 value1, Silk.NET.Maths.Matrix4X3 value2) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.Identity.get -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.operator !=(Silk.NET.Maths.Matrix4X3 value1, Silk.NET.Maths.Matrix4X3 value2) -> bool -static Silk.NET.Maths.Matrix4X3.operator *(Silk.NET.Maths.Matrix4X3 value1, Silk.NET.Maths.Matrix3X3 value2) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.operator *(Silk.NET.Maths.Matrix4X3 value1, Silk.NET.Maths.Matrix3X4 value2) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X3.operator *(Silk.NET.Maths.Matrix4X3 value1, T value2) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.operator *(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Matrix4X3 value2) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Matrix4X3.operator +(Silk.NET.Maths.Matrix4X3 value1, Silk.NET.Maths.Matrix4X3 value2) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.operator -(Silk.NET.Maths.Matrix4X3 value) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.operator -(Silk.NET.Maths.Matrix4X3 value1, Silk.NET.Maths.Matrix4X3 value2) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X3.operator ==(Silk.NET.Maths.Matrix4X3 value1, Silk.NET.Maths.Matrix4X3 value2) -> bool -static Silk.NET.Maths.Matrix4X4.Add(Silk.NET.Maths.Matrix4X4 value1, Silk.NET.Maths.Matrix4X4 value2) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateBillboard(Silk.NET.Maths.Vector3D objectPosition, Silk.NET.Maths.Vector3D cameraPosition, Silk.NET.Maths.Vector3D cameraUpVector, Silk.NET.Maths.Vector3D cameraForwardVector) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateConstrainedBillboard(Silk.NET.Maths.Vector3D objectPosition, Silk.NET.Maths.Vector3D cameraPosition, Silk.NET.Maths.Vector3D rotateAxis, Silk.NET.Maths.Vector3D cameraForwardVector, Silk.NET.Maths.Vector3D objectForwardVector) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateFromAxisAngle(Silk.NET.Maths.Vector3D axis, T angle) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateFromQuaternion(Silk.NET.Maths.Quaternion quaternion) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateFromYawPitchRoll(T yaw, T pitch, T roll) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateLookAt(Silk.NET.Maths.Vector3D cameraPosition, Silk.NET.Maths.Vector3D cameraTarget, Silk.NET.Maths.Vector3D cameraUpVector) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateOrthographic(T width, T height, T zNearPlane, T zFarPlane) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateOrthographicOffCenter(T left, T right, T bottom, T top, T zNearPlane, T zFarPlane) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreatePerspective(T width, T height, T nearPlaneDistance, T farPlaneDistance) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreatePerspectiveFieldOfView(T fieldOfView, T aspectRatio, T nearPlaneDistance, T farPlaneDistance) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreatePerspectiveOffCenter(T left, T right, T bottom, T top, T nearPlaneDistance, T farPlaneDistance) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateReflection(Silk.NET.Maths.Plane value) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateRotationX(T radians) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateRotationX(T radians, Silk.NET.Maths.Vector3D centerPoint) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateRotationY(T radians) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateRotationY(T radians, Silk.NET.Maths.Vector3D centerPoint) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateRotationZ(T radians) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateRotationZ(T radians, Silk.NET.Maths.Vector3D centerPoint) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateScale(Silk.NET.Maths.Vector3D scales) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateScale(Silk.NET.Maths.Vector3D scales, Silk.NET.Maths.Vector3D centerPoint) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateScale(T scale) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateScale(T scale, Silk.NET.Maths.Vector3D centerPoint) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateScale(T xScale, T yScale, T zScale) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateScale(T xScale, T yScale, T zScale, Silk.NET.Maths.Vector3D centerPoint) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateShadow(Silk.NET.Maths.Vector3D lightDirection, Silk.NET.Maths.Plane plane) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateTranslation(Silk.NET.Maths.Vector3D position) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateTranslation(T xPosition, T yPosition, T zPosition) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.CreateWorld(Silk.NET.Maths.Vector3D position, Silk.NET.Maths.Vector3D forward, Silk.NET.Maths.Vector3D up) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.Decompose(Silk.NET.Maths.Matrix4X4 matrix, out Silk.NET.Maths.Vector3D scale, out Silk.NET.Maths.Quaternion rotation, out Silk.NET.Maths.Vector3D translation) -> bool -static Silk.NET.Maths.Matrix4X4.Invert(Silk.NET.Maths.Matrix4X4 matrix, out Silk.NET.Maths.Matrix4X4 result) -> bool -static Silk.NET.Maths.Matrix4X4.Lerp(Silk.NET.Maths.Matrix4X4 matrix1, Silk.NET.Maths.Matrix4X4 matrix2, T amount) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.Multiply(Silk.NET.Maths.Matrix2X4 value1, Silk.NET.Maths.Matrix4X4 value2) -> Silk.NET.Maths.Matrix2X4 -static Silk.NET.Maths.Matrix4X4.Multiply(Silk.NET.Maths.Matrix4X4 value1, Silk.NET.Maths.Matrix4X2 value2) -> Silk.NET.Maths.Matrix4X2 -static Silk.NET.Maths.Matrix4X4.Multiply(Silk.NET.Maths.Matrix4X4 value1, Silk.NET.Maths.Matrix4X4 value2) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.Multiply(Silk.NET.Maths.Matrix4X4 value1, T value2) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.Multiply(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Matrix4X4 value2) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Matrix4X4.Negate(Silk.NET.Maths.Matrix4X4 value) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.Subtract(Silk.NET.Maths.Matrix4X4 value1, Silk.NET.Maths.Matrix4X4 value2) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.Transform(Silk.NET.Maths.Matrix4X4 value, Silk.NET.Maths.Quaternion rotation) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.Transpose(Silk.NET.Maths.Matrix4X4 matrix) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.Identity.get -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.operator !=(Silk.NET.Maths.Matrix4X4 value1, Silk.NET.Maths.Matrix4X4 value2) -> bool -static Silk.NET.Maths.Matrix4X4.operator *(Silk.NET.Maths.Matrix3X4 value1, Silk.NET.Maths.Matrix4X4 value2) -> Silk.NET.Maths.Matrix3X4 -static Silk.NET.Maths.Matrix4X4.operator *(Silk.NET.Maths.Matrix4X4 value1, Silk.NET.Maths.Matrix4X3 value2) -> Silk.NET.Maths.Matrix4X3 -static Silk.NET.Maths.Matrix4X4.operator *(Silk.NET.Maths.Matrix4X4 value1, Silk.NET.Maths.Matrix4X4 value2) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.operator *(Silk.NET.Maths.Matrix4X4 value1, T value2) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.operator *(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Matrix4X4 value2) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Matrix4X4.operator +(Silk.NET.Maths.Matrix4X4 value1, Silk.NET.Maths.Matrix4X4 value2) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.operator -(Silk.NET.Maths.Matrix4X4 value) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.operator -(Silk.NET.Maths.Matrix4X4 value1, Silk.NET.Maths.Matrix4X4 value2) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.Matrix4X4.operator ==(Silk.NET.Maths.Matrix4X4 value1, Silk.NET.Maths.Matrix4X4 value2) -> bool -static Silk.NET.Maths.Matrix5X4.Add(Silk.NET.Maths.Matrix5X4 value1, Silk.NET.Maths.Matrix5X4 value2) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.Lerp(Silk.NET.Maths.Matrix5X4 matrix1, Silk.NET.Maths.Matrix5X4 matrix2, T amount) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.Multiply(Silk.NET.Maths.Matrix5X4 value1, T value2) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.Multiply(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Matrix5X4 value2) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Matrix5X4.Negate(Silk.NET.Maths.Matrix5X4 value) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.Subtract(Silk.NET.Maths.Matrix5X4 value1, Silk.NET.Maths.Matrix5X4 value2) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.Identity.get -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.operator !=(Silk.NET.Maths.Matrix5X4 value1, Silk.NET.Maths.Matrix5X4 value2) -> bool -static Silk.NET.Maths.Matrix5X4.operator *(Silk.NET.Maths.Matrix5X4 value1, T value2) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.operator *(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Matrix5X4 value2) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Matrix5X4.operator +(Silk.NET.Maths.Matrix5X4 value1, Silk.NET.Maths.Matrix5X4 value2) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.operator -(Silk.NET.Maths.Matrix5X4 value) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.operator -(Silk.NET.Maths.Matrix5X4 value1, Silk.NET.Maths.Matrix5X4 value2) -> Silk.NET.Maths.Matrix5X4 -static Silk.NET.Maths.Matrix5X4.operator ==(Silk.NET.Maths.Matrix5X4 value1, Silk.NET.Maths.Matrix5X4 value2) -> bool -static Silk.NET.Maths.Plane.CreateFromVertices(Silk.NET.Maths.Vector3D point1, Silk.NET.Maths.Vector3D point2, Silk.NET.Maths.Vector3D point3) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.Plane.Dot(Silk.NET.Maths.Plane plane, Silk.NET.Maths.Vector4D value) -> T -static Silk.NET.Maths.Plane.DotCoordinate(Silk.NET.Maths.Plane plane, Silk.NET.Maths.Vector3D value) -> T -static Silk.NET.Maths.Plane.DotNormal(Silk.NET.Maths.Plane plane, Silk.NET.Maths.Vector3D value) -> T -static Silk.NET.Maths.Plane.Normalize(Silk.NET.Maths.Plane value) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.Plane.Transform(Silk.NET.Maths.Plane plane, Silk.NET.Maths.Matrix4X4 matrix) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.Plane.Transform(Silk.NET.Maths.Plane plane, Silk.NET.Maths.Quaternion rotation) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.Plane.explicit operator System.Numerics.Plane(Silk.NET.Maths.Plane from) -> System.Numerics.Plane -static Silk.NET.Maths.Plane.operator !=(Silk.NET.Maths.Plane value1, Silk.NET.Maths.Plane value2) -> bool -static Silk.NET.Maths.Plane.operator ==(Silk.NET.Maths.Plane value1, Silk.NET.Maths.Plane value2) -> bool -static Silk.NET.Maths.Quaternion.Add(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.Concatenate(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.Conjugate(Silk.NET.Maths.Quaternion value) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.CreateFromAxisAngle(Silk.NET.Maths.Vector3D axis, T angle) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.CreateFromRotationMatrix(Silk.NET.Maths.Matrix3X3 matrix) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.CreateFromRotationMatrix(Silk.NET.Maths.Matrix4X4 matrix) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.CreateFromYawPitchRoll(T yaw, T pitch, T roll) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.Divide(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.Dot(Silk.NET.Maths.Quaternion quaternion1, Silk.NET.Maths.Quaternion quaternion2) -> T -static Silk.NET.Maths.Quaternion.explicit operator Silk.NET.Maths.Quaternion(Silk.NET.Maths.Quaternion from) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.explicit operator Silk.NET.Maths.Quaternion(Silk.NET.Maths.Quaternion from) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.explicit operator Silk.NET.Maths.Quaternion(Silk.NET.Maths.Quaternion from) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.explicit operator Silk.NET.Maths.Quaternion(Silk.NET.Maths.Quaternion from) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.explicit operator Silk.NET.Maths.Quaternion(Silk.NET.Maths.Quaternion from) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.explicit operator Silk.NET.Maths.Quaternion(Silk.NET.Maths.Quaternion from) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.explicit operator Silk.NET.Maths.Quaternion(Silk.NET.Maths.Quaternion from) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.explicit operator Silk.NET.Maths.Quaternion(Silk.NET.Maths.Quaternion from) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.explicit operator Silk.NET.Maths.Quaternion(Silk.NET.Maths.Quaternion from) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.explicit operator Silk.NET.Maths.Quaternion(Silk.NET.Maths.Quaternion from) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.explicit operator Silk.NET.Maths.Quaternion(Silk.NET.Maths.Quaternion from) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.explicit operator Silk.NET.Maths.Quaternion(Silk.NET.Maths.Quaternion from) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.explicit operator System.Numerics.Quaternion(Silk.NET.Maths.Quaternion from) -> System.Numerics.Quaternion -static Silk.NET.Maths.Quaternion.Identity.get -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.Inverse(Silk.NET.Maths.Quaternion value) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.Lerp(Silk.NET.Maths.Quaternion quaternion1, Silk.NET.Maths.Quaternion quaternion2, T amount) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.Multiply(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.Multiply(Silk.NET.Maths.Quaternion value1, T value2) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.Negate(Silk.NET.Maths.Quaternion value) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.Normalize(Silk.NET.Maths.Quaternion value) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.operator !=(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> bool -static Silk.NET.Maths.Quaternion.operator *(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.operator *(Silk.NET.Maths.Quaternion value1, T value2) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.operator +(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.operator -(Silk.NET.Maths.Quaternion value) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.operator -(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.operator /(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.operator ==(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> bool -static Silk.NET.Maths.Quaternion.Slerp(Silk.NET.Maths.Quaternion quaternion1, Silk.NET.Maths.Quaternion quaternion2, T amount) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Quaternion.Subtract(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.Ray2D.operator !=(Silk.NET.Maths.Ray2D value1, Silk.NET.Maths.Ray2D value2) -> bool -static Silk.NET.Maths.Ray2D.operator ==(Silk.NET.Maths.Ray2D value1, Silk.NET.Maths.Ray2D value2) -> bool -static Silk.NET.Maths.Ray3D.operator !=(Silk.NET.Maths.Ray3D value1, Silk.NET.Maths.Ray3D value2) -> bool -static Silk.NET.Maths.Ray3D.operator ==(Silk.NET.Maths.Ray3D value1, Silk.NET.Maths.Ray3D value2) -> bool -static Silk.NET.Maths.Rectangle.FromLTRB(T left, T top, T right, T bottom) -> Silk.NET.Maths.Rectangle -static Silk.NET.Maths.Rectangle.operator !=(Silk.NET.Maths.Rectangle value1, Silk.NET.Maths.Rectangle value2) -> bool -static Silk.NET.Maths.Rectangle.operator ==(Silk.NET.Maths.Rectangle value1, Silk.NET.Maths.Rectangle value2) -> bool -static Silk.NET.Maths.Scalar.Abs(T x) -> T -static Silk.NET.Maths.Scalar.Acos(T x) -> T -static Silk.NET.Maths.Scalar.Acosh(T x) -> T -static Silk.NET.Maths.Scalar.Add(T left, T right) -> T -static Silk.NET.Maths.Scalar.And(T left, T right) -> T -static Silk.NET.Maths.Scalar.As(TFrom val) -> TTo -static Silk.NET.Maths.Scalar.Asin(T x) -> T -static Silk.NET.Maths.Scalar.Asinh(T x) -> T -static Silk.NET.Maths.Scalar.Atan2(T y, T x) -> T -static Silk.NET.Maths.Scalar.Atan(T x) -> T -static Silk.NET.Maths.Scalar.Atanh(T x) -> T -static Silk.NET.Maths.Scalar.Cbrt(T x) -> T -static Silk.NET.Maths.Scalar.Ceiling(T x) -> T -static Silk.NET.Maths.Scalar.Cos(T x) -> T -static Silk.NET.Maths.Scalar.Cosh(T x) -> T -static Silk.NET.Maths.Scalar.DegreesToRadians(T degrees) -> T -static Silk.NET.Maths.Scalar.Divide(T left, T right) -> T -static Silk.NET.Maths.Scalar.Equal(T left, T right) -> bool -static Silk.NET.Maths.Scalar.Exp(T x) -> T -static Silk.NET.Maths.Scalar.Floor(T x) -> T -static Silk.NET.Maths.Scalar.GreaterThan(T left, T right) -> bool -static Silk.NET.Maths.Scalar.GreaterThanOrEqual(T left, T right) -> bool -static Silk.NET.Maths.Scalar.IEEERemainder(T x, T y) -> T -static Silk.NET.Maths.Scalar.IsFinite(T f) -> bool -static Silk.NET.Maths.Scalar.IsHardwareAccelerated.get -> bool -static Silk.NET.Maths.Scalar.IsInfinity(T f) -> bool -static Silk.NET.Maths.Scalar.IsNaN(T f) -> bool -static Silk.NET.Maths.Scalar.IsNegative(T f) -> bool -static Silk.NET.Maths.Scalar.IsNegativeInfinity(T f) -> bool -static Silk.NET.Maths.Scalar.IsNormal(T f) -> bool -static Silk.NET.Maths.Scalar.IsPositiveInfinity(T f) -> bool -static Silk.NET.Maths.Scalar.IsSubnormal(T f) -> bool -static Silk.NET.Maths.Scalar.LessThan(T left, T right) -> bool -static Silk.NET.Maths.Scalar.LessThanOrEqual(T left, T right) -> bool -static Silk.NET.Maths.Scalar.Log10(T x) -> T -static Silk.NET.Maths.Scalar.Log(T x) -> T -static Silk.NET.Maths.Scalar.Log(T x, T y) -> T -static Silk.NET.Maths.Scalar.Max(T x, T y) -> T -static Silk.NET.Maths.Scalar.Min(T x, T y) -> T -static Silk.NET.Maths.Scalar.Multiply(T left, T right) -> T -static Silk.NET.Maths.Scalar.Negate(T x) -> T -static Silk.NET.Maths.Scalar.Not(T value) -> T -static Silk.NET.Maths.Scalar.NotEqual(T left, T right) -> bool -static Silk.NET.Maths.Scalar.Or(T left, T right) -> T -static Silk.NET.Maths.Scalar.Pow(T x, T y) -> T -static Silk.NET.Maths.Scalar.RadiansToDegrees(T radians) -> T -static Silk.NET.Maths.Scalar.Reciprocal(T x) -> T -static Silk.NET.Maths.Scalar.RotateLeft(T value, int offset) -> T -static Silk.NET.Maths.Scalar.RotateRight(T value, int offset) -> T -static Silk.NET.Maths.Scalar.Round(T x) -> T -static Silk.NET.Maths.Scalar.Round(T x, int digits) -> T -static Silk.NET.Maths.Scalar.Round(T x, int digits, System.MidpointRounding mode) -> T -static Silk.NET.Maths.Scalar.Round(T x, System.MidpointRounding mode) -> T -static Silk.NET.Maths.Scalar.ShiftLeft(T value, int offset) -> T -static Silk.NET.Maths.Scalar.ShiftRight(T value, int offset) -> T -static Silk.NET.Maths.Scalar.Sign(T x) -> int -static Silk.NET.Maths.Scalar.Sin(T x) -> T -static Silk.NET.Maths.Scalar.Sinh(T x) -> T -static Silk.NET.Maths.Scalar.Sqrt(T x) -> T -static Silk.NET.Maths.Scalar.Subtract(T left, T right) -> T -static Silk.NET.Maths.Scalar.Tan(T x) -> T -static Silk.NET.Maths.Scalar.Tanh(T x) -> T -static Silk.NET.Maths.Scalar.Truncate(T x) -> T -static Silk.NET.Maths.Scalar.Xor(T left, T right) -> T -static Silk.NET.Maths.Sphere.operator !=(Silk.NET.Maths.Sphere value1, Silk.NET.Maths.Sphere value2) -> bool -static Silk.NET.Maths.Sphere.operator ==(Silk.NET.Maths.Sphere value1, Silk.NET.Maths.Sphere value2) -> bool -static Silk.NET.Maths.SystemNumericsExtensions.ToGeneric(this System.Numerics.Matrix3x2 value) -> Silk.NET.Maths.Matrix3X2 -static Silk.NET.Maths.SystemNumericsExtensions.ToGeneric(this System.Numerics.Matrix4x4 value) -> Silk.NET.Maths.Matrix4X4 -static Silk.NET.Maths.SystemNumericsExtensions.ToGeneric(this System.Numerics.Plane value) -> Silk.NET.Maths.Plane -static Silk.NET.Maths.SystemNumericsExtensions.ToGeneric(this System.Numerics.Quaternion value) -> Silk.NET.Maths.Quaternion -static Silk.NET.Maths.SystemNumericsExtensions.ToGeneric(this System.Numerics.Vector2 value) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.SystemNumericsExtensions.ToGeneric(this System.Numerics.Vector3 value) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.SystemNumericsExtensions.ToGeneric(this System.Numerics.Vector4 value) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.SystemNumericsExtensions.ToSystem(this Silk.NET.Maths.Matrix3X2 value) -> System.Numerics.Matrix3x2 -static Silk.NET.Maths.SystemNumericsExtensions.ToSystem(this Silk.NET.Maths.Matrix4X4 value) -> System.Numerics.Matrix4x4 -static Silk.NET.Maths.SystemNumericsExtensions.ToSystem(this Silk.NET.Maths.Plane value) -> System.Numerics.Plane -static Silk.NET.Maths.SystemNumericsExtensions.ToSystem(this Silk.NET.Maths.Quaternion value) -> System.Numerics.Quaternion -static Silk.NET.Maths.SystemNumericsExtensions.ToSystem(this Silk.NET.Maths.Vector2D value) -> System.Numerics.Vector2 -static Silk.NET.Maths.SystemNumericsExtensions.ToSystem(this Silk.NET.Maths.Vector3D value) -> System.Numerics.Vector3 -static Silk.NET.Maths.SystemNumericsExtensions.ToSystem(this Silk.NET.Maths.Vector4D value) -> System.Numerics.Vector4 -static Silk.NET.Maths.Vector2D.Abs(Silk.NET.Maths.Vector2D value) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Add(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Clamp(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Vector2D min, Silk.NET.Maths.Vector2D max) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Distance(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Vector2D value2) -> T -static Silk.NET.Maths.Vector2D.DistanceSquared(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Vector2D value2) -> T -static Silk.NET.Maths.Vector2D.Divide(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Divide(Silk.NET.Maths.Vector2D left, T divisor) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Dot(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Vector2D value2) -> T -static Silk.NET.Maths.Vector2D.Lerp(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Vector2D value2, T amount) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Max(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Vector2D value2) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Min(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Vector2D value2) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Multiply(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Multiply(Silk.NET.Maths.Vector2D left, T right) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Multiply(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Matrix2X2 value2) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Multiply(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Matrix2X3 value2) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector2D.Multiply(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Matrix2X4 value2) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector2D.Multiply(T left, Silk.NET.Maths.Vector2D right) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Negate(Silk.NET.Maths.Vector2D value) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Normalize(Silk.NET.Maths.Vector2D value) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Reflect(Silk.NET.Maths.Vector2D vector, Silk.NET.Maths.Vector2D normal) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.SquareRoot(Silk.NET.Maths.Vector2D value) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Subtract(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Transform(Silk.NET.Maths.Vector2D position, Silk.NET.Maths.Matrix3X2 matrix) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Transform(Silk.NET.Maths.Vector2D position, Silk.NET.Maths.Matrix4X4 matrix) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Transform(Silk.NET.Maths.Vector2D value, Silk.NET.Maths.Quaternion rotation) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.TransformNormal(Silk.NET.Maths.Vector2D normal, Silk.NET.Maths.Matrix3X2 matrix) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.TransformNormal(Silk.NET.Maths.Vector2D normal, Silk.NET.Maths.Matrix4X4 matrix) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.explicit operator System.Numerics.Vector2(Silk.NET.Maths.Vector2D from) -> System.Numerics.Vector2 -static Silk.NET.Maths.Vector2D.One.get -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.operator !=(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> bool -static Silk.NET.Maths.Vector2D.operator *(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.operator *(Silk.NET.Maths.Vector2D left, T right) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.operator *(T left, Silk.NET.Maths.Vector2D right) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.operator +(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.operator -(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.operator -(Silk.NET.Maths.Vector2D value) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.operator /(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.operator /(Silk.NET.Maths.Vector2D value1, T value2) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.operator ==(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> bool -static Silk.NET.Maths.Vector2D.UnitX.get -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.UnitY.get -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector2D.Zero.get -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector3D.Abs(Silk.NET.Maths.Vector3D value) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Add(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Clamp(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Vector3D min, Silk.NET.Maths.Vector3D max) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Cross(Silk.NET.Maths.Vector3D vector1, Silk.NET.Maths.Vector3D vector2) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Distance(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Vector3D value2) -> T -static Silk.NET.Maths.Vector3D.DistanceSquared(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Vector3D value2) -> T -static Silk.NET.Maths.Vector3D.Divide(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Divide(Silk.NET.Maths.Vector3D left, T divisor) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Dot(Silk.NET.Maths.Vector3D vector1, Silk.NET.Maths.Vector3D vector2) -> T -static Silk.NET.Maths.Vector3D.Lerp(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Vector3D value2, T amount) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Max(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Vector3D value2) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Min(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Vector3D value2) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Multiply(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Multiply(Silk.NET.Maths.Vector3D left, T right) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Multiply(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Matrix3X2 value2) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector3D.Multiply(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Matrix3X3 value2) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Multiply(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Matrix3X4 value2) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector3D.Multiply(T left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Negate(Silk.NET.Maths.Vector3D value) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Normalize(Silk.NET.Maths.Vector3D value) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Reflect(Silk.NET.Maths.Vector3D vector, Silk.NET.Maths.Vector3D normal) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.SquareRoot(Silk.NET.Maths.Vector3D value) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Subtract(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Transform(Silk.NET.Maths.Vector3D position, Silk.NET.Maths.Matrix4X4 matrix) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Transform(Silk.NET.Maths.Vector3D value, Silk.NET.Maths.Quaternion rotation) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.TransformNormal(Silk.NET.Maths.Vector3D normal, Silk.NET.Maths.Matrix4X4 matrix) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.explicit operator System.Numerics.Vector3(Silk.NET.Maths.Vector3D from) -> System.Numerics.Vector3 -static Silk.NET.Maths.Vector3D.One.get -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.operator !=(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> bool -static Silk.NET.Maths.Vector3D.operator *(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.operator *(Silk.NET.Maths.Vector3D left, T right) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.operator *(T left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.operator +(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.operator -(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.operator -(Silk.NET.Maths.Vector3D value) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.operator /(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.operator /(Silk.NET.Maths.Vector3D value1, T value2) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.operator ==(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> bool -static Silk.NET.Maths.Vector3D.UnitX.get -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.UnitY.get -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.UnitZ.get -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector3D.Zero.get -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector4D.Abs(Silk.NET.Maths.Vector4D value) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Add(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Clamp(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Vector4D min, Silk.NET.Maths.Vector4D max) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Distance(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Vector4D value2) -> T -static Silk.NET.Maths.Vector4D.DistanceSquared(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Vector4D value2) -> T -static Silk.NET.Maths.Vector4D.Divide(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Divide(Silk.NET.Maths.Vector4D left, T divisor) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Dot(Silk.NET.Maths.Vector4D vector1, Silk.NET.Maths.Vector4D vector2) -> T -static Silk.NET.Maths.Vector4D.Lerp(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Vector4D value2, T amount) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Max(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Vector4D value2) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Min(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Vector4D value2) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Multiply(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Multiply(Silk.NET.Maths.Vector4D left, T right) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Multiply(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Matrix4X2 value2) -> Silk.NET.Maths.Vector2D -static Silk.NET.Maths.Vector4D.Multiply(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Matrix4X3 value2) -> Silk.NET.Maths.Vector3D -static Silk.NET.Maths.Vector4D.Multiply(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Matrix4X4 value2) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Multiply(T left, Silk.NET.Maths.Vector4D right) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Negate(Silk.NET.Maths.Vector4D value) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Normalize(Silk.NET.Maths.Vector4D vector) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.SquareRoot(Silk.NET.Maths.Vector4D value) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Subtract(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Transform(Silk.NET.Maths.Vector2D position, Silk.NET.Maths.Matrix4X4 matrix) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Transform(Silk.NET.Maths.Vector2D value, Silk.NET.Maths.Quaternion rotation) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Transform(Silk.NET.Maths.Vector3D position, Silk.NET.Maths.Matrix4X4 matrix) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Transform(Silk.NET.Maths.Vector3D value, Silk.NET.Maths.Quaternion rotation) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Transform(Silk.NET.Maths.Vector4D value, Silk.NET.Maths.Quaternion rotation) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Transform(Silk.NET.Maths.Vector4D vector, Silk.NET.Maths.Matrix4X4 matrix) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.explicit operator System.Numerics.Vector4(Silk.NET.Maths.Vector4D from) -> System.Numerics.Vector4 -static Silk.NET.Maths.Vector4D.One.get -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.operator !=(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> bool -static Silk.NET.Maths.Vector4D.operator *(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.operator *(Silk.NET.Maths.Vector4D left, T right) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.operator *(T left, Silk.NET.Maths.Vector4D right) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.operator +(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.operator -(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.operator -(Silk.NET.Maths.Vector4D value) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.operator /(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.operator /(Silk.NET.Maths.Vector4D value1, T value2) -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.operator ==(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> bool -static Silk.NET.Maths.Vector4D.UnitW.get -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.UnitX.get -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.UnitY.get -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.UnitZ.get -> Silk.NET.Maths.Vector4D -static Silk.NET.Maths.Vector4D.Zero.get -> Silk.NET.Maths.Vector4D diff --git a/sources/Maths/Maths/PublicAPI/net8.0/PublicAPI.Unshipped.txt b/sources/Maths/Maths/PublicAPI/net8.0/PublicAPI.Unshipped.txt index 7dc5c58110..47ef53fa1c 100644 --- a/sources/Maths/Maths/PublicAPI/net8.0/PublicAPI.Unshipped.txt +++ b/sources/Maths/Maths/PublicAPI/net8.0/PublicAPI.Unshipped.txt @@ -1 +1,1873 @@ #nullable enable +override Silk.NET.Maths.Box2D.Equals(object? obj) -> bool +override Silk.NET.Maths.Box2D.GetHashCode() -> int +override Silk.NET.Maths.Box3D.Equals(object? obj) -> bool +override Silk.NET.Maths.Box3D.GetHashCode() -> int +override Silk.NET.Maths.Circle.Equals(object? obj) -> bool +override Silk.NET.Maths.Circle.GetHashCode() -> int +override Silk.NET.Maths.Cube.Equals(object? obj) -> bool +override Silk.NET.Maths.Cube.GetHashCode() -> int +override Silk.NET.Maths.Matrix2X2.Equals(object? obj) -> bool +override Silk.NET.Maths.Matrix2X2.GetHashCode() -> int +override Silk.NET.Maths.Matrix2X2.ToString() -> string! +override Silk.NET.Maths.Matrix2X3.Equals(object? obj) -> bool +override Silk.NET.Maths.Matrix2X3.GetHashCode() -> int +override Silk.NET.Maths.Matrix2X3.ToString() -> string! +override Silk.NET.Maths.Matrix2X4.Equals(object? obj) -> bool +override Silk.NET.Maths.Matrix2X4.GetHashCode() -> int +override Silk.NET.Maths.Matrix2X4.ToString() -> string! +override Silk.NET.Maths.Matrix3X2.Equals(object? obj) -> bool +override Silk.NET.Maths.Matrix3X2.GetHashCode() -> int +override Silk.NET.Maths.Matrix3X2.ToString() -> string! +override Silk.NET.Maths.Matrix3X3.Equals(object? obj) -> bool +override Silk.NET.Maths.Matrix3X3.GetHashCode() -> int +override Silk.NET.Maths.Matrix3X3.ToString() -> string! +override Silk.NET.Maths.Matrix3X4.Equals(object? obj) -> bool +override Silk.NET.Maths.Matrix3X4.GetHashCode() -> int +override Silk.NET.Maths.Matrix3X4.ToString() -> string! +override Silk.NET.Maths.Matrix4X2.Equals(object? obj) -> bool +override Silk.NET.Maths.Matrix4X2.GetHashCode() -> int +override Silk.NET.Maths.Matrix4X2.ToString() -> string! +override Silk.NET.Maths.Matrix4X3.Equals(object? obj) -> bool +override Silk.NET.Maths.Matrix4X3.GetHashCode() -> int +override Silk.NET.Maths.Matrix4X3.ToString() -> string! +override Silk.NET.Maths.Matrix4X4.Equals(object? obj) -> bool +override Silk.NET.Maths.Matrix4X4.GetHashCode() -> int +override Silk.NET.Maths.Matrix4X4.ToString() -> string! +override Silk.NET.Maths.Matrix5X4.Equals(object? obj) -> bool +override Silk.NET.Maths.Matrix5X4.GetHashCode() -> int +override Silk.NET.Maths.Matrix5X4.ToString() -> string! +override Silk.NET.Maths.Plane.Equals(object? obj) -> bool +override Silk.NET.Maths.Plane.GetHashCode() -> int +override Silk.NET.Maths.Plane.ToString() -> string! +override Silk.NET.Maths.Quaternion.Equals(object? obj) -> bool +override Silk.NET.Maths.Quaternion.GetHashCode() -> int +override Silk.NET.Maths.Quaternion.ToString() -> string! +override Silk.NET.Maths.Ray2D.Equals(object? obj) -> bool +override Silk.NET.Maths.Ray2D.GetHashCode() -> int +override Silk.NET.Maths.Ray3D.Equals(object? obj) -> bool +override Silk.NET.Maths.Ray3D.GetHashCode() -> int +override Silk.NET.Maths.Rectangle.Equals(object? obj) -> bool +override Silk.NET.Maths.Rectangle.GetHashCode() -> int +override Silk.NET.Maths.Sphere.Equals(object? obj) -> bool +override Silk.NET.Maths.Sphere.GetHashCode() -> int +override Silk.NET.Maths.Vector2D.Equals(object? obj) -> bool +override Silk.NET.Maths.Vector2D.GetHashCode() -> int +override Silk.NET.Maths.Vector2D.ToString() -> string! +override Silk.NET.Maths.Vector3D.Equals(object? obj) -> bool +override Silk.NET.Maths.Vector3D.GetHashCode() -> int +override Silk.NET.Maths.Vector3D.ToString() -> string! +override Silk.NET.Maths.Vector4D.Equals(object? obj) -> bool +override Silk.NET.Maths.Vector4D.GetHashCode() -> int +override Silk.NET.Maths.Vector4D.ToString() -> string! +Silk.NET.Maths.Box2D +Silk.NET.Maths.Box2D.As() -> Silk.NET.Maths.Box2D +Silk.NET.Maths.Box2D.AsChecked() -> Silk.NET.Maths.Box2D +Silk.NET.Maths.Box2D.AsSaturating() -> Silk.NET.Maths.Box2D +Silk.NET.Maths.Box2D.AsTruncating() -> Silk.NET.Maths.Box2D +Silk.NET.Maths.Box2D.Box2D() -> void +Silk.NET.Maths.Box2D.Box2D(Silk.NET.Maths.Vector2D min, Silk.NET.Maths.Vector2D max) -> void +Silk.NET.Maths.Box2D.Box2D(Silk.NET.Maths.Vector2D min, T maxX, T maxY) -> void +Silk.NET.Maths.Box2D.Box2D(T minX, T minY, Silk.NET.Maths.Vector2D max) -> void +Silk.NET.Maths.Box2D.Box2D(T minX, T minY, T maxX, T maxY) -> void +Silk.NET.Maths.Box2D.Center.get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Box2D.Contains(Silk.NET.Maths.Box2D other) -> bool +Silk.NET.Maths.Box2D.Contains(Silk.NET.Maths.Vector2D point) -> bool +Silk.NET.Maths.Box2D.Equals(Silk.NET.Maths.Box2D other) -> bool +Silk.NET.Maths.Box2D.GetDistanceToNearestEdge(Silk.NET.Maths.Vector2D point) -> T +Silk.NET.Maths.Box2D.GetInflated(Silk.NET.Maths.Vector2D point) -> Silk.NET.Maths.Box2D +Silk.NET.Maths.Box2D.GetScaled(Silk.NET.Maths.Vector2D scale, Silk.NET.Maths.Vector2D anchor) -> Silk.NET.Maths.Box2D +Silk.NET.Maths.Box2D.GetScaled(Silk.NET.Maths.Vector2D scale, Silk.NET.Maths.Vector2D anchor) -> Silk.NET.Maths.Box2D +Silk.NET.Maths.Box2D.GetTranslated(Silk.NET.Maths.Vector2D distance) -> Silk.NET.Maths.Box2D +Silk.NET.Maths.Box2D.Max -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Box2D.Min -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Box2D.Size.get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Box3D +Silk.NET.Maths.Box3D.As() -> Silk.NET.Maths.Box3D +Silk.NET.Maths.Box3D.Box3D() -> void +Silk.NET.Maths.Box3D.Box3D(Silk.NET.Maths.Vector3D min, Silk.NET.Maths.Vector3D max) -> void +Silk.NET.Maths.Box3D.Box3D(Silk.NET.Maths.Vector3D min, T maxX, T maxY, T maxZ) -> void +Silk.NET.Maths.Box3D.Box3D(T minX, T minY, T minZ, Silk.NET.Maths.Vector3D max) -> void +Silk.NET.Maths.Box3D.Box3D(T minX, T minY, T minZ, T maxX, T maxY, T maxZ) -> void +Silk.NET.Maths.Box3D.Center.get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Box3D.Contains(Silk.NET.Maths.Box3D other) -> bool +Silk.NET.Maths.Box3D.Contains(Silk.NET.Maths.Vector3D point) -> bool +Silk.NET.Maths.Box3D.Equals(Silk.NET.Maths.Box3D other) -> bool +Silk.NET.Maths.Box3D.GetDistanceToNearestEdge(Silk.NET.Maths.Vector3D point) -> T +Silk.NET.Maths.Box3D.GetInflated(Silk.NET.Maths.Vector3D point) -> Silk.NET.Maths.Box3D +Silk.NET.Maths.Box3D.GetScaled(Silk.NET.Maths.Vector3D scale, Silk.NET.Maths.Vector3D anchor) -> Silk.NET.Maths.Box3D +Silk.NET.Maths.Box3D.GetScaled(Silk.NET.Maths.Vector3D scale, Silk.NET.Maths.Vector3D anchor) -> Silk.NET.Maths.Box3D +Silk.NET.Maths.Box3D.GetTranslated(Silk.NET.Maths.Vector3D distance) -> Silk.NET.Maths.Box3D +Silk.NET.Maths.Box3D.Max -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Box3D.Min -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Box3D.Size.get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Circle +Silk.NET.Maths.Circle.As() -> Silk.NET.Maths.Circle +Silk.NET.Maths.Circle.Center -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Circle.Circle() -> void +Silk.NET.Maths.Circle.Circle(Silk.NET.Maths.Vector2D center, T radius) -> void +Silk.NET.Maths.Circle.Circle(T centerX, T centerY, T radius) -> void +Silk.NET.Maths.Circle.Circumference.get -> T +Silk.NET.Maths.Circle.Contains(Silk.NET.Maths.Circle other) -> bool +Silk.NET.Maths.Circle.Contains(Silk.NET.Maths.Vector2D point) -> bool +Silk.NET.Maths.Circle.Diameter.get -> T +Silk.NET.Maths.Circle.Equals(Silk.NET.Maths.Circle other) -> bool +Silk.NET.Maths.Circle.GetDistanceToNearestEdge(Silk.NET.Maths.Vector2D point) -> T +Silk.NET.Maths.Circle.GetDistanceToNearestEdgeSquared(Silk.NET.Maths.Vector2D point) -> T +Silk.NET.Maths.Circle.GetInflated(Silk.NET.Maths.Vector2D point) -> Silk.NET.Maths.Circle +Silk.NET.Maths.Circle.GetTranslated(Silk.NET.Maths.Vector2D distance) -> Silk.NET.Maths.Circle +Silk.NET.Maths.Circle.Radius -> T +Silk.NET.Maths.Circle.SquaredRadius.get -> T +Silk.NET.Maths.Cube +Silk.NET.Maths.Cube.As() -> Silk.NET.Maths.Cube +Silk.NET.Maths.Cube.Center.get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Cube.Contains(Silk.NET.Maths.Cube other) -> bool +Silk.NET.Maths.Cube.Contains(Silk.NET.Maths.Vector3D point) -> bool +Silk.NET.Maths.Cube.Cube() -> void +Silk.NET.Maths.Cube.Cube(Silk.NET.Maths.Vector3D origin, Silk.NET.Maths.Vector3D size) -> void +Silk.NET.Maths.Cube.Cube(Silk.NET.Maths.Vector3D origin, T sizeX, T sizeY, T sizeZ) -> void +Silk.NET.Maths.Cube.Cube(T originX, T originY, T originZ, Silk.NET.Maths.Vector3D size) -> void +Silk.NET.Maths.Cube.Cube(T originX, T originY, T originZ, T sizeX, T sizeY, T sizeZ) -> void +Silk.NET.Maths.Cube.Equals(Silk.NET.Maths.Cube other) -> bool +Silk.NET.Maths.Cube.GetDistanceToNearestEdge(Silk.NET.Maths.Vector3D point) -> T +Silk.NET.Maths.Cube.GetInflated(Silk.NET.Maths.Vector3D point) -> Silk.NET.Maths.Cube +Silk.NET.Maths.Cube.GetScaled(Silk.NET.Maths.Vector3D scale, Silk.NET.Maths.Vector3D anchor) -> Silk.NET.Maths.Cube +Silk.NET.Maths.Cube.GetScaled(Silk.NET.Maths.Vector3D scale, Silk.NET.Maths.Vector3D anchor) -> Silk.NET.Maths.Cube +Silk.NET.Maths.Cube.GetTranslated(Silk.NET.Maths.Vector3D distance) -> Silk.NET.Maths.Cube +Silk.NET.Maths.Cube.HalfSize.get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Cube.Max.get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Cube.Origin -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Cube.Size -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix2X2 +Silk.NET.Maths.Matrix2X2 +Silk.NET.Maths.Matrix2X2.As() -> Silk.NET.Maths.Matrix2X2 +Silk.NET.Maths.Matrix2X2.AsChecked() -> Silk.NET.Maths.Matrix2X2 +Silk.NET.Maths.Matrix2X2.AsSaturating() -> Silk.NET.Maths.Matrix2X2 +Silk.NET.Maths.Matrix2X2.AsTruncating() -> Silk.NET.Maths.Matrix2X2 +Silk.NET.Maths.Matrix2X2.Column1.get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix2X2.Column2.get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix2X2.Equals(Silk.NET.Maths.Matrix2X2 other) -> bool +Silk.NET.Maths.Matrix2X2.GetDeterminant() -> T +Silk.NET.Maths.Matrix2X2.IsIdentity.get -> bool +Silk.NET.Maths.Matrix2X2.M11.get -> T +Silk.NET.Maths.Matrix2X2.M12.get -> T +Silk.NET.Maths.Matrix2X2.M21.get -> T +Silk.NET.Maths.Matrix2X2.M22.get -> T +Silk.NET.Maths.Matrix2X2.Matrix2X2() -> void +Silk.NET.Maths.Matrix2X2.Matrix2X2(Silk.NET.Maths.Matrix2X4 value) -> void +Silk.NET.Maths.Matrix2X2.Matrix2X2(Silk.NET.Maths.Matrix3X2 value) -> void +Silk.NET.Maths.Matrix2X2.Matrix2X2(Silk.NET.Maths.Matrix3X4 value) -> void +Silk.NET.Maths.Matrix2X2.Matrix2X2(Silk.NET.Maths.Matrix4X2 value) -> void +Silk.NET.Maths.Matrix2X2.Matrix2X2(Silk.NET.Maths.Matrix4X3 value) -> void +Silk.NET.Maths.Matrix2X2.Matrix2X2(Silk.NET.Maths.Vector2D row1, Silk.NET.Maths.Vector2D row2) -> void +Silk.NET.Maths.Matrix2X2.Matrix2X2(T m11, T m12, T m21, T m22) -> void +Silk.NET.Maths.Matrix2X2.Row1 -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix2X2.Row2 -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix2X2.this[int row, int column].get -> T +Silk.NET.Maths.Matrix2X2.this[int row].get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix2X2.Transpose() -> Silk.NET.Maths.Matrix2X2 +Silk.NET.Maths.Matrix2X3 +Silk.NET.Maths.Matrix2X3 +Silk.NET.Maths.Matrix2X3.As() -> Silk.NET.Maths.Matrix2X3 +Silk.NET.Maths.Matrix2X3.AsChecked() -> Silk.NET.Maths.Matrix2X3 +Silk.NET.Maths.Matrix2X3.AsSaturating() -> Silk.NET.Maths.Matrix2X3 +Silk.NET.Maths.Matrix2X3.AsTruncating() -> Silk.NET.Maths.Matrix2X3 +Silk.NET.Maths.Matrix2X3.Column1.get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix2X3.Column2.get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix2X3.Column3.get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix2X3.Equals(Silk.NET.Maths.Matrix2X3 other) -> bool +Silk.NET.Maths.Matrix2X3.IsIdentity.get -> bool +Silk.NET.Maths.Matrix2X3.M11.get -> T +Silk.NET.Maths.Matrix2X3.M12.get -> T +Silk.NET.Maths.Matrix2X3.M13.get -> T +Silk.NET.Maths.Matrix2X3.M21.get -> T +Silk.NET.Maths.Matrix2X3.M22.get -> T +Silk.NET.Maths.Matrix2X3.M23.get -> T +Silk.NET.Maths.Matrix2X3.Matrix2X3() -> void +Silk.NET.Maths.Matrix2X3.Matrix2X3(Silk.NET.Maths.Matrix2X4 value) -> void +Silk.NET.Maths.Matrix2X3.Matrix2X3(Silk.NET.Maths.Matrix3X2 value) -> void +Silk.NET.Maths.Matrix2X3.Matrix2X3(Silk.NET.Maths.Matrix3X4 value) -> void +Silk.NET.Maths.Matrix2X3.Matrix2X3(Silk.NET.Maths.Matrix4X2 value) -> void +Silk.NET.Maths.Matrix2X3.Matrix2X3(Silk.NET.Maths.Matrix4X3 value) -> void +Silk.NET.Maths.Matrix2X3.Matrix2X3(Silk.NET.Maths.Vector3D row1, Silk.NET.Maths.Vector3D row2) -> void +Silk.NET.Maths.Matrix2X3.Matrix2X3(T m11, T m12, T m13, T m21, T m22, T m23) -> void +Silk.NET.Maths.Matrix2X3.Row1 -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix2X3.Row2 -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix2X3.this[int row, int column].get -> T +Silk.NET.Maths.Matrix2X3.this[int row].get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix2X3.Transpose() -> Silk.NET.Maths.Matrix3X2 +Silk.NET.Maths.Matrix2X4 +Silk.NET.Maths.Matrix2X4 +Silk.NET.Maths.Matrix2X4.As() -> Silk.NET.Maths.Matrix2X4 +Silk.NET.Maths.Matrix2X4.AsChecked() -> Silk.NET.Maths.Matrix2X4 +Silk.NET.Maths.Matrix2X4.AsSaturating() -> Silk.NET.Maths.Matrix2X4 +Silk.NET.Maths.Matrix2X4.AsTruncating() -> Silk.NET.Maths.Matrix2X4 +Silk.NET.Maths.Matrix2X4.Column1.get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix2X4.Column2.get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix2X4.Column3.get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix2X4.Column4.get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix2X4.Equals(Silk.NET.Maths.Matrix2X4 other) -> bool +Silk.NET.Maths.Matrix2X4.IsIdentity.get -> bool +Silk.NET.Maths.Matrix2X4.M11.get -> T +Silk.NET.Maths.Matrix2X4.M12.get -> T +Silk.NET.Maths.Matrix2X4.M13.get -> T +Silk.NET.Maths.Matrix2X4.M14.get -> T +Silk.NET.Maths.Matrix2X4.M21.get -> T +Silk.NET.Maths.Matrix2X4.M22.get -> T +Silk.NET.Maths.Matrix2X4.M23.get -> T +Silk.NET.Maths.Matrix2X4.M24.get -> T +Silk.NET.Maths.Matrix2X4.Matrix2X4() -> void +Silk.NET.Maths.Matrix2X4.Matrix2X4(Silk.NET.Maths.Matrix3X2 value) -> void +Silk.NET.Maths.Matrix2X4.Matrix2X4(Silk.NET.Maths.Matrix3X3 value) -> void +Silk.NET.Maths.Matrix2X4.Matrix2X4(Silk.NET.Maths.Matrix3X4 value) -> void +Silk.NET.Maths.Matrix2X4.Matrix2X4(Silk.NET.Maths.Matrix4X2 value) -> void +Silk.NET.Maths.Matrix2X4.Matrix2X4(Silk.NET.Maths.Matrix4X3 value) -> void +Silk.NET.Maths.Matrix2X4.Matrix2X4(Silk.NET.Maths.Vector4D row1, Silk.NET.Maths.Vector4D row2) -> void +Silk.NET.Maths.Matrix2X4.Matrix2X4(T m11, T m12, T m13, T m14, T m21, T m22, T m23, T m24) -> void +Silk.NET.Maths.Matrix2X4.Row1 -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix2X4.Row2 -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix2X4.this[int row, int column].get -> T +Silk.NET.Maths.Matrix2X4.this[int row].get -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix2X4.Transpose() -> Silk.NET.Maths.Matrix4X2 +Silk.NET.Maths.Matrix3X2 +Silk.NET.Maths.Matrix3X2 +Silk.NET.Maths.Matrix3X2.As() -> Silk.NET.Maths.Matrix3X2 +Silk.NET.Maths.Matrix3X2.AsChecked() -> Silk.NET.Maths.Matrix3X2 +Silk.NET.Maths.Matrix3X2.AsSaturating() -> Silk.NET.Maths.Matrix3X2 +Silk.NET.Maths.Matrix3X2.AsTruncating() -> Silk.NET.Maths.Matrix3X2 +Silk.NET.Maths.Matrix3X2.Column1.get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix3X2.Column2.get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix3X2.Equals(Silk.NET.Maths.Matrix3X2 other) -> bool +Silk.NET.Maths.Matrix3X2.GetDeterminant() -> T +Silk.NET.Maths.Matrix3X2.IsIdentity.get -> bool +Silk.NET.Maths.Matrix3X2.M11.get -> T +Silk.NET.Maths.Matrix3X2.M12.get -> T +Silk.NET.Maths.Matrix3X2.M21.get -> T +Silk.NET.Maths.Matrix3X2.M22.get -> T +Silk.NET.Maths.Matrix3X2.M31.get -> T +Silk.NET.Maths.Matrix3X2.M32.get -> T +Silk.NET.Maths.Matrix3X2.Matrix3X2() -> void +Silk.NET.Maths.Matrix3X2.Matrix3X2(Silk.NET.Maths.Matrix2X4 value) -> void +Silk.NET.Maths.Matrix3X2.Matrix3X2(Silk.NET.Maths.Matrix3X3 value) -> void +Silk.NET.Maths.Matrix3X2.Matrix3X2(Silk.NET.Maths.Matrix3X4 value) -> void +Silk.NET.Maths.Matrix3X2.Matrix3X2(Silk.NET.Maths.Matrix4X2 value) -> void +Silk.NET.Maths.Matrix3X2.Matrix3X2(Silk.NET.Maths.Matrix4X3 value) -> void +Silk.NET.Maths.Matrix3X2.Matrix3X2(Silk.NET.Maths.Vector2D row1, Silk.NET.Maths.Vector2D row2, Silk.NET.Maths.Vector2D row3) -> void +Silk.NET.Maths.Matrix3X2.Matrix3X2(T m11, T m12, T m21, T m22, T m31, T m32) -> void +Silk.NET.Maths.Matrix3X2.Row1 -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix3X2.Row2 -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix3X2.Row3 -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix3X2.this[int row, int column].get -> T +Silk.NET.Maths.Matrix3X2.this[int row].get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix3X2.Transpose() -> Silk.NET.Maths.Matrix2X3 +Silk.NET.Maths.Matrix3X3 +Silk.NET.Maths.Matrix3X3 +Silk.NET.Maths.Matrix3X3.As() -> Silk.NET.Maths.Matrix3X3 +Silk.NET.Maths.Matrix3X3.AsChecked() -> Silk.NET.Maths.Matrix3X3 +Silk.NET.Maths.Matrix3X3.AsSaturating() -> Silk.NET.Maths.Matrix3X3 +Silk.NET.Maths.Matrix3X3.AsTruncating() -> Silk.NET.Maths.Matrix3X3 +Silk.NET.Maths.Matrix3X3.Column1.get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix3X3.Column2.get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix3X3.Column3.get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix3X3.Equals(Silk.NET.Maths.Matrix3X3 other) -> bool +Silk.NET.Maths.Matrix3X3.GetDeterminant() -> T +Silk.NET.Maths.Matrix3X3.IsIdentity.get -> bool +Silk.NET.Maths.Matrix3X3.M11.get -> T +Silk.NET.Maths.Matrix3X3.M12.get -> T +Silk.NET.Maths.Matrix3X3.M13.get -> T +Silk.NET.Maths.Matrix3X3.M21.get -> T +Silk.NET.Maths.Matrix3X3.M22.get -> T +Silk.NET.Maths.Matrix3X3.M23.get -> T +Silk.NET.Maths.Matrix3X3.M31.get -> T +Silk.NET.Maths.Matrix3X3.M32.get -> T +Silk.NET.Maths.Matrix3X3.M33.get -> T +Silk.NET.Maths.Matrix3X3.Matrix3X3() -> void +Silk.NET.Maths.Matrix3X3.Matrix3X3(Silk.NET.Maths.Matrix2X4 value) -> void +Silk.NET.Maths.Matrix3X3.Matrix3X3(Silk.NET.Maths.Matrix3X2 value) -> void +Silk.NET.Maths.Matrix3X3.Matrix3X3(Silk.NET.Maths.Matrix3X3 value) -> void +Silk.NET.Maths.Matrix3X3.Matrix3X3(Silk.NET.Maths.Matrix3X4 value) -> void +Silk.NET.Maths.Matrix3X3.Matrix3X3(Silk.NET.Maths.Matrix4X2 value) -> void +Silk.NET.Maths.Matrix3X3.Matrix3X3(Silk.NET.Maths.Matrix4X3 value) -> void +Silk.NET.Maths.Matrix3X3.Matrix3X3(Silk.NET.Maths.Matrix4X4 value) -> void +Silk.NET.Maths.Matrix3X3.Matrix3X3(Silk.NET.Maths.Vector3D row1, Silk.NET.Maths.Vector3D row2, Silk.NET.Maths.Vector3D row3) -> void +Silk.NET.Maths.Matrix3X3.Matrix3X3(T m11, T m12, T m13, T m21, T m22, T m23, T m31, T m32, T m33) -> void +Silk.NET.Maths.Matrix3X3.Row1 -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix3X3.Row2 -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix3X3.Row3 -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix3X3.this[int row, int column].get -> T +Silk.NET.Maths.Matrix3X3.this[int row].get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix3X3.Transpose() -> Silk.NET.Maths.Matrix3X3 +Silk.NET.Maths.Matrix3X4 +Silk.NET.Maths.Matrix3X4 +Silk.NET.Maths.Matrix3X4.As() -> Silk.NET.Maths.Matrix3X4 +Silk.NET.Maths.Matrix3X4.AsChecked() -> Silk.NET.Maths.Matrix3X4 +Silk.NET.Maths.Matrix3X4.AsSaturating() -> Silk.NET.Maths.Matrix3X4 +Silk.NET.Maths.Matrix3X4.AsTruncating() -> Silk.NET.Maths.Matrix3X4 +Silk.NET.Maths.Matrix3X4.Column1.get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix3X4.Column2.get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix3X4.Column3.get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix3X4.Column4.get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix3X4.Equals(Silk.NET.Maths.Matrix3X4 other) -> bool +Silk.NET.Maths.Matrix3X4.IsIdentity.get -> bool +Silk.NET.Maths.Matrix3X4.M11.get -> T +Silk.NET.Maths.Matrix3X4.M12.get -> T +Silk.NET.Maths.Matrix3X4.M13.get -> T +Silk.NET.Maths.Matrix3X4.M14.get -> T +Silk.NET.Maths.Matrix3X4.M21.get -> T +Silk.NET.Maths.Matrix3X4.M22.get -> T +Silk.NET.Maths.Matrix3X4.M23.get -> T +Silk.NET.Maths.Matrix3X4.M24.get -> T +Silk.NET.Maths.Matrix3X4.M31.get -> T +Silk.NET.Maths.Matrix3X4.M32.get -> T +Silk.NET.Maths.Matrix3X4.M33.get -> T +Silk.NET.Maths.Matrix3X4.M34.get -> T +Silk.NET.Maths.Matrix3X4.Matrix3X4() -> void +Silk.NET.Maths.Matrix3X4.Matrix3X4(Silk.NET.Maths.Matrix2X4 value) -> void +Silk.NET.Maths.Matrix3X4.Matrix3X4(Silk.NET.Maths.Matrix3X2 value) -> void +Silk.NET.Maths.Matrix3X4.Matrix3X4(Silk.NET.Maths.Matrix3X3 value) -> void +Silk.NET.Maths.Matrix3X4.Matrix3X4(Silk.NET.Maths.Matrix3X4 value) -> void +Silk.NET.Maths.Matrix3X4.Matrix3X4(Silk.NET.Maths.Matrix4X2 value) -> void +Silk.NET.Maths.Matrix3X4.Matrix3X4(Silk.NET.Maths.Matrix4X3 value) -> void +Silk.NET.Maths.Matrix3X4.Matrix3X4(Silk.NET.Maths.Vector4D row1, Silk.NET.Maths.Vector4D row2, Silk.NET.Maths.Vector4D row3) -> void +Silk.NET.Maths.Matrix3X4.Matrix3X4(T m11, T m12, T m13, T m14, T m21, T m22, T m23, T m24, T m31, T m32, T m33, T m34) -> void +Silk.NET.Maths.Matrix3X4.Row1 -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix3X4.Row2 -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix3X4.Row3 -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix3X4.this[int row, int column].get -> T +Silk.NET.Maths.Matrix3X4.this[int row].get -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix3X4.Transpose() -> Silk.NET.Maths.Matrix4X3 +Silk.NET.Maths.Matrix4X2 +Silk.NET.Maths.Matrix4X2 +Silk.NET.Maths.Matrix4X2.As() -> Silk.NET.Maths.Matrix4X2 +Silk.NET.Maths.Matrix4X2.AsChecked() -> Silk.NET.Maths.Matrix4X2 +Silk.NET.Maths.Matrix4X2.AsSaturating() -> Silk.NET.Maths.Matrix4X2 +Silk.NET.Maths.Matrix4X2.AsTruncating() -> Silk.NET.Maths.Matrix4X2 +Silk.NET.Maths.Matrix4X2.Column1.get -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix4X2.Column2.get -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix4X2.Equals(Silk.NET.Maths.Matrix4X2 other) -> bool +Silk.NET.Maths.Matrix4X2.IsIdentity.get -> bool +Silk.NET.Maths.Matrix4X2.M11.get -> T +Silk.NET.Maths.Matrix4X2.M12.get -> T +Silk.NET.Maths.Matrix4X2.M21.get -> T +Silk.NET.Maths.Matrix4X2.M22.get -> T +Silk.NET.Maths.Matrix4X2.M31.get -> T +Silk.NET.Maths.Matrix4X2.M32.get -> T +Silk.NET.Maths.Matrix4X2.M41.get -> T +Silk.NET.Maths.Matrix4X2.M42.get -> T +Silk.NET.Maths.Matrix4X2.Matrix4X2() -> void +Silk.NET.Maths.Matrix4X2.Matrix4X2(Silk.NET.Maths.Matrix2X4 value) -> void +Silk.NET.Maths.Matrix4X2.Matrix4X2(Silk.NET.Maths.Matrix3X2 value) -> void +Silk.NET.Maths.Matrix4X2.Matrix4X2(Silk.NET.Maths.Matrix3X3 value) -> void +Silk.NET.Maths.Matrix4X2.Matrix4X2(Silk.NET.Maths.Matrix3X4 value) -> void +Silk.NET.Maths.Matrix4X2.Matrix4X2(Silk.NET.Maths.Matrix4X3 value) -> void +Silk.NET.Maths.Matrix4X2.Matrix4X2(Silk.NET.Maths.Vector2D row1, Silk.NET.Maths.Vector2D row2, Silk.NET.Maths.Vector2D row3, Silk.NET.Maths.Vector2D row4) -> void +Silk.NET.Maths.Matrix4X2.Matrix4X2(T m11, T m12, T m21, T m22, T m31, T m32, T m41, T m42) -> void +Silk.NET.Maths.Matrix4X2.Row1 -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix4X2.Row2 -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix4X2.Row3 -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix4X2.Row4 -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix4X2.this[int row, int column].get -> T +Silk.NET.Maths.Matrix4X2.this[int row].get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Matrix4X2.Transpose() -> Silk.NET.Maths.Matrix2X4 +Silk.NET.Maths.Matrix4X3 +Silk.NET.Maths.Matrix4X3 +Silk.NET.Maths.Matrix4X3.As() -> Silk.NET.Maths.Matrix4X3 +Silk.NET.Maths.Matrix4X3.AsChecked() -> Silk.NET.Maths.Matrix4X3 +Silk.NET.Maths.Matrix4X3.AsSaturating() -> Silk.NET.Maths.Matrix4X3 +Silk.NET.Maths.Matrix4X3.AsTruncating() -> Silk.NET.Maths.Matrix4X3 +Silk.NET.Maths.Matrix4X3.Column1.get -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix4X3.Column2.get -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix4X3.Column3.get -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix4X3.Equals(Silk.NET.Maths.Matrix4X3 other) -> bool +Silk.NET.Maths.Matrix4X3.IsIdentity.get -> bool +Silk.NET.Maths.Matrix4X3.M11.get -> T +Silk.NET.Maths.Matrix4X3.M12.get -> T +Silk.NET.Maths.Matrix4X3.M13.get -> T +Silk.NET.Maths.Matrix4X3.M21.get -> T +Silk.NET.Maths.Matrix4X3.M22.get -> T +Silk.NET.Maths.Matrix4X3.M23.get -> T +Silk.NET.Maths.Matrix4X3.M31.get -> T +Silk.NET.Maths.Matrix4X3.M32.get -> T +Silk.NET.Maths.Matrix4X3.M33.get -> T +Silk.NET.Maths.Matrix4X3.M41.get -> T +Silk.NET.Maths.Matrix4X3.M42.get -> T +Silk.NET.Maths.Matrix4X3.M43.get -> T +Silk.NET.Maths.Matrix4X3.Matrix4X3() -> void +Silk.NET.Maths.Matrix4X3.Matrix4X3(Silk.NET.Maths.Matrix2X4 value) -> void +Silk.NET.Maths.Matrix4X3.Matrix4X3(Silk.NET.Maths.Matrix3X2 value) -> void +Silk.NET.Maths.Matrix4X3.Matrix4X3(Silk.NET.Maths.Matrix3X3 value) -> void +Silk.NET.Maths.Matrix4X3.Matrix4X3(Silk.NET.Maths.Matrix3X4 value) -> void +Silk.NET.Maths.Matrix4X3.Matrix4X3(Silk.NET.Maths.Matrix4X2 value) -> void +Silk.NET.Maths.Matrix4X3.Matrix4X3(Silk.NET.Maths.Matrix4X3 value) -> void +Silk.NET.Maths.Matrix4X3.Matrix4X3(Silk.NET.Maths.Matrix4X4 value) -> void +Silk.NET.Maths.Matrix4X3.Matrix4X3(Silk.NET.Maths.Vector3D row1, Silk.NET.Maths.Vector3D row2, Silk.NET.Maths.Vector3D row3, Silk.NET.Maths.Vector3D row4) -> void +Silk.NET.Maths.Matrix4X3.Matrix4X3(T m11, T m12, T m13, T m21, T m22, T m23, T m31, T m32, T m33, T m41, T m42, T m43) -> void +Silk.NET.Maths.Matrix4X3.Row1 -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix4X3.Row2 -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix4X3.Row3 -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix4X3.Row4 -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix4X3.this[int row, int column].get -> T +Silk.NET.Maths.Matrix4X3.this[int row].get -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Matrix4X3.Transpose() -> Silk.NET.Maths.Matrix3X4 +Silk.NET.Maths.Matrix4X4 +Silk.NET.Maths.Matrix4X4 +Silk.NET.Maths.Matrix4X4.As() -> Silk.NET.Maths.Matrix4X4 +Silk.NET.Maths.Matrix4X4.AsChecked() -> Silk.NET.Maths.Matrix4X4 +Silk.NET.Maths.Matrix4X4.AsSaturating() -> Silk.NET.Maths.Matrix4X4 +Silk.NET.Maths.Matrix4X4.AsTruncating() -> Silk.NET.Maths.Matrix4X4 +Silk.NET.Maths.Matrix4X4.Column1.get -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix4X4.Column2.get -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix4X4.Column3.get -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix4X4.Column4.get -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix4X4.Equals(Silk.NET.Maths.Matrix4X4 other) -> bool +Silk.NET.Maths.Matrix4X4.GetDeterminant() -> T +Silk.NET.Maths.Matrix4X4.IsIdentity.get -> bool +Silk.NET.Maths.Matrix4X4.M11.get -> T +Silk.NET.Maths.Matrix4X4.M12.get -> T +Silk.NET.Maths.Matrix4X4.M13.get -> T +Silk.NET.Maths.Matrix4X4.M14.get -> T +Silk.NET.Maths.Matrix4X4.M21.get -> T +Silk.NET.Maths.Matrix4X4.M22.get -> T +Silk.NET.Maths.Matrix4X4.M23.get -> T +Silk.NET.Maths.Matrix4X4.M24.get -> T +Silk.NET.Maths.Matrix4X4.M31.get -> T +Silk.NET.Maths.Matrix4X4.M32.get -> T +Silk.NET.Maths.Matrix4X4.M33.get -> T +Silk.NET.Maths.Matrix4X4.M34.get -> T +Silk.NET.Maths.Matrix4X4.M41.get -> T +Silk.NET.Maths.Matrix4X4.M42.get -> T +Silk.NET.Maths.Matrix4X4.M43.get -> T +Silk.NET.Maths.Matrix4X4.M44.get -> T +Silk.NET.Maths.Matrix4X4.Matrix4X4() -> void +Silk.NET.Maths.Matrix4X4.Matrix4X4(Silk.NET.Maths.Matrix2X4 value) -> void +Silk.NET.Maths.Matrix4X4.Matrix4X4(Silk.NET.Maths.Matrix3X2 value) -> void +Silk.NET.Maths.Matrix4X4.Matrix4X4(Silk.NET.Maths.Matrix3X3 value) -> void +Silk.NET.Maths.Matrix4X4.Matrix4X4(Silk.NET.Maths.Matrix3X4 value) -> void +Silk.NET.Maths.Matrix4X4.Matrix4X4(Silk.NET.Maths.Matrix4X2 value) -> void +Silk.NET.Maths.Matrix4X4.Matrix4X4(Silk.NET.Maths.Matrix4X3 value) -> void +Silk.NET.Maths.Matrix4X4.Matrix4X4(Silk.NET.Maths.Vector4D row1, Silk.NET.Maths.Vector4D row2, Silk.NET.Maths.Vector4D row3, Silk.NET.Maths.Vector4D row4) -> void +Silk.NET.Maths.Matrix4X4.Matrix4X4(T m11, T m12, T m13, T m14, T m21, T m22, T m23, T m24, T m31, T m32, T m33, T m34, T m41, T m42, T m43, T m44) -> void +Silk.NET.Maths.Matrix4X4.Row1 -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix4X4.Row2 -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix4X4.Row3 -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix4X4.Row4 -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix4X4.this[int row, int column].get -> T +Silk.NET.Maths.Matrix4X4.this[int row].get -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix4X4.Transpose() -> Silk.NET.Maths.Matrix4X4 +Silk.NET.Maths.Matrix5X4 +Silk.NET.Maths.Matrix5X4 +Silk.NET.Maths.Matrix5X4.As() -> Silk.NET.Maths.Matrix5X4 +Silk.NET.Maths.Matrix5X4.AsChecked() -> Silk.NET.Maths.Matrix5X4 +Silk.NET.Maths.Matrix5X4.AsSaturating() -> Silk.NET.Maths.Matrix5X4 +Silk.NET.Maths.Matrix5X4.AsTruncating() -> Silk.NET.Maths.Matrix5X4 +Silk.NET.Maths.Matrix5X4.Equals(Silk.NET.Maths.Matrix5X4 other) -> bool +Silk.NET.Maths.Matrix5X4.IsIdentity.get -> bool +Silk.NET.Maths.Matrix5X4.M11.get -> T +Silk.NET.Maths.Matrix5X4.M12.get -> T +Silk.NET.Maths.Matrix5X4.M13.get -> T +Silk.NET.Maths.Matrix5X4.M14.get -> T +Silk.NET.Maths.Matrix5X4.M21.get -> T +Silk.NET.Maths.Matrix5X4.M22.get -> T +Silk.NET.Maths.Matrix5X4.M23.get -> T +Silk.NET.Maths.Matrix5X4.M24.get -> T +Silk.NET.Maths.Matrix5X4.M31.get -> T +Silk.NET.Maths.Matrix5X4.M32.get -> T +Silk.NET.Maths.Matrix5X4.M33.get -> T +Silk.NET.Maths.Matrix5X4.M34.get -> T +Silk.NET.Maths.Matrix5X4.M41.get -> T +Silk.NET.Maths.Matrix5X4.M42.get -> T +Silk.NET.Maths.Matrix5X4.M43.get -> T +Silk.NET.Maths.Matrix5X4.M44.get -> T +Silk.NET.Maths.Matrix5X4.M51.get -> T +Silk.NET.Maths.Matrix5X4.M52.get -> T +Silk.NET.Maths.Matrix5X4.M53.get -> T +Silk.NET.Maths.Matrix5X4.M54.get -> T +Silk.NET.Maths.Matrix5X4.Matrix5X4() -> void +Silk.NET.Maths.Matrix5X4.Matrix5X4(Silk.NET.Maths.Matrix2X4 value) -> void +Silk.NET.Maths.Matrix5X4.Matrix5X4(Silk.NET.Maths.Matrix3X2 value) -> void +Silk.NET.Maths.Matrix5X4.Matrix5X4(Silk.NET.Maths.Matrix3X3 value) -> void +Silk.NET.Maths.Matrix5X4.Matrix5X4(Silk.NET.Maths.Matrix3X4 value) -> void +Silk.NET.Maths.Matrix5X4.Matrix5X4(Silk.NET.Maths.Matrix4X2 value) -> void +Silk.NET.Maths.Matrix5X4.Matrix5X4(Silk.NET.Maths.Matrix4X3 value) -> void +Silk.NET.Maths.Matrix5X4.Matrix5X4(Silk.NET.Maths.Matrix4X4 value) -> void +Silk.NET.Maths.Matrix5X4.Matrix5X4(Silk.NET.Maths.Vector4D row1, Silk.NET.Maths.Vector4D row2, Silk.NET.Maths.Vector4D row3, Silk.NET.Maths.Vector4D row4, Silk.NET.Maths.Vector4D row5) -> void +Silk.NET.Maths.Matrix5X4.Matrix5X4(T m11, T m12, T m13, T m14, T m21, T m22, T m23, T m24, T m31, T m32, T m33, T m34, T m41, T m42, T m43, T m44, T m51, T m52, T m53, T m54) -> void +Silk.NET.Maths.Matrix5X4.Row1 -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix5X4.Row2 -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix5X4.Row3 -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix5X4.Row4 -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix5X4.Row5 -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Matrix5X4.this[int row, int column].get -> T +Silk.NET.Maths.Matrix5X4.this[int row].get -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Plane +Silk.NET.Maths.Plane +Silk.NET.Maths.Plane.As() -> Silk.NET.Maths.Plane +Silk.NET.Maths.Plane.Distance -> T +Silk.NET.Maths.Plane.Equals(Silk.NET.Maths.Plane other) -> bool +Silk.NET.Maths.Plane.Normal -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Plane.Plane() -> void +Silk.NET.Maths.Plane.Plane(Silk.NET.Maths.Vector3D normal, T distance) -> void +Silk.NET.Maths.Plane.Plane(Silk.NET.Maths.Vector4D value) -> void +Silk.NET.Maths.Plane.Plane(T x, T y, T z, T distance) -> void +Silk.NET.Maths.Quaternion +Silk.NET.Maths.Quaternion.Angle.get -> T +Silk.NET.Maths.Quaternion.As() -> Silk.NET.Maths.Quaternion +Silk.NET.Maths.Quaternion.Equals(Silk.NET.Maths.Quaternion other) -> bool +Silk.NET.Maths.Quaternion.IsIdentity.get -> bool +Silk.NET.Maths.Quaternion.Length() -> T +Silk.NET.Maths.Quaternion.LengthSquared() -> T +Silk.NET.Maths.Quaternion.Quaternion() -> void +Silk.NET.Maths.Quaternion.Quaternion(Silk.NET.Maths.Vector3D vectorPart, T scalarPart) -> void +Silk.NET.Maths.Quaternion.Quaternion(T x, T y, T z, T w) -> void +Silk.NET.Maths.Quaternion.this[int index].get -> T +Silk.NET.Maths.Quaternion.W -> T +Silk.NET.Maths.Quaternion.X -> T +Silk.NET.Maths.Quaternion.Y -> T +Silk.NET.Maths.Quaternion.Z -> T +Silk.NET.Maths.Ray2D +Silk.NET.Maths.Ray2D.As() -> Silk.NET.Maths.Ray2D +Silk.NET.Maths.Ray2D.Direction -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Ray2D.Equals(Silk.NET.Maths.Ray2D other) -> bool +Silk.NET.Maths.Ray2D.GetPoint(T distance) -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Ray2D.Origin -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Ray2D.Ray2D() -> void +Silk.NET.Maths.Ray2D.Ray2D(Silk.NET.Maths.Vector2D origin, Silk.NET.Maths.Vector2D direction) -> void +Silk.NET.Maths.Ray2D.Ray2D(Silk.NET.Maths.Vector2D origin, T directionX, T directionY) -> void +Silk.NET.Maths.Ray2D.Ray2D(T originX, T originY, Silk.NET.Maths.Vector2D direction) -> void +Silk.NET.Maths.Ray2D.Ray2D(T originX, T originY, T directionX, T directionY) -> void +Silk.NET.Maths.Ray3D +Silk.NET.Maths.Ray3D.As() -> Silk.NET.Maths.Ray3D +Silk.NET.Maths.Ray3D.Direction -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Ray3D.Equals(Silk.NET.Maths.Ray3D other) -> bool +Silk.NET.Maths.Ray3D.GetPoint(T distance) -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Ray3D.Origin -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Ray3D.Ray3D() -> void +Silk.NET.Maths.Ray3D.Ray3D(Silk.NET.Maths.Vector3D origin, Silk.NET.Maths.Vector3D direction) -> void +Silk.NET.Maths.Ray3D.Ray3D(Silk.NET.Maths.Vector3D origin, T directionX, T directionY, T directionZ) -> void +Silk.NET.Maths.Ray3D.Ray3D(T originX, T originY, T originZ, Silk.NET.Maths.Vector3D direction) -> void +Silk.NET.Maths.Ray3D.Ray3D(T originX, T originY, T originZ, T directionX, T directionY, T directionZ) -> void +Silk.NET.Maths.Rectangle +Silk.NET.Maths.Rectangle +Silk.NET.Maths.Rectangle.As() -> Silk.NET.Maths.Rectangle +Silk.NET.Maths.Rectangle.Center.get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Rectangle.Contains(Silk.NET.Maths.Rectangle other) -> bool +Silk.NET.Maths.Rectangle.Contains(Silk.NET.Maths.Vector2D point) -> bool +Silk.NET.Maths.Rectangle.Equals(Silk.NET.Maths.Rectangle other) -> bool +Silk.NET.Maths.Rectangle.GetDistanceToNearestEdge(Silk.NET.Maths.Vector2D point) -> T +Silk.NET.Maths.Rectangle.GetInflated(Silk.NET.Maths.Vector2D point) -> Silk.NET.Maths.Rectangle +Silk.NET.Maths.Rectangle.GetScaled(Silk.NET.Maths.Vector2D scale, Silk.NET.Maths.Vector2D anchor) -> Silk.NET.Maths.Rectangle +Silk.NET.Maths.Rectangle.GetScaled(Silk.NET.Maths.Vector2D scale, Silk.NET.Maths.Vector2D anchor) -> Silk.NET.Maths.Rectangle +Silk.NET.Maths.Rectangle.GetTranslated(Silk.NET.Maths.Vector2D distance) -> Silk.NET.Maths.Rectangle +Silk.NET.Maths.Rectangle.HalfSize.get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Rectangle.Max.get -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Rectangle.Origin -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Rectangle.Rectangle() -> void +Silk.NET.Maths.Rectangle.Rectangle(Silk.NET.Maths.Vector2D origin, Silk.NET.Maths.Vector2D size) -> void +Silk.NET.Maths.Rectangle.Rectangle(Silk.NET.Maths.Vector2D origin, T sizeX, T sizeY) -> void +Silk.NET.Maths.Rectangle.Rectangle(T originX, T originY, Silk.NET.Maths.Vector2D size) -> void +Silk.NET.Maths.Rectangle.Rectangle(T originX, T originY, T sizeX, T sizeY) -> void +Silk.NET.Maths.Rectangle.Size -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Scalar +Silk.NET.Maths.Scalar +Silk.NET.Maths.Sphere +Silk.NET.Maths.Sphere.As() -> Silk.NET.Maths.Sphere +Silk.NET.Maths.Sphere.Center -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Sphere.Contains(Silk.NET.Maths.Sphere other) -> bool +Silk.NET.Maths.Sphere.Contains(Silk.NET.Maths.Vector3D point) -> bool +Silk.NET.Maths.Sphere.Diameter.get -> T +Silk.NET.Maths.Sphere.Equals(Silk.NET.Maths.Sphere other) -> bool +Silk.NET.Maths.Sphere.GetDistanceToNearestEdge(Silk.NET.Maths.Vector3D point) -> T +Silk.NET.Maths.Sphere.GetDistanceToNearestEdgeSquared(Silk.NET.Maths.Vector3D point) -> T +Silk.NET.Maths.Sphere.GetInflated(Silk.NET.Maths.Vector3D point) -> Silk.NET.Maths.Sphere +Silk.NET.Maths.Sphere.GetTranslated(Silk.NET.Maths.Vector3D distance) -> Silk.NET.Maths.Sphere +Silk.NET.Maths.Sphere.Radius -> T +Silk.NET.Maths.Sphere.Sphere() -> void +Silk.NET.Maths.Sphere.Sphere(Silk.NET.Maths.Vector3D center, T radius) -> void +Silk.NET.Maths.Sphere.Sphere(T centerX, T centerY, T centerZ, T radius) -> void +Silk.NET.Maths.Sphere.SquaredRadius.get -> T +Silk.NET.Maths.SystemNumericsExtensions +Silk.NET.Maths.Vector2D +Silk.NET.Maths.Vector2D.extension(Silk.NET.Maths.Vector2D) +Silk.NET.Maths.Vector2D.extension(Silk.NET.Maths.Vector2D).Length.get -> T +Silk.NET.Maths.Vector2D.extension(Silk.NET.Maths.Vector2D).LengthSquared.get -> T +Silk.NET.Maths.Vector2D +Silk.NET.Maths.Vector2D.As() -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Vector2D.AsChecked() -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Vector2D.AsSaturating() -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Vector2D.AsSpan() -> System.Span +Silk.NET.Maths.Vector2D.AsTruncating() -> Silk.NET.Maths.Vector2D +Silk.NET.Maths.Vector2D.CopyTo(System.Span span) -> void +Silk.NET.Maths.Vector2D.CopyTo(System.Span span, int startIndex) -> void +Silk.NET.Maths.Vector2D.CopyTo(T[]! array) -> void +Silk.NET.Maths.Vector2D.CopyTo(T[]! array, int startIndex) -> void +Silk.NET.Maths.Vector2D.Count.get -> int +Silk.NET.Maths.Vector2D.Equals(Silk.NET.Maths.Vector2D other) -> bool +Silk.NET.Maths.Vector2D.GetEnumerator() -> System.Collections.Generic.IEnumerator! +Silk.NET.Maths.Vector2D.this[int index].get -> T +Silk.NET.Maths.Vector2D.ToString(string? format, System.IFormatProvider? formatProvider) -> string! +Silk.NET.Maths.Vector2D.TryFormat(System.Span utf8Destination, out int bytesWritten, System.ReadOnlySpan format, System.IFormatProvider? provider) -> bool +Silk.NET.Maths.Vector2D.TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format, System.IFormatProvider? provider) -> bool +Silk.NET.Maths.Vector2D.Vector2D() -> void +Silk.NET.Maths.Vector2D.Vector2D(System.ReadOnlySpan values) -> void +Silk.NET.Maths.Vector2D.Vector2D(T value) -> void +Silk.NET.Maths.Vector2D.Vector2D(T x, T y) -> void +Silk.NET.Maths.Vector2D.X -> T +Silk.NET.Maths.Vector2D.Y -> T +Silk.NET.Maths.Vector3D +Silk.NET.Maths.Vector3D.extension(Silk.NET.Maths.Vector3D) +Silk.NET.Maths.Vector3D.extension(Silk.NET.Maths.Vector3D).Length.get -> T +Silk.NET.Maths.Vector3D.extension(Silk.NET.Maths.Vector3D).LengthSquared.get -> T +Silk.NET.Maths.Vector3D +Silk.NET.Maths.Vector3D.As() -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Vector3D.AsChecked() -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Vector3D.AsSaturating() -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Vector3D.AsSpan() -> System.Span +Silk.NET.Maths.Vector3D.AsTruncating() -> Silk.NET.Maths.Vector3D +Silk.NET.Maths.Vector3D.CopyTo(System.Span span) -> void +Silk.NET.Maths.Vector3D.CopyTo(System.Span span, int startIndex) -> void +Silk.NET.Maths.Vector3D.CopyTo(T[]! array) -> void +Silk.NET.Maths.Vector3D.CopyTo(T[]! array, int startIndex) -> void +Silk.NET.Maths.Vector3D.Count.get -> int +Silk.NET.Maths.Vector3D.Equals(Silk.NET.Maths.Vector3D other) -> bool +Silk.NET.Maths.Vector3D.GetEnumerator() -> System.Collections.Generic.IEnumerator! +Silk.NET.Maths.Vector3D.this[int index].get -> T +Silk.NET.Maths.Vector3D.ToString(string? format, System.IFormatProvider? formatProvider) -> string! +Silk.NET.Maths.Vector3D.TryFormat(System.Span utf8Destination, out int bytesWritten, System.ReadOnlySpan format, System.IFormatProvider? provider) -> bool +Silk.NET.Maths.Vector3D.TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format, System.IFormatProvider? provider) -> bool +Silk.NET.Maths.Vector3D.Vector3D() -> void +Silk.NET.Maths.Vector3D.Vector3D(Silk.NET.Maths.Vector2D other, T z) -> void +Silk.NET.Maths.Vector3D.Vector3D(System.ReadOnlySpan values) -> void +Silk.NET.Maths.Vector3D.Vector3D(T value) -> void +Silk.NET.Maths.Vector3D.Vector3D(T x, T y, T z) -> void +Silk.NET.Maths.Vector3D.X -> T +Silk.NET.Maths.Vector3D.Y -> T +Silk.NET.Maths.Vector3D.Z -> T +Silk.NET.Maths.Vector4D +Silk.NET.Maths.Vector4D.extension(Silk.NET.Maths.Vector4D) +Silk.NET.Maths.Vector4D.extension(Silk.NET.Maths.Vector4D).Length.get -> T +Silk.NET.Maths.Vector4D.extension(Silk.NET.Maths.Vector4D).LengthSquared.get -> T +Silk.NET.Maths.Vector4D +Silk.NET.Maths.Vector4D.As() -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Vector4D.AsChecked() -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Vector4D.AsSaturating() -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Vector4D.AsSpan() -> System.Span +Silk.NET.Maths.Vector4D.AsTruncating() -> Silk.NET.Maths.Vector4D +Silk.NET.Maths.Vector4D.CopyTo(System.Span span) -> void +Silk.NET.Maths.Vector4D.CopyTo(System.Span span, int startIndex) -> void +Silk.NET.Maths.Vector4D.CopyTo(T[]! array) -> void +Silk.NET.Maths.Vector4D.CopyTo(T[]! array, int startIndex) -> void +Silk.NET.Maths.Vector4D.Count.get -> int +Silk.NET.Maths.Vector4D.Equals(Silk.NET.Maths.Vector4D other) -> bool +Silk.NET.Maths.Vector4D.GetEnumerator() -> System.Collections.Generic.IEnumerator! +Silk.NET.Maths.Vector4D.this[int index].get -> T +Silk.NET.Maths.Vector4D.ToString(string? format, System.IFormatProvider? formatProvider) -> string! +Silk.NET.Maths.Vector4D.TryFormat(System.Span utf8Destination, out int bytesWritten, System.ReadOnlySpan format, System.IFormatProvider? provider) -> bool +Silk.NET.Maths.Vector4D.TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format, System.IFormatProvider? provider) -> bool +Silk.NET.Maths.Vector4D.Vector4D() -> void +Silk.NET.Maths.Vector4D.Vector4D(Silk.NET.Maths.Vector2D other, T z, T w) -> void +Silk.NET.Maths.Vector4D.Vector4D(Silk.NET.Maths.Vector3D other, T w) -> void +Silk.NET.Maths.Vector4D.Vector4D(System.ReadOnlySpan values) -> void +Silk.NET.Maths.Vector4D.Vector4D(T value) -> void +Silk.NET.Maths.Vector4D.Vector4D(T x, T y, T z, T w) -> void +Silk.NET.Maths.Vector4D.W -> T +Silk.NET.Maths.Vector4D.X -> T +Silk.NET.Maths.Vector4D.Y -> T +Silk.NET.Maths.Vector4D.Z -> T +static readonly Silk.NET.Maths.Scalar.DegreesPerRadian -> T +static readonly Silk.NET.Maths.Scalar.E -> T +static readonly Silk.NET.Maths.Scalar.Epsilon -> T +static readonly Silk.NET.Maths.Scalar.MaxValue -> T +static readonly Silk.NET.Maths.Scalar.MinusOne -> T +static readonly Silk.NET.Maths.Scalar.MinusTwo -> T +static readonly Silk.NET.Maths.Scalar.MinValue -> T +static readonly Silk.NET.Maths.Scalar.NaN -> T +static readonly Silk.NET.Maths.Scalar.NegativeInfinity -> T +static readonly Silk.NET.Maths.Scalar.One -> T +static readonly Silk.NET.Maths.Scalar.Pi -> T +static readonly Silk.NET.Maths.Scalar.PiOver2 -> T +static readonly Silk.NET.Maths.Scalar.PositiveInfinity -> T +static readonly Silk.NET.Maths.Scalar.RadiansPerDegree -> T +static readonly Silk.NET.Maths.Scalar.Tau -> T +static readonly Silk.NET.Maths.Scalar.Two -> T +static readonly Silk.NET.Maths.Scalar.Zero -> T +static Silk.NET.Maths.Box2D.operator !=(Silk.NET.Maths.Box2D value1, Silk.NET.Maths.Box2D value2) -> bool +static Silk.NET.Maths.Box2D.operator ==(Silk.NET.Maths.Box2D value1, Silk.NET.Maths.Box2D value2) -> bool +static Silk.NET.Maths.Box3D.operator !=(Silk.NET.Maths.Box3D value1, Silk.NET.Maths.Box3D value2) -> bool +static Silk.NET.Maths.Box3D.operator ==(Silk.NET.Maths.Box3D value1, Silk.NET.Maths.Box3D value2) -> bool +static Silk.NET.Maths.Circle.operator !=(Silk.NET.Maths.Circle value1, Silk.NET.Maths.Circle value2) -> bool +static Silk.NET.Maths.Circle.operator ==(Silk.NET.Maths.Circle value1, Silk.NET.Maths.Circle value2) -> bool +static Silk.NET.Maths.Cube.operator !=(Silk.NET.Maths.Cube value1, Silk.NET.Maths.Cube value2) -> bool +static Silk.NET.Maths.Cube.operator ==(Silk.NET.Maths.Cube value1, Silk.NET.Maths.Cube value2) -> bool +static Silk.NET.Maths.Matrix2X2.Add(Silk.NET.Maths.Matrix2X2 left, Silk.NET.Maths.Matrix2X2 right) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.Lerp(Silk.NET.Maths.Matrix2X2 value1, Silk.NET.Maths.Matrix2X2 value2, T amount) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.Multiply(Silk.NET.Maths.Matrix2X2 left, Silk.NET.Maths.Matrix2X2 right) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.Multiply(Silk.NET.Maths.Matrix2X2 left, Silk.NET.Maths.Matrix2X3 right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X2.Multiply(Silk.NET.Maths.Matrix2X2 left, Silk.NET.Maths.Matrix2X4 right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X2.Multiply(Silk.NET.Maths.Matrix2X2 left, T right) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.Multiply(Silk.NET.Maths.Matrix2X2 matrix, Silk.NET.Maths.Vector2D columnVector) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Matrix2X2.Multiply(Silk.NET.Maths.Matrix3X2 left, Silk.NET.Maths.Matrix2X2 right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix2X2.Multiply(Silk.NET.Maths.Matrix4X2 left, Silk.NET.Maths.Matrix2X2 right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix2X2.Multiply(Silk.NET.Maths.Vector2D rowVector, Silk.NET.Maths.Matrix2X2 matrix) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Matrix2X2.Multiply(T left, Silk.NET.Maths.Matrix2X2 right) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.Negate(Silk.NET.Maths.Matrix2X2 value) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.Subtract(Silk.NET.Maths.Matrix2X2 left, Silk.NET.Maths.Matrix2X2 right) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.CreateChecked(Silk.NET.Maths.Matrix2X2 other) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.CreateSaturating(Silk.NET.Maths.Matrix2X2 other) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.CreateTruncating(Silk.NET.Maths.Matrix2X2 other) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator checked Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator checked Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator checked Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator checked Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator checked Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator checked Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator checked Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator checked Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator checked Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator checked Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator checked Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator checked Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.explicit operator Silk.NET.Maths.Matrix2X2(Silk.NET.Maths.Matrix2X2 from) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.Identity.get -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.operator !=(Silk.NET.Maths.Matrix2X2 left, Silk.NET.Maths.Matrix2X2 right) -> bool +static Silk.NET.Maths.Matrix2X2.operator *(Silk.NET.Maths.Matrix2X2 left, Silk.NET.Maths.Matrix2X2 right) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.operator *(Silk.NET.Maths.Matrix2X2 left, T right) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.operator *(Silk.NET.Maths.Matrix2X2 matrix, Silk.NET.Maths.Vector2D columnVector) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Matrix2X2.operator *(Silk.NET.Maths.Vector2D rowVector, Silk.NET.Maths.Matrix2X2 matrix) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Matrix2X2.operator *(T left, Silk.NET.Maths.Matrix2X2 right) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.operator +(Silk.NET.Maths.Matrix2X2 left, Silk.NET.Maths.Matrix2X2 right) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.operator -(Silk.NET.Maths.Matrix2X2 left, Silk.NET.Maths.Matrix2X2 right) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.operator -(Silk.NET.Maths.Matrix2X2 value) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X2.operator ==(Silk.NET.Maths.Matrix2X2 left, Silk.NET.Maths.Matrix2X2 right) -> bool +static Silk.NET.Maths.Matrix2X3.Add(Silk.NET.Maths.Matrix2X3 left, Silk.NET.Maths.Matrix2X3 right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.CreateBillboard(Silk.NET.Maths.Vector3D objectPosition, Silk.NET.Maths.Vector3D cameraPosition, Silk.NET.Maths.Vector3D cameraUpVector, Silk.NET.Maths.Vector3D cameraForwardVector) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.CreateFromAxisAngle(Silk.NET.Maths.Vector3D axis, T angle) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.CreateFromQuaternion(Silk.NET.Maths.Quaternion quaternion) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.CreateFromYawPitchRoll(T yaw, T pitch, T roll) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.Lerp(Silk.NET.Maths.Matrix2X3 value1, Silk.NET.Maths.Matrix2X3 value2, T amount) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.Multiply(Silk.NET.Maths.Matrix2X2 left, Silk.NET.Maths.Matrix2X3 right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.Multiply(Silk.NET.Maths.Matrix2X3 left, Silk.NET.Maths.Matrix3X2 right) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X3.Multiply(Silk.NET.Maths.Matrix2X3 left, Silk.NET.Maths.Matrix3X3 right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.Multiply(Silk.NET.Maths.Matrix2X3 left, Silk.NET.Maths.Matrix3X4 right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X3.Multiply(Silk.NET.Maths.Matrix2X3 left, T right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.Multiply(Silk.NET.Maths.Matrix2X3 matrix, Silk.NET.Maths.Vector3D columnVector) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Matrix2X3.Multiply(Silk.NET.Maths.Matrix3X2 left, Silk.NET.Maths.Matrix2X3 right) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix2X3.Multiply(Silk.NET.Maths.Matrix4X2 left, Silk.NET.Maths.Matrix2X3 right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix2X3.Multiply(Silk.NET.Maths.Vector2D rowVector, Silk.NET.Maths.Matrix2X3 matrix) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Matrix2X3.Multiply(T left, Silk.NET.Maths.Matrix2X3 right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.Negate(Silk.NET.Maths.Matrix2X3 value) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.Subtract(Silk.NET.Maths.Matrix2X3 left, Silk.NET.Maths.Matrix2X3 right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.Transform(Silk.NET.Maths.Matrix2X3 value, Silk.NET.Maths.Quaternion rotation) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.CreateChecked(Silk.NET.Maths.Matrix2X3 other) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.CreateSaturating(Silk.NET.Maths.Matrix2X3 other) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.CreateTruncating(Silk.NET.Maths.Matrix2X3 other) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator checked Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator checked Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator checked Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator checked Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator checked Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator checked Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator checked Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator checked Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator checked Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator checked Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator checked Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator checked Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.explicit operator Silk.NET.Maths.Matrix2X3(Silk.NET.Maths.Matrix2X3 from) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.Identity.get -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.operator !=(Silk.NET.Maths.Matrix2X3 left, Silk.NET.Maths.Matrix2X3 right) -> bool +static Silk.NET.Maths.Matrix2X3.operator *(Silk.NET.Maths.Matrix2X2 left, Silk.NET.Maths.Matrix2X3 right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.operator *(Silk.NET.Maths.Matrix2X3 left, Silk.NET.Maths.Matrix3X2 right) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X3.operator *(Silk.NET.Maths.Matrix2X3 left, T right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.operator *(Silk.NET.Maths.Matrix2X3 matrix, Silk.NET.Maths.Vector3D columnVector) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Matrix2X3.operator *(Silk.NET.Maths.Vector2D rowVector, Silk.NET.Maths.Matrix2X3 matrix) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Matrix2X3.operator *(T left, Silk.NET.Maths.Matrix2X3 right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.operator +(Silk.NET.Maths.Matrix2X3 left, Silk.NET.Maths.Matrix2X3 right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.operator -(Silk.NET.Maths.Matrix2X3 left, Silk.NET.Maths.Matrix2X3 right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.operator -(Silk.NET.Maths.Matrix2X3 value) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X3.operator ==(Silk.NET.Maths.Matrix2X3 left, Silk.NET.Maths.Matrix2X3 right) -> bool +static Silk.NET.Maths.Matrix2X4.Add(Silk.NET.Maths.Matrix2X4 left, Silk.NET.Maths.Matrix2X4 right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.Lerp(Silk.NET.Maths.Matrix2X4 value1, Silk.NET.Maths.Matrix2X4 value2, T amount) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.Multiply(Silk.NET.Maths.Matrix2X2 left, Silk.NET.Maths.Matrix2X4 right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.Multiply(Silk.NET.Maths.Matrix2X4 left, Silk.NET.Maths.Matrix4X2 right) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X4.Multiply(Silk.NET.Maths.Matrix2X4 left, Silk.NET.Maths.Matrix4X3 right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix2X4.Multiply(Silk.NET.Maths.Matrix2X4 left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.Multiply(Silk.NET.Maths.Matrix2X4 left, T right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.Multiply(Silk.NET.Maths.Matrix2X4 matrix, Silk.NET.Maths.Vector4D columnVector) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Matrix2X4.Multiply(Silk.NET.Maths.Matrix3X2 left, Silk.NET.Maths.Matrix2X4 right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix2X4.Multiply(Silk.NET.Maths.Matrix4X2 left, Silk.NET.Maths.Matrix2X4 right) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix2X4.Multiply(Silk.NET.Maths.Vector2D rowVector, Silk.NET.Maths.Matrix2X4 matrix) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Matrix2X4.Multiply(T left, Silk.NET.Maths.Matrix2X4 right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.Negate(Silk.NET.Maths.Matrix2X4 value) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.Subtract(Silk.NET.Maths.Matrix2X4 left, Silk.NET.Maths.Matrix2X4 right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.CreateChecked(Silk.NET.Maths.Matrix2X4 other) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.CreateSaturating(Silk.NET.Maths.Matrix2X4 other) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.CreateTruncating(Silk.NET.Maths.Matrix2X4 other) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator checked Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator checked Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator checked Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator checked Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator checked Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator checked Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator checked Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator checked Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator checked Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator checked Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator checked Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator checked Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.explicit operator Silk.NET.Maths.Matrix2X4(Silk.NET.Maths.Matrix2X4 from) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.Identity.get -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.operator !=(Silk.NET.Maths.Matrix2X4 left, Silk.NET.Maths.Matrix2X4 right) -> bool +static Silk.NET.Maths.Matrix2X4.operator *(Silk.NET.Maths.Matrix2X2 left, Silk.NET.Maths.Matrix2X4 right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.operator *(Silk.NET.Maths.Matrix2X4 left, Silk.NET.Maths.Matrix4X2 right) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix2X4.operator *(Silk.NET.Maths.Matrix2X4 left, T right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.operator *(Silk.NET.Maths.Matrix2X4 matrix, Silk.NET.Maths.Vector4D columnVector) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Matrix2X4.operator *(Silk.NET.Maths.Matrix3X2 left, Silk.NET.Maths.Matrix2X4 right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix2X4.operator *(Silk.NET.Maths.Vector2D rowVector, Silk.NET.Maths.Matrix2X4 matrix) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Matrix2X4.operator *(T left, Silk.NET.Maths.Matrix2X4 right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.operator +(Silk.NET.Maths.Matrix2X4 left, Silk.NET.Maths.Matrix2X4 right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.operator -(Silk.NET.Maths.Matrix2X4 left, Silk.NET.Maths.Matrix2X4 right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.operator -(Silk.NET.Maths.Matrix2X4 value) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix2X4.operator ==(Silk.NET.Maths.Matrix2X4 left, Silk.NET.Maths.Matrix2X4 right) -> bool +static Silk.NET.Maths.Matrix3X2.Add(Silk.NET.Maths.Matrix3X2 left, Silk.NET.Maths.Matrix3X2 right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.CreateRotation(T radians) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.CreateRotation(T radians, Silk.NET.Maths.Vector2D centerPoint) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.CreateScale(Silk.NET.Maths.Vector2D scales) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.CreateScale(Silk.NET.Maths.Vector2D scales, Silk.NET.Maths.Vector2D centerPoint) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.CreateScale(T scale) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.CreateScale(T scale, Silk.NET.Maths.Vector2D centerPoint) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.CreateScale(T xScale, T yScale) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.CreateScale(T xScale, T yScale, Silk.NET.Maths.Vector2D centerPoint) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.CreateSkew(T radiansX, T radiansY) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.CreateSkew(T radiansX, T radiansY, Silk.NET.Maths.Vector2D centerPoint) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.CreateTranslation(Silk.NET.Maths.Vector2D position) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.CreateTranslation(T xPosition, T yPosition) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.Invert(Silk.NET.Maths.Matrix3X2 matrix, out Silk.NET.Maths.Matrix3X2 result) -> bool +static Silk.NET.Maths.Matrix3X2.Lerp(Silk.NET.Maths.Matrix3X2 value1, Silk.NET.Maths.Matrix3X2 value2, T amount) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.Multiply(Silk.NET.Maths.Matrix2X3 left, Silk.NET.Maths.Matrix3X2 right) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix3X2.Multiply(Silk.NET.Maths.Matrix3X2 left, Silk.NET.Maths.Matrix2X2 right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.Multiply(Silk.NET.Maths.Matrix3X2 left, Silk.NET.Maths.Matrix2X3 right) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X2.Multiply(Silk.NET.Maths.Matrix3X2 left, Silk.NET.Maths.Matrix2X4 right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X2.Multiply(Silk.NET.Maths.Matrix3X2 left, T right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.Multiply(Silk.NET.Maths.Matrix3X2 matrix, Silk.NET.Maths.Vector2D columnVector) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Matrix3X2.Multiply(Silk.NET.Maths.Matrix3X3 left, Silk.NET.Maths.Matrix3X2 right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.Multiply(Silk.NET.Maths.Matrix4X3 left, Silk.NET.Maths.Matrix3X2 right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix3X2.Multiply(Silk.NET.Maths.Vector3D rowVector, Silk.NET.Maths.Matrix3X2 matrix) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Matrix3X2.Multiply(T left, Silk.NET.Maths.Matrix3X2 right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.Negate(Silk.NET.Maths.Matrix3X2 value) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.Subtract(Silk.NET.Maths.Matrix3X2 left, Silk.NET.Maths.Matrix3X2 right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.CreateChecked(Silk.NET.Maths.Matrix3X2 other) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.CreateSaturating(Silk.NET.Maths.Matrix3X2 other) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.CreateTruncating(Silk.NET.Maths.Matrix3X2 other) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator checked Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator checked Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator checked Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator checked Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator checked Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator checked Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator checked Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator checked Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator checked Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator checked Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator checked Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator checked Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator Silk.NET.Maths.Matrix3X2(Silk.NET.Maths.Matrix3X2 from) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.explicit operator System.Numerics.Matrix3x2(Silk.NET.Maths.Matrix3X2 from) -> System.Numerics.Matrix3x2 +static Silk.NET.Maths.Matrix3X2.Identity.get -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.operator !=(Silk.NET.Maths.Matrix3X2 left, Silk.NET.Maths.Matrix3X2 right) -> bool +static Silk.NET.Maths.Matrix3X2.operator *(Silk.NET.Maths.Matrix3X2 left, Silk.NET.Maths.Matrix2X2 right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.operator *(Silk.NET.Maths.Matrix3X2 left, Silk.NET.Maths.Matrix2X3 right) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X2.operator *(Silk.NET.Maths.Matrix3X2 left, T right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.operator *(Silk.NET.Maths.Matrix3X2 matrix, Silk.NET.Maths.Vector2D columnVector) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Matrix3X2.operator *(Silk.NET.Maths.Vector3D rowVector, Silk.NET.Maths.Matrix3X2 matrix) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Matrix3X2.operator *(T left, Silk.NET.Maths.Matrix3X2 right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.operator +(Silk.NET.Maths.Matrix3X2 left, Silk.NET.Maths.Matrix3X2 right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.operator -(Silk.NET.Maths.Matrix3X2 left, Silk.NET.Maths.Matrix3X2 right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.operator -(Silk.NET.Maths.Matrix3X2 value) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X2.operator ==(Silk.NET.Maths.Matrix3X2 left, Silk.NET.Maths.Matrix3X2 right) -> bool +static Silk.NET.Maths.Matrix3X3.Add(Silk.NET.Maths.Matrix3X3 left, Silk.NET.Maths.Matrix3X3 right) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.CreateBillboard(Silk.NET.Maths.Vector3D objectPosition, Silk.NET.Maths.Vector3D cameraPosition, Silk.NET.Maths.Vector3D cameraUpVector, Silk.NET.Maths.Vector3D cameraForwardVector) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.CreateFromAxisAngle(Silk.NET.Maths.Vector3D axis, T angle) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.CreateFromQuaternion(Silk.NET.Maths.Quaternion quaternion) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.CreateFromYawPitchRoll(T yaw, T pitch, T roll) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.CreateRotationX(T radians) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.CreateRotationY(T radians) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.CreateRotationZ(T radians) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.CreateScale(Silk.NET.Maths.Vector3D scales) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.CreateScale(T scale) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.CreateScale(T xScale, T yScale, T zScale) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.Lerp(Silk.NET.Maths.Matrix3X3 value1, Silk.NET.Maths.Matrix3X3 value2, T amount) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.Multiply(Silk.NET.Maths.Matrix2X3 left, Silk.NET.Maths.Matrix3X3 right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix3X3.Multiply(Silk.NET.Maths.Matrix3X3 left, Silk.NET.Maths.Matrix3X2 right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X3.Multiply(Silk.NET.Maths.Matrix3X3 left, Silk.NET.Maths.Matrix3X3 right) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.Multiply(Silk.NET.Maths.Matrix3X3 left, Silk.NET.Maths.Matrix3X4 right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X3.Multiply(Silk.NET.Maths.Matrix3X3 left, T right) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.Multiply(Silk.NET.Maths.Matrix3X3 matrix, Silk.NET.Maths.Vector3D columnVector) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Matrix3X3.Multiply(Silk.NET.Maths.Matrix4X3 left, Silk.NET.Maths.Matrix3X3 right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix3X3.Multiply(Silk.NET.Maths.Vector3D rowVector, Silk.NET.Maths.Matrix3X3 matrix) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Matrix3X3.Multiply(T left, Silk.NET.Maths.Matrix3X3 right) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.Negate(Silk.NET.Maths.Matrix3X3 value) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.Subtract(Silk.NET.Maths.Matrix3X3 left, Silk.NET.Maths.Matrix3X3 right) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.Transform(Silk.NET.Maths.Matrix3X3 value, Silk.NET.Maths.Quaternion rotation) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.Transpose(Silk.NET.Maths.Matrix3X3 matrix) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.CreateChecked(Silk.NET.Maths.Matrix3X3 other) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.CreateSaturating(Silk.NET.Maths.Matrix3X3 other) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.CreateTruncating(Silk.NET.Maths.Matrix3X3 other) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator checked Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator checked Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator checked Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator checked Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator checked Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator checked Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator checked Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator checked Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator checked Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator checked Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator checked Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator checked Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.explicit operator Silk.NET.Maths.Matrix3X3(Silk.NET.Maths.Matrix3X3 from) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.Identity.get -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.operator !=(Silk.NET.Maths.Matrix3X3 left, Silk.NET.Maths.Matrix3X3 right) -> bool +static Silk.NET.Maths.Matrix3X3.operator *(Silk.NET.Maths.Matrix2X3 left, Silk.NET.Maths.Matrix3X3 right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix3X3.operator *(Silk.NET.Maths.Matrix3X3 left, Silk.NET.Maths.Matrix3X2 right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X3.operator *(Silk.NET.Maths.Matrix3X3 left, Silk.NET.Maths.Matrix3X3 right) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.operator *(Silk.NET.Maths.Matrix3X3 left, T right) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.operator *(Silk.NET.Maths.Matrix3X3 matrix, Silk.NET.Maths.Vector3D columnVector) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Matrix3X3.operator *(Silk.NET.Maths.Vector3D rowVector, Silk.NET.Maths.Matrix3X3 matrix) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Matrix3X3.operator *(T left, Silk.NET.Maths.Matrix3X3 right) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.operator +(Silk.NET.Maths.Matrix3X3 left, Silk.NET.Maths.Matrix3X3 right) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.operator -(Silk.NET.Maths.Matrix3X3 left, Silk.NET.Maths.Matrix3X3 right) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.operator -(Silk.NET.Maths.Matrix3X3 value) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X3.operator ==(Silk.NET.Maths.Matrix3X3 left, Silk.NET.Maths.Matrix3X3 right) -> bool +static Silk.NET.Maths.Matrix3X4.Add(Silk.NET.Maths.Matrix3X4 left, Silk.NET.Maths.Matrix3X4 right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.Lerp(Silk.NET.Maths.Matrix3X4 value1, Silk.NET.Maths.Matrix3X4 value2, T amount) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.Multiply(Silk.NET.Maths.Matrix2X3 left, Silk.NET.Maths.Matrix3X4 right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix3X4.Multiply(Silk.NET.Maths.Matrix3X3 left, Silk.NET.Maths.Matrix3X4 right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.Multiply(Silk.NET.Maths.Matrix3X4 left, Silk.NET.Maths.Matrix4X2 right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X4.Multiply(Silk.NET.Maths.Matrix3X4 left, Silk.NET.Maths.Matrix4X3 right) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X4.Multiply(Silk.NET.Maths.Matrix3X4 left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.Multiply(Silk.NET.Maths.Matrix3X4 left, T right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.Multiply(Silk.NET.Maths.Matrix3X4 matrix, Silk.NET.Maths.Vector4D columnVector) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Matrix3X4.Multiply(Silk.NET.Maths.Matrix4X3 left, Silk.NET.Maths.Matrix3X4 right) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix3X4.Multiply(Silk.NET.Maths.Vector3D rowVector, Silk.NET.Maths.Matrix3X4 matrix) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Matrix3X4.Multiply(T left, Silk.NET.Maths.Matrix3X4 right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.Negate(Silk.NET.Maths.Matrix3X4 value) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.Subtract(Silk.NET.Maths.Matrix3X4 left, Silk.NET.Maths.Matrix3X4 right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.CreateChecked(Silk.NET.Maths.Matrix3X4 other) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.CreateSaturating(Silk.NET.Maths.Matrix3X4 other) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.CreateTruncating(Silk.NET.Maths.Matrix3X4 other) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator checked Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator checked Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator checked Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator checked Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator checked Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator checked Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator checked Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator checked Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator checked Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator checked Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator checked Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator checked Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.explicit operator Silk.NET.Maths.Matrix3X4(Silk.NET.Maths.Matrix3X4 from) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.Identity.get -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.operator !=(Silk.NET.Maths.Matrix3X4 left, Silk.NET.Maths.Matrix3X4 right) -> bool +static Silk.NET.Maths.Matrix3X4.operator *(Silk.NET.Maths.Matrix2X3 left, Silk.NET.Maths.Matrix3X4 right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix3X4.operator *(Silk.NET.Maths.Matrix3X3 left, Silk.NET.Maths.Matrix3X4 right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.operator *(Silk.NET.Maths.Matrix3X4 left, Silk.NET.Maths.Matrix4X2 right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix3X4.operator *(Silk.NET.Maths.Matrix3X4 left, Silk.NET.Maths.Matrix4X3 right) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix3X4.operator *(Silk.NET.Maths.Matrix3X4 left, T right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.operator *(Silk.NET.Maths.Matrix3X4 matrix, Silk.NET.Maths.Vector4D columnVector) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Matrix3X4.operator *(Silk.NET.Maths.Vector3D rowVector, Silk.NET.Maths.Matrix3X4 matrix) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Matrix3X4.operator *(T left, Silk.NET.Maths.Matrix3X4 right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.operator +(Silk.NET.Maths.Matrix3X4 left, Silk.NET.Maths.Matrix3X4 right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.operator -(Silk.NET.Maths.Matrix3X4 left, Silk.NET.Maths.Matrix3X4 right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.operator -(Silk.NET.Maths.Matrix3X4 value) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix3X4.operator ==(Silk.NET.Maths.Matrix3X4 left, Silk.NET.Maths.Matrix3X4 right) -> bool +static Silk.NET.Maths.Matrix4X2.Add(Silk.NET.Maths.Matrix4X2 left, Silk.NET.Maths.Matrix4X2 right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.Lerp(Silk.NET.Maths.Matrix4X2 value1, Silk.NET.Maths.Matrix4X2 value2, T amount) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.Multiply(Silk.NET.Maths.Matrix2X4 left, Silk.NET.Maths.Matrix4X2 right) -> Silk.NET.Maths.Matrix2X2 +static Silk.NET.Maths.Matrix4X2.Multiply(Silk.NET.Maths.Matrix3X4 left, Silk.NET.Maths.Matrix4X2 right) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.Matrix4X2.Multiply(Silk.NET.Maths.Matrix4X2 left, Silk.NET.Maths.Matrix2X2 right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.Multiply(Silk.NET.Maths.Matrix4X2 left, Silk.NET.Maths.Matrix2X3 right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X2.Multiply(Silk.NET.Maths.Matrix4X2 left, Silk.NET.Maths.Matrix2X4 right) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X2.Multiply(Silk.NET.Maths.Matrix4X2 left, T right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.Multiply(Silk.NET.Maths.Matrix4X2 matrix, Silk.NET.Maths.Vector2D columnVector) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Matrix4X2.Multiply(Silk.NET.Maths.Matrix4X4 left, Silk.NET.Maths.Matrix4X2 right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.Multiply(Silk.NET.Maths.Vector4D rowVector, Silk.NET.Maths.Matrix4X2 matrix) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Matrix4X2.Multiply(T left, Silk.NET.Maths.Matrix4X2 right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.Negate(Silk.NET.Maths.Matrix4X2 value) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.Subtract(Silk.NET.Maths.Matrix4X2 left, Silk.NET.Maths.Matrix4X2 right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.CreateChecked(Silk.NET.Maths.Matrix4X2 other) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.CreateSaturating(Silk.NET.Maths.Matrix4X2 other) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.CreateTruncating(Silk.NET.Maths.Matrix4X2 other) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator checked Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator checked Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator checked Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator checked Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator checked Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator checked Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator checked Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator checked Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator checked Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator checked Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator checked Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator checked Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.explicit operator Silk.NET.Maths.Matrix4X2(Silk.NET.Maths.Matrix4X2 from) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.Identity.get -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.operator !=(Silk.NET.Maths.Matrix4X2 left, Silk.NET.Maths.Matrix4X2 right) -> bool +static Silk.NET.Maths.Matrix4X2.operator *(Silk.NET.Maths.Matrix4X2 left, Silk.NET.Maths.Matrix2X2 right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.operator *(Silk.NET.Maths.Matrix4X2 left, Silk.NET.Maths.Matrix2X3 right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X2.operator *(Silk.NET.Maths.Matrix4X2 left, Silk.NET.Maths.Matrix2X4 right) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X2.operator *(Silk.NET.Maths.Matrix4X2 left, T right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.operator *(Silk.NET.Maths.Matrix4X2 matrix, Silk.NET.Maths.Vector2D columnVector) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Matrix4X2.operator *(Silk.NET.Maths.Vector4D rowVector, Silk.NET.Maths.Matrix4X2 matrix) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Matrix4X2.operator *(T left, Silk.NET.Maths.Matrix4X2 right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.operator +(Silk.NET.Maths.Matrix4X2 left, Silk.NET.Maths.Matrix4X2 right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.operator -(Silk.NET.Maths.Matrix4X2 left, Silk.NET.Maths.Matrix4X2 right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.operator -(Silk.NET.Maths.Matrix4X2 value) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X2.operator ==(Silk.NET.Maths.Matrix4X2 left, Silk.NET.Maths.Matrix4X2 right) -> bool +static Silk.NET.Maths.Matrix4X3.Add(Silk.NET.Maths.Matrix4X3 left, Silk.NET.Maths.Matrix4X3 right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.Lerp(Silk.NET.Maths.Matrix4X3 value1, Silk.NET.Maths.Matrix4X3 value2, T amount) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.Multiply(Silk.NET.Maths.Matrix2X4 left, Silk.NET.Maths.Matrix4X3 right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix4X3.Multiply(Silk.NET.Maths.Matrix3X4 left, Silk.NET.Maths.Matrix4X3 right) -> Silk.NET.Maths.Matrix3X3 +static Silk.NET.Maths.Matrix4X3.Multiply(Silk.NET.Maths.Matrix4X3 left, Silk.NET.Maths.Matrix3X2 right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X3.Multiply(Silk.NET.Maths.Matrix4X3 left, Silk.NET.Maths.Matrix3X3 right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.Multiply(Silk.NET.Maths.Matrix4X3 left, Silk.NET.Maths.Matrix3X4 right) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X3.Multiply(Silk.NET.Maths.Matrix4X3 left, T right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.Multiply(Silk.NET.Maths.Matrix4X3 matrix, Silk.NET.Maths.Vector3D columnVector) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Matrix4X3.Multiply(Silk.NET.Maths.Matrix4X4 left, Silk.NET.Maths.Matrix4X3 right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.Multiply(Silk.NET.Maths.Vector4D rowVector, Silk.NET.Maths.Matrix4X3 matrix) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Matrix4X3.Multiply(T left, Silk.NET.Maths.Matrix4X3 right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.Negate(Silk.NET.Maths.Matrix4X3 value) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.Subtract(Silk.NET.Maths.Matrix4X3 left, Silk.NET.Maths.Matrix4X3 right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.CreateChecked(Silk.NET.Maths.Matrix4X3 other) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.CreateSaturating(Silk.NET.Maths.Matrix4X3 other) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.CreateTruncating(Silk.NET.Maths.Matrix4X3 other) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator checked Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator checked Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator checked Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator checked Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator checked Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator checked Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator checked Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator checked Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator checked Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator checked Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator checked Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator checked Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.explicit operator Silk.NET.Maths.Matrix4X3(Silk.NET.Maths.Matrix4X3 from) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.Identity.get -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.operator !=(Silk.NET.Maths.Matrix4X3 left, Silk.NET.Maths.Matrix4X3 right) -> bool +static Silk.NET.Maths.Matrix4X3.operator *(Silk.NET.Maths.Matrix2X4 left, Silk.NET.Maths.Matrix4X3 right) -> Silk.NET.Maths.Matrix2X3 +static Silk.NET.Maths.Matrix4X3.operator *(Silk.NET.Maths.Matrix4X3 left, Silk.NET.Maths.Matrix3X2 right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X3.operator *(Silk.NET.Maths.Matrix4X3 left, Silk.NET.Maths.Matrix3X3 right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.operator *(Silk.NET.Maths.Matrix4X3 left, Silk.NET.Maths.Matrix3X4 right) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X3.operator *(Silk.NET.Maths.Matrix4X3 left, T right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.operator *(Silk.NET.Maths.Matrix4X3 matrix, Silk.NET.Maths.Vector3D columnVector) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Matrix4X3.operator *(Silk.NET.Maths.Vector4D rowVector, Silk.NET.Maths.Matrix4X3 matrix) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Matrix4X3.operator *(T left, Silk.NET.Maths.Matrix4X3 right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.operator +(Silk.NET.Maths.Matrix4X3 left, Silk.NET.Maths.Matrix4X3 right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.operator -(Silk.NET.Maths.Matrix4X3 left, Silk.NET.Maths.Matrix4X3 right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.operator -(Silk.NET.Maths.Matrix4X3 value) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X3.operator ==(Silk.NET.Maths.Matrix4X3 left, Silk.NET.Maths.Matrix4X3 right) -> bool +static Silk.NET.Maths.Matrix4X4.Add(Silk.NET.Maths.Matrix4X4 left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateBillboard(Silk.NET.Maths.Vector3D objectPosition, Silk.NET.Maths.Vector3D cameraPosition, Silk.NET.Maths.Vector3D cameraUpVector, Silk.NET.Maths.Vector3D cameraForwardVector) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateConstrainedBillboard(Silk.NET.Maths.Vector3D objectPosition, Silk.NET.Maths.Vector3D cameraPosition, Silk.NET.Maths.Vector3D rotateAxis, Silk.NET.Maths.Vector3D cameraForwardVector, Silk.NET.Maths.Vector3D objectForwardVector) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateFromAxisAngle(Silk.NET.Maths.Vector3D axis, T angle) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateFromQuaternion(Silk.NET.Maths.Quaternion quaternion) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateFromYawPitchRoll(T yaw, T pitch, T roll) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateLookAt(Silk.NET.Maths.Vector3D cameraPosition, Silk.NET.Maths.Vector3D cameraTarget, Silk.NET.Maths.Vector3D cameraUpVector) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateOrthographic(T width, T height, T zNearPlane, T zFarPlane) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateOrthographicOffCenter(T left, T right, T bottom, T top, T zNearPlane, T zFarPlane) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreatePerspective(T width, T height, T nearPlaneDistance, T farPlaneDistance) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreatePerspectiveFieldOfView(T fieldOfView, T aspectRatio, T nearPlaneDistance, T farPlaneDistance) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreatePerspectiveOffCenter(T left, T right, T bottom, T top, T nearPlaneDistance, T farPlaneDistance) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateReflection(Silk.NET.Maths.Plane value) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateRotationX(T radians) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateRotationX(T radians, Silk.NET.Maths.Vector3D centerPoint) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateRotationY(T radians) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateRotationY(T radians, Silk.NET.Maths.Vector3D centerPoint) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateRotationZ(T radians) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateRotationZ(T radians, Silk.NET.Maths.Vector3D centerPoint) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateScale(Silk.NET.Maths.Vector3D scales) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateScale(Silk.NET.Maths.Vector3D scales, Silk.NET.Maths.Vector3D centerPoint) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateScale(T scale) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateScale(T scale, Silk.NET.Maths.Vector3D centerPoint) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateScale(T xScale, T yScale, T zScale) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateScale(T xScale, T yScale, T zScale, Silk.NET.Maths.Vector3D centerPoint) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateShadow(Silk.NET.Maths.Vector3D lightDirection, Silk.NET.Maths.Plane plane) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateTranslation(Silk.NET.Maths.Vector3D position) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateTranslation(T xPosition, T yPosition, T zPosition) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateWorld(Silk.NET.Maths.Vector3D position, Silk.NET.Maths.Vector3D forward, Silk.NET.Maths.Vector3D up) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.Invert(Silk.NET.Maths.Matrix4X4 matrix, out Silk.NET.Maths.Matrix4X4 result) -> bool +static Silk.NET.Maths.Matrix4X4.Lerp(Silk.NET.Maths.Matrix4X4 value1, Silk.NET.Maths.Matrix4X4 value2, T amount) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.Multiply(Silk.NET.Maths.Matrix2X4 left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix4X4.Multiply(Silk.NET.Maths.Matrix3X4 left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix4X4.Multiply(Silk.NET.Maths.Matrix4X4 left, Silk.NET.Maths.Matrix4X2 right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X4.Multiply(Silk.NET.Maths.Matrix4X4 left, Silk.NET.Maths.Matrix4X3 right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X4.Multiply(Silk.NET.Maths.Matrix4X4 left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.Multiply(Silk.NET.Maths.Matrix4X4 left, T right) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.Multiply(Silk.NET.Maths.Matrix4X4 matrix, Silk.NET.Maths.Vector4D columnVector) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Matrix4X4.Multiply(Silk.NET.Maths.Matrix5X4 left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix4X4.Multiply(Silk.NET.Maths.Vector4D rowVector, Silk.NET.Maths.Matrix4X4 matrix) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Matrix4X4.Multiply(T left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.Negate(Silk.NET.Maths.Matrix4X4 value) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.Subtract(Silk.NET.Maths.Matrix4X4 left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.Transform(Silk.NET.Maths.Matrix4X4 value, Silk.NET.Maths.Quaternion rotation) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.Transpose(Silk.NET.Maths.Matrix4X4 matrix) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateChecked(Silk.NET.Maths.Matrix4X4 other) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateSaturating(Silk.NET.Maths.Matrix4X4 other) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.CreateTruncating(Silk.NET.Maths.Matrix4X4 other) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator checked Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator checked Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator checked Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator checked Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator checked Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator checked Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator checked Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator checked Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator checked Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator checked Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator checked Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator checked Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.explicit operator Silk.NET.Maths.Matrix4X4(Silk.NET.Maths.Matrix4X4 from) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.Identity.get -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.operator !=(Silk.NET.Maths.Matrix4X4 left, Silk.NET.Maths.Matrix4X4 right) -> bool +static Silk.NET.Maths.Matrix4X4.operator *(Silk.NET.Maths.Matrix2X4 left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix2X4 +static Silk.NET.Maths.Matrix4X4.operator *(Silk.NET.Maths.Matrix3X4 left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix3X4 +static Silk.NET.Maths.Matrix4X4.operator *(Silk.NET.Maths.Matrix4X4 left, Silk.NET.Maths.Matrix4X2 right) -> Silk.NET.Maths.Matrix4X2 +static Silk.NET.Maths.Matrix4X4.operator *(Silk.NET.Maths.Matrix4X4 left, Silk.NET.Maths.Matrix4X3 right) -> Silk.NET.Maths.Matrix4X3 +static Silk.NET.Maths.Matrix4X4.operator *(Silk.NET.Maths.Matrix4X4 left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.operator *(Silk.NET.Maths.Matrix4X4 left, T right) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.operator *(Silk.NET.Maths.Matrix4X4 matrix, Silk.NET.Maths.Vector4D columnVector) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Matrix4X4.operator *(Silk.NET.Maths.Vector4D rowVector, Silk.NET.Maths.Matrix4X4 matrix) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Matrix4X4.operator *(T left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.operator +(Silk.NET.Maths.Matrix4X4 left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.operator -(Silk.NET.Maths.Matrix4X4 left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.operator -(Silk.NET.Maths.Matrix4X4 value) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.Matrix4X4.operator ==(Silk.NET.Maths.Matrix4X4 left, Silk.NET.Maths.Matrix4X4 right) -> bool +static Silk.NET.Maths.Matrix5X4.Add(Silk.NET.Maths.Matrix5X4 left, Silk.NET.Maths.Matrix5X4 right) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.Lerp(Silk.NET.Maths.Matrix5X4 value1, Silk.NET.Maths.Matrix5X4 value2, T amount) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.Multiply(Silk.NET.Maths.Matrix5X4 left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.Multiply(Silk.NET.Maths.Matrix5X4 left, T right) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.Multiply(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Matrix5X4 value2) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Matrix5X4.Multiply(T left, Silk.NET.Maths.Matrix5X4 right) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.Negate(Silk.NET.Maths.Matrix5X4 value) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.Subtract(Silk.NET.Maths.Matrix5X4 left, Silk.NET.Maths.Matrix5X4 right) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.CreateChecked(Silk.NET.Maths.Matrix5X4 other) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.CreateSaturating(Silk.NET.Maths.Matrix5X4 other) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.CreateTruncating(Silk.NET.Maths.Matrix5X4 other) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator checked Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator checked Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator checked Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator checked Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator checked Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator checked Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator checked Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator checked Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator checked Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator checked Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator checked Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator checked Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.explicit operator Silk.NET.Maths.Matrix5X4(Silk.NET.Maths.Matrix5X4 from) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.Identity.get -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.operator !=(Silk.NET.Maths.Matrix5X4 left, Silk.NET.Maths.Matrix5X4 right) -> bool +static Silk.NET.Maths.Matrix5X4.operator *(Silk.NET.Maths.Matrix5X4 left, Silk.NET.Maths.Matrix4X4 right) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.operator *(Silk.NET.Maths.Matrix5X4 left, T right) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.operator *(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Matrix5X4 value2) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Matrix5X4.operator *(T left, Silk.NET.Maths.Matrix5X4 right) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.operator +(Silk.NET.Maths.Matrix5X4 left, Silk.NET.Maths.Matrix5X4 right) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.operator -(Silk.NET.Maths.Matrix5X4 left, Silk.NET.Maths.Matrix5X4 right) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.operator -(Silk.NET.Maths.Matrix5X4 value) -> Silk.NET.Maths.Matrix5X4 +static Silk.NET.Maths.Matrix5X4.operator ==(Silk.NET.Maths.Matrix5X4 left, Silk.NET.Maths.Matrix5X4 right) -> bool +static Silk.NET.Maths.Plane.CreateFromVertices(Silk.NET.Maths.Vector3D point1, Silk.NET.Maths.Vector3D point2, Silk.NET.Maths.Vector3D point3) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.Plane.Dot(Silk.NET.Maths.Plane plane, Silk.NET.Maths.Vector4D value) -> T +static Silk.NET.Maths.Plane.DotCoordinate(Silk.NET.Maths.Plane plane, Silk.NET.Maths.Vector3D value) -> T +static Silk.NET.Maths.Plane.DotNormal(Silk.NET.Maths.Plane plane, Silk.NET.Maths.Vector3D value) -> T +static Silk.NET.Maths.Plane.Normalize(Silk.NET.Maths.Plane value) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.Plane.Transform(Silk.NET.Maths.Plane plane, Silk.NET.Maths.Matrix4X4 matrix) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.Plane.Transform(Silk.NET.Maths.Plane plane, Silk.NET.Maths.Quaternion rotation) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.Plane.explicit operator Silk.NET.Maths.Plane(Silk.NET.Maths.Plane from) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.Plane.explicit operator System.Numerics.Plane(Silk.NET.Maths.Plane from) -> System.Numerics.Plane +static Silk.NET.Maths.Plane.operator !=(Silk.NET.Maths.Plane value1, Silk.NET.Maths.Plane value2) -> bool +static Silk.NET.Maths.Plane.operator ==(Silk.NET.Maths.Plane value1, Silk.NET.Maths.Plane value2) -> bool +static Silk.NET.Maths.Quaternion.Add(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.Concatenate(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.Conjugate(Silk.NET.Maths.Quaternion value) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.CreateFromAxisAngle(Silk.NET.Maths.Vector3D axis, T angle) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.CreateFromRotationMatrix(Silk.NET.Maths.Matrix3X3 matrix) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.CreateFromRotationMatrix(Silk.NET.Maths.Matrix4X4 matrix) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.CreateFromYawPitchRoll(T yaw, T pitch, T roll) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.Divide(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.Dot(Silk.NET.Maths.Quaternion quaternion1, Silk.NET.Maths.Quaternion quaternion2) -> T +static Silk.NET.Maths.Quaternion.explicit operator Silk.NET.Maths.Quaternion(Silk.NET.Maths.Quaternion from) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.explicit operator Silk.NET.Maths.Quaternion(Silk.NET.Maths.Quaternion from) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.explicit operator Silk.NET.Maths.Quaternion(Silk.NET.Maths.Quaternion from) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.explicit operator System.Numerics.Quaternion(Silk.NET.Maths.Quaternion from) -> System.Numerics.Quaternion +static Silk.NET.Maths.Quaternion.Identity.get -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.Inverse(Silk.NET.Maths.Quaternion value) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.Lerp(Silk.NET.Maths.Quaternion quaternion1, Silk.NET.Maths.Quaternion quaternion2, T amount) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.Multiply(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.Multiply(Silk.NET.Maths.Quaternion value1, T value2) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.Negate(Silk.NET.Maths.Quaternion value) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.Normalize(Silk.NET.Maths.Quaternion value) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.operator !=(Silk.NET.Maths.Quaternion left, Silk.NET.Maths.Quaternion right) -> bool +static Silk.NET.Maths.Quaternion.operator *(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.operator *(Silk.NET.Maths.Quaternion value1, T value2) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.operator +(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.operator -(Silk.NET.Maths.Quaternion value) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.operator -(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.operator /(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.operator ==(Silk.NET.Maths.Quaternion left, Silk.NET.Maths.Quaternion right) -> bool +static Silk.NET.Maths.Quaternion.Slerp(Silk.NET.Maths.Quaternion quaternion1, Silk.NET.Maths.Quaternion quaternion2, T amount) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Quaternion.Subtract(Silk.NET.Maths.Quaternion value1, Silk.NET.Maths.Quaternion value2) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.Ray2D.operator !=(Silk.NET.Maths.Ray2D value1, Silk.NET.Maths.Ray2D value2) -> bool +static Silk.NET.Maths.Ray2D.operator ==(Silk.NET.Maths.Ray2D value1, Silk.NET.Maths.Ray2D value2) -> bool +static Silk.NET.Maths.Ray3D.operator !=(Silk.NET.Maths.Ray3D value1, Silk.NET.Maths.Ray3D value2) -> bool +static Silk.NET.Maths.Ray3D.operator ==(Silk.NET.Maths.Ray3D value1, Silk.NET.Maths.Ray3D value2) -> bool +static Silk.NET.Maths.Rectangle.FromLTRB(T left, T top, T right, T bottom) -> Silk.NET.Maths.Rectangle +static Silk.NET.Maths.Rectangle.operator !=(Silk.NET.Maths.Rectangle value1, Silk.NET.Maths.Rectangle value2) -> bool +static Silk.NET.Maths.Rectangle.operator ==(Silk.NET.Maths.Rectangle value1, Silk.NET.Maths.Rectangle value2) -> bool +static Silk.NET.Maths.Scalar.Abs(T x) -> T +static Silk.NET.Maths.Scalar.Acos(T x) -> T +static Silk.NET.Maths.Scalar.Acosh(T x) -> T +static Silk.NET.Maths.Scalar.Add(T left, T right) -> T +static Silk.NET.Maths.Scalar.And(T left, T right) -> T +static Silk.NET.Maths.Scalar.As(TFrom val) -> TTo +static Silk.NET.Maths.Scalar.Asin(T x) -> T +static Silk.NET.Maths.Scalar.Asinh(T x) -> T +static Silk.NET.Maths.Scalar.Atan2(T y, T x) -> T +static Silk.NET.Maths.Scalar.Atan(T x) -> T +static Silk.NET.Maths.Scalar.Atanh(T x) -> T +static Silk.NET.Maths.Scalar.Cbrt(T x) -> T +static Silk.NET.Maths.Scalar.Ceiling(T x) -> T +static Silk.NET.Maths.Scalar.Cos(T x) -> T +static Silk.NET.Maths.Scalar.Cosh(T x) -> T +static Silk.NET.Maths.Scalar.DegreesToRadians(T degrees) -> T +static Silk.NET.Maths.Scalar.Divide(T left, T right) -> T +static Silk.NET.Maths.Scalar.Equal(T left, T right) -> bool +static Silk.NET.Maths.Scalar.Exp(T x) -> T +static Silk.NET.Maths.Scalar.Floor(T x) -> T +static Silk.NET.Maths.Scalar.GreaterThan(T left, T right) -> bool +static Silk.NET.Maths.Scalar.GreaterThanOrEqual(T left, T right) -> bool +static Silk.NET.Maths.Scalar.IEEERemainder(T x, T y) -> T +static Silk.NET.Maths.Scalar.IsFinite(T f) -> bool +static Silk.NET.Maths.Scalar.IsHardwareAccelerated.get -> bool +static Silk.NET.Maths.Scalar.IsInfinity(T f) -> bool +static Silk.NET.Maths.Scalar.IsNaN(T f) -> bool +static Silk.NET.Maths.Scalar.IsNegative(T f) -> bool +static Silk.NET.Maths.Scalar.IsNegativeInfinity(T f) -> bool +static Silk.NET.Maths.Scalar.IsNormal(T f) -> bool +static Silk.NET.Maths.Scalar.IsPositiveInfinity(T f) -> bool +static Silk.NET.Maths.Scalar.IsSubnormal(T f) -> bool +static Silk.NET.Maths.Scalar.LessThan(T left, T right) -> bool +static Silk.NET.Maths.Scalar.LessThanOrEqual(T left, T right) -> bool +static Silk.NET.Maths.Scalar.Log10(T x) -> T +static Silk.NET.Maths.Scalar.Log(T x) -> T +static Silk.NET.Maths.Scalar.Log(T x, T y) -> T +static Silk.NET.Maths.Scalar.Max(T x, T y) -> T +static Silk.NET.Maths.Scalar.Min(T x, T y) -> T +static Silk.NET.Maths.Scalar.Multiply(T left, T right) -> T +static Silk.NET.Maths.Scalar.Negate(T x) -> T +static Silk.NET.Maths.Scalar.Not(T value) -> T +static Silk.NET.Maths.Scalar.NotEqual(T left, T right) -> bool +static Silk.NET.Maths.Scalar.Or(T left, T right) -> T +static Silk.NET.Maths.Scalar.Pow(T x, T y) -> T +static Silk.NET.Maths.Scalar.RadiansToDegrees(T radians) -> T +static Silk.NET.Maths.Scalar.Reciprocal(T x) -> T +static Silk.NET.Maths.Scalar.RotateLeft(T value, int offset) -> T +static Silk.NET.Maths.Scalar.RotateRight(T value, int offset) -> T +static Silk.NET.Maths.Scalar.Round(T x) -> T +static Silk.NET.Maths.Scalar.Round(T x, int digits) -> T +static Silk.NET.Maths.Scalar.Round(T x, int digits, System.MidpointRounding mode) -> T +static Silk.NET.Maths.Scalar.Round(T x, System.MidpointRounding mode) -> T +static Silk.NET.Maths.Scalar.ShiftLeft(T value, int offset) -> T +static Silk.NET.Maths.Scalar.ShiftRight(T value, int offset) -> T +static Silk.NET.Maths.Scalar.Sign(T x) -> int +static Silk.NET.Maths.Scalar.Sin(T x) -> T +static Silk.NET.Maths.Scalar.Sinh(T x) -> T +static Silk.NET.Maths.Scalar.Sqrt(T x) -> T +static Silk.NET.Maths.Scalar.Subtract(T left, T right) -> T +static Silk.NET.Maths.Scalar.Tan(T x) -> T +static Silk.NET.Maths.Scalar.Tanh(T x) -> T +static Silk.NET.Maths.Scalar.Truncate(T x) -> T +static Silk.NET.Maths.Scalar.Xor(T left, T right) -> T +static Silk.NET.Maths.Sphere.operator !=(Silk.NET.Maths.Sphere value1, Silk.NET.Maths.Sphere value2) -> bool +static Silk.NET.Maths.Sphere.operator ==(Silk.NET.Maths.Sphere value1, Silk.NET.Maths.Sphere value2) -> bool +static Silk.NET.Maths.SystemNumericsExtensions.ToGeneric(this System.Numerics.Matrix3x2 value) -> Silk.NET.Maths.Matrix3X2 +static Silk.NET.Maths.SystemNumericsExtensions.ToGeneric(this System.Numerics.Matrix4x4 value) -> Silk.NET.Maths.Matrix4X4 +static Silk.NET.Maths.SystemNumericsExtensions.ToGeneric(this System.Numerics.Plane value) -> Silk.NET.Maths.Plane +static Silk.NET.Maths.SystemNumericsExtensions.ToGeneric(this System.Numerics.Quaternion value) -> Silk.NET.Maths.Quaternion +static Silk.NET.Maths.SystemNumericsExtensions.ToGeneric(this System.Numerics.Vector2 value) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.SystemNumericsExtensions.ToGeneric(this System.Numerics.Vector3 value) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.SystemNumericsExtensions.ToGeneric(this System.Numerics.Vector4 value) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.SystemNumericsExtensions.ToSystem(this Silk.NET.Maths.Matrix3X2 value) -> System.Numerics.Matrix3x2 +static Silk.NET.Maths.SystemNumericsExtensions.ToSystem(this Silk.NET.Maths.Matrix4X4 value) -> System.Numerics.Matrix4x4 +static Silk.NET.Maths.SystemNumericsExtensions.ToSystem(this Silk.NET.Maths.Plane value) -> System.Numerics.Plane +static Silk.NET.Maths.SystemNumericsExtensions.ToSystem(this Silk.NET.Maths.Quaternion value) -> System.Numerics.Quaternion +static Silk.NET.Maths.SystemNumericsExtensions.ToSystem(this Silk.NET.Maths.Vector2D value) -> System.Numerics.Vector2 +static Silk.NET.Maths.SystemNumericsExtensions.ToSystem(this Silk.NET.Maths.Vector3D value) -> System.Numerics.Vector3 +static Silk.NET.Maths.SystemNumericsExtensions.ToSystem(this Silk.NET.Maths.Vector4D value) -> System.Numerics.Vector4 +static Silk.NET.Maths.Vector2D.Abs(this Silk.NET.Maths.Vector2D value) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Acos(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Acosh(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.AcosPi(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Asin(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Asinh(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.AsinPi(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Atan2(this Silk.NET.Maths.Vector2D y, Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Atan2Pi(this Silk.NET.Maths.Vector2D y, Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Atan(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Atanh(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.AtanPi(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.BitDecrement(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.BitIncrement(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Cbrt(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Ceiling(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Clamp(this Silk.NET.Maths.Vector2D value, Silk.NET.Maths.Vector2D min, Silk.NET.Maths.Vector2D max) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Clamp(this Silk.NET.Maths.Vector2D value, TSelf min, TSelf max) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.CopySign(this Silk.NET.Maths.Vector2D value, Silk.NET.Maths.Vector2D sign) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.CopySign(this Silk.NET.Maths.Vector2D value, TSelf sign) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Cos(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Cosh(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.CosPi(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Cross(this Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> T +static Silk.NET.Maths.Vector2D.Deconstruct(this Silk.NET.Maths.Vector2D vector, out T x, out T y) -> void +static Silk.NET.Maths.Vector2D.DegreesToRadians(this Silk.NET.Maths.Vector2D degrees) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Distance(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Vector2D value2) -> T +static Silk.NET.Maths.Vector2D.DistanceSquared(Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Vector2D value2) -> T +static Silk.NET.Maths.Vector2D.DivRem(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> (Silk.NET.Maths.Vector2D Quotient, Silk.NET.Maths.Vector2D Remainder) +static Silk.NET.Maths.Vector2D.Dot(this Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> T +static Silk.NET.Maths.Vector2D.Exp10(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Exp10M1(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Exp2(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Exp2M1(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Exp(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.ExpM1(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Floor(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.FusedMultiplyAdd(this Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right, Silk.NET.Maths.Vector2D addend) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.FusedMultiplyAdd(this Silk.NET.Maths.Vector2D left, TSelf right, TSelf addend) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Hypot(this Silk.NET.Maths.Vector2D x, Silk.NET.Maths.Vector2D y) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Ieee754Remainder(this Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Ieee754Remainder(this Silk.NET.Maths.Vector2D left, TSelf right) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.ILogB(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Lerp(this Silk.NET.Maths.Vector2D value1, Silk.NET.Maths.Vector2D value2, TSelf amount) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.LerpClamped(Silk.NET.Maths.Vector2D a, Silk.NET.Maths.Vector2D b, Silk.NET.Maths.Vector2D amount) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.LerpClamped(Silk.NET.Maths.Vector2D a, Silk.NET.Maths.Vector2D b, T amount) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Log10(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Log10P1(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Log2(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Log2P1(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Log(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Log(this Silk.NET.Maths.Vector2D x, TSelf newBase) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.LogP1(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Max(this Silk.NET.Maths.Vector2D x, Silk.NET.Maths.Vector2D y) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Max(this Silk.NET.Maths.Vector2D x, TSelf y) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.MaxMagnitude(this Silk.NET.Maths.Vector2D x, Silk.NET.Maths.Vector2D y) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.MaxMagnitudeNumber(this Silk.NET.Maths.Vector2D x, Silk.NET.Maths.Vector2D y) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.MaxNumber(this Silk.NET.Maths.Vector2D x, Silk.NET.Maths.Vector2D y) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.MaxNumber(this Silk.NET.Maths.Vector2D x, TSelf y) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Min(this Silk.NET.Maths.Vector2D x, Silk.NET.Maths.Vector2D y) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Min(this Silk.NET.Maths.Vector2D x, TSelf y) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.MinMagnitude(this Silk.NET.Maths.Vector2D x, Silk.NET.Maths.Vector2D y) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.MinMagnitudeNumber(this Silk.NET.Maths.Vector2D x, Silk.NET.Maths.Vector2D y) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.MinNumber(this Silk.NET.Maths.Vector2D x, Silk.NET.Maths.Vector2D y) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.MinNumber(this Silk.NET.Maths.Vector2D x, TSelf y) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Multiply(Silk.NET.Maths.Vector2D left, T right) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Multiply(T left, Silk.NET.Maths.Vector2D right) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Normalize(this Silk.NET.Maths.Vector2D vector) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.PopCount(this Silk.NET.Maths.Vector2D value) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Pow(this Silk.NET.Maths.Vector2D x, Silk.NET.Maths.Vector2D y) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Pow(this Silk.NET.Maths.Vector2D x, TSelf y) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.RadiansToDegrees(this Silk.NET.Maths.Vector2D radians) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.ReciprocalEstimate(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.ReciprocalSqrtEstimate(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Reflect(Silk.NET.Maths.Vector2D vector, Silk.NET.Maths.Vector2D normal) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.RootN(this Silk.NET.Maths.Vector2D x, int n) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.RootN(this Silk.NET.Maths.Vector2D x, Silk.NET.Maths.Vector2D n) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Round(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Round(this Silk.NET.Maths.Vector2D x, int digits, System.MidpointRounding mode) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.ScaleB(this Silk.NET.Maths.Vector2D x, int n) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.ScaleB(this Silk.NET.Maths.Vector2D x, Silk.NET.Maths.Vector2D n) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Sign(this Silk.NET.Maths.Vector2D value) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Sin(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.SinCos(this Silk.NET.Maths.Vector2D x) -> (Silk.NET.Maths.Vector2D Sin, Silk.NET.Maths.Vector2D Cos) +static Silk.NET.Maths.Vector2D.SinCosPi(this Silk.NET.Maths.Vector2D x) -> (Silk.NET.Maths.Vector2D SinPi, Silk.NET.Maths.Vector2D CosPi) +static Silk.NET.Maths.Vector2D.Sinh(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.SinPi(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Sqrt(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Tan(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Tanh(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.TanPi(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.TrailingZeroCount(this Silk.NET.Maths.Vector2D value) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Truncate(this Silk.NET.Maths.Vector2D x) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.CreateChecked(Silk.NET.Maths.Vector2D source) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.CreateSaturating(Silk.NET.Maths.Vector2D source) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.CreateTruncating(Silk.NET.Maths.Vector2D source) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator checked Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator checked Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator checked Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator checked Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator checked Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator checked Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator checked Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator checked Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator checked Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator checked Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator checked Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator checked Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(System.Numerics.Vector2 v) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator Silk.NET.Maths.Vector2D(Silk.NET.Maths.Vector2D from) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.explicit operator System.Numerics.Vector2(Silk.NET.Maths.Vector2D v) -> System.Numerics.Vector2 +static Silk.NET.Maths.Vector2D.implicit operator (T X, T Y)(Silk.NET.Maths.Vector2D v) -> (T X, T Y) +static Silk.NET.Maths.Vector2D.implicit operator Silk.NET.Maths.Vector2D((T X, T Y) v) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.One.get -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.operator !=(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> bool +static Silk.NET.Maths.Vector2D.operator *(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.operator *(Silk.NET.Maths.Vector2D vector, T scalar) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.operator *(T scalar, Silk.NET.Maths.Vector2D vector) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.operator +(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.operator +(Silk.NET.Maths.Vector2D vector) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.operator +(Silk.NET.Maths.Vector2D vector, T scalar) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.operator -(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.operator -(Silk.NET.Maths.Vector2D vector) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.operator -(Silk.NET.Maths.Vector2D vector, T scalar) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.operator /(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.operator /(Silk.NET.Maths.Vector2D vector, T scalar) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.operator ==(Silk.NET.Maths.Vector2D left, Silk.NET.Maths.Vector2D right) -> bool +static Silk.NET.Maths.Vector2D.Parse(string! s, System.IFormatProvider? provider) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Parse(System.ReadOnlySpan utf8Text, System.IFormatProvider? provider) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.TryParse(string? s, System.IFormatProvider? provider, out Silk.NET.Maths.Vector2D result) -> bool +static Silk.NET.Maths.Vector2D.TryParse(System.ReadOnlySpan utf8Text, System.IFormatProvider? provider, out Silk.NET.Maths.Vector2D result) -> bool +static Silk.NET.Maths.Vector2D.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out Silk.NET.Maths.Vector2D result) -> bool +static Silk.NET.Maths.Vector2D.UnitX.get -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.UnitY.get -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector2D.Zero.get -> Silk.NET.Maths.Vector2D +static Silk.NET.Maths.Vector3D.Abs(this Silk.NET.Maths.Vector3D value) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Acos(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Acosh(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.AcosPi(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Asin(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Asinh(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.AsinPi(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Atan2(this Silk.NET.Maths.Vector3D y, Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Atan2Pi(this Silk.NET.Maths.Vector3D y, Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Atan(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Atanh(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.AtanPi(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.BitDecrement(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.BitIncrement(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Cbrt(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Ceiling(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Clamp(this Silk.NET.Maths.Vector3D value, Silk.NET.Maths.Vector3D min, Silk.NET.Maths.Vector3D max) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Clamp(this Silk.NET.Maths.Vector3D value, TSelf min, TSelf max) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.CopySign(this Silk.NET.Maths.Vector3D value, Silk.NET.Maths.Vector3D sign) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.CopySign(this Silk.NET.Maths.Vector3D value, TSelf sign) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Cos(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Cosh(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.CosPi(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Cross(this Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Deconstruct(this Silk.NET.Maths.Vector3D vector, out T x, out T y, out T z) -> void +static Silk.NET.Maths.Vector3D.DegreesToRadians(this Silk.NET.Maths.Vector3D degrees) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Distance(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Vector3D value2) -> T +static Silk.NET.Maths.Vector3D.DistanceSquared(Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Vector3D value2) -> T +static Silk.NET.Maths.Vector3D.DivRem(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> (Silk.NET.Maths.Vector3D Quotient, Silk.NET.Maths.Vector3D Remainder) +static Silk.NET.Maths.Vector3D.Dot(this Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> T +static Silk.NET.Maths.Vector3D.Exp10(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Exp10M1(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Exp2(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Exp2M1(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Exp(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.ExpM1(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Floor(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.FusedMultiplyAdd(this Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right, Silk.NET.Maths.Vector3D addend) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.FusedMultiplyAdd(this Silk.NET.Maths.Vector3D left, TSelf right, TSelf addend) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Hypot(this Silk.NET.Maths.Vector3D x, Silk.NET.Maths.Vector3D y) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Ieee754Remainder(this Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Ieee754Remainder(this Silk.NET.Maths.Vector3D left, TSelf right) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.ILogB(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Lerp(this Silk.NET.Maths.Vector3D value1, Silk.NET.Maths.Vector3D value2, TSelf amount) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.LerpClamped(Silk.NET.Maths.Vector3D a, Silk.NET.Maths.Vector3D b, Silk.NET.Maths.Vector3D amount) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.LerpClamped(Silk.NET.Maths.Vector3D a, Silk.NET.Maths.Vector3D b, T amount) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Log10(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Log10P1(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Log2(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Log2P1(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Log(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Log(this Silk.NET.Maths.Vector3D x, TSelf newBase) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.LogP1(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Max(this Silk.NET.Maths.Vector3D x, Silk.NET.Maths.Vector3D y) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Max(this Silk.NET.Maths.Vector3D x, TSelf y) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.MaxMagnitude(this Silk.NET.Maths.Vector3D x, Silk.NET.Maths.Vector3D y) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.MaxMagnitudeNumber(this Silk.NET.Maths.Vector3D x, Silk.NET.Maths.Vector3D y) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.MaxNumber(this Silk.NET.Maths.Vector3D x, Silk.NET.Maths.Vector3D y) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.MaxNumber(this Silk.NET.Maths.Vector3D x, TSelf y) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Min(this Silk.NET.Maths.Vector3D x, Silk.NET.Maths.Vector3D y) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Min(this Silk.NET.Maths.Vector3D x, TSelf y) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.MinMagnitude(this Silk.NET.Maths.Vector3D x, Silk.NET.Maths.Vector3D y) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.MinMagnitudeNumber(this Silk.NET.Maths.Vector3D x, Silk.NET.Maths.Vector3D y) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.MinNumber(this Silk.NET.Maths.Vector3D x, Silk.NET.Maths.Vector3D y) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.MinNumber(this Silk.NET.Maths.Vector3D x, TSelf y) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Multiply(Silk.NET.Maths.Vector3D left, T right) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Multiply(T left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Normalize(this Silk.NET.Maths.Vector3D vector) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.PopCount(this Silk.NET.Maths.Vector3D value) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Pow(this Silk.NET.Maths.Vector3D x, Silk.NET.Maths.Vector3D y) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Pow(this Silk.NET.Maths.Vector3D x, TSelf y) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.RadiansToDegrees(this Silk.NET.Maths.Vector3D radians) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.ReciprocalEstimate(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.ReciprocalSqrtEstimate(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Reflect(Silk.NET.Maths.Vector3D vector, Silk.NET.Maths.Vector3D normal) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.RootN(this Silk.NET.Maths.Vector3D x, int n) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.RootN(this Silk.NET.Maths.Vector3D x, Silk.NET.Maths.Vector3D n) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Round(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Round(this Silk.NET.Maths.Vector3D x, int digits, System.MidpointRounding mode) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.ScaleB(this Silk.NET.Maths.Vector3D x, int n) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.ScaleB(this Silk.NET.Maths.Vector3D x, Silk.NET.Maths.Vector3D n) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Sign(this Silk.NET.Maths.Vector3D value) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Sin(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.SinCos(this Silk.NET.Maths.Vector3D x) -> (Silk.NET.Maths.Vector3D Sin, Silk.NET.Maths.Vector3D Cos) +static Silk.NET.Maths.Vector3D.SinCosPi(this Silk.NET.Maths.Vector3D x) -> (Silk.NET.Maths.Vector3D SinPi, Silk.NET.Maths.Vector3D CosPi) +static Silk.NET.Maths.Vector3D.Sinh(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.SinPi(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Sqrt(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Tan(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Tanh(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.TanPi(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.TrailingZeroCount(this Silk.NET.Maths.Vector3D value) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Truncate(this Silk.NET.Maths.Vector3D x) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.CreateChecked(Silk.NET.Maths.Vector3D source) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.CreateSaturating(Silk.NET.Maths.Vector3D source) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.CreateTruncating(Silk.NET.Maths.Vector3D source) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator checked Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator checked Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator checked Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator checked Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator checked Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator checked Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator checked Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator checked Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator checked Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator checked Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator checked Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator checked Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(System.Numerics.Vector3 v) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator Silk.NET.Maths.Vector3D(Silk.NET.Maths.Vector3D from) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.explicit operator System.Numerics.Vector3(Silk.NET.Maths.Vector3D v) -> System.Numerics.Vector3 +static Silk.NET.Maths.Vector3D.implicit operator (T X, T Y, T Z)(Silk.NET.Maths.Vector3D v) -> (T X, T Y, T Z) +static Silk.NET.Maths.Vector3D.implicit operator Silk.NET.Maths.Vector3D((T X, T Y, T Z) v) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.One.get -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.operator !=(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> bool +static Silk.NET.Maths.Vector3D.operator *(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.operator *(Silk.NET.Maths.Vector3D vector, T scalar) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.operator *(T scalar, Silk.NET.Maths.Vector3D vector) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.operator +(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.operator +(Silk.NET.Maths.Vector3D vector) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.operator +(Silk.NET.Maths.Vector3D vector, T scalar) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.operator -(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.operator -(Silk.NET.Maths.Vector3D vector) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.operator -(Silk.NET.Maths.Vector3D vector, T scalar) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.operator /(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.operator /(Silk.NET.Maths.Vector3D vector, T scalar) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.operator ==(Silk.NET.Maths.Vector3D left, Silk.NET.Maths.Vector3D right) -> bool +static Silk.NET.Maths.Vector3D.Parse(string! s, System.IFormatProvider? provider) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Parse(System.ReadOnlySpan utf8Text, System.IFormatProvider? provider) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.TryParse(string? s, System.IFormatProvider? provider, out Silk.NET.Maths.Vector3D result) -> bool +static Silk.NET.Maths.Vector3D.TryParse(System.ReadOnlySpan utf8Text, System.IFormatProvider? provider, out Silk.NET.Maths.Vector3D result) -> bool +static Silk.NET.Maths.Vector3D.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out Silk.NET.Maths.Vector3D result) -> bool +static Silk.NET.Maths.Vector3D.UnitX.get -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.UnitY.get -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.UnitZ.get -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector3D.Zero.get -> Silk.NET.Maths.Vector3D +static Silk.NET.Maths.Vector4D.Abs(this Silk.NET.Maths.Vector4D value) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Acos(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Acosh(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.AcosPi(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Asin(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Asinh(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.AsinPi(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Atan2(this Silk.NET.Maths.Vector4D y, Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Atan2Pi(this Silk.NET.Maths.Vector4D y, Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Atan(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Atanh(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.AtanPi(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.BitDecrement(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.BitIncrement(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Cbrt(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Ceiling(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Clamp(this Silk.NET.Maths.Vector4D value, Silk.NET.Maths.Vector4D min, Silk.NET.Maths.Vector4D max) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Clamp(this Silk.NET.Maths.Vector4D value, TSelf min, TSelf max) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.CopySign(this Silk.NET.Maths.Vector4D value, Silk.NET.Maths.Vector4D sign) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.CopySign(this Silk.NET.Maths.Vector4D value, TSelf sign) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Cos(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Cosh(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.CosPi(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Deconstruct(this Silk.NET.Maths.Vector4D vector, out T x, out T y, out T z, out T w) -> void +static Silk.NET.Maths.Vector4D.DegreesToRadians(this Silk.NET.Maths.Vector4D degrees) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Distance(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Vector4D value2) -> T +static Silk.NET.Maths.Vector4D.DistanceSquared(Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Vector4D value2) -> T +static Silk.NET.Maths.Vector4D.DivRem(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> (Silk.NET.Maths.Vector4D Quotient, Silk.NET.Maths.Vector4D Remainder) +static Silk.NET.Maths.Vector4D.Dot(this Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> T +static Silk.NET.Maths.Vector4D.Exp10(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Exp10M1(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Exp2(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Exp2M1(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Exp(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.ExpM1(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Floor(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.FusedMultiplyAdd(this Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right, Silk.NET.Maths.Vector4D addend) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.FusedMultiplyAdd(this Silk.NET.Maths.Vector4D left, TSelf right, TSelf addend) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Hypot(this Silk.NET.Maths.Vector4D x, Silk.NET.Maths.Vector4D y) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Ieee754Remainder(this Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Ieee754Remainder(this Silk.NET.Maths.Vector4D left, TSelf right) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.ILogB(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Lerp(this Silk.NET.Maths.Vector4D value1, Silk.NET.Maths.Vector4D value2, TSelf amount) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.LerpClamped(Silk.NET.Maths.Vector4D a, Silk.NET.Maths.Vector4D b, Silk.NET.Maths.Vector4D amount) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.LerpClamped(Silk.NET.Maths.Vector4D a, Silk.NET.Maths.Vector4D b, T amount) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Log10(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Log10P1(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Log2(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Log2P1(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Log(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Log(this Silk.NET.Maths.Vector4D x, TSelf newBase) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.LogP1(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Max(this Silk.NET.Maths.Vector4D x, Silk.NET.Maths.Vector4D y) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Max(this Silk.NET.Maths.Vector4D x, TSelf y) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.MaxMagnitude(this Silk.NET.Maths.Vector4D x, Silk.NET.Maths.Vector4D y) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.MaxMagnitudeNumber(this Silk.NET.Maths.Vector4D x, Silk.NET.Maths.Vector4D y) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.MaxNumber(this Silk.NET.Maths.Vector4D x, Silk.NET.Maths.Vector4D y) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.MaxNumber(this Silk.NET.Maths.Vector4D x, TSelf y) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Min(this Silk.NET.Maths.Vector4D x, Silk.NET.Maths.Vector4D y) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Min(this Silk.NET.Maths.Vector4D x, TSelf y) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.MinMagnitude(this Silk.NET.Maths.Vector4D x, Silk.NET.Maths.Vector4D y) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.MinMagnitudeNumber(this Silk.NET.Maths.Vector4D x, Silk.NET.Maths.Vector4D y) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.MinNumber(this Silk.NET.Maths.Vector4D x, Silk.NET.Maths.Vector4D y) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.MinNumber(this Silk.NET.Maths.Vector4D x, TSelf y) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Multiply(Silk.NET.Maths.Vector4D left, T right) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Multiply(T left, Silk.NET.Maths.Vector4D right) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Normalize(this Silk.NET.Maths.Vector4D vector) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.PopCount(this Silk.NET.Maths.Vector4D value) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Pow(this Silk.NET.Maths.Vector4D x, Silk.NET.Maths.Vector4D y) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Pow(this Silk.NET.Maths.Vector4D x, TSelf y) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.RadiansToDegrees(this Silk.NET.Maths.Vector4D radians) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.ReciprocalEstimate(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.ReciprocalSqrtEstimate(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Reflect(Silk.NET.Maths.Vector4D vector, Silk.NET.Maths.Vector4D normal) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.RootN(this Silk.NET.Maths.Vector4D x, int n) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.RootN(this Silk.NET.Maths.Vector4D x, Silk.NET.Maths.Vector4D n) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Round(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Round(this Silk.NET.Maths.Vector4D x, int digits, System.MidpointRounding mode) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.ScaleB(this Silk.NET.Maths.Vector4D x, int n) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.ScaleB(this Silk.NET.Maths.Vector4D x, Silk.NET.Maths.Vector4D n) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Sign(this Silk.NET.Maths.Vector4D value) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Sin(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.SinCos(this Silk.NET.Maths.Vector4D x) -> (Silk.NET.Maths.Vector4D Sin, Silk.NET.Maths.Vector4D Cos) +static Silk.NET.Maths.Vector4D.SinCosPi(this Silk.NET.Maths.Vector4D x) -> (Silk.NET.Maths.Vector4D SinPi, Silk.NET.Maths.Vector4D CosPi) +static Silk.NET.Maths.Vector4D.Sinh(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.SinPi(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Sqrt(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Tan(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Tanh(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.TanPi(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.TrailingZeroCount(this Silk.NET.Maths.Vector4D value) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Truncate(this Silk.NET.Maths.Vector4D x) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.CreateChecked(Silk.NET.Maths.Vector4D source) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.CreateSaturating(Silk.NET.Maths.Vector4D source) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.CreateTruncating(Silk.NET.Maths.Vector4D source) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator checked Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator checked Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator checked Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator checked Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator checked Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator checked Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator checked Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator checked Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator checked Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator checked Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator checked Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator checked Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(System.Numerics.Vector4 v) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator Silk.NET.Maths.Vector4D(Silk.NET.Maths.Vector4D from) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.explicit operator System.Numerics.Vector4(Silk.NET.Maths.Vector4D v) -> System.Numerics.Vector4 +static Silk.NET.Maths.Vector4D.implicit operator (T X, T Y, T Z, T W)(Silk.NET.Maths.Vector4D v) -> (T X, T Y, T Z, T W) +static Silk.NET.Maths.Vector4D.implicit operator Silk.NET.Maths.Vector4D((T X, T Y, T Z, T W) v) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.One.get -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.operator !=(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> bool +static Silk.NET.Maths.Vector4D.operator *(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.operator *(Silk.NET.Maths.Vector4D vector, T scalar) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.operator *(T scalar, Silk.NET.Maths.Vector4D vector) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.operator +(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.operator +(Silk.NET.Maths.Vector4D vector) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.operator +(Silk.NET.Maths.Vector4D vector, T scalar) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.operator -(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.operator -(Silk.NET.Maths.Vector4D vector) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.operator -(Silk.NET.Maths.Vector4D vector, T scalar) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.operator /(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.operator /(Silk.NET.Maths.Vector4D vector, T scalar) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.operator ==(Silk.NET.Maths.Vector4D left, Silk.NET.Maths.Vector4D right) -> bool +static Silk.NET.Maths.Vector4D.Parse(string! s, System.IFormatProvider? provider) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Parse(System.ReadOnlySpan utf8Text, System.IFormatProvider? provider) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.TryParse(string? s, System.IFormatProvider? provider, out Silk.NET.Maths.Vector4D result) -> bool +static Silk.NET.Maths.Vector4D.TryParse(System.ReadOnlySpan utf8Text, System.IFormatProvider? provider, out Silk.NET.Maths.Vector4D result) -> bool +static Silk.NET.Maths.Vector4D.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out Silk.NET.Maths.Vector4D result) -> bool +static Silk.NET.Maths.Vector4D.UnitW.get -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.UnitX.get -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.UnitY.get -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.UnitZ.get -> Silk.NET.Maths.Vector4D +static Silk.NET.Maths.Vector4D.Zero.get -> Silk.NET.Maths.Vector4D