From b96ef7b620fe489f7b25ed337a7333ff630bae45 Mon Sep 17 00:00:00 2001 From: Yetanotherx Date: Mon, 2 Jan 2012 21:41:57 -0500 Subject: [PATCH] Allow conversion from an old region to ellipsoid when using //sel. --- .../regions/EllipsoidRegionSelector.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegionSelector.java b/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegionSelector.java index 746f0025b..d020b5632 100644 --- a/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegionSelector.java +++ b/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegionSelector.java @@ -53,20 +53,21 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion { final EllipsoidRegionSelector ellipsoidRegionSelector = (EllipsoidRegionSelector) oldSelector; region = new EllipsoidRegion(ellipsoidRegionSelector.getIncompleteRegion()); - }/* else { - final Region oldRegion; + } else { + Region oldRegion = null; try { oldRegion = oldSelector.getRegion(); } catch (IncompleteRegionException e) { return; } - pos1 = oldRegion.getMinimumPoint().toBlockVector(); - pos2 = oldRegion.getMaximumPoint().toBlockVector(); + BlockVector pos1 = oldRegion.getMinimumPoint().toBlockVector(); + BlockVector pos2 = oldRegion.getMaximumPoint().toBlockVector(); + + Vector center = pos1.add(pos2).divide(2).floor(); + region.setCenter(center); + region.setRadius(pos2.subtract(center)); } - - region.setPos1(pos1); - region.setPos2(pos2);*/ } public boolean selectPrimary(Vector pos) {