mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-27 05:00:08 +08:00
Vector changes.
- Clarified some javadocs - Optimized toBlockPoint and made it return a BlockVector instead of a Vector. - Changed some whitespace
This commit is contained in:
parent
8c68cdf4a8
commit
e4d3f70594
@ -290,7 +290,7 @@ public Vector subtract(Vector... others) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiplies two points.
|
* Component-wise multiplication
|
||||||
*
|
*
|
||||||
* @param other
|
* @param other
|
||||||
* @return New point
|
* @return New point
|
||||||
@ -300,7 +300,7 @@ public Vector multiply(Vector other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiply two points.
|
* Component-wise multiplication
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@ -312,7 +312,7 @@ public Vector multiply(double x, double y, double z) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiply two points.
|
* Component-wise multiplication
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@ -324,7 +324,7 @@ public Vector multiply(int x, int y, int z) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiply points.
|
* Component-wise multiplication
|
||||||
*
|
*
|
||||||
* @param others
|
* @param others
|
||||||
* @return New point
|
* @return New point
|
||||||
@ -371,7 +371,7 @@ public Vector multiply(int n) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Divide two points.
|
* Component-wise division
|
||||||
*
|
*
|
||||||
* @param other
|
* @param other
|
||||||
* @return New point
|
* @return New point
|
||||||
@ -381,7 +381,7 @@ public Vector divide(Vector other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Divide two points.
|
* Component-wise division
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@ -393,7 +393,7 @@ public Vector divide(double x, double y, double z) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Divide two points.
|
* Component-wise division
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@ -565,7 +565,9 @@ public Vector ceil() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rounds all components to the closest integer.
|
* Rounds all components to the closest integer.<br>
|
||||||
|
*<br>
|
||||||
|
* Components < 0.5 are rounded down, otherwise up
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -606,10 +608,12 @@ public Vector transform2D(double angle,
|
|||||||
* @param z
|
* @param z
|
||||||
* @return point
|
* @return point
|
||||||
*/
|
*/
|
||||||
public static Vector toBlockPoint(double x, double y, double z) {
|
public static BlockVector toBlockPoint(double x, double y, double z) {
|
||||||
return new Vector((int) Math.floor(x),
|
return new BlockVector(
|
||||||
(int) Math.floor(y),
|
Math.floor(x),
|
||||||
(int) Math.floor(z));
|
Math.floor(y),
|
||||||
|
Math.floor(z)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -618,9 +622,11 @@ public static Vector toBlockPoint(double x, double y, double z) {
|
|||||||
* @return point
|
* @return point
|
||||||
*/
|
*/
|
||||||
public BlockVector toBlockPoint() {
|
public BlockVector toBlockPoint() {
|
||||||
return new BlockVector((int) Math.floor(x),
|
return new BlockVector(
|
||||||
(int) Math.floor(y),
|
Math.floor(x),
|
||||||
(int) Math.floor(z));
|
Math.floor(y),
|
||||||
|
Math.floor(z)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -634,6 +640,7 @@ public boolean equals(Object obj) {
|
|||||||
if (!(obj instanceof Vector)) {
|
if (!(obj instanceof Vector)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector other = (Vector) obj;
|
Vector other = (Vector) obj;
|
||||||
return other.getX() == this.x && other.getY() == this.y && other.getZ() == this.z;
|
return other.getX() == this.x && other.getY() == this.y && other.getZ() == this.z;
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ public Vector2D subtract(Vector2D... others) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiplies two points.
|
* Component-wise multiplication
|
||||||
*
|
*
|
||||||
* @param other
|
* @param other
|
||||||
* @return New point
|
* @return New point
|
||||||
@ -256,7 +256,7 @@ public Vector2D multiply(Vector2D other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiply two points.
|
* Component-wise multiplication
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@ -268,7 +268,7 @@ public Vector2D multiply(double x, double z) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiply two points.
|
* Component-wise multiplication
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@ -280,7 +280,7 @@ public Vector2D multiply(int x, int z) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiply points.
|
* Component-wise multiplication
|
||||||
*
|
*
|
||||||
* @param others
|
* @param others
|
||||||
* @return New point
|
* @return New point
|
||||||
@ -326,7 +326,7 @@ public Vector2D multiply(int n) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Divide two points.
|
* Component-wise division
|
||||||
*
|
*
|
||||||
* @param other
|
* @param other
|
||||||
* @return New point
|
* @return New point
|
||||||
@ -336,7 +336,7 @@ public Vector2D divide(Vector2D other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Divide two points.
|
* Component-wise division
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@ -348,7 +348,7 @@ public Vector2D divide(double x, double z) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Divide two points.
|
* Component-wise division
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@ -491,7 +491,9 @@ public Vector2D ceil() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rounds all components to the closest integer.
|
* Rounds all components to the closest integer.<br>
|
||||||
|
*<br>
|
||||||
|
* Components < 0.5 are rounded down, otherwise up
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -542,6 +544,7 @@ public boolean equals(Object obj) {
|
|||||||
if (!(obj instanceof Vector2D)) {
|
if (!(obj instanceof Vector2D)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D other = (Vector2D) obj;
|
Vector2D other = (Vector2D) obj;
|
||||||
return other.x == this.x && other.z == this.z;
|
return other.x == this.x && other.z == this.z;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user