Tests for curve calculation

This commit is contained in:
Alexander Nozik 2022-08-29 18:37:42 +03:00
parent 4614b1f7bc
commit e0cc0bc60b
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
2 changed files with 12 additions and 2 deletions

View File

@ -88,6 +88,7 @@ public fun GeoEllipsoid.parallelCurve(latitude: Angle, fromLongitude: Angle, toL
* @param start starting location * @param start starting location
* @return solution to the direct geodetic problem * @return solution to the direct geodetic problem
*/ */
@Suppress("SpellCheckingInspection", "LocalVariableName")
public fun GeoEllipsoid.curveInDirection( public fun GeoEllipsoid.curveInDirection(
start: GmcPose, start: GmcPose,
distance: Distance, distance: Distance,
@ -210,6 +211,7 @@ public fun GeoEllipsoid.curveInDirection(
* @param end ending coordinates * @param end ending coordinates
* @return solution to the inverse geodetic problem * @return solution to the inverse geodetic problem
*/ */
@Suppress("SpellCheckingInspection", "LocalVariableName")
public fun GeoEllipsoid.curveBetween(start: GMC, end: GMC, precision: Double = 1e-6): GmcCurve { public fun GeoEllipsoid.curveBetween(start: GMC, end: GMC, precision: Double = 1e-6): GmcCurve {
// //
// All equation numbers refer back to Vincenty's publication: // All equation numbers refer back to Vincenty's publication:

View File

@ -27,11 +27,19 @@ internal class DistanceTest {
} }
@Test @Test
fun largeDistance() { fun curveBetween() {
val curve = GeoEllipsoid.WGS84.curveBetween(moscow, spb) val curve = GeoEllipsoid.WGS84.curveBetween(moscow, spb)
val distance = curve.distance 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)
} }
} }