Skip to content

Commit

Permalink
rollback to old translate
Browse files Browse the repository at this point in the history
  • Loading branch information
jillesvangurp committed Jan 9, 2024
1 parent ba77f68 commit 2054746
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 72 deletions.
24 changes: 5 additions & 19 deletions src/commonMain/kotlin/com/jillesvangurp/geo/GeoGeometry.kt
Original file line number Diff line number Diff line change
Expand Up @@ -509,26 +509,12 @@ class GeoGeometry {
fun translate(
latitude: Double,
longitude: Double,
dy: Double,
dx: Double
latitudalMeters: Double,
longitudalMeters: Double
): DoubleArray {
val earthRadius = 6378137.0 // Earth's radius in meters

// Convert latitude and longitude to radians
val latRadians = toRadians(latitude)
val lonRadians = toRadians(longitude)

// Calculate the new latitude in radians
val newLatRadians = latRadians + dy / earthRadius

// Calculate the new longitude in radians
val newLonRadians = lonRadians + dx / (earthRadius * cos(latRadians))

// Convert the new latitude and longitude back to degrees
val newLatitude = fromRadians(newLatRadians)
val newLongitude = fromRadians(newLonRadians)

return doubleArrayOf(newLongitude, newLatitude)
validate(latitude, longitude, false)
val longitudal = translateLongitude(latitude, longitude, longitudalMeters)
return translateLatitude(longitudal.latitude, longitudal.longitude, latitudalMeters)
}

fun translate(
Expand Down
53 changes: 0 additions & 53 deletions src/commonMain/kotlin/com/jillesvangurp/geo/math.kt

This file was deleted.

0 comments on commit 2054746

Please sign in to comment.