mirror of
https://github.com/FalsePattern/FalsePatternLib.git
synced 2026-11-16 09:34:51 +00:00
Annotate all the things
This commit is contained in:
63 files changed
+623
-369
No files matched your search
@@ -42,10 +42,14 @@ public class Vec3i implements Comparable<Vec3i> {
|
||||
/**
|
||||
* A static zero vector
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public static final Vec3i NULL_VECTOR = new Vec3i(0, 0, 0);
|
||||
|
||||
@StableAPI.Expose
|
||||
protected final int x;
|
||||
@StableAPI.Expose
|
||||
protected final int y;
|
||||
@StableAPI.Expose
|
||||
protected final int z;
|
||||
|
||||
/**
|
||||
@@ -55,10 +59,12 @@ public class Vec3i implements Comparable<Vec3i> {
|
||||
* @param y the y
|
||||
* @param z the z
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public Vec3i(double x, double y, double z) {
|
||||
this(MathUtil.floor(x), MathUtil.floor(y), MathUtil.floor(z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@NonNull Vec3i vec) {
|
||||
return y == vec.getY() ? z == vec.getZ() ? x - vec.getX() : z - vec.getZ() : y - vec.getY();
|
||||
}
|
||||
@@ -70,6 +76,7 @@ public class Vec3i implements Comparable<Vec3i> {
|
||||
*
|
||||
* @return the new resulting vector
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public Vec3i crossProduct(@NonNull Vec3i vec) {
|
||||
return new Vec3i(y * vec.getZ() - z * vec.getY(), z * vec.getX() - x * vec.getZ(),
|
||||
x * vec.getY() - y * vec.getX());
|
||||
@@ -84,6 +91,7 @@ public class Vec3i implements Comparable<Vec3i> {
|
||||
*
|
||||
* @return the distance
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public double getDistance(int x, int y, int z) {
|
||||
return Math.sqrt(distanceSq(x, y, z));
|
||||
}
|
||||
@@ -97,6 +105,7 @@ public class Vec3i implements Comparable<Vec3i> {
|
||||
*
|
||||
* @return the square distance
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public double distanceSq(int x, int y, int z) {
|
||||
val dX = this.x - x;
|
||||
val dY = this.y - y;
|
||||
@@ -111,6 +120,7 @@ public class Vec3i implements Comparable<Vec3i> {
|
||||
*
|
||||
* @return the square distance
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public double distanceSq(@NonNull Vec3i vec) {
|
||||
return distanceSq(vec.getX(), vec.getY(), vec.getZ());
|
||||
}
|
||||
@@ -124,6 +134,7 @@ public class Vec3i implements Comparable<Vec3i> {
|
||||
*
|
||||
* @return the square distance to center
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public double distanceSqToCenter(double x, double y, double z) {
|
||||
val dX = this.x + 0.5D - x;
|
||||
val dY = this.y + 0.5D - y;
|
||||
|
||||
Reference in new issue
Block a user