Skip to content

Commit

Permalink
add test distance and azimut for named point with known values
Browse files Browse the repository at this point in the history
  • Loading branch information
ELePors committed Oct 16, 2024
1 parent 2e7d3c7 commit 2c68a7d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
27 changes: 27 additions & 0 deletions GeoTools-Tests/AbsoluteCoordinatesTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"
An AbsoluteCoordinatesTest is a test class for testing the behavior of AbsoluteCoordinates
"
Class {
#name : #AbsoluteCoordinatesTest,
#superclass : #TestCase,
#category : #'GeoTools-Tests-Coordinates'
}

{ #category : #tests }
AbsoluteCoordinatesTest >> testDistanceBetweenKnownAbsoluteCoordinates [

| pt1 pt2 dist az |
pt1 := AbsoluteCoordinates frBrest.
pt2 := AbsoluteCoordinates frStRenan.

dist := GeodesicUtilities
convertGeodesicToDistanceInMeterFrom: pt1
to: pt2.
az := GeodesicUtilities
convertGeodesicToAzimuthInRadiansFrom: pt1
to: pt2.
az := az radiansToDegrees.
self assert: (az - 295) abs < 5 .
self assert: (dist - 11500) abs < 1000 .

]
9 changes: 9 additions & 0 deletions GeoTools/AbsoluteCoordinates.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ AbsoluteCoordinates class >> frParis [
altitudeInMeters: 79
]

{ #category : #'instance creation' }
AbsoluteCoordinates class >> frStRenan [

^ AbsoluteCoordinates
latitudeInDegrees: 48.4328
longitudeInDegrees: -4.6219
altitudeInMeters: 60
]

{ #category : #'instance creation' }
AbsoluteCoordinates class >> latitudeInDegrees: aLatitudeInDegrees longitudeInDegrees: aLongitudeInDegrees [

Expand Down

0 comments on commit 2c68a7d

Please sign in to comment.