From ba89091207331b588d727685ca3949fcb9063b07 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 27 Feb 2023 01:55:21 +0100 Subject: Highlight new visitor NPCs. --- src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/main/java/at/hannibal2/skyhanni/utils') 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) -- cgit