From e0cc0bc60b72a134251b870d3022e1ecfae47773 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 29 Aug 2022 18:37:42 +0300 Subject: [PATCH] Tests for curve calculation --- .../center/sciprog/maps/coordinates/GmcCurve.kt | 2 ++ .../center/sciprog/maps/coordinates/DistanceTest.kt | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/maps-kt-core/src/commonMain/kotlin/center/sciprog/maps/coordinates/GmcCurve.kt b/maps-kt-core/src/commonMain/kotlin/center/sciprog/maps/coordinates/GmcCurve.kt index c13f51e..d528831 100644 --- a/maps-kt-core/src/commonMain/kotlin/center/sciprog/maps/coordinates/GmcCurve.kt +++ b/maps-kt-core/src/commonMain/kotlin/center/sciprog/maps/coordinates/GmcCurve.kt @@ -88,6 +88,7 @@ public fun GeoEllipsoid.parallelCurve(latitude: Angle, fromLongitude: Angle, toL * @param start starting location * @return solution to the direct geodetic problem */ +@Suppress("SpellCheckingInspection", "LocalVariableName") public fun GeoEllipsoid.curveInDirection( start: GmcPose, distance: Distance, @@ -210,6 +211,7 @@ public fun GeoEllipsoid.curveInDirection( * @param end ending coordinates * @return solution to the inverse geodetic problem */ +@Suppress("SpellCheckingInspection", "LocalVariableName") public fun GeoEllipsoid.curveBetween(start: GMC, end: GMC, precision: Double = 1e-6): GmcCurve { // // All equation numbers refer back to Vincenty's publication: diff --git a/maps-kt-core/src/commonTest/kotlin/center/sciprog/maps/coordinates/DistanceTest.kt b/maps-kt-core/src/commonTest/kotlin/center/sciprog/maps/coordinates/DistanceTest.kt index 2e5cf03..1a8a561 100644 --- a/maps-kt-core/src/commonTest/kotlin/center/sciprog/maps/coordinates/DistanceTest.kt +++ b/maps-kt-core/src/commonTest/kotlin/center/sciprog/maps/coordinates/DistanceTest.kt @@ -27,11 +27,19 @@ internal class DistanceTest { } @Test - fun largeDistance() { + fun curveBetween() { val curve = GeoEllipsoid.WGS84.curveBetween(moscow, spb) val distance = curve.distance - assertEquals(632.035426877, distance.kilometers, 0.1) + assertEquals(632.035426877, distance.kilometers, 0.0001) + } + @Test + fun curveInDirection() { + val curve = GeoEllipsoid.WGS84.curveInDirection( + GmcPose(moscow, (-0.6947937116552751).radians), Distance(632.035426877) + ) + + assertEquals(spb.latitude.radians.value,curve.backward.latitude.radians.value, 0.0001) } } \ No newline at end of file