diff --git a/Changelog.txt b/Changelog.txt new file mode 100644 index 0000000..224a9e3 --- /dev/null +++ b/Changelog.txt @@ -0,0 +1,16 @@ +# Nerd_STF v2.0.1 + +* Nerd_STF + * Mathematics + * Geometry + * Line + + ToDoubleArray() + + ToDoubleList() + * Triangle + + ToDoubleArray() + + ToDoubleList() + * Vert + + : IGroup\ + + GetEnumerator() + + ToArray() + + ToList() diff --git a/Nerd_STF/Mathematics/Geometry/Line.cs b/Nerd_STF/Mathematics/Geometry/Line.cs index 542d38d..431f265 100644 --- a/Nerd_STF/Mathematics/Geometry/Line.cs +++ b/Nerd_STF/Mathematics/Geometry/Line.cs @@ -127,6 +127,11 @@ namespace Nerd_STF.Mathematics.Geometry public Vert[] ToArray() => new Vert[] { start, end }; public List ToList() => new() { start, end }; + public double[] ToDoubleArray() => new double[] { start.position.x, start.position.y, start.position.z, + end.position.x, end.position.y, end.position.z }; + public List ToDoubleList() => new() { start.position.x, start.position.y, start.position.z, + end.position.x, end.position.y, end.position.z }; + public static Line operator +(Line a, Line b) => new(a.start + b.start, a.end + b.end); public static Line operator +(Line a, Vert b) => new(a.start + b, a.end + b); public static Line operator -(Line a, Line b) => new(a.start - b.start, a.end - b.end); diff --git a/Nerd_STF/Mathematics/Geometry/Triangle.cs b/Nerd_STF/Mathematics/Geometry/Triangle.cs index 8709918..9b6e631 100644 --- a/Nerd_STF/Mathematics/Geometry/Triangle.cs +++ b/Nerd_STF/Mathematics/Geometry/Triangle.cs @@ -220,6 +220,13 @@ namespace Nerd_STF.Mathematics.Geometry public Vert[] ToArray() => new Vert[] { A, B, C }; public List ToList() => new() { A, B, C }; + public double[] ToDoubleArray() => new double[] { A.position.x, A.position.y, A.position.z, + B.position.x, B.position.y, B.position.z, + C.position.x, C.position.y, C.position.z }; + public List ToDoubleList() => new() { A.position.x, A.position.y, A.position.z, + B.position.x, B.position.y, B.position.z, + C.position.x, C.position.y, C.position.z }; + public static Triangle operator +(Triangle a, Triangle b) => new(a.A + b.A, a.B + b.B, a.C + b.C); public static Triangle operator +(Triangle a, Vert b) => new(a.A + b, a.B + b, a.C + b); public static Triangle operator -(Triangle a, Triangle b) => new(a.A - b.A, a.B - b.B, a.C - b.C); diff --git a/Nerd_STF/Mathematics/Geometry/Vert.cs b/Nerd_STF/Mathematics/Geometry/Vert.cs index 9e41d85..8705c41 100644 --- a/Nerd_STF/Mathematics/Geometry/Vert.cs +++ b/Nerd_STF/Mathematics/Geometry/Vert.cs @@ -1,8 +1,9 @@ -using System.Diagnostics.CodeAnalysis; +using System.Collections; +using System.Diagnostics.CodeAnalysis; namespace Nerd_STF.Mathematics.Geometry { - public struct Vert : ICloneable, IEquatable + public struct Vert : ICloneable, IEquatable, IGroup { public static Vert Back => new(0, 0, -1); public static Vert Down => new(0, -1, 0); @@ -73,6 +74,12 @@ namespace Nerd_STF.Mathematics.Geometry public object Clone() => new Vert(position); + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + public IEnumerator GetEnumerator() => position.GetEnumerator(); + + public double[] ToArray() => position.ToArray(); + public List ToList() => position.ToList(); + public static Vert operator +(Vert a, Vert b) => new(a.position + b.position); public static Vert operator -(Vert d) => new(-d.position); public static Vert operator -(Vert a, Vert b) => new(a.position - b.position); diff --git a/Nerd_STF/bin/Release/net6.0/ref/Nerd_STF.dll b/Nerd_STF/bin/Release/net6.0/ref/Nerd_STF.dll index 7303c53..135be99 100644 Binary files a/Nerd_STF/bin/Release/net6.0/ref/Nerd_STF.dll and b/Nerd_STF/bin/Release/net6.0/ref/Nerd_STF.dll differ