From 3852be0d7edeb3e136c29b5eced23f49657c8503 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 23 Aug 2015 11:50:00 -0600 Subject: [PATCH] Remove unused sphere.initialBearing() method --- src/ol/sphere/sphere.js | 18 ------------------ test/spec/ol/sphere/sphere.test.js | 28 ---------------------------- 2 files changed, 46 deletions(-) diff --git a/src/ol/sphere/sphere.js b/src/ol/sphere/sphere.js index 662f56fd83..7bbd2a4a3e 100644 --- a/src/ol/sphere/sphere.js +++ b/src/ol/sphere/sphere.js @@ -126,24 +126,6 @@ ol.Sphere.prototype.interpolate = function(c1, c2, fraction) { }; -/** - * Returns the initial bearing from c1 to c2. - * - * @param {ol.Coordinate} c1 Coordinate 1. - * @param {ol.Coordinate} c2 Coordinate 2. - * @return {number} Initial bearing. - */ -ol.Sphere.prototype.initialBearing = function(c1, c2) { - var lat1 = goog.math.toRadians(c1[1]); - var lat2 = goog.math.toRadians(c2[1]); - var deltaLon = goog.math.toRadians(c2[0] - c1[0]); - var y = Math.sin(deltaLon) * Math.cos(lat2); - var x = Math.cos(lat1) * Math.sin(lat2) - - Math.sin(lat1) * Math.cos(lat2) * Math.cos(deltaLon); - return goog.math.toDegrees(Math.atan2(y, x)); -}; - - /** * Returns the maximum latitude of the great circle defined by bearing and * latitude. diff --git a/test/spec/ol/sphere/sphere.test.js b/test/spec/ol/sphere/sphere.test.js index 8b89ab85cf..7b97f870ec 100644 --- a/test/spec/ol/sphere/sphere.test.js +++ b/test/spec/ol/sphere/sphere.test.js @@ -13,105 +13,90 @@ describe('ol.Sphere', function() { c1: [0, 0], c2: [0, 0], haversineDistance: 0, - initialBearing: 0, midpoint: [0, 0] }, { c1: [0, 0], c2: [45, 45], haversineDistance: 6671.695598673525, - initialBearing: 35.264389682754654, midpoint: [18.434948822922006, 24.0948425521107] }, { c1: [0, 0], c2: [-45, 45], haversineDistance: 6671.695598673525, - initialBearing: -35.264389682754654, midpoint: [-18.434948822922006, 24.0948425521107] }, { c1: [0, 0], c2: [-45, -45], haversineDistance: 6671.695598673525, - initialBearing: -144.73561031724535, midpoint: [-18.434948822922006, -24.0948425521107] }, { c1: [0, 0], c2: [45, -45], haversineDistance: 6671.695598673525, - initialBearing: 144.73561031724535, midpoint: [18.434948822922006, -24.0948425521107] }, { c1: [45, 45], c2: [45, 45], haversineDistance: 0, - initialBearing: 0, midpoint: [45.00000000000005, 45] }, { c1: [45, 45], c2: [-45, 45], haversineDistance: 6671.695598673525, - initialBearing: -54.73561031724535, midpoint: [0, 54.735610317245346] }, { c1: [45, 45], c2: [-45, -45], haversineDistance: 13343.391197347048, - initialBearing: -125.26438968275465, midpoint: [0, 0] }, { c1: [45, 45], c2: [45, -45], haversineDistance: 10007.543398010286, - initialBearing: 180, midpoint: [45.00000000000005, 0] }, { c1: [-45, 45], c2: [-45, 45], haversineDistance: 0, - initialBearing: 0, midpoint: [-45.00000000000005, 45] }, { c1: [-45, 45], c2: [-45, -45], haversineDistance: 10007.543398010286, - initialBearing: 180, midpoint: [-45.00000000000005, 0] }, { c1: [-45, 45], c2: [45, -45], haversineDistance: 13343.391197347048, - initialBearing: 125.26438968275465, midpoint: [0, 0] }, { c1: [-45, -45], c2: [-45, -45], haversineDistance: 0, - initialBearing: 0, midpoint: [-45.00000000000005, -45] }, { c1: [-45, -45], c2: [45, -45], haversineDistance: 6671.695598673525, - initialBearing: 125.26438968275465, midpoint: [0, -54.735610317245346] }, { c1: [45, -45], c2: [45, -45], haversineDistance: 0, - initialBearing: 0, midpoint: [45.00000000000005, -45] } ]; @@ -129,19 +114,6 @@ describe('ol.Sphere', function() { }); - describe('initialBearing', function() { - - it('results match Chris Veness\'s reference implementation', function() { - var e, i; - for (i = 0; i < expected.length; ++i) { - e = expected[i]; - expect(sphere.initialBearing(e.c1, e.c2)).to.roughlyEqual( - e.initialBearing, 1e-9); - } - }); - - }); - describe('interpolate', function() { it('results match at the start, midpoint, and end', function() {