3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-05 02:50:05 +01:00

The Sphere selector can now also shrink the region.

The radius is set to ceil(distanceToCenter).
Dieser Commit ist enthalten in:
TomyLobo 2013-08-24 09:55:35 +02:00
Ursprung 878c26a8f0
Commit 77219a8b3e
2 geänderte Dateien mit 4 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -763,7 +763,7 @@ public class SelectionCommands {
player.print("Ellipsoid selector: left click=center, right click to extend");
} else if (typeName.equalsIgnoreCase("sphere")) {
selector = new SphereRegionSelector(oldSelector);
player.print("Sphere selector: left click=center, right click to extend");
player.print("Sphere selector: left click=center, right click to set radius");
} else if (typeName.equalsIgnoreCase("cyl")) {
selector = new CylinderRegionSelector(oldSelector);
player.print("Cylindrical selector: Left click=center, right click to extend.");

Datei anzeigen

@ -41,7 +41,7 @@ public class SphereRegionSelector extends EllipsoidRegionSelector {
public SphereRegionSelector(RegionSelector oldSelector) {
super(oldSelector);
final Vector radius = region.getRadius();
double radiusScalar = Math.max(Math.max(radius.getX(), radius.getY()), radius.getZ());
final double radiusScalar = Math.max(Math.max(radius.getX(), radius.getY()), radius.getZ());
region.setRadius(new Vector(radiusScalar, radiusScalar, radiusScalar));
}
@ -51,12 +51,9 @@ public class SphereRegionSelector extends EllipsoidRegionSelector {
@Override
public boolean selectSecondary(Vector pos) {
final Vector diff = pos.subtract(region.getCenter());
final Vector minRadius = Vector.getMaximum(diff, diff.multiply(-1.0));
final double radiusScalar = Math.ceil(pos.distance(region.getCenter()));
region.setRadius(new Vector(radiusScalar, radiusScalar, radiusScalar));
double minRadiusScalar = Math.max(Math.max(minRadius.getX(), minRadius.getY()), minRadius.getZ());
region.extendRadius(new Vector(minRadiusScalar, minRadiusScalar, minRadiusScalar));
return true;
}