Updated Vector to have getMin() and getMax().

Dieser Commit ist enthalten in:
sk89q 2011-01-17 00:37:23 -08:00
Ursprung 84da5bc6f8
Commit a86a96f2d0

Datei anzeigen

@ -578,4 +578,32 @@ public class Vector {
public BlockVector toBlockVector() { public BlockVector toBlockVector() {
return new BlockVector(this); 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()));
}
} }