3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-26 11:00:04 +01:00

Fix ellipsoid selection

Dieser Commit ist enthalten in:
dordsor21 2021-09-21 14:07:10 +01:00
Ursprung a23abc1bb6
Commit 69ae4a7121
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B

Datei anzeigen

@ -55,7 +55,7 @@ public class EllipsoidRegion extends AbstractRegion {
//FAWE start //FAWE start
private Vector3 radiusSqr; private Vector3 radiusSqr;
private Vector3 inverseRadius; private Vector3 inverseRadiusSqr;
private int radiusLengthSqr; private int radiusLengthSqr;
private boolean sphere; private boolean sphere;
//FAWE end //FAWE end
@ -200,7 +200,7 @@ public class EllipsoidRegion extends AbstractRegion {
radiusSqr = radius.multiply(radius); radiusSqr = radius.multiply(radius);
radiusLengthSqr = (int) radiusSqr.getX(); radiusLengthSqr = (int) radiusSqr.getX();
this.sphere = radius.getY() == radius.getX() && radius.getX() == radius.getZ(); this.sphere = radius.getY() == radius.getX() && radius.getX() == radius.getZ();
inverseRadius = Vector3.ONE.divide(radius); inverseRadiusSqr = Vector3.ONE.divide(radiusSqr);
//FAWE end //FAWE end
} }
@ -249,9 +249,9 @@ public class EllipsoidRegion extends AbstractRegion {
if (sphere) { if (sphere) {
return cx2 + cy2 + cz2 <= radiusLengthSqr; return cx2 + cy2 + cz2 <= radiusLengthSqr;
} }
double cxd = cx2 * inverseRadius.getX(); double cxd = cx2 * inverseRadiusSqr.getX();
double cyd = cy2 * inverseRadius.getY(); double cyd = cy2 * inverseRadiusSqr.getY();
double czd = cz2 * inverseRadius.getZ(); double czd = cz2 * inverseRadiusSqr.getZ();
return cxd + cyd + czd <= 1; return cxd + cyd + czd <= 1;
} }
@ -280,8 +280,8 @@ public class EllipsoidRegion extends AbstractRegion {
if (cz2 > radiusSqr.getBlockZ()) { if (cz2 > radiusSqr.getBlockZ()) {
return false; return false;
} }
double cxd = cx2 * inverseRadius.getX(); double cxd = cx2 * inverseRadiusSqr.getX();
double czd = cz2 * inverseRadius.getZ(); double czd = cz2 * inverseRadiusSqr.getZ();
return cxd + czd <= 1; return cxd + czd <= 1;
} }
//FAWE end //FAWE end