diff --git a/Changelog.md b/Changelog.md index 8a17e79..66fb4ad 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,10 @@ Here's the full changelog: ``` * Nerd_STF * Mathematics + * NumberSystems + * Complex + + operator Complex(SystemComplex) + + operator SystemComplex(Complex) * Float3 = Added a setter to `XY` = Added a setter to `XZ` diff --git a/Nerd_STF/Mathematics/NumberSystems/Complex.cs b/Nerd_STF/Mathematics/NumberSystems/Complex.cs index 6727473..5f1da3e 100644 --- a/Nerd_STF/Mathematics/NumberSystems/Complex.cs +++ b/Nerd_STF/Mathematics/NumberSystems/Complex.cs @@ -1,4 +1,6 @@ -namespace Nerd_STF.Mathematics.NumberSystems; +using SystemComplex = System.Numerics.Complex; + +namespace Nerd_STF.Mathematics.NumberSystems; public record struct Complex(float u, float i) : IAbsolute, IAverage, ICeiling, IClampMagnitude, IComparable, IDivide, IDot, @@ -204,4 +206,7 @@ public record struct Complex(float u, float i) : IAbsolute, IAverage fill) => new(fill); public static implicit operator Complex(Fill fill) => new(fill); public static implicit operator Complex((float u, float i) val) => new(val.u, val.i); + + public static implicit operator Complex(SystemComplex val) => ((float)val.Real, (float)val.Imaginary); + public static implicit operator SystemComplex(Complex val) => new(val.u, val.i); } diff --git a/Nerd_STF/Mathematics/NumberSystems/Quaternion.cs b/Nerd_STF/Mathematics/NumberSystems/Quaternion.cs index 9dd6991..06f5eb7 100644 --- a/Nerd_STF/Mathematics/NumberSystems/Quaternion.cs +++ b/Nerd_STF/Mathematics/NumberSystems/Quaternion.cs @@ -1,4 +1,6 @@ -namespace Nerd_STF.Mathematics.NumberSystems; +using SystemQuaternion = System.Numerics.Quaternion; + +namespace Nerd_STF.Mathematics.NumberSystems; public record struct Quaternion(float u, float i, float j, float k) : IAbsolute, IAverage, ICeiling, IClamp, IClampMagnitude, IComparable, @@ -332,4 +334,7 @@ public record struct Quaternion(float u, float i, float j, float k) : IAbsolute< public static implicit operator Quaternion(Fill fill) => new(fill); public static implicit operator Quaternion((float u, float i, float j, float k) val) => new(val.u, val.i, val.j, val.k); + + public static implicit operator Quaternion(SystemQuaternion val) => (val.X, val.Y, val.Z, val.W); + public static implicit operator SystemQuaternion(Quaternion val) => new(val.u, val.i, val.j, val.k); } diff --git a/Nerd_STF/Nerd_STF.csproj b/Nerd_STF/Nerd_STF.csproj index ed9ea85..7f0aed6 100644 --- a/Nerd_STF/Nerd_STF.csproj +++ b/Nerd_STF/Nerd_STF.csproj @@ -12,7 +12,7 @@ Copyright (c) 2023 That_One_Nerd README.md https://github.com/That-One-Nerd/Nerd_STF - 2.5.0 + 2.4.1 c#;csharp;c sharp;math;mathematics;mathametics;maths;color;rgb;rgba;cmyk;cmyka;hsv;hsva;calculus;linear algebra;linalg;linearalgebra;matrix;matrix2x2;matrix 2x2;matrix3x3;matrix 3x3;matrix4x4;matrix 4x4;matrix multiplication;vector;vector2d;vector3d;vector2;vector3;float2;float3;float4;int2;int3;int4;angle;geometry;vert;line;polygon;triangle;quadrilateral;sphere;circle;number system;numbersystem;complex numbers;complex;2d numbers;2dnumbers;quaternions;4d numbers;4dnumbers 2.4.1 Nerd_STF