Skip to content

Commit 47aa90d

Browse files
committed
parse queries without antlr
1 parent 3e9cd5d commit 47aa90d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package org.comroid.util;
2+
3+
import org.comroid.api.data.Vector;
4+
import org.jetbrains.annotations.NotNull;
5+
6+
public class MathUtil {
7+
public static boolean aabb(@NotNull Vector.N3 a, @NotNull Vector.N3 b, @NotNull Vector.N3 position) {
8+
// Get the minimum and maximum corners of the AABB
9+
double minX = Math.min(a.getX(), b.getX());
10+
double maxX = Math.max(a.getX(), b.getX());
11+
double minY = Math.min(a.getY(), b.getY());
12+
double maxY = Math.max(a.getY(), b.getY());
13+
double minZ = Math.min(a.getZ(), b.getZ());
14+
double maxZ = Math.max(a.getZ(), b.getZ());
15+
16+
// Check if the position is within the bounds
17+
return (position.getX() >= minX && position.getX() <= maxX) &&
18+
(position.getY() >= minY && position.getY() <= maxY) &&
19+
(position.getZ() >= minZ && position.getZ() <= maxZ);
20+
}
21+
}

0 commit comments

Comments
 (0)