Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Boolean isInside(Location loc, Location corner1, Location corner2) {
- double xMin = 0;
- double xMax = 0;
- double yMin = 0;
- double yMax = 0;
- double zMin = 0;
- double zMax = 0;
- double x = loc.getX();
- double y = loc.getY();
- double z = loc.getZ();
- xMin = Math.min(corner1.getX(), corner2.getX());
- xMax = Math.max(corner1.getX(), corner2.getX());
- yMin = Math.min(corner1.getY(), corner2.getY());
- yMax = Math.max(corner1.getY(), corner2.getY());
- zMin = Math.min(corner1.getZ(), corner2.getZ());
- zMax = Math.max(corner1.getZ(), corner2.getZ());
- return (x >= xMin && x <= xMax && y >= yMin && y <= yMax && z >= zMin && z <= zMax);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement