From 69ae4a7121922934e469c0ff2887735cf082e372 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Tue, 21 Sep 2021 14:07:10 +0100 Subject: [PATCH] Fix ellipsoid selection --- .../sk89q/worldedit/regions/EllipsoidRegion.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java index 14b26e2d0..c3aed2a53 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java @@ -55,7 +55,7 @@ public class EllipsoidRegion extends AbstractRegion { //FAWE start private Vector3 radiusSqr; - private Vector3 inverseRadius; + private Vector3 inverseRadiusSqr; private int radiusLengthSqr; private boolean sphere; //FAWE end @@ -200,7 +200,7 @@ public class EllipsoidRegion extends AbstractRegion { radiusSqr = radius.multiply(radius); radiusLengthSqr = (int) radiusSqr.getX(); this.sphere = radius.getY() == radius.getX() && radius.getX() == radius.getZ(); - inverseRadius = Vector3.ONE.divide(radius); + inverseRadiusSqr = Vector3.ONE.divide(radiusSqr); //FAWE end } @@ -249,9 +249,9 @@ public class EllipsoidRegion extends AbstractRegion { if (sphere) { return cx2 + cy2 + cz2 <= radiusLengthSqr; } - double cxd = cx2 * inverseRadius.getX(); - double cyd = cy2 * inverseRadius.getY(); - double czd = cz2 * inverseRadius.getZ(); + double cxd = cx2 * inverseRadiusSqr.getX(); + double cyd = cy2 * inverseRadiusSqr.getY(); + double czd = cz2 * inverseRadiusSqr.getZ(); return cxd + cyd + czd <= 1; } @@ -280,8 +280,8 @@ public class EllipsoidRegion extends AbstractRegion { if (cz2 > radiusSqr.getBlockZ()) { return false; } - double cxd = cx2 * inverseRadius.getX(); - double czd = cz2 * inverseRadius.getZ(); + double cxd = cx2 * inverseRadiusSqr.getX(); + double czd = cz2 * inverseRadiusSqr.getZ(); return cxd + czd <= 1; } //FAWE end