Version 2.1.1 #10
86
Changelog.md
86
Changelog.md
@ -1,84 +1,12 @@
|
||||
# Nerd_STF v2.1.0
|
||||
# Nerd_STF v2.1.1
|
||||
|
||||
This update adds some operations from calculus, as well as many new geometry structures.
|
||||
This update doesn't add any new features, simply a code simplification, using some of the .net 6 tools, such as global usings and file-scoped namespace declarations.
|
||||
|
||||
```
|
||||
* Nerd_STF
|
||||
+ Exceptions
|
||||
+ Nerd_STFException
|
||||
+ DifferingVertCountException
|
||||
+ DisconnectedLinesException
|
||||
+ Miscellaneous
|
||||
+ `GlobalUsings.cs`
|
||||
+ IClosest<T>
|
||||
+ IContainer<T>
|
||||
* Logger
|
||||
* DefaultLogHandler(LogMessage)
|
||||
= Replaced a `throw new Exception` with a `throw new ArgumentException`
|
||||
* Mathematics
|
||||
+ Angle
|
||||
+ Calculus
|
||||
+ delegate double Equation(double)
|
||||
* Double2
|
||||
= Made `CompareTo(Double2)` better
|
||||
* Double3
|
||||
= Made `CompareTo(Double3)` better
|
||||
* Double4
|
||||
= Made `CompareTo(Double4)` better
|
||||
* Int2
|
||||
+ operator &(Int2, Int2)
|
||||
+ operator |(Int2, Int2)
|
||||
+ operator ^(Int2, Int2)
|
||||
= Made `CompareTo(Int2)` better
|
||||
* Int3
|
||||
+ operator &(Int3, Int3)
|
||||
+ operator |(Int3, Int3)
|
||||
+ operator ^(Int3, Int3)
|
||||
= Made `CompareTo(Int3)` better
|
||||
* Int4
|
||||
+ operator &(Int4, Int4)
|
||||
+ operator |(Int4, Int4)
|
||||
+ operator ^(Int4, Int4)
|
||||
= Made `CompareTo(Int4)` better
|
||||
* Mathf
|
||||
+ Average(Equation, double, double, double)
|
||||
+ GetValues(Equation)
|
||||
+ MakeEquation(Dictionary<double, double>)
|
||||
+ Max(Equation, double, double, double)
|
||||
+ Min(Equation, double, double, double)
|
||||
= Swapped the names of "RadToDeg" and "DegToRad"
|
||||
* Geometry
|
||||
+ Box2D
|
||||
+ Box3D
|
||||
+ Polygon
|
||||
+ Quadrilateral
|
||||
+ Sphere
|
||||
+ ISubdividable
|
||||
* ITriangulatable
|
||||
+ Triangle[] TriangulateAll(params ITriangulatable[])
|
||||
* Line
|
||||
+ : IComparable<Line>
|
||||
+ : IContainer<Vert>
|
||||
+ : IClosest<Vert>
|
||||
+ : ISubdividable<Line[]>
|
||||
+ ClosestTo(Vert)
|
||||
+ ClosestTo(Vert, double)
|
||||
+ CompareTo(Line)
|
||||
+ Contains(Vert)
|
||||
+ Subdivide()
|
||||
+ operator -(Line)
|
||||
+ operator >(Line)
|
||||
+ operator <(Line)
|
||||
+ operator >=(Line)
|
||||
+ operator <=(Line)
|
||||
= Renamed all instances of "start" to "a"
|
||||
= Renamed all instances of "end" to "b"
|
||||
* Triangle
|
||||
+ operator -(Triangle)
|
||||
+ ToDoubleArrayAll(params Triangle[])
|
||||
= Replaced the variable assignings in the Triangle to not re-assign the lines.
|
||||
= Now uses custom exception in line constructor
|
||||
= Renamed "L1" to "AB"
|
||||
= Renamed "L2" to "BC"
|
||||
= Renamed "L3" to "CA"
|
||||
= Removed unused or unrequired usings in all files.
|
||||
= Replaced all namespace declarations with file-scoped declarations.
|
||||
* Miscellaneous
|
||||
* GlobalUsings
|
||||
+ global using System.Diagnostics.CodeAnalysis
|
||||
```
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Nerd_STF.Exceptions
|
||||
{
|
||||
namespace Nerd_STF.Exceptions;
|
||||
|
||||
[Serializable]
|
||||
public class DifferingVertCountException : Nerd_STFException
|
||||
@ -27,4 +26,3 @@ namespace Nerd_STF.Exceptions
|
||||
}
|
||||
protected DifferingVertCountException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,7 @@
|
||||
using Nerd_STF.Mathematics.Geometry;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Nerd_STF.Exceptions;
|
||||
|
||||
namespace Nerd_STF.Exceptions
|
||||
{
|
||||
[Serializable]
|
||||
public class DisconnectedLinesException : Nerd_STFException
|
||||
{
|
||||
@ -32,4 +26,3 @@ namespace Nerd_STF.Exceptions
|
||||
}
|
||||
protected DisconnectedLinesException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Nerd_STF.Exceptions;
|
||||
|
||||
namespace Nerd_STF.Exceptions
|
||||
{
|
||||
[Serializable]
|
||||
public class Nerd_STFException : Exception
|
||||
{
|
||||
@ -15,4 +10,3 @@ namespace Nerd_STF.Exceptions
|
||||
public Nerd_STFException(string message, Exception inner) : base(message, inner) { }
|
||||
protected Nerd_STFException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
namespace Nerd_STF
|
||||
{
|
||||
namespace Nerd_STF;
|
||||
|
||||
public delegate T Fill<T>(int index);
|
||||
}
|
||||
|
||||
@ -1,13 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Nerd_STF;
|
||||
|
||||
namespace Nerd_STF
|
||||
{
|
||||
public interface IClosest<T> where T : IEquatable<T>
|
||||
{
|
||||
public T ClosestTo(T item);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Nerd_STF;
|
||||
|
||||
namespace Nerd_STF
|
||||
{
|
||||
public interface IContainer<T> where T : IEquatable<T>
|
||||
{
|
||||
public bool Contains(T item);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Nerd_STF;
|
||||
|
||||
namespace Nerd_STF
|
||||
{
|
||||
public interface IEncapsulator<T, TE> : IContainer<TE> where T : IEquatable<T> where TE : IEquatable<TE>
|
||||
{
|
||||
public T Encapsulate(TE val);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
namespace Nerd_STF
|
||||
{
|
||||
namespace Nerd_STF;
|
||||
|
||||
public interface IGroup<T> : IEnumerable<T>
|
||||
{
|
||||
public T[] ToArray();
|
||||
public List<T> ToList();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Nerd_STF;
|
||||
|
||||
namespace Nerd_STF
|
||||
{
|
||||
public struct LogMessage
|
||||
{
|
||||
public string Message;
|
||||
@ -22,4 +16,3 @@ namespace Nerd_STF
|
||||
|
||||
public override string ToString() => Timestamp + " " + Severity.ToString().ToUpper() + ": " + Message;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
namespace Nerd_STF
|
||||
{
|
||||
namespace Nerd_STF;
|
||||
|
||||
public enum LogSeverity
|
||||
{
|
||||
Debug = 1,
|
||||
@ -8,4 +8,3 @@
|
||||
Error = 8,
|
||||
Fatal = 16,
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Nerd_STF
|
||||
{
|
||||
namespace Nerd_STF;
|
||||
|
||||
public class Logger
|
||||
{
|
||||
public event Action<LogMessage> OnMessageRecieved = DefaultLogHandler;
|
||||
@ -69,4 +69,3 @@ namespace Nerd_STF
|
||||
Console.ForegroundColor = originalCol;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Nerd_STF.Mathematics;
|
||||
|
||||
namespace Nerd_STF.Mathematics
|
||||
{
|
||||
public struct Angle : ICloneable, IComparable<Angle>, IEquatable<Angle>
|
||||
{
|
||||
public static Angle Full => new(360);
|
||||
@ -121,4 +114,3 @@ namespace Nerd_STF.Mathematics
|
||||
Radians,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Nerd_STF.Mathematics;
|
||||
|
||||
namespace Nerd_STF.Mathematics
|
||||
{
|
||||
public static class Calculus
|
||||
{
|
||||
public const double DefaultStep = 0.001;
|
||||
@ -38,4 +32,3 @@ namespace Nerd_STF.Mathematics
|
||||
return val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
using Nerd_STF.Mathematics.Geometry;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
namespace Nerd_STF.Mathematics;
|
||||
|
||||
namespace Nerd_STF.Mathematics
|
||||
{
|
||||
public struct Double2 : ICloneable, IComparable<Double2>, IEquatable<Double2>, IGroup<double>
|
||||
{
|
||||
public static Double2 Down => new(0, -1);
|
||||
@ -183,4 +179,3 @@ namespace Nerd_STF.Mathematics
|
||||
public static implicit operator Double2(Fill<double> fill) => new(fill);
|
||||
public static implicit operator Double2(Fill<int> fill) => new(fill);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
using Nerd_STF.Mathematics.Geometry;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
namespace Nerd_STF.Mathematics;
|
||||
|
||||
namespace Nerd_STF.Mathematics
|
||||
{
|
||||
public struct Double3 : ICloneable, IComparable<Double3>, IEquatable<Double3>, IGroup<double>
|
||||
{
|
||||
public static Double3 Back => new(0, 0, -1);
|
||||
@ -204,4 +200,3 @@ namespace Nerd_STF.Mathematics
|
||||
public static implicit operator Double3(Fill<double> fill) => new(fill);
|
||||
public static implicit operator Double3(Fill<int> fill) => new(fill);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
using Nerd_STF.Mathematics.Geometry;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
namespace Nerd_STF.Mathematics;
|
||||
|
||||
namespace Nerd_STF.Mathematics
|
||||
{
|
||||
public struct Double4 : ICloneable, IComparable<Double4>, IEquatable<Double4>, IGroup<double>
|
||||
{
|
||||
public static Double4 Back => new(0, 0, -1, 0);
|
||||
@ -220,4 +216,3 @@ namespace Nerd_STF.Mathematics
|
||||
public static implicit operator Double4(Fill<double> fill) => new(fill);
|
||||
public static implicit operator Double4(Fill<int> fill) => new(fill);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Nerd_STF.Mathematics;
|
||||
|
||||
namespace Nerd_STF.Mathematics
|
||||
{
|
||||
public delegate double Equation(double x);
|
||||
}
|
||||
|
||||
@ -1,12 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Nerd_STF.Mathematics.Geometry;
|
||||
|
||||
namespace Nerd_STF.Mathematics.Geometry
|
||||
{
|
||||
public struct Box2D : ICloneable, IContainer<Vert>, IEquatable<Box2D>
|
||||
{
|
||||
public static Box2D Unit => new(Vert.Zero, Double2.One);
|
||||
@ -127,4 +120,3 @@ namespace Nerd_STF.Mathematics.Geometry
|
||||
public static implicit operator Box2D(Fill<double> fill) => new(fill);
|
||||
public static explicit operator Box2D(Box3D box) => new(box.center, (Double2)box.size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Nerd_STF.Mathematics.Geometry;
|
||||
|
||||
namespace Nerd_STF.Mathematics.Geometry
|
||||
{
|
||||
public struct Box3D : ICloneable, IContainer<Vert>, IEquatable<Box3D>
|
||||
{
|
||||
public static Box3D Unit => new(Vert.Zero, Double3.One);
|
||||
@ -110,7 +103,6 @@ namespace Nerd_STF.Mathematics.Geometry
|
||||
Double3 diff = Double3.Absolute(center - vert);
|
||||
return diff.x <= size.x && diff.y <= size.y && diff.z <= size.z;
|
||||
}
|
||||
|
||||
public object Clone() => new Box3D(center, size);
|
||||
|
||||
public static Box3D operator +(Box3D a, Vert b) => new(a.center + b, a.size);
|
||||
@ -128,4 +120,3 @@ namespace Nerd_STF.Mathematics.Geometry
|
||||
public static implicit operator Box3D(Fill<double> fill) => new(fill);
|
||||
public static implicit operator Box3D(Box2D box) => new(box);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,14 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Nerd_STF.Mathematics.Geometry;
|
||||
|
||||
namespace Nerd_STF.Mathematics.Geometry
|
||||
{
|
||||
public interface ISubdividable<T>
|
||||
{
|
||||
public T Subdivide();
|
||||
public T Subdivide(int iterations);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Nerd_STF.Mathematics.Geometry;
|
||||
|
||||
namespace Nerd_STF.Mathematics.Geometry
|
||||
{
|
||||
public interface ITriangulatable
|
||||
{
|
||||
public static Triangle[] TriangulateAll(params ITriangulatable[] triangulatables)
|
||||
@ -17,4 +11,3 @@ namespace Nerd_STF.Mathematics.Geometry
|
||||
|
||||
public Triangle[] Triangulate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Nerd_STF.Mathematics.Geometry;
|
||||
|
||||
namespace Nerd_STF.Mathematics.Geometry
|
||||
{
|
||||
public struct Line : ICloneable, IClosest<Vert>, IComparable<Line>, IContainer<Vert>, IEquatable<Line>,
|
||||
IGroup<Vert>, ISubdividable<Line[]>
|
||||
{
|
||||
@ -199,4 +191,3 @@ namespace Nerd_STF.Mathematics.Geometry
|
||||
public static implicit operator Line(Fill<double> fill) => new(fill);
|
||||
public static implicit operator Line(Fill<int> fill) => new(fill);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,5 @@
|
||||
using Nerd_STF.Exceptions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Nerd_STF.Mathematics.Geometry;
|
||||
|
||||
namespace Nerd_STF.Mathematics.Geometry
|
||||
{
|
||||
public struct Polygon : ICloneable, IEquatable<Polygon>, IGroup<Vert>, ISubdividable<Polygon>, ITriangulatable
|
||||
{
|
||||
public Line[] Lines
|
||||
@ -516,4 +508,3 @@ namespace Nerd_STF.Mathematics.Geometry
|
||||
public static implicit operator Polygon(Triangle tri) => new(tri.AB, tri.BC, tri.CA);
|
||||
public static implicit operator Polygon(Quadrilateral quad) => new(quad.AB, quad.BC, quad.CD, quad.DA);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,14 +1,5 @@
|
||||
using Nerd_STF.Exceptions;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Nerd_STF.Mathematics.Geometry;
|
||||
|
||||
namespace Nerd_STF.Mathematics.Geometry
|
||||
{
|
||||
public struct Quadrilateral : ICloneable, IEquatable<Quadrilateral>, IGroup<Vert>, ITriangulatable
|
||||
{
|
||||
public Vert A
|
||||
@ -339,4 +330,3 @@ namespace Nerd_STF.Mathematics.Geometry
|
||||
public static explicit operator Quadrilateral(Polygon poly) => new(poly.Lines[0], poly.Lines[1],
|
||||
poly.Lines[2], poly.Lines[3]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Nerd_STF.Mathematics.Geometry;
|
||||
|
||||
namespace Nerd_STF.Mathematics.Geometry
|
||||
{
|
||||
public struct Sphere : ICloneable, IClosest<Vert>, IComparable<Sphere>, IComparable<double>, IContainer<Vert>,
|
||||
IEquatable<Sphere>, IEquatable<double>
|
||||
{
|
||||
@ -123,4 +116,3 @@ namespace Nerd_STF.Mathematics.Geometry
|
||||
public static bool operator >=(Sphere a, double b) => a > b || a == b;
|
||||
public static bool operator <=(Sphere a, double b) => a < b || a == b;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
using Nerd_STF.Exceptions;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
namespace Nerd_STF.Mathematics.Geometry;
|
||||
|
||||
namespace Nerd_STF.Mathematics.Geometry
|
||||
{
|
||||
public struct Triangle : ICloneable, IEquatable<Triangle>, IGroup<Vert>
|
||||
{
|
||||
public Vert A
|
||||
@ -110,11 +106,9 @@ namespace Nerd_STF.Mathematics.Geometry
|
||||
public Triangle(Fill<Vert> fill) : this(fill(0), fill(1), fill(2)) { }
|
||||
public Triangle(Fill<Line> fill) : this(fill(0), fill(1), fill(2)) { }
|
||||
public Triangle(Fill<double> fill) : this(fill(0), fill(1), fill(2), fill(3), fill(4), fill(5), fill(6),
|
||||
fill(7), fill(8))
|
||||
{ }
|
||||
fill(7), fill(8)) { }
|
||||
public Triangle(Fill<int> fill) : this(fill(0), fill(1), fill(2), fill(3), fill(4), fill(5), fill(6),
|
||||
fill(7), fill(8))
|
||||
{ }
|
||||
fill(7), fill(8)) { }
|
||||
|
||||
public Vert this[int index]
|
||||
{
|
||||
@ -186,7 +180,6 @@ namespace Nerd_STF.Mathematics.Geometry
|
||||
b[i] = tris[i].B;
|
||||
c[i] = tris[i].C;
|
||||
}
|
||||
|
||||
return (a, b, c);
|
||||
}
|
||||
public static (Line[] ABs, Line[] BCs, Line[] CAs) SplitLineArray(params Triangle[] tris)
|
||||
@ -198,7 +191,6 @@ namespace Nerd_STF.Mathematics.Geometry
|
||||
bc[i] = tris[i].BC;
|
||||
ca[i] = tris[i].CA;
|
||||
}
|
||||
|
||||
return (ab, bc, ca);
|
||||
}
|
||||
|
||||
@ -254,7 +246,6 @@ namespace Nerd_STF.Mathematics.Geometry
|
||||
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, Vert b) => new(a.A + b, a.B + b, a.C + b);
|
||||
public static Triangle operator -(Triangle t) => new(-t.A, -t.B, -t.C);
|
||||
@ -277,4 +268,3 @@ namespace Nerd_STF.Mathematics.Geometry
|
||||
public static implicit operator Triangle(Fill<int> fill) => new(fill);
|
||||
public static explicit operator Triangle(Polygon poly) => new(poly.Lines[0], poly.Lines[1], poly.Lines[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
namespace Nerd_STF.Mathematics.Geometry;
|
||||
|
||||
namespace Nerd_STF.Mathematics.Geometry
|
||||
{
|
||||
public struct Vert : ICloneable, IEquatable<Vert>, IGroup<double>
|
||||
{
|
||||
public static Vert Back => new(0, 0, -1);
|
||||
@ -99,4 +96,3 @@ namespace Nerd_STF.Mathematics.Geometry
|
||||
public static implicit operator Vert(Fill<double> fill) => new(fill);
|
||||
public static implicit operator Vert(Fill<int> fill) => new(fill);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
using Nerd_STF.Mathematics.Geometry;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
namespace Nerd_STF.Mathematics;
|
||||
|
||||
namespace Nerd_STF.Mathematics
|
||||
{
|
||||
public struct Int2 : ICloneable, IComparable<Int2>, IEquatable<Int2>, IGroup<int>
|
||||
{
|
||||
public static Int2 Down => new(0, -1);
|
||||
@ -180,4 +176,3 @@ namespace Nerd_STF.Mathematics
|
||||
public static explicit operator Int2(Vert val) => new((int)val.position.x, (int)val.position.y);
|
||||
public static implicit operator Int2(Fill<int> fill) => new(fill);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
using Nerd_STF.Mathematics.Geometry;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
namespace Nerd_STF.Mathematics;
|
||||
|
||||
namespace Nerd_STF.Mathematics
|
||||
{
|
||||
public struct Int3 : ICloneable, IComparable<Int3>, IEquatable<Int3>, IGroup<int>
|
||||
{
|
||||
public static Int3 Back => new(0, 0, -1);
|
||||
@ -148,7 +144,6 @@ namespace Nerd_STF.Mathematics
|
||||
foreach (Int3 d in vals) val += d;
|
||||
return val;
|
||||
}
|
||||
|
||||
public int CompareTo(Int3 other) => Magnitude.CompareTo(other.Magnitude);
|
||||
public override bool Equals([NotNullWhen(true)] object? obj)
|
||||
{
|
||||
@ -162,9 +157,7 @@ namespace Nerd_STF.Mathematics
|
||||
"X: " + x.ToString(provider) + " Y: " + y.ToString(provider) + " Z: " + z.ToString(provider);
|
||||
public string ToString(IFormatProvider provider) =>
|
||||
"X: " + x.ToString(provider) + " Y: " + y.ToString(provider) + " Z: " + z.ToString(provider);
|
||||
|
||||
public object Clone() => new Int3(x, y, z);
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||
public IEnumerator<int> GetEnumerator()
|
||||
{
|
||||
@ -202,4 +195,3 @@ namespace Nerd_STF.Mathematics
|
||||
(int)val.position.z);
|
||||
public static implicit operator Int3(Fill<int> fill) => new(fill);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
using Nerd_STF.Mathematics.Geometry;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
namespace Nerd_STF.Mathematics;
|
||||
|
||||
namespace Nerd_STF.Mathematics
|
||||
{
|
||||
public struct Int4 : ICloneable, IComparable<Int4>, IEquatable<Int4>, IGroup<int>
|
||||
{
|
||||
public static Int4 Back => new(0, 0, -1, 0);
|
||||
@ -218,4 +214,3 @@ namespace Nerd_STF.Mathematics
|
||||
(int)val.position.z, 0);
|
||||
public static implicit operator Int4(Fill<int> fill) => new(fill);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
namespace Nerd_STF.Mathematics
|
||||
{
|
||||
namespace Nerd_STF.Mathematics;
|
||||
|
||||
public static class Mathf
|
||||
{
|
||||
public const double RadToDeg = 0.0174532925199; // Pi / 180
|
||||
@ -250,4 +250,3 @@
|
||||
|
||||
public static double Tan(double radians) => Sin(radians) / Cos(radians);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
global using System;
|
||||
global using System.Collections;
|
||||
global using System.Collections.Generic;
|
||||
global using System.Diagnostics.CodeAnalysis;
|
||||
global using System.IO;
|
||||
global using System.Linq;
|
||||
global using System.Net.Http;
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user