v2.0.1 out

tiny, i know
This commit is contained in:
That-One-Nerd 2022-04-03 09:58:10 -04:00
parent 1d6fe9ff2f
commit 1a769b4404
5 changed files with 37 additions and 2 deletions

16
Changelog.txt Normal file
View File

@ -0,0 +1,16 @@
# Nerd_STF v2.0.1
* Nerd_STF
* Mathematics
* Geometry
* Line
+ ToDoubleArray()
+ ToDoubleList()
* Triangle
+ ToDoubleArray()
+ ToDoubleList()
* Vert
+ : IGroup\<Vert>
+ GetEnumerator()
+ ToArray()
+ ToList()

View File

@ -127,6 +127,11 @@ namespace Nerd_STF.Mathematics.Geometry
public Vert[] ToArray() => new Vert[] { start, end }; public Vert[] ToArray() => new Vert[] { start, end };
public List<Vert> ToList() => new() { start, end }; public List<Vert> 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<double> 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, 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, 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); public static Line operator -(Line a, Line b) => new(a.start - b.start, a.end - b.end);

View File

@ -220,6 +220,13 @@ namespace Nerd_STF.Mathematics.Geometry
public Vert[] ToArray() => new Vert[] { A, B, C }; public Vert[] ToArray() => new Vert[] { A, B, C };
public List<Vert> ToList() => new() { A, B, C }; public List<Vert> 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<double> 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, 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, 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); public static Triangle operator -(Triangle a, Triangle b) => new(a.A - b.A, a.B - b.B, a.C - b.C);

View File

@ -1,8 +1,9 @@
using System.Diagnostics.CodeAnalysis; using System.Collections;
using System.Diagnostics.CodeAnalysis;
namespace Nerd_STF.Mathematics.Geometry namespace Nerd_STF.Mathematics.Geometry
{ {
public struct Vert : ICloneable, IEquatable<Vert> public struct Vert : ICloneable, IEquatable<Vert>, IGroup<double>
{ {
public static Vert Back => new(0, 0, -1); public static Vert Back => new(0, 0, -1);
public static Vert Down => new(0, -1, 0); public static Vert Down => new(0, -1, 0);
@ -73,6 +74,12 @@ namespace Nerd_STF.Mathematics.Geometry
public object Clone() => new Vert(position); public object Clone() => new Vert(position);
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public IEnumerator<double> GetEnumerator() => position.GetEnumerator();
public double[] ToArray() => position.ToArray();
public List<double> ToList() => position.ToList();
public static Vert operator +(Vert a, Vert b) => new(a.position + b.position); 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 d) => new(-d.position);
public static Vert operator -(Vert a, Vert b) => new(a.position - b.position); public static Vert operator -(Vert a, Vert b) => new(a.position - b.position);