Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
- semi, array-bracket-spacing, no-loss-of-precision
  • Loading branch information
chrisveness committed Oct 23, 2021
1 parent 18bbafc commit 70e7b15
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions latlon-nvector-spherical.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const π = Math.PI;
* Note that these formulations take x => 0°N,0°E, y => 0°N,90°E, z => 90°N; Gade uses x => 90°N,
* y => 0°N,90°E, z => 0°N,0°E.
*
* Note also that on a spherical model earth, an n-vector is equivalent to a normalised version of
* Note also that on a spherical model earth, an n-vector is equivalent to a normalised version of
* an (ECEF) cartesian coordinate.
*
* @module latlon-nvector-spherical
Expand Down Expand Up @@ -710,8 +710,8 @@ class LatLonNvectorSpherical {
// will sum to less than 360° (due to spherical excess), exterior point angles will be small
// but non-zero. TODO: are any winding number optimisations applicable to spherical surface?

if (!(polygon instanceof Array)) throw new TypeError(`isEnclosedBy: polygon must be Array (not ${classOf(polygon)})`)
if (!(polygon[0] instanceof LatLonNvectorSpherical)) throw new TypeError(`isEnclosedBy: polygon must be Array of LatLon (not ${classOf(polygon[0])})`)
if (!(polygon instanceof Array)) throw new TypeError(`isEnclosedBy: polygon must be Array (not ${classOf(polygon)})`);
if (!(polygon[0] instanceof LatLonNvectorSpherical)) throw new TypeError(`isEnclosedBy: polygon must be Array of LatLon (not ${classOf(polygon[0])})`);
if (polygon.length < 3) return false; // or throw?

// close the polygon so that the last point equals the first point
Expand Down
2 changes: 1 addition & 1 deletion test/latlon-nvector-spherical-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ describe('latlon-nvector-spherical', function() {
test('concave enclosed n', () => new LatLon(2, 2).isEnclosedBy(polyConcave).should.be.false);
test('enclosed (fail 1)', () => should.Throw(function() { new LatLon(1, 1).isEnclosedBy('a string'); }, TypeError, 'isEnclosedBy: polygon must be Array (not String)'));
test('enclosed (fail 2)', () => should.Throw(function() { new LatLon(1, 1).isEnclosedBy([ 'a string' ]); }, TypeError, 'isEnclosedBy: polygon must be Array of LatLon (not String)'));
test('enclosed by line', () => new LatLon(1, 1).isEnclosedBy([new LatLon(1, 1), new LatLon(2, 2) ]).should.be.false);
test('enclosed by line', () => new LatLon(1, 1).isEnclosedBy([ new LatLon(1, 1), new LatLon(2, 2) ]).should.be.false);
});

describe('Ed Williams', function() { // www.edwilliams.org/avform.htm
Expand Down
2 changes: 1 addition & 1 deletion test/latlon-spherical-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ describe('latlon-spherical', function() {
test('int’n (fail 3)', () => should.Throw(function() { LatLon.intersection(stn, 'n', cdg, 's'); }, TypeError, 'invalid brng1 ‘n’'));
test('int’n (fail 4)', () => should.Throw(function() { LatLon.intersection(stn, 0, cdg, 's'); }, TypeError, 'invalid brng2 ‘s’'));
test('rounding errors', () => LatLon.intersection(new LatLon(51, 0), 120, new LatLon(50, 0), 60).toString().should.equal('50.4921°N, 001.3612°E'));
test('rounding: φ3 requires clamp #71', () => LatLon.intersection(new LatLon(-77.6966041375563, 18.2812500000000), 179.99999999999995, new LatLon(89, 180), 180).toString().should.equal('90.0000°S, 163.9902°W'));
test('rounding: φ3 requires clamp #71', () => LatLon.intersection(new LatLon(-77.6966041375563, 18.2812500000000), 179.99999999999994, new LatLon(89, 180), 180).toString().should.equal('90.0000°S, 163.9902°W'));
});

describe('cross-track / along-track', function() {
Expand Down

0 comments on commit 70e7b15

Please sign in to comment.