1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-13 18:21:51 +00:00

Fix Vector#equalsEpsilon ignoring parameter

Provided epsilon parameter was used for Y axis but ignored for X axis.
Some useless return statements are also removed.
This commit is contained in:
Даниїл Григор'єв 2024-07-26 18:59:55 +03:00
parent 67f7babd09
commit ad6e3c3b92
No known key found for this signature in database
GPG Key ID: B890DF16341D8C1D

View File

@ -489,7 +489,6 @@ export class Vector {
} }
default: { default: {
assertAlways(false, "Invalid fast inplace rotation: " + angle); assertAlways(false, "Invalid fast inplace rotation: " + angle);
return this;
} }
} }
// return new Vector(this.x * cos - this.y * sin, this.x * sin + this.y * cos); // return new Vector(this.x * cos - this.y * sin, this.x * sin + this.y * cos);
@ -519,7 +518,6 @@ export class Vector {
} }
default: { default: {
assertAlways(false, "Invalid fast inplace rotation: " + angle); assertAlways(false, "Invalid fast inplace rotation: " + angle);
return new Vector();
} }
} }
} }
@ -593,7 +591,6 @@ export class Vector {
} }
default: default:
assertAlways(false, "Invalid angle: " + angle); assertAlways(false, "Invalid angle: " + angle);
return;
} }
} }
@ -603,7 +600,7 @@ export class Vector {
* @returns {Boolean} * @returns {Boolean}
*/ */
equalsEpsilon(v, epsilon = 1e-5) { equalsEpsilon(v, epsilon = 1e-5) {
return Math.abs(this.x - v.x) < 1e-5 && Math.abs(this.y - v.y) < epsilon; return Math.abs(this.x - v.x) < epsilon && Math.abs(this.y - v.y) < epsilon;
} }
/** /**