fix: incorrect macro wheel for two items because of angle lerp near π / 2 defaulting the wrong way
This commit is contained in:
@@ -73,7 +73,7 @@ jarvis = "1.1.4"
|
|||||||
nealisp = "1.1.0"
|
nealisp = "1.1.0"
|
||||||
|
|
||||||
# Update from https://github.com/NotEnoughUpdates/MoulConfig/tags
|
# Update from https://github.com/NotEnoughUpdates/MoulConfig/tags
|
||||||
moulconfig = "4.0.0-beta"
|
moulconfig = "4.0.1-beta"
|
||||||
|
|
||||||
# Update from https://repo.nea.moe/#/releases/moe/nea/mc-auto-translations/moe.nea.mc-auto-translations.gradle.plugin
|
# Update from https://repo.nea.moe/#/releases/moe/nea/mc-auto-translations/moe.nea.mc-auto-translations.gradle.plugin
|
||||||
mcAutoTranslations = "0.3.0"
|
mcAutoTranslations = "0.3.0"
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
package moe.nea.firmament.util.render
|
package moe.nea.firmament.util.render
|
||||||
|
|
||||||
import me.shedaniel.math.Color
|
import me.shedaniel.math.Color
|
||||||
|
import kotlin.math.absoluteValue
|
||||||
|
|
||||||
val π = Math.PI
|
val π = Math.PI
|
||||||
val τ = Math.PI * 2
|
val τ = Math.PI * 2
|
||||||
fun lerpAngle(a: Float, b: Float, progress: Float): Float {
|
fun lerpAngle(a: Float, b: Float, progress: Float): Float {
|
||||||
// TODO: there is at least 10 mods to many in here lol
|
// TODO: there is at least 10 mods to many in here lol
|
||||||
|
if (((b - a).absoluteValue - π).absoluteValue < 0.0001) {
|
||||||
|
return lerp(a, b, progress)
|
||||||
|
}
|
||||||
val shortestAngle = ((((b.mod(τ) - a.mod(τ)).mod(τ)) + τ + π).mod(τ)) - π
|
val shortestAngle = ((((b.mod(τ) - a.mod(τ)).mod(τ)) + τ + π).mod(τ)) - π
|
||||||
return ((a + (shortestAngle) * progress).mod(τ)).toFloat()
|
return ((a + (shortestAngle) * progress).mod(τ)).toFloat()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user