From a86a96f2d0074bdb73b864d8779a6ccb70d3e157 Mon Sep 17 00:00:00 2001 From: sk89q Date: Mon, 17 Jan 2011 00:37:23 -0800 Subject: [PATCH] Updated Vector to have getMin() and getMax(). --- src/com/sk89q/worldedit/Vector.java | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/com/sk89q/worldedit/Vector.java b/src/com/sk89q/worldedit/Vector.java index d8841c15f..8a4e62800 100644 --- a/src/com/sk89q/worldedit/Vector.java +++ b/src/com/sk89q/worldedit/Vector.java @@ -578,4 +578,32 @@ public class Vector { public BlockVector toBlockVector() { return new BlockVector(this); } + + /** + * Gets the minimum components of two vectors. + * + * @param v1 + * @param v2 + * @return minimum + */ + public static Vector getMinimum(Vector v1, Vector v2) { + return new Vector( + Math.min(v1.getX(), v2.getX()), + Math.min(v1.getY(), v2.getY()), + Math.min(v1.getZ(), v2.getZ())); + } + + /** + * Gets the maximum components of two vectors. + * + * @param v1 + * @param v2 + * @return maximum + */ + public static Vector getMaximum(Vector v1, Vector v2) { + return new Vector( + Math.max(v1.getX(), v2.getX()), + Math.max(v1.getY(), v2.getY()), + Math.max(v1.getZ(), v2.getZ())); + } }