mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-07 00:48:28 +01:00
Add epsilon operator
This commit is contained in:
parent
8849b6eec8
commit
4187bc0e4d
@ -392,6 +392,15 @@ public final class Vec implements Point {
|
|||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface Operator {
|
public interface Operator {
|
||||||
|
/**
|
||||||
|
* Checks each axis' value, if it's below {@code 1E-6} then it gets replaced with {@code 0}
|
||||||
|
*/
|
||||||
|
Operator EPSILON = (x, y, z) -> new Vec(
|
||||||
|
Math.abs(x) < 1E-6 ? 0 : x,
|
||||||
|
Math.abs(y) < 1E-6 ? 0 : y,
|
||||||
|
Math.abs(z) < 1E-6 ? 0 : z
|
||||||
|
);
|
||||||
|
|
||||||
@NotNull Vec apply(double x, double y, double z);
|
@NotNull Vec apply(double x, double y, double z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user