Skip to content

Commit

Permalink
Trying to migrate towards Vector3.
Browse files Browse the repository at this point in the history
  • Loading branch information
MeltyPlayer committed Jan 5, 2025
1 parent 65e51c0 commit aaf3642
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion FinModelUtility/Formats/Vrml/Vrml/src/util/Misc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public static int GetOrientation(Vector3m v0,
Vector3m v2,
Vector3m normal) {
var res = (v0 - v1).Cross(v2 - v1);
if (res.LengthSquared().IsZero)
if (res.LengthSquared().ToDouble() == 0)
return 0;
if (res.X.Sign != normal.X.Sign ||
res.Y.Sign != normal.Y.Sign ||
Expand Down
12 changes: 7 additions & 5 deletions FinModelUtility/Formats/Vrml/Vrml/src/util/Vector3m.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using PeterO.Numbers;
using System.Numerics;

using PeterO.Numbers;

namespace vrml.util;

Expand Down Expand Up @@ -44,13 +46,13 @@ public override bool Equals(object obj) {
return false;
}

return this.X.CompareTo(other.X) == 0 &&
this.Y.CompareTo(other.Y) == 0 &&
this.Z.CompareTo(other.Z) == 0;
return new Vector3((float) this.X, (float) this.Y, (float) this.Z) ==
new Vector3((float) other.X, (float) other.Y, (float) other.Z);
}

public override int GetHashCode() {
return this.X.GetHashCode() ^ this.Y.GetHashCode() ^ this.Z.GetHashCode();
return new Vector3((float) this.X, (float) this.Y, (float) this.Z)
.GetHashCode();
}

public static Vector3m operator-(Vector3m a, Vector3m b) {
Expand Down

0 comments on commit aaf3642

Please sign in to comment.