Merge branch 'master' into master

This commit is contained in:
Kevin Hester 2021-03-19 15:00:49 +08:00 committed by GitHub
commit 3ab9ee4afc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 126 additions and 27 deletions

View file

@ -1,5 +1,6 @@
package com.geeksville.mesh.ui
import com.geeksville.mesh.MeshProtos
import kotlin.math.cos
import kotlin.math.sin
@ -124,6 +125,14 @@ fun latLongToMeter(
return 6366000 * tt
}
// Same as above, but takes Mesh Position proto.
fun positionToMeter(a: MeshProtos.Position, b: MeshProtos.Position): Double {
return latLongToMeter(
a.latitudeI * 1e-7,
a.longitudeI * 1e-7,
b.latitudeI * 1e-7,
b.longitudeI * 1e-7)
}
/**
* Convert degrees/mins/secs to a single double
*
@ -186,4 +195,4 @@ fun bearing(
*/
fun radToBearing(rad: Double): Double {
return (Math.toDegrees(rad) + 360) % 360
}
}