diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-11-17 19:55:02 +0100 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-11-17 19:55:02 +0100 |
| commit | c93a04a001b0f66b2724d46b04b6d1ed49a08d07 (patch) | |
| tree | 5869ca70acc482ef0362f27785c3d3f1cbb9ffae /src/main/kotlin/util/math | |
| parent | af9893b59407c69d31ebd2ed513f0396ab4d2dc9 (diff) | |
| download | Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.gz Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.bz2 Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.zip | |
refactor: port to mojmaps
Diffstat (limited to 'src/main/kotlin/util/math')
| -rw-r--r-- | src/main/kotlin/util/math/Projections.kt | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/kotlin/util/math/Projections.kt b/src/main/kotlin/util/math/Projections.kt index 359b21b..9e9f844 100644 --- a/src/main/kotlin/util/math/Projections.kt +++ b/src/main/kotlin/util/math/Projections.kt @@ -3,7 +3,7 @@ package moe.nea.firmament.util.math import kotlin.math.absoluteValue import kotlin.math.cos import kotlin.math.sin -import net.minecraft.util.math.Vec2f +import net.minecraft.world.phys.Vec2 import moe.nea.firmament.util.render.wrapAngle object Projections { @@ -14,14 +14,14 @@ object Projections { fun isNullish(float: Float) = float.absoluteValue < ε - fun xInterceptOfLine(origin: Vec2f, direction: Vec2f): Vec2f? { + fun xInterceptOfLine(origin: Vec2, direction: Vec2): Vec2? { if (isNullish(direction.x)) - return Vec2f(origin.x, 0F) + return Vec2(origin.x, 0F) if (isNullish(direction.y)) return null val slope = direction.y / direction.x - return Vec2f(origin.x - origin.y / slope, 0F) + return Vec2(origin.x - origin.y / slope, 0F) } fun interceptAlongCardinal(distanceFromAxis: Float, slope: Float): Float? { @@ -30,7 +30,7 @@ object Projections { return -distanceFromAxis / slope } - fun projectAngleOntoUnitBox(angleRadians: Double): Vec2f { + fun projectAngleOntoUnitBox(angleRadians: Double): Vec2 { val angleRadians = wrapAngle(angleRadians) val cx = cos(angleRadians) val cy = sin(angleRadians) @@ -40,7 +40,7 @@ object Projections { val e = minOf(ex, ey) - return Vec2f((cx * e).toFloat(), (cy * e).toFloat()) + return Vec2((cx * e).toFloat(), (cy * e).toFloat()) } } } |
