geforkt von Mirrors/FastAsyncWorldEdit
Added floor, ceil and round to Vector and Vector2D.
Dieser Commit ist enthalten in:
Ursprung
e598f8eaa0
Commit
c099ae5eb5
@ -546,6 +546,33 @@ public class Vector {
|
|||||||
return new Vector(x, Math.max(min, Math.min(max, y)), z);
|
return new Vector(x, Math.max(min, Math.min(max, y)), z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rounds all components down.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Vector floor() {
|
||||||
|
return new Vector(Math.floor(x), Math.floor(y), Math.floor(z));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rounds all components up.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Vector ceil() {
|
||||||
|
return new Vector(Math.ceil(x), Math.ceil(y), Math.ceil(z));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rounds all components to the closest integer.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Vector round() {
|
||||||
|
return new Vector(Math.floor(x + 0.5), Math.floor(y + 0.5), Math.floor(z + 0.5));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2D transformation.
|
* 2D transformation.
|
||||||
*
|
*
|
||||||
|
@ -472,6 +472,33 @@ public class Vector2D {
|
|||||||
&& getBlockZ() >= min.getBlockZ() && getBlockZ() <= max.getBlockZ();
|
&& getBlockZ() >= min.getBlockZ() && getBlockZ() <= max.getBlockZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rounds all components down.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Vector2D floor() {
|
||||||
|
return new Vector2D(Math.floor(x), Math.floor(z));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rounds all components up.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Vector2D ceil() {
|
||||||
|
return new Vector2D(Math.ceil(x), Math.ceil(z));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rounds all components to the closest integer.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Vector2D round() {
|
||||||
|
return new Vector2D(Math.floor(x + 0.5), Math.floor(z + 0.5));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2D transformation.
|
* 2D transformation.
|
||||||
*
|
*
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren