Advertisement
Guest User

Untitled

a guest
Jul 28th, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. public static Boolean isInside(Location loc, Location corner1, Location corner2) {
  2. double xMin = 0;
  3. double xMax = 0;
  4. double yMin = 0;
  5. double yMax = 0;
  6. double zMin = 0;
  7. double zMax = 0;
  8. double x = loc.getX();
  9. double y = loc.getY();
  10. double z = loc.getZ();
  11.  
  12. xMin = Math.min(corner1.getX(), corner2.getX());
  13. xMax = Math.max(corner1.getX(), corner2.getX());
  14.  
  15. yMin = Math.min(corner1.getY(), corner2.getY());
  16. yMax = Math.max(corner1.getY(), corner2.getY());
  17.  
  18. zMin = Math.min(corner1.getZ(), corner2.getZ());
  19. zMax = Math.max(corner1.getZ(), corner2.getZ());
  20.  
  21. return (x >= xMin && x <= xMax && y >= yMin && y <= yMax && z >= zMin && z <= zMax);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement