summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-27 01:55:21 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-27 01:55:21 +0100
commitba89091207331b588d727685ca3949fcb9063b07 (patch)
tree6375d96b73e5eb95e6ead22c0017495f5a1fd6ea /src/main/java/at/hannibal2/skyhanni/utils
parent9bb15c6cb1003b40dda07f14bf3abbe50652cb1d (diff)
downloadskyhanni-ba89091207331b588d727685ca3949fcb9063b07.tar.gz
skyhanni-ba89091207331b588d727685ca3949fcb9063b07.tar.bz2
skyhanni-ba89091207331b588d727685ca3949fcb9063b07.zip
Highlight new visitor NPCs.
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)