Remove unused sphere.initialBearing() method

This commit is contained in:
Tim Schaub
2015-08-23 11:50:00 -06:00
parent daa4781072
commit 3852be0d7e
2 changed files with 0 additions and 46 deletions

View File

@@ -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.

View File

@@ -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() {