From a7530b7f8955021c9e2f7087578af741bac9c04c Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Thu, 5 Jan 2012 15:35:06 +0100 Subject: [PATCH] Added Vector.getMidpoint --- src/main/java/com/sk89q/worldedit/Vector.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/com/sk89q/worldedit/Vector.java b/src/main/java/com/sk89q/worldedit/Vector.java index dcc36cc5d..90efecfe7 100644 --- a/src/main/java/com/sk89q/worldedit/Vector.java +++ b/src/main/java/com/sk89q/worldedit/Vector.java @@ -708,4 +708,19 @@ public class Vector { Math.max(v1.z, v2.z) ); } + + /** + * Gets the midpoint of two vectors. + * + * @param v1 + * @param v2 + * @return maximum + */ + public static Vector getMidpoint(Vector v1, Vector v2) { + return new Vector( + (v1.x + v2.x) / 2, + (v1.y + v2.y) / 2, + (v1.z + v2.z) / 2 + ); + } }