Added minor fixes to resources and build scripts

This commit is contained in:
Arty Bishop committed 2025-12-27 15:01:45 +00:00
1 parent 7191e02f99
commit 5a8108384f
27 files changed
+45 -101

No files matched your search

@@ -1,12 +1,9 @@
package com.rtbishop.look4sat.domain.utility
import com.rtbishop.look4sat.domain.predict.DEG2RAD
import com.rtbishop.look4sat.domain.predict.PI
import com.rtbishop.look4sat.domain.predict.RAD2DEG
import kotlin.math.ln
import kotlin.math.max
import kotlin.math.min
import kotlin.math.sin
private const val MIN_LATITUDE = -85.05112877980658
private const val MAX_LATITUDE = 85.05112877980658
@@ -17,14 +14,14 @@ fun Double.toDegrees(): Double = this * RAD2DEG
fun Double.toRadians(): Double = this * DEG2RAD
fun Double.latToY01(): Double {
val sinus = sin(clipLat(this) * PI / MAX_LONGITUDE)
return 0.5 - ln((1 + sinus) / (1 - sinus)) / (4 * PI)
}
//fun Double.latToY01(): Double {
// val sinus = sin(clipLat(this) * PI / MAX_LONGITUDE)
// return 0.5 - ln((1 + sinus) / (1 - sinus)) / (4 * PI)
//}
fun Double.lonToX01(): Double {
return (clipLon(this) - MIN_LONGITUDE) / (MAX_LONGITUDE - MIN_LONGITUDE)
}
//fun Double.lonToX01(): Double {
// return (clipLon(this) - MIN_LONGITUDE) / (MAX_LONGITUDE - MIN_LONGITUDE)
//}
//fun Double.y01ToLat(): Double {
// return 90 - 360 * atan(exp((this - 0.5) * 2 * PI)) / PI
@@ -34,11 +31,11 @@ fun Double.lonToX01(): Double {
// return MIN_LONGITUDE + (MAX_LONGITUDE - MIN_LONGITUDE) * this
//}
private fun clipLat(latitude: Double): Double {
fun clipLat(latitude: Double): Double {
return clip(latitude, MIN_LATITUDE, MAX_LATITUDE)
}
private fun clipLon(longitude: Double): Double {
fun clipLon(longitude: Double): Double {
var result = longitude
while (result < MIN_LONGITUDE) result += 360.0
while (result > MAX_LONGITUDE) result -= 360.0