Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 18:40:05 +01:00
Fixed Vector[2D].transform2D not using the aboutX/Z arguments properly.
Dieser Commit ist enthalten in:
Ursprung
a7530b7f89
Commit
8c68cdf4a8
@ -577,22 +577,25 @@ public class Vector {
|
|||||||
* 2D transformation.
|
* 2D transformation.
|
||||||
*
|
*
|
||||||
* @param angle in degrees
|
* @param angle in degrees
|
||||||
* @param aboutX
|
* @param aboutX about which x coordinate to rotate
|
||||||
* @param aboutZ
|
* @param aboutZ about which z coordinate to rotate
|
||||||
* @param translateX
|
* @param translateX what to add after rotation
|
||||||
* @param translateZ
|
* @param translateZ what to add after rotation
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Vector transform2D(double angle,
|
public Vector transform2D(double angle,
|
||||||
double aboutX, double aboutZ, double translateX, double translateZ) {
|
double aboutX, double aboutZ, double translateX, double translateZ) {
|
||||||
angle = Math.toRadians(angle);
|
angle = Math.toRadians(angle);
|
||||||
double x = this.x;
|
double x = this.x - aboutX;
|
||||||
double z = this.z;
|
double z = this.z - aboutZ;
|
||||||
double x2 = x * Math.cos(angle) - z * Math.sin(angle);
|
double x2 = x * Math.cos(angle) - z * Math.sin(angle);
|
||||||
double z2 = x * Math.sin(angle) + z * Math.cos(angle);
|
double z2 = x * Math.sin(angle) + z * Math.cos(angle);
|
||||||
return new Vector(x2 + aboutX + translateX,
|
|
||||||
y,
|
return new Vector(
|
||||||
z2 + aboutZ + translateZ);
|
x2 + aboutX + translateX,
|
||||||
|
y,
|
||||||
|
z2 + aboutZ + translateZ
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -503,21 +503,23 @@ public class Vector2D {
|
|||||||
* 2D transformation.
|
* 2D transformation.
|
||||||
*
|
*
|
||||||
* @param angle in degrees
|
* @param angle in degrees
|
||||||
* @param aboutX
|
* @param aboutX about which x coordinate to rotate
|
||||||
* @param aboutZ
|
* @param aboutZ about which z coordinate to rotate
|
||||||
* @param translateX
|
* @param translateX what to add after rotation
|
||||||
* @param translateZ
|
* @param translateZ what to add after rotation
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Vector2D transform2D(double angle,
|
public Vector2D transform2D(double angle,
|
||||||
double aboutX, double aboutZ, double translateX, double translateZ) {
|
double aboutX, double aboutZ, double translateX, double translateZ) {
|
||||||
angle = Math.toRadians(angle);
|
angle = Math.toRadians(angle);
|
||||||
double x = this.x;
|
double x = this.x - aboutX;
|
||||||
double z = this.z;
|
double z = this.z - aboutZ;
|
||||||
double x2 = x * Math.cos(angle) - z * Math.sin(angle);
|
double x2 = x * Math.cos(angle) - z * Math.sin(angle);
|
||||||
double z2 = x * Math.sin(angle) + z * Math.cos(angle);
|
double z2 = x * Math.sin(angle) + z * Math.cos(angle);
|
||||||
return new Vector2D(x2 + aboutX + translateX,
|
return new Vector2D(
|
||||||
z2 + aboutZ + translateZ);
|
x2 + aboutX + translateX,
|
||||||
|
z2 + aboutZ + translateZ
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren