summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt
index 6d55a9185..f973a4e6a 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt
@@ -20,6 +20,8 @@ data class LorenzVec(
fun toVec3(): Vec3 = Vec3(x, y, z)
+ fun distanceIgnoreY(other: LorenzVec): Double = distanceIgnoreYSq(other).pow(0.5)
+
fun distance(other: LorenzVec): Double = distanceSq(other).pow(0.5)
fun distanceSq(x: Double, y: Double, z: Double): Double = distanceSq(LorenzVec(x, y, z))
@@ -33,6 +35,12 @@ data class LorenzVec(
return (dx * dx + dy * dy + dz * dz)
}
+ fun distanceIgnoreYSq(other: LorenzVec): Double {
+ val dx = (other.x - x)
+ val dz = (other.z - z)
+ return (dx * dx + dz * dz)
+ }
+
fun add(x: Double, y: Double, z: Double): LorenzVec = LorenzVec(this.x + x, this.y + y, this.z + z)
fun add(x: Int, y: Int, z: Int): LorenzVec = LorenzVec(this.x + x, this.y + y, this.z + z)