diff --git a/sources/Maths/Maths/Box2D.cs b/sources/Maths/Maths/Box2D.cs index c9b4945be4..c468e2fa48 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 : INumber { /// /// The min. @@ -148,9 +149,9 @@ 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 : INumber { - return this.As().GetScaled(scale, anchor.As()).As(); + return this.AsTruncating().GetScaled(scale, anchor.AsTruncating()).AsTruncating(); } /// @@ -209,9 +210,44 @@ public override int GetHashCode() /// /// The type to cast to /// The casted box - public Box2D As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + [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()); + } } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Box3D.cs b/sources/Maths/Maths/Box3D.cs index 36c4ab815c..4e50cfb16a 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; @@ -14,7 +15,7 @@ namespace Silk.NET.Maths [DataContract] public struct Box3D : IEquatable> - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumber { /// /// The min. @@ -157,12 +158,12 @@ 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; - 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()); } /// @@ -221,9 +222,11 @@ public override int GetHashCode() /// /// The type to cast to /// The casted box - public Box3D As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] + public Box3D As() + where TOther : INumber { return new(Min.As(), Max.As()); } } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Circle.cs b/sources/Maths/Maths/Circle.cs index fafcc12f4d..53e37c049e 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 : IRootFunctions { /// /// The center. @@ -166,15 +168,16 @@ public override int GetHashCode() { return !value1.Equals(value2); } - + /// /// Returns this circle casted to /// /// The type to cast to /// The casted circle - public Circle As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] + public Circle As() where TOther : IRootFunctions { 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..bdc61f267e 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 : INumber { /// /// The origin. @@ -169,12 +170,12 @@ 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; - 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()); } /// @@ -229,15 +230,17 @@ public override int GetHashCode() { return !value1.Equals(value2); } - + /// /// Returns this circle casted to /// /// The type to cast to /// The casted cube - public Cube As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] + public Cube As() + where TOther : INumber { return new(Origin.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/Matrix2X2.Ops.cs b/sources/Maths/Maths/Matrix2X2.Ops.cs deleted file mode 100644 index 0d768ab0ce..0000000000 --- a/sources/Maths/Maths/Matrix2X2.Ops.cs +++ /dev/null @@ -1,93 +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 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 - { - 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 : unmanaged, IFormattable, IEquatable, IComparable => 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; - - /// 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; - - /// 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; - - /// 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; - - /// 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; - - /// 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; - } - } -} \ No newline at end of file diff --git a/sources/Maths/Maths/Matrix2X2.cs b/sources/Maths/Maths/Matrix2X2.cs index e01fcf288f..25d3a702ca 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,98 +54,6 @@ 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. - /// The result of the multiplication. - public static unsafe Vector2D operator *(Vector2D value1, Matrix2X2 value2) - { - 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); - } - - /// 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() @@ -261,162 +61,10 @@ 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)); } - - /// 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() - { - 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 - /// - /// The type to cast to - /// The casted matrix - public Matrix2X2 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable - { - return new(Row1.As(), Row2.As()); - } } } diff --git a/sources/Maths/Maths/Matrix2X2.gen.cs b/sources/Maths/Maths/Matrix2X2.gen.cs new file mode 100644 index 0000000000..36d8a000cb --- /dev/null +++ b/sources/Maths/Maths/Matrix2X2.gen.cs @@ -0,0 +1,563 @@ +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 Matrix2X2 Identity { get; } = new( + 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; + + /// 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); + + /// + /// 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] + { + get + { + switch (row) + { + case 0: + return ref Row1; + case 1: + return ref Row2; + } + + 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; + + + /// + public override string ToString() => + string.Format( + "{{ {{M11:{0} M12:{1}}} {{M21:{2} M22:{3}}} }}", + Row1.X, Row1.Y, + Row2.X, Row2.Y); + + /// + public override bool Equals(object? obj) => obj is Matrix2X2 other && Equals(other); + + /// + public bool Equals(Matrix2X2 other) => this == other; + + /// + public override int GetHashCode() => HashCode.Combine(Row1, Row2); + + /// 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 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 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 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), + 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 ==(Matrix2X2 left, Matrix2X2 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 !=(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 Matrix2X2 operator +(Matrix2X2 left, Matrix2X2 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 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 Matrix2X2 operator -(Matrix2X2 value) => + 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, 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. + /// The result of the multiplication. + 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(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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X2(Matrix2X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X2(Matrix2X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X2(Matrix2X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X2(Matrix2X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X2(Matrix2X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X2(Matrix2X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X2(Matrix2X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X2(Matrix2X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X2(Matrix2X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X2(Matrix2X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X2(Matrix2X2 from) => + 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)); + } + + /// + /// Methods for working with . + /// + 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(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 6ebb6124ca..fdd180d1ce 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,21 +10,10 @@ namespace Silk.NET.Maths /// /// Methods for working with /// - public static class Matrix2X3 + 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 : unmanaged, IFormattable, IEquatable, IComparable - { - 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. @@ -31,7 +21,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 : IRootFunctions { Vector3D zaxis = objectPosition - cameraPosition; var norm = zaxis.LengthSquared; @@ -56,7 +46,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. @@ -104,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 : unmanaged, IFormattable, IEquatable, IComparable + public static Matrix2X3 CreateFromQuaternion(Quaternion quaternion) + where T : ITrigonometricFunctions { Matrix2X3 result = Matrix2X3.Identity; @@ -138,93 +128,18 @@ 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 : ITrigonometricFunctions { - Legacy.Quaternion q = Legacy.Quaternion.CreateFromYawPitchRoll(yaw, pitch, roll); + var q = Quaternion.CreateFromYawPitchRoll(yaw, pitch, 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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; - - /// 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 : 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; - - /// 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 : unmanaged, IFormattable, IEquatable, IComparable - => -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 : 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 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 + 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/Matrix2X3.cs b/sources/Maths/Maths/Matrix2X3.cs index 87bdfc4701..1f9c06fc6e 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,142 +20,12 @@ 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) { - 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 . @@ -186,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. @@ -195,268 +65,6 @@ 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); - - /// 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. - /// The result of the multiplication. - public static unsafe Vector3D operator *(Vector2D value1, Matrix2X3 value2) - { - 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. - /// The scaled matrix. - public static unsafe Matrix2X3 operator *(Matrix2X3 value1, T value2) - { - 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() - { - 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 - /// - /// The type to cast to - /// The casted matrix - public Matrix2X3 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable - { - return new(Row1.As(), Row2.As()); - } + public readonly bool IsIdentity => this == Identity; } } diff --git a/sources/Maths/Maths/Matrix2X3.gen.cs b/sources/Maths/Maths/Matrix2X3.gen.cs new file mode 100644 index 0000000000..bff4862b07 --- /dev/null +++ b/sources/Maths/Maths/Matrix2X3.gen.cs @@ -0,0 +1,585 @@ +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); + + /// + /// 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] + { + get + { + switch (row) + { + case 0: + return ref Row1; + case 1: + return ref Row2; + } + + 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; + + + /// + 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); + + /// + public override bool Equals(object? obj) => obj is Matrix2X3 other && Equals(other); + + /// + public bool Equals(Matrix2X3 other) => this == other; + + /// + public override int GetHashCode() => HashCode.Combine(Row1, Row2); + + /// 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 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 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 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), + 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 ==(Matrix2X3 left, Matrix2X3 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 !=(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 Matrix2X3 operator +(Matrix2X3 left, Matrix2X3 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 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 Matrix2X3 operator -(Matrix2X3 value) => + 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, 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. + /// The result of the multiplication. + 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); + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + 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(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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X3(Matrix2X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X3(Matrix2X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X3(Matrix2X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X3(Matrix2X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X3(Matrix2X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X3(Matrix2X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X3(Matrix2X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X3(Matrix2X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X3(Matrix2X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X3(Matrix2X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X3(Matrix2X3 from) => + 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)); + } + + /// + /// Methods for working with . + /// + 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(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 b7402f1507..0000000000 --- a/sources/Maths/Maths/Matrix2X4.Ops.cs +++ /dev/null @@ -1,101 +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 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 : unmanaged, IFormattable, IEquatable, IComparable - { - 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : 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 Vector4D Multiply(Vector2D value1, Matrix2X4 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 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..447aa4fac4 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,180 +12,28 @@ 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 ( - 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 ); - /// - /// 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) { - 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 . @@ -199,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. @@ -216,346 +65,6 @@ 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); - - /// 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. - /// The result of the multiplication. - public static unsafe Vector4D operator *(Vector2D value1, Matrix2X4 value2) - { - 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 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. - /// The scaled matrix. - public static unsafe Matrix2X4 operator *(Matrix2X4 value1, T value2) - { - 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() - { - 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 - /// - /// The type to cast to - /// The casted matrix - public Matrix2X4 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable - { - return new(Row1.As(), Row2.As()); - } + public readonly bool IsIdentity => this == Identity; } } diff --git a/sources/Maths/Maths/Matrix2X4.gen.cs b/sources/Maths/Maths/Matrix2X4.gen.cs new file mode 100644 index 0000000000..708458f69b --- /dev/null +++ b/sources/Maths/Maths/Matrix2X4.gen.cs @@ -0,0 +1,609 @@ +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); + + /// + /// 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] + { + get + { + switch (row) + { + case 0: + return ref Row1; + case 1: + return ref Row2; + } + + 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; + + + /// + 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); + + /// + public override bool Equals(object? obj) => obj is Matrix2X4 other && Equals(other); + + /// + public bool Equals(Matrix2X4 other) => this == other; + + /// + public override int GetHashCode() => HashCode.Combine(Row1, Row2); + + /// 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 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 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 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), + 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 ==(Matrix2X4 left, Matrix2X4 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 !=(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 Matrix2X4 operator +(Matrix2X4 left, Matrix2X4 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 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 Matrix2X4 operator -(Matrix2X4 value) => + 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, 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. + /// The result of the multiplication. + 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); + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + 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); + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + 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); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X4(Matrix2X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X4(Matrix2X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X4(Matrix2X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X4(Matrix2X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X4(Matrix2X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X4(Matrix2X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X4(Matrix2X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X4(Matrix2X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X4(Matrix2X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X4(Matrix2X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X4(Matrix2X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix2X4(Matrix2X4 from) => + 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)); + } + + /// + /// Methods for working with . + /// + 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(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/Matrix2x2F.gen.cs b/sources/Maths/Maths/Matrix2x2F.gen.cs deleted file mode 100644 index 0d43a43ed1..0000000000 --- a/sources/Maths/Maths/Matrix2x2F.gen.cs +++ /dev/null @@ -1,129 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix2x2F : - IEquatable> - where T : IFloatingPointIeee754 - { - /// The multiplicative identity matrix of size 2x2. - public static readonly Matrix2x2F 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; - - /// The 2nd row of the matrix represented as a vector. - public Vector2F Row2; - - /// - /// Constructs a from the given rows. - /// - public Matrix2x2F(Vector2F row1, Vector2F row2) => (Row1, Row2) = (row1, row2); - - [UnscopedRef] - public ref Vector2F 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 Matrix2x2F other && Equals(other); - - /// - public bool Equals(Matrix2x2F other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2); - - /// Computes the transpose of the matrix. - public Matrix2x2F 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 ==(Matrix2x2F left, Matrix2x2F 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 !=(Matrix2x2F left, Matrix2x2F 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) => - 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 Matrix2x2F operator -(Matrix2x2F left, Matrix2x2F 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) => - 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 Matrix2x2F operator *(Matrix2x2F left, Matrix2x2F right) => - new(left.M11 * right.Row1 + left.M12 * right.Row2, - left.M21 * right.Row1 + left.M22 * right.Row2); - } - - static partial class Matrix2x2F - { - public static Matrix2x2F Lerp(Matrix2x2F value1, Matrix2x2F 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/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/Matrix2x3F.gen.cs b/sources/Maths/Maths/Matrix2x3F.gen.cs deleted file mode 100644 index 9c946035c6..0000000000 --- a/sources/Maths/Maths/Matrix2x3F.gen.cs +++ /dev/null @@ -1,141 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix2x3F : - IEquatable> - where T : IFloatingPointIeee754 - { - /// The 1st row of the matrix represented as a vector. - public Vector3F Row1; - - /// The 2nd row of the matrix represented as a vector. - public Vector3F Row2; - - /// - /// Constructs a from the given rows. - /// - public Matrix2x3F(Vector3F row1, Vector3F row2) => (Row1, Row2) = (row1, row2); - - [UnscopedRef] - public ref Vector3F 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 Matrix2x3F other && Equals(other); - - /// - public bool Equals(Matrix2x3F other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2); - - /// Computes the transpose of the matrix. - public Matrix3x2F 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 ==(Matrix2x3F left, Matrix2x3F 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 !=(Matrix2x3F left, Matrix2x3F 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) => - 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 Matrix2x3F operator -(Matrix2x3F left, Matrix2x3F 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) => - 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 Matrix2x3F operator *(Matrix2x2F left, Matrix2x3F 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 Matrix2x2F operator *(Matrix2x3F left, Matrix3x2F 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 Matrix2x3F Lerp(Matrix2x3F value1, Matrix2x3F 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/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/Matrix2x4F.gen.cs b/sources/Maths/Maths/Matrix2x4F.gen.cs deleted file mode 100644 index b4d4f8c6f0..0000000000 --- a/sources/Maths/Maths/Matrix2x4F.gen.cs +++ /dev/null @@ -1,159 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix2x4F : - IEquatable> - where T : IFloatingPointIeee754 - { - /// 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; - - /// - /// Constructs a from the given rows. - /// - public Matrix2x4F(Vector4F row1, Vector4F row2) => (Row1, Row2) = (row1, row2); - - [UnscopedRef] - public ref Vector4F 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 Matrix2x4F other && Equals(other); - - /// - public bool Equals(Matrix2x4F other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2); - - /// Computes the transpose of the matrix. - public Matrix4x2F 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 ==(Matrix2x4F left, Matrix2x4F 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 !=(Matrix2x4F left, Matrix2x4F 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) => - 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 Matrix2x4F operator -(Matrix2x4F left, Matrix2x4F 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) => - 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 Matrix2x4F operator *(Matrix2x2F left, Matrix2x4F 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 Matrix2x2F operator *(Matrix2x4F 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); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix3x4F operator *(Matrix3x2F left, Matrix2x4F 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 Matrix2x4F Lerp(Matrix2x4F value1, Matrix2x4F 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/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/Matrix3X2.Ops.cs b/sources/Maths/Maths/Matrix3X2.Ops.cs index 20d7ff905a..34096ae04d 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 @@ -17,20 +18,11 @@ public static 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 +113,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 +202,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 +217,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 +233,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 +253,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 +272,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 +287,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 +307,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 +326,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 +346,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 +364,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 +379,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; @@ -412,89 +404,5 @@ 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 - => 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 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => -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 : unmanaged, IFormattable, IEquatable, IComparable - => value1 - value2; } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Matrix3X2.cs b/sources/Maths/Maths/Matrix3X2.cs index 8d80e72d79..6f618c2e69 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,130 +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. - /// 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; - } - - /// 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. - /// 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. - /// The resulting matrix. - public static Matrix3X2 operator *(Matrix3X2 value1, T value2) - { - 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. @@ -351,50 +93,11 @@ 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)); } - /// 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() - { - 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. /// @@ -406,135 +109,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) ); - - /// - /// 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 - /// - /// The type to cast to - /// The casted matrix - public Matrix3X2 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable - { - return new(Row1.As(), Row2.As(), Row3.As()); - } } } diff --git a/sources/Maths/Maths/Matrix3X2.gen.cs b/sources/Maths/Maths/Matrix3X2.gen.cs new file mode 100644 index 0000000000..792f84ebaa --- /dev/null +++ b/sources/Maths/Maths/Matrix3X2.gen.cs @@ -0,0 +1,622 @@ +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); + + /// + /// 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] + { + get + { + switch (row) + { + case 0: + return ref Row1; + case 1: + return ref Row2; + case 2: + return ref Row3; + } + + 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; + + + /// + 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); + + /// + public override bool Equals(object? obj) => obj is Matrix3X2 other && Equals(other); + + /// + public bool Equals(Matrix3X2 other) => this == other; + + /// + public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); + + /// 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 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 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 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), + 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 ==(Matrix3X2 left, Matrix3X2 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 !=(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 Matrix3X2 operator +(Matrix3X2 left, Matrix3X2 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 Matrix3X2 operator -(Matrix3X2 left, Matrix3X2 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 Matrix3X2 operator -(Matrix3X2 value) => + new(-value.Row1, + -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, 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. + /// The result of the multiplication. + 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); + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + 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); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X2(Matrix3X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X2(Matrix3X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X2(Matrix3X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X2(Matrix3X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X2(Matrix3X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X2(Matrix3X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X2(Matrix3X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X2(Matrix3X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X2(Matrix3X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X2(Matrix3X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X2(Matrix3X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X2(Matrix3X2 from) => + 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)); + } + + /// + /// Methods for working with . + /// + 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(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 aa3905c23a..2cdcb433e6 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,13 +10,14 @@ 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; @@ -23,7 +25,7 @@ private struct CanonicalBasis }; private struct VectorBasis - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { #pragma warning disable 649 public unsafe Vector3D* Element0; @@ -31,17 +33,7 @@ private struct VectorBasis public unsafe Vector3D* Element2; #pragma warning restore 649 } - - /// 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 : unmanaged, IFormattable, IEquatable, IComparable - { - return value1 + value2; - } + */ /// Creates a spherical billboard that rotates around a specified object position. /// Position of the object the billboard will rotate around. @@ -50,7 +42,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 : IRootFunctions { Vector3D zaxis = objectPosition - cameraPosition; var norm = zaxis.LengthSquared; @@ -75,7 +67,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. @@ -127,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 : unmanaged, IFormattable, IEquatable, IComparable + public static Matrix3X3 CreateFromQuaternion(Quaternion quaternion) + where T : ITrigonometricFunctions { Matrix3X3 result = Matrix3X3.Identity; @@ -165,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 : unmanaged, IFormattable, IEquatable, IComparable + where T : ITrigonometricFunctions { - Legacy.Quaternion q = Legacy.Quaternion.CreateFromYawPitchRoll(yaw, pitch, roll); + var q = Quaternion.CreateFromYawPitchRoll(yaw, pitch, roll); return CreateFromQuaternion(q); } @@ -175,7 +167,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 +191,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 +214,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 +239,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 +252,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 +265,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; @@ -284,89 +276,7 @@ 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : 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; - - /// 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 : unmanaged, IFormattable, IEquatable, IComparable - => -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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 +284,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 +469,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 + public static Matrix3X3 Transform(Matrix3X3 value, Quaternion rotation) + where T : ITrigonometricFunctions { // Compute rotation matrix. T x2 = Scalar.Add(rotation.X, rotation.X); @@ -620,7 +516,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..492bc49f43 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,186 +12,15 @@ 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) { - 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 . @@ -233,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 . @@ -247,115 +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 - => 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); - - /// 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. - /// 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; - } - - /// 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); - } - - /// 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() @@ -364,9 +85,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( @@ -374,176 +95,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 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() - { - 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 - /// - /// The type to cast to - /// The casted matrix - public Matrix3X3 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable - { - return new(Row1.As(), Row2.As(), Row3.As()); - } } } diff --git a/sources/Maths/Maths/Matrix3X3.gen.cs b/sources/Maths/Maths/Matrix3X3.gen.cs new file mode 100644 index 0000000000..8bc8ec7c86 --- /dev/null +++ b/sources/Maths/Maths/Matrix3X3.gen.cs @@ -0,0 +1,652 @@ +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 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)); + + /// 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; + + /// 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); + + /// + /// 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] + { + get + { + switch (row) + { + case 0: + return ref Row1; + case 1: + return ref Row2; + case 2: + return ref Row3; + } + + 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; + + + /// + 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); + + /// + public override bool Equals(object? obj) => obj is Matrix3X3 other && Equals(other); + + /// + public bool Equals(Matrix3X3 other) => this == other; + + /// + public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); + + /// 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 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 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 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), + 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 ==(Matrix3X3 left, Matrix3X3 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 !=(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 Matrix3X3 operator +(Matrix3X3 left, Matrix3X3 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 Matrix3X3 operator -(Matrix3X3 left, Matrix3X3 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 Matrix3X3 operator -(Matrix3X3 value) => + new(-value.Row1, + -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, 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. + /// The result of the multiplication. + 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); + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + 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); + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + 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); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X3(Matrix3X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X3(Matrix3X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X3(Matrix3X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X3(Matrix3X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X3(Matrix3X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X3(Matrix3X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X3(Matrix3X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X3(Matrix3X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X3(Matrix3X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X3(Matrix3X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X3(Matrix3X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X3(Matrix3X3 from) => + 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)); + } + + /// + /// Methods for working with . + /// + 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(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 3c9c07af8a..0000000000 --- a/sources/Maths/Maths/Matrix3X4.Ops.cs +++ /dev/null @@ -1,112 +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 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 : unmanaged, IFormattable, IEquatable, IComparable - { - 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : 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 Vector4D Multiply(Vector3D value1, Matrix3X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => -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 : 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 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..1143215c6a 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,226 +12,31 @@ 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 ( - 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 ); - /// - /// 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) { - 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 . @@ -246,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 . @@ -264,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. @@ -274,362 +80,6 @@ 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); - - /// 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. - /// 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; - } - - /// 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. - /// The scaled matrix. - public static unsafe Matrix3X4 operator *(Matrix3X4 value1, T value2) - { - 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() - { - 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 - /// - /// The type to cast to - /// The casted matrix - public Matrix3X4 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable - { - return new(Row1.As(), Row2.As(), Row3.As()); - } + public readonly bool IsIdentity => this == Identity; } } diff --git a/sources/Maths/Maths/Matrix3X4.gen.cs b/sources/Maths/Maths/Matrix3X4.gen.cs new file mode 100644 index 0000000000..2df43ee04c --- /dev/null +++ b/sources/Maths/Maths/Matrix3X4.gen.cs @@ -0,0 +1,679 @@ +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); + + /// + /// 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] + { + get + { + switch (row) + { + case 0: + return ref Row1; + case 1: + return ref Row2; + case 2: + return ref Row3; + } + + 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; + + + /// + 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); + + /// + public override bool Equals(object? obj) => obj is Matrix3X4 other && Equals(other); + + /// + public bool Equals(Matrix3X4 other) => this == other; + + /// + public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); + + /// 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 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 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 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), + 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 ==(Matrix3X4 left, Matrix3X4 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 !=(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 Matrix3X4 operator +(Matrix3X4 left, Matrix3X4 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 Matrix3X4 operator -(Matrix3X4 left, Matrix3X4 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 Matrix3X4 operator -(Matrix3X4 value) => + new(-value.Row1, + -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, 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. + /// The result of the multiplication. + 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); + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + 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); + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + 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); + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + 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); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X4(Matrix3X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X4(Matrix3X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X4(Matrix3X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X4(Matrix3X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X4(Matrix3X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X4(Matrix3X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X4(Matrix3X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X4(Matrix3X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X4(Matrix3X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X4(Matrix3X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X4(Matrix3X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix3X4(Matrix3X4 from) => + 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)); + } + + /// + /// Methods for working with . + /// + 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(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/Matrix3x2F.gen.cs b/sources/Maths/Maths/Matrix3x2F.gen.cs deleted file mode 100644 index fa7209a596..0000000000 --- a/sources/Maths/Maths/Matrix3x2F.gen.cs +++ /dev/null @@ -1,152 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix3x2F : - IEquatable> - where T : IFloatingPointIeee754 - { - /// The 1st row of the matrix represented as a vector. - public Vector2F Row1; - - /// The 2nd row of the matrix represented as a vector. - public Vector2F Row2; - - /// The 3rd row of the matrix represented as a vector. - public Vector2F Row3; - - /// - /// Constructs a from the given rows. - /// - public Matrix3x2F(Vector2F row1, Vector2F row2, Vector2F row3) => (Row1, Row2, Row3) = (row1, row2, row3); - - [UnscopedRef] - public ref Vector2F 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 Matrix3x2F other && Equals(other); - - /// - public bool Equals(Matrix3x2F other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); - - /// Computes the transpose of the matrix. - public Matrix2x3F 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 ==(Matrix3x2F left, Matrix3x2F 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 !=(Matrix3x2F left, Matrix3x2F 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) => - 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 Matrix3x2F operator -(Matrix3x2F left, Matrix3x2F 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 Matrix3x2F operator -(Matrix3x2F 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 Matrix3x2F operator *(Matrix3x2F left, Matrix2x2F 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 Matrix3x3F operator *(Matrix3x2F left, Matrix2x3F 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 Matrix3x2F Lerp(Matrix3x2F value1, Matrix3x2F 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))); - } -} 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/Matrix3x3F.gen.cs b/sources/Maths/Maths/Matrix3x3F.gen.cs deleted file mode 100644 index 2c94325eb2..0000000000 --- a/sources/Maths/Maths/Matrix3x3F.gen.cs +++ /dev/null @@ -1,179 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix3x3F : - IEquatable> - where T : IFloatingPointIeee754 - { - /// The multiplicative identity matrix of size 3x3. - public static readonly Matrix3x3F 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; - - /// The 2nd row of the matrix represented as a vector. - public Vector3F Row2; - - /// The 3rd row of the matrix represented as a vector. - public Vector3F Row3; - - /// - /// Constructs a from the given rows. - /// - public Matrix3x3F(Vector3F row1, Vector3F row2, Vector3F row3) => (Row1, Row2, Row3) = (row1, row2, row3); - - [UnscopedRef] - public ref Vector3F 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 Matrix3x3F other && Equals(other); - - /// - public bool Equals(Matrix3x3F other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); - - /// Computes the transpose of the matrix. - public Matrix3x3F 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 ==(Matrix3x3F left, Matrix3x3F 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 !=(Matrix3x3F left, Matrix3x3F 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) => - 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 Matrix3x3F operator -(Matrix3x3F left, Matrix3x3F 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 Matrix3x3F operator -(Matrix3x3F 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 Matrix2x3F operator *(Matrix2x3F left, Matrix3x3F 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 Matrix3x2F operator *(Matrix3x3F left, Matrix3x2F 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 Matrix3x3F operator *(Matrix3x3F left, Matrix3x3F 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 Matrix3x3F Lerp(Matrix3x3F value1, Matrix3x3F 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))); - } -} 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/Matrix3x4F.gen.cs b/sources/Maths/Maths/Matrix3x4F.gen.cs deleted file mode 100644 index 45de27a659..0000000000 --- a/sources/Maths/Maths/Matrix3x4F.gen.cs +++ /dev/null @@ -1,195 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix3x4F : - IEquatable> - where T : IFloatingPointIeee754 - { - /// 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; - - /// - /// Constructs a from the given rows. - /// - public Matrix3x4F(Vector4F row1, Vector4F row2, Vector4F row3) => (Row1, Row2, Row3) = (row1, row2, row3); - - [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; - } - - 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 Matrix3x4F other && Equals(other); - - /// - public bool Equals(Matrix3x4F other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3); - - /// Computes the transpose of the matrix. - public Matrix4x3F 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 ==(Matrix3x4F left, Matrix3x4F 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 !=(Matrix3x4F left, Matrix3x4F 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) => - 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 Matrix3x4F operator -(Matrix3x4F left, Matrix3x4F 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 Matrix3x4F operator -(Matrix3x4F 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 Matrix2x4F operator *(Matrix2x3F left, Matrix3x4F 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 Matrix3x4F operator *(Matrix3x3F left, Matrix3x4F 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 Matrix3x2F operator *(Matrix3x4F 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); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix3x3F operator *(Matrix3x4F 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); - } - - static partial class Matrix3x4F - { - public static Matrix3x4F Lerp(Matrix3x4F value1, Matrix3x4F 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))); - } -} 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/Matrix4X2.Ops.cs b/sources/Maths/Maths/Matrix4X2.Ops.cs index 3fa4c29020..d6a6d59f00 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,102 +10,11 @@ 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. - /// The second source matrix. - /// The resulting matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix4X2 Add(Matrix4X2 value1, Matrix4X2 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : 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 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => -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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 +30,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..4fab060824 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) @@ -235,389 +78,6 @@ 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); - - - /// 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. - /// 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. - /// 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; - } - - /// 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); - } - - /// 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() - { - 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 - /// - /// The type to cast to - /// The casted matrix - public Matrix4X2 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable - { - return new(Row1.As(), Row2.As(), Row3.As(), Row4.As()); - } + public readonly bool IsIdentity => this == Identity; } } diff --git a/sources/Maths/Maths/Matrix4X2.gen.cs b/sources/Maths/Maths/Matrix4X2.gen.cs new file mode 100644 index 0000000000..3b147c1b97 --- /dev/null +++ b/sources/Maths/Maths/Matrix4X2.gen.cs @@ -0,0 +1,684 @@ +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); + + /// + /// 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] + { + 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 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; + + + /// + 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); + + /// + public override bool Equals(object? obj) => obj is Matrix4X2 other && Equals(other); + + /// + public bool Equals(Matrix4X2 other) => this == other; + + /// + public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); + + /// 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 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 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 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), + 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 ==(Matrix4X2 left, Matrix4X2 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 !=(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 Matrix4X2 operator +(Matrix4X2 left, Matrix4X2 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 Matrix4X2 operator -(Matrix4X2 left, Matrix4X2 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 Matrix4X2 operator -(Matrix4X2 value) => + new(-value.Row1, + -value.Row2, + -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, 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. + /// The result of the multiplication. + 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, + 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 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, + 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 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); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X2(Matrix4X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X2(Matrix4X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X2(Matrix4X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X2(Matrix4X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X2(Matrix4X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X2(Matrix4X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X2(Matrix4X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X2(Matrix4X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X2(Matrix4X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X2(Matrix4X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X2(Matrix4X2 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X2(Matrix4X2 from) => + 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)); + } + + /// + /// Methods for working with . + /// + 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(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)); + + /// 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 09407f0f98..0000000000 --- a/sources/Maths/Maths/Matrix4X3.Ops.cs +++ /dev/null @@ -1,112 +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 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 : unmanaged, IFormattable, IEquatable, IComparable - { - 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : 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; - - /// 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 : unmanaged, IFormattable, IEquatable, IComparable - => -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 : 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 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..bbda207d29 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,207 +24,14 @@ 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) { - 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 . @@ -269,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); } @@ -290,395 +99,6 @@ 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); - - /// 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. - /// 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; - } - - /// 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); - } - - /// 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() - { - 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 - /// - /// The type to cast to - /// The casted matrix - public Matrix4X3 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable - { - return new(Row1.As(), Row2.As(), Row3.As(), Row4.As()); - } + public readonly bool IsIdentity => this == Identity; } } diff --git a/sources/Maths/Maths/Matrix4X3.gen.cs b/sources/Maths/Maths/Matrix4X3.gen.cs new file mode 100644 index 0000000000..85ef245f27 --- /dev/null +++ b/sources/Maths/Maths/Matrix4X3.gen.cs @@ -0,0 +1,717 @@ +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); + + /// + /// 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] + { + 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 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; + + + /// + 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); + + /// + public override bool Equals(object? obj) => obj is Matrix4X3 other && Equals(other); + + /// + public bool Equals(Matrix4X3 other) => this == other; + + /// + public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); + + /// 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 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 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 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), + 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 ==(Matrix4X3 left, Matrix4X3 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 !=(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 Matrix4X3 operator +(Matrix4X3 left, Matrix4X3 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 Matrix4X3 operator -(Matrix4X3 left, Matrix4X3 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 Matrix4X3 operator -(Matrix4X3 value) => + new(-value.Row1, + -value.Row2, + -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, 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. + /// The result of the multiplication. + 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); + + /// Multiplies a matrix by another matrix. + /// The first source matrix. + /// The second source matrix. + /// The result of the multiplication. + 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, + 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 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, + 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 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); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X3(Matrix4X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X3(Matrix4X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X3(Matrix4X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X3(Matrix4X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X3(Matrix4X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X3(Matrix4X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X3(Matrix4X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X3(Matrix4X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X3(Matrix4X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X3(Matrix4X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X3(Matrix4X3 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X3(Matrix4X3 from) => + 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)); + } + + /// + /// Methods for working with . + /// + 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(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)); + + /// 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 fb74c4345a..fffd21652b 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 @@ -19,8 +20,9 @@ public static class Matrix4X4 #endif private const float DecomposeEpsilon = 0.0001f; + /* private struct CanonicalBasis - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { public Vector3D Row0; public Vector3D Row1; @@ -28,7 +30,7 @@ private struct CanonicalBasis }; private struct VectorBasis - where T : unmanaged, IFormattable, IEquatable, IComparable + where T : INumberBase { #pragma warning disable 649 public unsafe Vector3D* Element0; @@ -36,17 +38,7 @@ private struct VectorBasis public unsafe Vector3D* Element2; #pragma warning restore 649 } - - /// 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 : unmanaged, IFormattable, IEquatable, IComparable - { - return value1 + value2; - } + */ /// Creates a spherical billboard that rotates around a specified object position. /// Position of the object the billboard will rotate around. @@ -55,7 +47,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 : IRootFunctions { Vector3D zaxis = objectPosition - cameraPosition; var norm = zaxis.LengthSquared; @@ -73,9 +65,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)); } @@ -87,7 +79,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 : IRootFunctions { // Treat the case when object and camera positions are too close. Vector3D faceDir = objectPosition - cameraPosition; @@ -109,17 +101,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); } @@ -134,9 +126,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)); } @@ -145,7 +137,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. @@ -197,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 : unmanaged, IFormattable, IEquatable, IComparable + public static Matrix4X4 CreateFromQuaternion(Quaternion quaternion) + where T : ITrigonometricFunctions { Matrix4X4 result = Matrix4X4.Identity; @@ -235,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 : unmanaged, IFormattable, IEquatable, IComparable + where T : ITrigonometricFunctions { - Legacy.Quaternion q = Legacy.Quaternion.CreateFromYawPitchRoll(yaw, pitch, roll); + var q = Quaternion.CreateFromYawPitchRoll(yaw, pitch, roll); return CreateFromQuaternion(q); } @@ -247,7 +239,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 : IRootFunctions { Vector3D zaxis = Vector3D.Normalize(cameraPosition - cameraTarget); Vector3D xaxis = Vector3D.Normalize(Vector3D.Cross(cameraUpVector, zaxis)); @@ -281,7 +273,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 +294,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 +318,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 +354,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 +396,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 +428,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 +465,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 +490,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 +519,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 +543,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 +571,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 +595,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 +625,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 +641,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 +662,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 +676,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 +697,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 +713,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 +737,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 +773,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 +788,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 +803,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 : IRootFunctions { Vector3D zaxis = Vector3D.Normalize(-forward); Vector3D xaxis = Vector3D.Normalize(Vector3D.Cross(up, zaxis)); @@ -845,7 +837,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 +1129,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, @@ -1189,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 : 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 Vector4D Multiply(Vector4D value1, Matrix4X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable - => -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 : unmanaged, IFormattable, IEquatable, IComparable - => value1 - value2; - /*[MethodImpl((MethodImplOptions)768)] private static Vector128 Permute(Vector128 value, byte control) { @@ -1269,6 +1199,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 +1208,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 +1398,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 + public static Matrix4X4 Transform(Matrix4X4 value, Quaternion rotation) + where T : ITrigonometricFunctions { // Compute rotation matrix. T x2 = Scalar.Add(rotation.X, rotation.X); @@ -1534,7 +1450,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..2cd9f69e41 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,284 +12,26 @@ 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) { - 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 . @@ -305,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 . @@ -325,180 +68,12 @@ 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); - } - - /// Returns the multiplicative identity matrix. - public static Matrix4X4 Identity => _identity; - - /// 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); - - /// 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); + 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 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. - /// 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; - } - - /// 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. - /// 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 - ); - } - - /// 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() @@ -530,10 +105,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)); @@ -562,271 +137,5 @@ public readonly T GetDeterminant() Scalar.Subtract(Scalar.Multiply(e, jo_kn), Scalar.Multiply(f, io_km)), 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() - { - 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 - /// - /// The type to cast to - /// The casted matrix - public Matrix4X4 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable - { - 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..0fcdce95cf --- /dev/null +++ b/sources/Maths/Maths/Matrix4X4.gen.cs @@ -0,0 +1,762 @@ +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)); + + /// 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; + + /// 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; + + + /// + 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); + + /// + 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); + + /// 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 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 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 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), + 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 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, 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. + /// 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); + + /// + /// Converts a matrix of into one with an underlying type of . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X4(Matrix4X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X4(Matrix4X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X4(Matrix4X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X4(Matrix4X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X4(Matrix4X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X4(Matrix4X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X4(Matrix4X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X4(Matrix4X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X4(Matrix4X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X4(Matrix4X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X4(Matrix4X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix4X4(Matrix4X4 from) => + 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)); + } + + /// + /// Methods for working with . + /// + 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)); + + /// 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/Matrix4x2F.gen.cs b/sources/Maths/Maths/Matrix4x2F.gen.cs deleted file mode 100644 index b5d608a7e0..0000000000 --- a/sources/Maths/Maths/Matrix4x2F.gen.cs +++ /dev/null @@ -1,182 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix4x2F : - IEquatable> - where T : IFloatingPointIeee754 - { - /// The 1st row of the matrix represented as a vector. - public Vector2F Row1; - - /// The 2nd row of the matrix represented as a vector. - public Vector2F Row2; - - /// The 3rd row of the matrix represented as a vector. - public Vector2F Row3; - - /// The 4th row of the matrix represented as a vector. - public Vector2F Row4; - - /// - /// Constructs a from the given rows. - /// - public Matrix4x2F(Vector2F row1, Vector2F row2, Vector2F row3, Vector2F row4) => (Row1, Row2, Row3, Row4) = (row1, row2, row3, row4); - - [UnscopedRef] - public ref Vector2F 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 Matrix4x2F other && Equals(other); - - /// - public bool Equals(Matrix4x2F other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); - - /// Computes the transpose of the matrix. - public Matrix2x4F 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 ==(Matrix4x2F left, Matrix4x2F 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 !=(Matrix4x2F left, Matrix4x2F 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) => - 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 Matrix4x2F operator -(Matrix4x2F left, Matrix4x2F 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 Matrix4x2F operator -(Matrix4x2F 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 Matrix4x2F operator *(Matrix4x2F left, Matrix2x2F 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 Matrix4x3F operator *(Matrix4x2F left, Matrix2x3F 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 Matrix4x4F operator *(Matrix4x2F left, Matrix2x4F 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 Matrix4x2F Lerp(Matrix4x2F value1, Matrix4x2F 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))); - } -} 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/Matrix4x3F.gen.cs b/sources/Maths/Maths/Matrix4x3F.gen.cs deleted file mode 100644 index 5600ad456c..0000000000 --- a/sources/Maths/Maths/Matrix4x3F.gen.cs +++ /dev/null @@ -1,207 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix4x3F : - IEquatable> - where T : IFloatingPointIeee754 - { - /// The 1st row of the matrix represented as a vector. - public Vector3F Row1; - - /// The 2nd row of the matrix represented as a vector. - public Vector3F Row2; - - /// The 3rd row of the matrix represented as a vector. - public Vector3F Row3; - - /// The 4th row of the matrix represented as a vector. - public Vector3F Row4; - - /// - /// Constructs a from the given rows. - /// - public Matrix4x3F(Vector3F row1, Vector3F row2, Vector3F row3, Vector3F row4) => (Row1, Row2, Row3, Row4) = (row1, row2, row3, row4); - - [UnscopedRef] - public ref Vector3F 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 Matrix4x3F other && Equals(other); - - /// - public bool Equals(Matrix4x3F other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4); - - /// Computes the transpose of the matrix. - public Matrix3x4F 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 ==(Matrix4x3F left, Matrix4x3F 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 !=(Matrix4x3F left, Matrix4x3F 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) => - 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 Matrix4x3F operator -(Matrix4x3F left, Matrix4x3F 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 Matrix4x3F operator -(Matrix4x3F 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 Matrix2x3F operator *(Matrix2x4F 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); - - /// Multiplies a matrix by another matrix. - /// The first source matrix. - /// The second source matrix. - /// The result of the multiplication. - public static Matrix4x2F operator *(Matrix4x3F left, Matrix3x2F 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 Matrix4x3F operator *(Matrix4x3F left, Matrix3x3F 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 Matrix4x4F operator *(Matrix4x3F left, Matrix3x4F 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 Matrix4x3F Lerp(Matrix4x3F value1, Matrix4x3F 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))); - } -} 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/Matrix5X4.Ops.cs b/sources/Maths/Maths/Matrix5X4.Ops.cs index 18fe708f4e..65c6170be8 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,69 +10,15 @@ 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. - /// The second source matrix. - /// The resulting matrix. - [MethodImpl((MethodImplOptions) 768)] - public static Matrix5X4 Add(Matrix5X4 value1, Matrix5X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - { - return 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, Matrix5X4 value2) - where T : unmanaged, IFormattable, IEquatable, IComparable - => 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 : unmanaged, IFormattable, IEquatable, IComparable + 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 : unmanaged, IFormattable, IEquatable, IComparable - => -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 : 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 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..555c6582b7 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,294 +12,24 @@ 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 ( - 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 ); - /// - /// 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) { - 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; } @@ -318,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; } @@ -340,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; } @@ -362,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; } @@ -374,69 +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); - - /// 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); - } + public readonly bool IsIdentity => this == Identity; /// Multiplies a vector by a matrix. /// The vector. @@ -447,358 +116,5 @@ public readonly bool IsIdentity return value1.X * value2.Row1 + value1.Y * value2.Row2 + value1.Z * value2.Row3 + 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 - ); - } - - /// 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() - { - 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 - /// - /// The type to cast to - /// The casted matrix - public Matrix5X4 As() where TOther : unmanaged, IFormattable, IEquatable, IComparable - { - 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 new file mode 100644 index 0000000000..6da344fa18 --- /dev/null +++ b/sources/Maths/Maths/Matrix5X4.gen.cs @@ -0,0 +1,682 @@ +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); + + /// + /// 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] + { + 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 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; + + + /// + 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); + + /// + public override bool Equals(object? obj) => obj is Matrix5X4 other && Equals(other); + + /// + public bool Equals(Matrix5X4 other) => this == other; + + /// + public override int GetHashCode() => HashCode.Combine(Row1, Row2, Row3, Row4, Row5); + + /// 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 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 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 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. + /// true if the given matrices are equal; false otherwise. + public static bool operator ==(Matrix5X4 left, Matrix5X4 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 !=(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 Matrix5X4 operator +(Matrix5X4 left, Matrix5X4 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 Matrix5X4 operator -(Matrix5X4 left, Matrix5X4 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 Matrix5X4 operator -(Matrix5X4 value) => + new(-value.Row1, + -value.Row2, + -value.Row3, + -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. + /// The result of the multiplication. + 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, + 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(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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix5X4(Matrix5X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix5X4(Matrix5X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix5X4(Matrix5X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix5X4(Matrix5X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix5X4(Matrix5X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix5X4(Matrix5X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix5X4(Matrix5X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix5X4(Matrix5X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix5X4(Matrix5X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix5X4(Matrix5X4 from) => + 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 . + /// + /// The source matrix. + /// The matrix. + public static explicit operator Matrix5X4(Matrix5X4 from) => + 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)); + } + + /// + /// Methods for working with . + /// + 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(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)); + + /// 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/Matrix5x4F.gen.cs b/sources/Maths/Maths/Matrix5x4F.gen.cs deleted file mode 100644 index 0c299fd514..0000000000 --- a/sources/Maths/Maths/Matrix5x4F.gen.cs +++ /dev/null @@ -1,216 +0,0 @@ -namespace Silk.NET.Maths -{ - using System.Diagnostics.CodeAnalysis; - using System.Numerics; - - partial struct Matrix5x4F : - IEquatable> - where T : IFloatingPointIeee754 - { - /// 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; - - /// The 5th row of the matrix represented as a vector. - public Vector4F Row5; - - /// - /// 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); - - [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; - 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 Matrix5x4F other && Equals(other); - - /// - public bool Equals(Matrix5x4F 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 ==(Matrix5x4F left, Matrix5x4F 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 !=(Matrix5x4F left, Matrix5x4F 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) => - 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 Matrix5x4F operator -(Matrix5x4F left, Matrix5x4F 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 Matrix5x4F operator -(Matrix5x4F 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 Matrix5x4F operator *(Matrix5x4F 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, - left.M51 * right.Row1 + left.M52 * right.Row2 + left.M53 * right.Row3 + left.M54 * right.Row4); - } - - static partial class Matrix5x4F - { - public static Matrix5x4F Lerp(Matrix5x4F value1, Matrix5x4F 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))); - } -} 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/Plane.Ops.cs b/sources/Maths/Maths/Plane.Ops.cs index 24879072fb..279f4200bf 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); @@ -181,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 : unmanaged, IFormattable, IEquatable, IComparable + 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/Plane.cs b/sources/Maths/Maths/Plane.cs index 83b0fccaf1..39a7164f86 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.AsSaturating(), short.CreateSaturating(from.Distance)); /// /// Converts a into one with a of @@ -212,9 +214,10 @@ public static explicit operator Plane(Plane from) /// /// The type to cast to /// The casted plane - public Plane As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] + 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/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 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 b0c46916b9..9a4c29648b 100644 --- a/sources/Maths/Maths/Legacy/Quaternion.cs +++ b/sources/Maths/Maths/Quaternion.Old.cs @@ -3,11 +3,12 @@ using System; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; 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. @@ -15,40 +16,10 @@ namespace Silk.NET.Maths.Legacy /// The type used to store values. [Serializable] [DataContract] - public struct Quaternion - : IEquatable> where T : unmanaged, IFormattable, IEquatable, IComparable + 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. @@ -60,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; @@ -102,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); @@ -128,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. @@ -164,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); @@ -255,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); @@ -294,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); @@ -311,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); @@ -328,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); @@ -337,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); @@ -346,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); @@ -363,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); @@ -380,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); @@ -389,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); @@ -398,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); @@ -421,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); @@ -475,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)); @@ -492,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; @@ -521,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); @@ -562,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); @@ -579,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)) { @@ -601,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); } @@ -628,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() @@ -683,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 /// @@ -700,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 : unmanaged, IFormattable, IEquatable, IComparable + 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); } } diff --git a/sources/Maths/Maths/Ray2D.cs b/sources/Maths/Maths/Ray2D.cs index 91b181f2fd..00b09dbcfe 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. @@ -123,15 +124,17 @@ public override int GetHashCode() { return !value1.Equals(value2); } - + /// /// Returns this ray casted to /// /// The type to cast to /// The casted ray - public Ray2D As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] + 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..44f14aab0f 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. @@ -127,15 +128,16 @@ public override int GetHashCode() { return !value1.Equals(value2); } - + /// /// Returns this ray casted to /// /// The type to cast to /// The casted ray - public Ray3D As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] + 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..cb1175a1a8 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 : 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 344d8f02a9..86198c30b8 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 : INumber { /// /// The origin. @@ -161,12 +162,12 @@ 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; - 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()); } /// @@ -221,15 +222,17 @@ public override int GetHashCode() { return !value1.Equals(value2); } - + /// /// Returns this rectangle casted to /// /// The type to cast to /// The casted rectangle - public Rectangle As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] + public Rectangle As() + where TOther : INumber { return new(Origin.As(), Size.As()); } } -} \ No newline at end of file +} 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/Sphere.cs b/sources/Maths/Maths/Sphere.cs index 5985308774..7c44cf801c 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,8 @@ namespace Silk.NET.Maths [Serializable] [DataContract] public struct Sphere - : IEquatable> where T : unmanaged, IFormattable, IEquatable, IComparable + : IEquatable> + where T : IRootFunctions { /// /// The center. @@ -168,9 +170,11 @@ public override int GetHashCode() /// /// The type to cast to /// The casted sphere - public Sphere As() where TOther : unmanaged, IFormattable, IEquatable, IComparable + [Obsolete("Use AsChecked, AsSaturating, or AsTruncating instead.", error: false)] + public Sphere As() + where TOther : IRootFunctions { return new(Center.As(), Scalar.As(Radius)); } } -} \ No newline at end of file +} diff --git a/sources/Maths/Maths/Vector2D.cs b/sources/Maths/Maths/Vector2D.cs new file mode 100644 index 0000000000..5ade5f68db --- /dev/null +++ b/sources/Maths/Maths/Vector2D.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Numerics; + +namespace Silk.NET.Maths +{ + /// A structure representing a 2D integer vector. + public partial struct Vector2D + { + /// 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 Vector2(Vector2D v) => + new Vector2(Convert.ToSingle(v.X), Convert.ToSingle(v.Y)); + } + + public static partial class Vector2D + { + /// Computes the cross product of two vectors. + public static T Cross(this Vector2D left, Vector2D right) + where T : INumberBase => + (left.X * right.Y) - (left.Y * right.X); + } +} diff --git a/sources/Maths/Maths/Vector2D.gen.cs b/sources/Maths/Maths/Vector2D.gen.cs new file mode 100644 index 0000000000..79b4f1297d --- /dev/null +++ b/sources/Maths/Maths/Vector2D.gen.cs @@ -0,0 +1,1249 @@ +namespace Silk.NET.Maths +{ + using System.Collections; + using System.Diagnostics.CodeAnalysis; + using System.Numerics; + using System.Runtime.InteropServices; + using System.Text; + + public partial struct Vector2D : + IEquatable>, + IReadOnlyList, + IFormattable, + IParsable>, + ISpanFormattable, + ISpanParsable>, + IUtf8SpanFormattable, + IUtf8SpanParsable> + where T : INumberBase + { + /// 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 Vector2D(T value) => (X, Y) = (value, value); + + /// Initializes the vector with individual component values. + public Vector2D(T x, T y) => (X, Y) = (x, y); + + /// Initializes the vector from a span of 2 values. + public Vector2D(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 Vector2D One => new(T.One); + + /// Returns a vector whose 2 elements are equal to zero. + public static Vector2D Zero => default; + + /// Gets the vector (1, 0). + public static Vector2D UnitX => new(T.One, T.Zero); + + /// Gets the vector (0, 1). + public static Vector2D UnitY => new(T.Zero, T.One); + + + /// + 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 Vector2D Parse(string s, IFormatProvider? provider) => Parse(s.AsSpan(), 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 Vector2D."); + + 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 Vector2D 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 Vector2D(x, y); + return true; + } + + return false; + } + + /// 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]; + 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 Vector2D 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 Vector2D result) => + TryParse(s.AsSpan(), provider, out result); + + /// Parses a span to a instance. + static Vector2D ISpanParsable>.Parse(ReadOnlySpan s, IFormatProvider? provider) => + Parse(s, 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 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 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 ==(Vector2D left, Vector2D 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 !=(Vector2D left, Vector2D right) => !(left == right); + + /// + public override bool Equals(object? obj) => obj is Vector2D other && Equals(other); + + /// + public bool Equals(Vector2D other) => this == other; + + /// + public override int GetHashCode() => HashCode.Combine(X, 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 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); + + /// Implicitly casts a to a . + 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); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector2D(Vector2D from) => + 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); + } + + /// + /// Methods for working with . + /// + public static partial class Vector2D + { + /// Extensions for vectors with elements implementing . + extension(Vector2D vector) + where T : IRootFunctions + { + /// Gets the length of the vector. + public T Length => T.Sqrt(vector.LengthSquared); + } + + /// Extensions for vectors with elements implementing . + extension(Vector2D vector) + where T : INumberBase + { + /// Gets the length squared of the vector. + public T LengthSquared => Vector2D.Dot(vector, vector); + } + + /// 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) + 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 => + left.X * right.X + left.Y * right.Y; + + /// Reflects a vector over a normal vector. + public static Vector2D Reflect(Vector2D vector, Vector2D normal) + where T : INumberBase + { + T dot = vector.Dot(normal); + return vector - (normal * (dot + dot)); + } + + /// Normalizes a vector. + public static Vector2D Normalize(this Vector2D vector) + where T : IRootFunctions + { + 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); + } + + /// 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))); + + /// 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 + { + 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)); + } + + /// 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) + 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 Vector2D Atan2Pi(this Vector2D y, Vector2D 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 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 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 Vector2D BitIncrement(this Vector2D 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 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)); + + /// 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 843f180af2..0000000000 --- a/sources/Maths/Maths/Vector2F.cs +++ /dev/null @@ -1,322 +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 - { - /// 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)); - - /// 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) - ); - - /// 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 . - 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 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))); - - 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)); - - 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)); - - 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 - { - /// 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/Vector2F.gen.cs b/sources/Maths/Maths/Vector2F.gen.cs deleted file mode 100644 index b7c5cfc47f..0000000000 --- a/sources/Maths/Maths/Vector2F.gen.cs +++ /dev/null @@ -1,426 +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 Vector2F : - IEquatable>, - IReadOnlyList, - IFormattable, - IParsable>, - ISpanFormattable, - ISpanParsable>, - IUtf8SpanFormattable, - IUtf8SpanParsable> - where T : IFloatingPointIeee754 - { - /// 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 Vector2F(T value) => (X, Y) = (value, value); - - /// Initializes the vector with individual component values. - public Vector2F(T x, T y) => (X, Y) = (x, y); - - /// Initializes the vector from a span of 2 values. - public Vector2F(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 Vector2F One => new(Scalar.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); - - /// Gets the vector (0, 1). - public static Vector2F UnitY => new(Scalar.Zero, Scalar.One); - - /// Gets the squared length of the vector (dot product with itself). - public T LengthSquared => Vector2F.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 Vector2F Parse(string s, IFormatProvider? provider) => Parse(s.AsSpan(), provider); - - /// Parses a span to a instance. - public static Vector2F Parse(ReadOnlySpan s, IFormatProvider? provider) - { - if (!TryParse(s, provider, out var result)) - throw new FormatException("Invalid format for Vector2F."); - - 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 Vector2F 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 Vector2F(x, y); - return true; - } - - return false; - } - - /// Parses a UTF-8 span to a instance. - public static Vector2F 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 Vector2F 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 Vector2F result) => - TryParse(s.AsSpan(), provider, out result); - - /// Parses a span to a instance. - static Vector2F ISpanParsable>.Parse(ReadOnlySpan s, IFormatProvider? provider) => - Parse(s, provider); - - /// Parses a string to a instance. - static Vector2F 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) => - 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) => - 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) => - 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 !=(Vector2F left, Vector2F right) => !(left == right); - - /// - public override bool Equals(object? obj) => obj is Vector2F other && Equals(other); - - /// - public bool Equals(Vector2F other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(X, Y); - - public static Vector2F operator +(Vector2F vector) => - vector; - - public static Vector2F operator -(Vector2F vector) => - new Vector2F(-vector.X, -vector.Y); - - public static Vector2F operator +(Vector2F left, Vector2F right) => - new Vector2F(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); - - public static Vector2F operator *(Vector2F left, Vector2F right) => - new Vector2F(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); - - public static Vector2F operator %(Vector2F left, Vector2F right) => - new Vector2F(left.X % right.X, left.Y % right.Y); - - public static Vector2F operator +(Vector2F vector, T scalar) => - new Vector2F(vector.X + scalar, vector.Y + scalar); - - public static Vector2F operator -(Vector2F vector, T scalar) => - new Vector2F(vector.X - scalar, vector.Y - scalar); - - public static Vector2F operator *(Vector2F vector, T scalar) => - new Vector2F(vector.X * scalar, vector.Y * scalar); - - public static Vector2F operator *(T scalar, Vector2F vector) => - new Vector2F(scalar * vector.X, scalar * vector.Y); - - public static Vector2F operator /(Vector2F vector, T scalar) => - new Vector2F(vector.X / scalar, vector.Y / scalar); - - public static Vector2F operator %(Vector2F vector, T scalar) => - new Vector2F(vector.X % scalar, vector.Y % scalar); - - } - - static partial class Vector2F - { - /// Computes the dot product of two vectors. - public static T Dot(this Vector2F left, Vector2F right) - where T : IFloatingPointIeee754 => - 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 - { - T dot = vector.Dot(normal); - return vector - (normal * (dot + dot)); - } - - /// Computes the length of the vector. - public static T GetLength(this Vector2F vector) - where T : IFloatingPointIeee754 => - T.Sqrt(vector.LengthSquared); - - /// Normalizes a vector. - public static Vector2F Normalize(this Vector2F vector) - where T : IFloatingPointIeee754 - { - T length = vector.GetLength(); - return length != T.Zero ? vector / length : Vector2F.Zero; - } - - public static Vector2F Log(this Vector2F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - 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)); - - public static Vector2F LogP1(this Vector2F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.LogP1(x.X), TSelf.LogP1(x.Y)); - - public static Vector2F Log2(this Vector2F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.Log2(x.X), TSelf.Log2(x.Y)); - - public static Vector2F Log2P1(this Vector2F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.Log2P1(x.X), TSelf.Log2P1(x.Y)); - - public static Vector2F Log10(this Vector2F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.Log10(x.X), TSelf.Log10(x.Y)); - - public static Vector2F Log10P1(this Vector2F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.Log10P1(x.X), TSelf.Log10P1(x.Y)); - - public static Vector2F Exp(this Vector2F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.Exp(x.X), TSelf.Exp(x.Y)); - - public static Vector2F ExpM1(this Vector2F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.ExpM1(x.X), TSelf.ExpM1(x.Y)); - - public static Vector2F Exp2(this Vector2F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.Exp2(x.X), TSelf.Exp2(x.Y)); - - public static Vector2F Exp2M1(this Vector2F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.Exp2M1(x.X), TSelf.Exp2M1(x.Y)); - - public static Vector2F Exp10(this Vector2F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.Exp10(x.X), TSelf.Exp10(x.Y)); - - public static Vector2F Exp10M1(this Vector2F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.Exp10M1(x.X), TSelf.Exp10M1(x.Y)); - } -} diff --git a/sources/Maths/Maths/Vector2I.cs b/sources/Maths/Maths/Vector2I.cs deleted file mode 100644 index fceb7b5b44..0000000000 --- a/sources/Maths/Maths/Vector2I.cs +++ /dev/null @@ -1,127 +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); - - /// 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 . - 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)); - - // 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 deleted file mode 100644 index afe221d779..0000000000 --- a/sources/Maths/Maths/Vector2I.gen.cs +++ /dev/null @@ -1,445 +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(Scalar.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); - - /// Gets the vector (0, 1). - public static Vector2I UnitY => new(Scalar.Zero, Scalar.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); - - public static Vector2I operator +(Vector2I vector) => - vector; - - 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 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 -(Vector2I vector, T scalar) => - new Vector2I(vector.X - scalar, vector.Y - scalar); - - 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 %(Vector2I vector, T scalar) => - new Vector2I(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)); - } - - 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)); - } -} diff --git a/sources/Maths/Maths/Vector3D.cs b/sources/Maths/Maths/Vector3D.cs new file mode 100644 index 0000000000..6e70b85bd8 --- /dev/null +++ b/sources/Maths/Maths/Vector3D.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Numerics; + +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(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 Vector3(Vector3D v) => + new Vector3(Convert.ToSingle(v.X), Convert.ToSingle(v.Y), Convert.ToSingle(v.Z)); + } + + public static partial class Vector3D + { + /// 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 new file mode 100644 index 0000000000..769dd516b2 --- /dev/null +++ b/sources/Maths/Maths/Vector3D.gen.cs @@ -0,0 +1,1290 @@ +namespace Silk.NET.Maths +{ + using System.Collections; + using System.Diagnostics.CodeAnalysis; + using System.Numerics; + using System.Runtime.InteropServices; + using System.Text; + + public partial struct Vector3D : + IEquatable>, + IReadOnlyList, + IFormattable, + IParsable>, + ISpanFormattable, + ISpanParsable>, + IUtf8SpanFormattable, + IUtf8SpanParsable> + where T : INumberBase + { + /// 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 Vector3D(T value) => (X, Y, Z) = (value, value, value); + + /// Initializes the vector with individual component values. + 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 Vector3D(Vector2D other, T z) => (X, Y, Z) = (other.X, other.Y, z); + + /// Initializes the vector from a span of 3 values. + public Vector3D(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 Vector3D One => new(T.One); + + /// Returns a vector whose 3 elements are equal to zero. + public static Vector3D Zero => default; + + /// Gets the vector (1, 0, 0). + public static Vector3D UnitX => new(T.One, T.Zero, T.Zero); + + /// Gets the vector (0, 1, 0). + public static Vector3D UnitY => new(T.Zero, T.One, T.Zero); + + /// Gets the vector (0, 0, 1). + public static Vector3D UnitZ => new(T.Zero, T.Zero, T.One); + + + /// + 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 Vector3D Parse(string s, IFormatProvider? provider) => Parse(s.AsSpan(), 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 Vector3D."); + + 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 Vector3D 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 Vector3D(x, y, z); + return true; + } + + return false; + } + + /// 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]; + 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 Vector3D 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 Vector3D result) => + TryParse(s.AsSpan(), provider, out result); + + /// Parses a span to a instance. + static Vector3D ISpanParsable>.Parse(ReadOnlySpan s, IFormatProvider? provider) => + Parse(s, 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 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 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 ==(Vector3D left, Vector3D 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 !=(Vector3D left, Vector3D right) => !(left == right); + + /// + public override bool Equals(object? obj) => obj is Vector3D other && Equals(other); + + /// + public bool Equals(Vector3D other) => this == other; + + /// + public override int GetHashCode() => HashCode.Combine(X, Y, 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 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); + + /// Implicitly casts a to a . + 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); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector3D(Vector3D from) => + 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); + } + + /// + /// Methods for working with . + /// + public static partial class Vector3D + { + /// Extensions for vectors with elements implementing . + extension(Vector3D vector) + where T : IRootFunctions + { + /// Gets the length of the vector. + public T Length => T.Sqrt(vector.LengthSquared); + } + + /// Extensions for vectors with elements implementing . + extension(Vector3D vector) + where T : INumberBase + { + /// Gets the length squared of the vector. + public T LengthSquared => Vector3D.Dot(vector, vector); + } + + /// Desconstructs a vector into its components. + /// The vector to deconstruct. + /// 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 => + left.X * right.X + left.Y * right.Y + left.Z * right.Z; + + /// Reflects a vector over a normal vector. + public static Vector3D Reflect(Vector3D vector, Vector3D normal) + where T : INumberBase + { + T dot = vector.Dot(normal); + return vector - (normal * (dot + dot)); + } + + /// Normalizes a vector. + public static Vector3D Normalize(this Vector3D vector) + where T : IRootFunctions + { + 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); + } + + /// 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))); + + /// 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 + { + 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)); + } + + /// 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) + 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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)); + + /// 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 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 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 Vector3D BitIncrement(this Vector3D 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 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)); + + /// 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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/Vector3F.gen.cs b/sources/Maths/Maths/Vector3F.gen.cs deleted file mode 100644 index 6c9a8a9f67..0000000000 --- a/sources/Maths/Maths/Vector3F.gen.cs +++ /dev/null @@ -1,463 +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 Vector3F : - IEquatable>, - IReadOnlyList, - IFormattable, - IParsable>, - ISpanFormattable, - ISpanParsable>, - IUtf8SpanFormattable, - IUtf8SpanParsable> - where T : IFloatingPointIeee754 - { - /// 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 Vector3F(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); - - /// 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 from a span of 3 values. - public Vector3F(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 Vector3F One => new(Scalar.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); - - /// Gets the vector (0, 1, 0). - public static Vector3F UnitY => new(Scalar.Zero, Scalar.One, Scalar.Zero); - - /// Gets the vector (0, 0, 1). - public static Vector3F UnitZ => new(Scalar.Zero, Scalar.Zero, Scalar.One); - - /// Gets the squared length of the vector (dot product with itself). - public T LengthSquared => Vector3F.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 Vector3F Parse(string s, IFormatProvider? provider) => Parse(s.AsSpan(), provider); - - /// Parses a span to a instance. - public static Vector3F Parse(ReadOnlySpan s, IFormatProvider? provider) - { - if (!TryParse(s, provider, out var result)) - throw new FormatException("Invalid format for Vector3F."); - - 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 Vector3F 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 Vector3F(x, y, z); - return true; - } - - return false; - } - - /// Parses a UTF-8 span to a instance. - public static Vector3F 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 Vector3F 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 Vector3F result) => - TryParse(s.AsSpan(), provider, out result); - - /// Parses a span to a instance. - static Vector3F ISpanParsable>.Parse(ReadOnlySpan s, IFormatProvider? provider) => - Parse(s, provider); - - /// Parses a string to a instance. - static Vector3F 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) => - 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) => - 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) => - 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 !=(Vector3F left, Vector3F right) => !(left == right); - - /// - public override bool Equals(object? obj) => obj is Vector3F other && Equals(other); - - /// - public bool Equals(Vector3F other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(X, Y, Z); - - public static Vector3F operator +(Vector3F vector) => - vector; - - public static Vector3F operator -(Vector3F vector) => - new Vector3F(-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); - - public static Vector3F operator -(Vector3F left, Vector3F right) => - new Vector3F(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); - - public static Vector3F operator /(Vector3F left, Vector3F right) => - new Vector3F(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); - - public static Vector3F operator +(Vector3F vector, T scalar) => - new Vector3F(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); - - public static Vector3F operator *(Vector3F vector, T scalar) => - new Vector3F(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); - - public static Vector3F operator /(Vector3F vector, T scalar) => - new Vector3F(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); - - } - - static partial class Vector3F - { - /// Computes the dot product of two vectors. - public static T Dot(this Vector3F left, Vector3F right) - where T : IFloatingPointIeee754 => - 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 - { - T dot = vector.Dot(normal); - return vector - (normal * (dot + dot)); - } - - /// Computes the length of the vector. - public static T GetLength(this Vector3F vector) - where T : IFloatingPointIeee754 => - T.Sqrt(vector.LengthSquared); - - /// Normalizes a vector. - public static Vector3F Normalize(this Vector3F vector) - where T : IFloatingPointIeee754 - { - T length = vector.GetLength(); - return length != T.Zero ? vector / length : Vector3F.Zero; - } - - public static Vector3F Log(this Vector3F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - 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)); - - public static Vector3F LogP1(this Vector3F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.LogP1(x.X), TSelf.LogP1(x.Y), TSelf.LogP1(x.Z)); - - public static Vector3F Log2(this Vector3F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.Log2(x.X), TSelf.Log2(x.Y), TSelf.Log2(x.Z)); - - public static Vector3F Log2P1(this Vector3F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.Log2P1(x.X), TSelf.Log2P1(x.Y), TSelf.Log2P1(x.Z)); - - public static Vector3F Log10(this Vector3F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.Log10(x.X), TSelf.Log10(x.Y), TSelf.Log10(x.Z)); - - public static Vector3F Log10P1(this Vector3F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.Log10P1(x.X), TSelf.Log10P1(x.Y), TSelf.Log10P1(x.Z)); - - public static Vector3F Exp(this Vector3F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.Exp(x.X), TSelf.Exp(x.Y), TSelf.Exp(x.Z)); - - public static Vector3F ExpM1(this Vector3F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.ExpM1(x.X), TSelf.ExpM1(x.Y), TSelf.ExpM1(x.Z)); - - public static Vector3F Exp2(this Vector3F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.Exp2(x.X), TSelf.Exp2(x.Y), TSelf.Exp2(x.Z)); - - public static Vector3F Exp2M1(this Vector3F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.Exp2M1(x.X), TSelf.Exp2M1(x.Y), TSelf.Exp2M1(x.Z)); - - public static Vector3F Exp10(this Vector3F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.Exp10(x.X), TSelf.Exp10(x.Y), TSelf.Exp10(x.Z)); - - public static Vector3F Exp10M1(this Vector3F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.Exp10M1(x.X), TSelf.Exp10M1(x.Y), TSelf.Exp10M1(x.Z)); - } -} diff --git a/sources/Maths/Maths/Vector3I.cs b/sources/Maths/Maths/Vector3I.cs deleted file mode 100644 index 167273b467..0000000000 --- a/sources/Maths/Maths/Vector3I.cs +++ /dev/null @@ -1,153 +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 3D integer vector. - internal partial struct Vector3I - { - /// Computes the cross product of this vector with another vector. - public Vector3I Cross(Vector3I other) => - new Vector3I( - (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( - (left.Y * right.Z) - (left.Z * right.Y), - (left.Z * right.X) - (left.X * right.Z), - (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 . - 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 . - 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); - 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)); - } - - 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 deleted file mode 100644 index 05bb368e10..0000000000 --- a/sources/Maths/Maths/Vector3I.gen.cs +++ /dev/null @@ -1,482 +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(Scalar.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); - - /// Gets the vector (0, 1, 0). - public static Vector3I UnitY => new(Scalar.Zero, Scalar.One, Scalar.Zero); - - /// Gets the vector (0, 0, 1). - public static Vector3I UnitZ => new(Scalar.Zero, Scalar.Zero, Scalar.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); - - public static Vector3I operator +(Vector3I vector) => - vector; - - 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 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 -(Vector3I vector, T scalar) => - new Vector3I(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); - - 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 %(Vector3I vector, T scalar) => - new Vector3I(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)); - } - - 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)); - } -} diff --git a/sources/Maths/Maths/Vector4D.cs b/sources/Maths/Maths/Vector4D.cs new file mode 100644 index 0000000000..8a11841c66 --- /dev/null +++ b/sources/Maths/Maths/Vector4D.cs @@ -0,0 +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.Numerics; + +namespace Silk.NET.Maths +{ + /// A structure representing a 4D integer vector. + public partial struct Vector4D + { + /// 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 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 new file mode 100644 index 0000000000..6f7e2d978c --- /dev/null +++ b/sources/Maths/Maths/Vector4D.gen.cs @@ -0,0 +1,1331 @@ +namespace Silk.NET.Maths +{ + using System.Collections; + using System.Diagnostics.CodeAnalysis; + using System.Numerics; + using System.Runtime.InteropServices; + using System.Text; + + public partial struct Vector4D : + IEquatable>, + IReadOnlyList, + IFormattable, + IParsable>, + ISpanFormattable, + ISpanParsable>, + IUtf8SpanFormattable, + IUtf8SpanParsable> + where T : INumberBase + { + /// 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 Vector4D(T value) => (X, Y, Z, W) = (value, value, value, value); + + /// Initializes the vector with individual component values. + 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 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 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 Vector4D(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 Vector4D One => new(T.One); + + /// Returns a vector whose 4 elements are equal to zero. + public static Vector4D Zero => default; + + /// Gets the vector (1, 0, 0, 0). + public static Vector4D UnitX => new(T.One, T.Zero, T.Zero, T.Zero); + + /// Gets the vector (0, 1, 0, 0). + public static Vector4D UnitY => new(T.Zero, T.One, T.Zero, T.Zero); + + /// Gets the vector (0, 0, 1, 0). + public static Vector4D UnitZ => new(T.Zero, T.Zero, T.One, T.Zero); + + /// Gets the vector (0, 0, 0, 1). + public static Vector4D UnitW => new(T.Zero, T.Zero, T.Zero, T.One); + + + /// + 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 Vector4D Parse(string s, IFormatProvider? provider) => Parse(s.AsSpan(), 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 Vector4D."); + + 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 Vector4D 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 Vector4D(x, y, z, w); + return true; + } + + return false; + } + + /// 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]; + 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 Vector4D 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 Vector4D result) => + TryParse(s.AsSpan(), provider, out result); + + /// Parses a span to a instance. + static Vector4D ISpanParsable>.Parse(ReadOnlySpan s, IFormatProvider? provider) => + Parse(s, 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 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 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 ==(Vector4D left, Vector4D 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 !=(Vector4D left, Vector4D right) => !(left == right); + + /// + public override bool Equals(object? obj) => obj is Vector4D other && Equals(other); + + /// + public bool Equals(Vector4D other) => this == other; + + /// + public override int GetHashCode() => HashCode.Combine(X, Y, Z, 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 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); + + /// 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); + + /// 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); + + /// + /// Converts a vector of into one with an underlying type of . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + 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 . + /// + /// The source vector. + /// The vector. + public static explicit operator Vector4D(Vector4D from) => + 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); + } + + /// + /// Methods for working with . + /// + public static partial class Vector4D + { + /// Extensions for vectors with elements implementing . + extension(Vector4D vector) + where T : IRootFunctions + { + /// Gets the length of the vector. + public T Length => T.Sqrt(vector.LengthSquared); + } + + /// Extensions for vectors with elements implementing . + extension(Vector4D vector) + where T : INumberBase + { + /// Gets the length squared of the vector. + public T LengthSquared => Vector4D.Dot(vector, vector); + } + + /// Desconstructs a vector into its components. + /// The vector to deconstruct. + /// 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 => + 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 Vector4D Reflect(Vector4D vector, Vector4D normal) + where T : INumberBase + { + T dot = vector.Dot(normal); + return vector - (normal * (dot + dot)); + } + + /// Normalizes a vector. + public static Vector4D Normalize(this Vector4D vector) + where T : IRootFunctions + { + 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); + } + + /// 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))); + + /// 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 + { + 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)); + } + + /// 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) + 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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)); + + /// 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 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 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 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)); + + /// 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 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)); + + /// 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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/Vector4F.gen.cs b/sources/Maths/Maths/Vector4F.gen.cs deleted file mode 100644 index be1a8e23ed..0000000000 --- a/sources/Maths/Maths/Vector4F.gen.cs +++ /dev/null @@ -1,500 +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 Vector4F : - IEquatable>, - IReadOnlyList, - IFormattable, - IParsable>, - ISpanFormattable, - ISpanParsable>, - IUtf8SpanFormattable, - IUtf8SpanParsable> - where T : IFloatingPointIeee754 - { - /// 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 Vector4F(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); - - /// 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 component for the remainder. - public Vector4F(Vector3F 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) - { - 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 Vector4F One => new(Scalar.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); - - /// Gets the vector (0, 1, 0, 0). - public static Vector4F UnitY => new(Scalar.Zero, Scalar.One, Scalar.Zero, Scalar.Zero); - - /// Gets the vector (0, 0, 1, 0). - public static Vector4F UnitZ => new(Scalar.Zero, Scalar.Zero, Scalar.One, Scalar.Zero); - - /// Gets the vector (0, 0, 0, 1). - public static Vector4F UnitW => new(Scalar.Zero, Scalar.Zero, Scalar.Zero, Scalar.One); - - /// Gets the squared length of the vector (dot product with itself). - public T LengthSquared => Vector4F.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 Vector4F Parse(string s, IFormatProvider? provider) => Parse(s.AsSpan(), provider); - - /// Parses a span to a instance. - public static Vector4F Parse(ReadOnlySpan s, IFormatProvider? provider) - { - if (!TryParse(s, provider, out var result)) - throw new FormatException("Invalid format for Vector4F."); - - 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 Vector4F 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 Vector4F(x, y, z, w); - return true; - } - - return false; - } - - /// Parses a UTF-8 span to a instance. - public static Vector4F 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 Vector4F 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 Vector4F result) => - TryParse(s.AsSpan(), provider, out result); - - /// Parses a span to a instance. - static Vector4F ISpanParsable>.Parse(ReadOnlySpan s, IFormatProvider? provider) => - Parse(s, provider); - - /// Parses a string to a instance. - static Vector4F 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) => - 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) => - 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) => - 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 !=(Vector4F left, Vector4F right) => !(left == right); - - /// - public override bool Equals(object? obj) => obj is Vector4F other && Equals(other); - - /// - public bool Equals(Vector4F other) => this == other; - - /// - public override int GetHashCode() => HashCode.Combine(X, Y, Z, W); - - public static Vector4F operator +(Vector4F vector) => - vector; - - public static Vector4F operator -(Vector4F vector) => - new Vector4F(-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); - - 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); - - 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); - - 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); - - 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); - - public static Vector4F operator +(Vector4F vector, T scalar) => - new Vector4F(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); - - public static Vector4F operator *(Vector4F vector, T scalar) => - new Vector4F(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); - - public static Vector4F operator /(Vector4F vector, T scalar) => - new Vector4F(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); - - } - - static partial class Vector4F - { - /// Computes the dot product of two vectors. - public static T Dot(this Vector4F left, Vector4F right) - where T : IFloatingPointIeee754 => - 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 - { - T dot = vector.Dot(normal); - return vector - (normal * (dot + dot)); - } - - /// Computes the length of the vector. - public static T GetLength(this Vector4F vector) - where T : IFloatingPointIeee754 => - T.Sqrt(vector.LengthSquared); - - /// Normalizes a vector. - public static Vector4F Normalize(this Vector4F vector) - where T : IFloatingPointIeee754 - { - T length = vector.GetLength(); - return length != T.Zero ? vector / length : Vector4F.Zero; - } - - public static Vector4F Log(this Vector4F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - 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)); - - public static Vector4F LogP1(this Vector4F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.LogP1(x.X), TSelf.LogP1(x.Y), TSelf.LogP1(x.Z), TSelf.LogP1(x.W)); - - public static Vector4F Log2(this Vector4F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.Log2(x.X), TSelf.Log2(x.Y), TSelf.Log2(x.Z), TSelf.Log2(x.W)); - - public static Vector4F Log2P1(this Vector4F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.Log2P1(x.X), TSelf.Log2P1(x.Y), TSelf.Log2P1(x.Z), TSelf.Log2P1(x.W)); - - public static Vector4F Log10(this Vector4F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.Log10(x.X), TSelf.Log10(x.Y), TSelf.Log10(x.Z), TSelf.Log10(x.W)); - - public static Vector4F Log10P1(this Vector4F x) - where TSelf : IFloatingPointIeee754, ILogarithmicFunctions => - new(TSelf.Log10P1(x.X), TSelf.Log10P1(x.Y), TSelf.Log10P1(x.Z), TSelf.Log10P1(x.W)); - - public static Vector4F Exp(this Vector4F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.Exp(x.X), TSelf.Exp(x.Y), TSelf.Exp(x.Z), TSelf.Exp(x.W)); - - public static Vector4F ExpM1(this Vector4F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.ExpM1(x.X), TSelf.ExpM1(x.Y), TSelf.ExpM1(x.Z), TSelf.ExpM1(x.W)); - - public static Vector4F Exp2(this Vector4F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.Exp2(x.X), TSelf.Exp2(x.Y), TSelf.Exp2(x.Z), TSelf.Exp2(x.W)); - - public static Vector4F Exp2M1(this Vector4F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.Exp2M1(x.X), TSelf.Exp2M1(x.Y), TSelf.Exp2M1(x.Z), TSelf.Exp2M1(x.W)); - - public static Vector4F Exp10(this Vector4F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.Exp10(x.X), TSelf.Exp10(x.Y), TSelf.Exp10(x.Z), TSelf.Exp10(x.W)); - - public static Vector4F Exp10M1(this Vector4F x) - where TSelf : IFloatingPointIeee754, IExponentialFunctions => - new(TSelf.Exp10M1(x.X), TSelf.Exp10M1(x.Y), TSelf.Exp10M1(x.Z), TSelf.Exp10M1(x.W)); - } -} diff --git a/sources/Maths/Maths/Vector4I.cs b/sources/Maths/Maths/Vector4I.cs deleted file mode 100644 index 16c3e21720..0000000000 --- a/sources/Maths/Maths/Vector4I.cs +++ /dev/null @@ -1,141 +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.InteropServices; -using System.Text; - -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. - 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 Vector4I to System.Numerics.Vector4. - 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); - 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)); - } - - 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 deleted file mode 100644 index 04eb7ca61c..0000000000 --- a/sources/Maths/Maths/Vector4I.gen.cs +++ /dev/null @@ -1,519 +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(Scalar.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); - - /// Gets the vector (0, 1, 0, 0). - public static Vector4I UnitY => new(Scalar.Zero, Scalar.One, Scalar.Zero, Scalar.Zero); - - /// Gets the vector (0, 0, 1, 0). - public static Vector4I UnitZ => new(Scalar.Zero, Scalar.Zero, Scalar.One, Scalar.Zero); - - /// Gets the vector (0, 0, 0, 1). - public static Vector4I UnitW => new(Scalar.Zero, Scalar.Zero, Scalar.Zero, Scalar.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); - - public static Vector4I operator +(Vector4I vector) => - vector; - - 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 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 -(Vector4I vector, T scalar) => - new Vector4I(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); - - 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 %(Vector4I vector, T scalar) => - new Vector4I(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)); - } - - 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)); - } -}