3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 02:20:07 +01:00
Dieser Commit ist enthalten in:
Jesse Boyd 2019-04-23 22:48:41 +10:00
Ursprung 208929c378
Commit d97836762d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F

Datei anzeigen

@ -43,7 +43,7 @@ public class CatenaryBrush implements Brush, ResettableTool {
return; return;
} }
if (this.vertex == null) { if (this.vertex == null) {
vertex = getVertex(pos1, pos2, slack); vertex = getVertex(pos1.toVector3(), pos2.toVector3(), slack);
if (this.direction) { if (this.direction) {
BBC.BRUSH_CATENARY_DIRECTION.send(editSession.getPlayer(), 2); BBC.BRUSH_CATENARY_DIRECTION.send(editSession.getPlayer(), 2);
return; return;
@ -79,8 +79,8 @@ public class CatenaryBrush implements Brush, ResettableTool {
return true; return true;
} }
public static BlockVector3 getVertex(BlockVector3 pos1, BlockVector3 pos2, double lenPercent) { public static BlockVector3 getVertex(Vector3 pos1, Vector3 pos2, double lenPercent) {
if (lenPercent <= 1) return MathUtils.midpoint(pos1, pos2); if (lenPercent <= 1) return pos1.add(pos2).divide(2).toBlockPoint();
double curveLen = pos1.distance(pos2) * lenPercent; double curveLen = pos1.distance(pos2) * lenPercent;
double dy = pos2.getY() - pos1.getY(); double dy = pos2.getY() - pos1.getY();
double dx = pos2.getX() - pos1.getX(); double dx = pos2.getX() - pos1.getX();
@ -93,6 +93,6 @@ public class CatenaryBrush implements Brush, ResettableTool {
double z = (dh/2)/a; double z = (dh/2)/a;
double oY = (dy - curveLen * (Math.cosh(z) / Math.sinh(z))) / 2; double oY = (dy - curveLen * (Math.cosh(z) / Math.sinh(z))) / 2;
double vertY = a * 1 + oY; double vertY = a * 1 + oY;
return pos1.add(pos2.subtract(pos1).multiply(MathMan.roundInt(vertX / dh)).add(0, MathMan.roundInt(vertY), 0)).round(); return pos1.add(pos2.subtract(pos1).multiply(vertX / dh).add(0, vertY, 0)).round().toBlockPoint();
} }
} }