Skip to content

Commit 2c68a7d

Browse files
committed
add test distance and azimut for named point with known values
1 parent 2e7d3c7 commit 2c68a7d

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"
2+
An AbsoluteCoordinatesTest is a test class for testing the behavior of AbsoluteCoordinates
3+
"
4+
Class {
5+
#name : #AbsoluteCoordinatesTest,
6+
#superclass : #TestCase,
7+
#category : #'GeoTools-Tests-Coordinates'
8+
}
9+
10+
{ #category : #tests }
11+
AbsoluteCoordinatesTest >> testDistanceBetweenKnownAbsoluteCoordinates [
12+
13+
| pt1 pt2 dist az |
14+
pt1 := AbsoluteCoordinates frBrest.
15+
pt2 := AbsoluteCoordinates frStRenan.
16+
17+
dist := GeodesicUtilities
18+
convertGeodesicToDistanceInMeterFrom: pt1
19+
to: pt2.
20+
az := GeodesicUtilities
21+
convertGeodesicToAzimuthInRadiansFrom: pt1
22+
to: pt2.
23+
az := az radiansToDegrees.
24+
self assert: (az - 295) abs < 5 .
25+
self assert: (dist - 11500) abs < 1000 .
26+
27+
]

GeoTools/AbsoluteCoordinates.class.st

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ AbsoluteCoordinates class >> frParis [
8484
altitudeInMeters: 79
8585
]
8686

87+
{ #category : #'instance creation' }
88+
AbsoluteCoordinates class >> frStRenan [
89+
90+
^ AbsoluteCoordinates
91+
latitudeInDegrees: 48.4328
92+
longitudeInDegrees: -4.6219
93+
altitudeInMeters: 60
94+
]
95+
8796
{ #category : #'instance creation' }
8897
AbsoluteCoordinates class >> latitudeInDegrees: aLatitudeInDegrees longitudeInDegrees: aLongitudeInDegrees [
8998

0 commit comments

Comments
 (0)