diff --git a/src/Core/Geographic/Coordinates.js b/src/Core/Geographic/Coordinates.js index 70ad97ff5f..d445915ad9 100644 --- a/src/Core/Geographic/Coordinates.js +++ b/src/Core/Geographic/Coordinates.js @@ -218,17 +218,17 @@ class Coordinates { } /** - * Calculate geodesic distance between this coordinates and `coord`. - * **Geodesic distance** is calculated in an ellispoid space as the distance + * Calculate geodetic distance between this coordinates and `coord`. + * **Geodetic distance** is calculated in an ellispoid space as the shortest distance * across the curved surface of the world. * * => As the crow flies/ Orthodromy * * @param {Coordinates} coord The coordinate - * @return {number} geodesic distance + * @return {number} geodetic distance * */ - geodesicDistanceTo(coord) { + geodeticDistanceTo(coord) { this.as('EPSG:4326', coord0); coord.as('EPSG:4326', coord1); return ellipsoid.geodesicDistance(coord0, coord1); @@ -241,7 +241,7 @@ class Coordinates { * @return {number} earth euclidean distance * */ - earthEuclideanDistanceTo(coord) { + spatialEuclideanDistanceTo(coord) { this.as('EPSG:4978', coord0).toVector3(v0); coord.as('EPSG:4978', coord1).toVector3(v1); return v0.distanceTo(v1); diff --git a/src/Core/Geographic/Extent.js b/src/Core/Geographic/Extent.js index 9ba2f1ce89..b4e8ca14de 100644 --- a/src/Core/Geographic/Extent.js +++ b/src/Core/Geographic/Extent.js @@ -258,7 +258,7 @@ class Extent { * @return {THREE.Vector2} */ dimensions(target = new THREE.Vector2()) { - console.warn('Extent.dimensions is deprecated, use planarDimensions, geodesicDimensions or geodesicChordDimensions'); + console.warn('Extent.dimensions is deprecated, use planarDimensions, geodeticDimensions or spatialEuclideanDimensions'); target.x = Math.abs(this.east - this.west); target.y = Math.abs(this.north - this.south); return target; @@ -277,14 +277,14 @@ class Extent { } /** - * Geodesic dimensions are two planar distances west/east and south/north. - * Geodesic distance is calculated in an ellispoid space as the distance + * Geodetic dimensions are two planar distances west/east and south/north. + * Geodetic distance is calculated in an ellispoid space as the distance * across the curved surface of the world. * * @param {THREE.Vector2} [target=new THREE.Vector2()] The target - * @return {THREE.Vector2} Planar dimensions + * @return {THREE.Vector2} geodetic dimensions */ - geodesicDimensions(target = new THREE.Vector2()) { + geodeticDimensions(target = new THREE.Vector2()) { // set 3 corners extent cNorthWest.crs = this.crs; cSouthWest.crs = this.crs; @@ -294,18 +294,18 @@ class Extent { cSouthWest.setFromValues(this.west, this.south, 0); cNorthEast.setFromValues(this.east, this.north, 0); - // calcul geodesic distance northWest/northEast and northWest/southWest - return target.set(cNorthWest.geodesicDistanceTo(cNorthEast), cNorthWest.geodesicDistanceTo(cSouthWest)); + // calcul geodetic distance northWest/northEast and northWest/southWest + return target.set(cNorthWest.geodeticDistanceTo(cNorthEast), cNorthWest.geodeticDistanceTo(cSouthWest)); } /** - * Earth euclidean dimensions are two earth euclidean distances between west/east and south/north. - * Earth euclidean distance chord is calculated in a ellispoid space. + * Spatial euclidean dimensions are two spatial euclidean distances between west/east corner and south/north corner. + * Spatial euclidean distance chord is calculated in a ellispoid space. * * @param {THREE.Vector2} [target=new THREE.Vector2()] The target - * @return {THREE.Vector2} Earth euclidean dimensions + * @return {THREE.Vector2} spatial euclidean dimensions */ - earthEuclideanDimensions(target = new THREE.Vector2()) { + spatialEuclideanDimensions(target = new THREE.Vector2()) { // set 3 corners extent cNorthWest.crs = this.crs; cSouthWest.crs = this.crs; @@ -316,7 +316,7 @@ class Extent { cNorthEast.setFromValues(this.east, this.north, 0); // calcul chord distance northWest/northEast and northWest/southWest - return target.set(cNorthWest.earthEuclideanDistanceTo(cNorthEast), cNorthWest.earthEuclideanDistanceTo(cSouthWest)); + return target.set(cNorthWest.spatialEuclideanDistanceTo(cNorthEast), cNorthWest.spatialEuclideanDistanceTo(cSouthWest)); } /** diff --git a/test/unit/coordinate.js b/test/unit/coordinate.js index 77f965a1dc..035f9515f9 100644 --- a/test/unit/coordinate.js +++ b/test/unit/coordinate.js @@ -112,17 +112,17 @@ describe('Coordinates', function () { const coord0 = new Coordinates('EPSG:4326', 0, 45, 0); const coord1 = new Coordinates('EPSG:4326', 1.83421, 46.2579066, 0); - const distance = coord0.geodesicDistanceTo(coord1) / 1000; + const distance = coord0.geodeticDistanceTo(coord1) / 1000; assert.ok(Math.abs(distance - 200) < 0.01); - assert.equal(distance, coord1.geodesicDistanceTo(coord0) / 1000); + assert.equal(distance, coord1.geodeticDistanceTo(coord0) / 1000); }); it('should correctly return earth euclidean distance to other coordinates', function () { const coord0 = new Coordinates('EPSG:4326', 0, 45, 0); const coord1 = new Coordinates('EPSG:4326', 1.83421, 46.2579066, 0); - const distance = coord0.earthEuclideanDistanceTo(coord1); + const distance = coord0.spatialEuclideanDistanceTo(coord1); assert.equal(distance, 199991.80319097277); - assert.equal(distance, coord1.earthEuclideanDistanceTo(coord0)); + assert.equal(distance, coord1.spatialEuclideanDistanceTo(coord0)); }); }); diff --git a/test/unit/extent.js b/test/unit/extent.js index 2468cc032f..c95d7fe2a4 100644 --- a/test/unit/extent.js +++ b/test/unit/extent.js @@ -120,7 +120,7 @@ describe('Extent', function () { const extent = new Extent('EPSG:4326', 3, 3.01, 46, 46.01); const dimensions = new Vector2(); - extent.earthEuclideanDimensions(dimensions); + extent.spatialEuclideanDimensions(dimensions); assert.equal(dimensions.x, 774.4934293643765); assert.equal(dimensions.y, 1111.5141604285038); }); @@ -129,7 +129,7 @@ describe('Extent', function () { const extent = new Extent('EPSG:4326', 3, 3.01, 46, 46.01); const dimensions = new Vector2(); - extent.geodesicDimensions(dimensions); + extent.geodeticDimensions(dimensions); assert.equal(dimensions.x, 773.2375602074535); assert.equal(dimensions.y, 1113.3197697640906); });