nodes2ts 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +102 -15
- package/dist/export.cjs +5331 -0
- package/dist/export.cjs.map +1 -0
- package/dist/export.d.cts +1838 -0
- package/dist/export.d.ts +1828 -20
- package/dist/export.js +5280 -62
- package/dist/export.js.map +1 -1
- package/package.json +34 -55
- package/.eslintignore +0 -3
- package/.eslintrc.cjs +0 -11
- package/.github/workflows/lint.js.yml +0 -22
- package/.github/workflows/node.js.yml +0 -22
- package/.mocharc.js +0 -7
- package/dist/Interval.d.ts +0 -24
- package/dist/Interval.js +0 -23
- package/dist/Interval.js.map +0 -1
- package/dist/MutableInteger.d.ts +0 -4
- package/dist/MutableInteger.js +0 -10
- package/dist/MutableInteger.js.map +0 -1
- package/dist/Platform.d.ts +0 -15
- package/dist/Platform.js +0 -53
- package/dist/Platform.js.map +0 -1
- package/dist/R1Interval.d.ts +0 -76
- package/dist/R1Interval.js +0 -158
- package/dist/R1Interval.js.map +0 -1
- package/dist/R2Vector.d.ts +0 -34
- package/dist/R2Vector.js +0 -131
- package/dist/R2Vector.js.map +0 -1
- package/dist/S1Angle.d.ts +0 -60
- package/dist/S1Angle.js +0 -133
- package/dist/S1Angle.js.map +0 -1
- package/dist/S1ChordAngle.d.ts +0 -166
- package/dist/S1ChordAngle.js +0 -318
- package/dist/S1ChordAngle.js.map +0 -1
- package/dist/S1Interval.d.ts +0 -109
- package/dist/S1Interval.js +0 -398
- package/dist/S1Interval.js.map +0 -1
- package/dist/S2.d.ts +0 -96
- package/dist/S2.js +0 -231
- package/dist/S2.js.map +0 -1
- package/dist/S2Cap.d.ts +0 -122
- package/dist/S2Cap.js +0 -399
- package/dist/S2Cap.js.map +0 -1
- package/dist/S2Cell.d.ts +0 -106
- package/dist/S2Cell.js +0 -358
- package/dist/S2Cell.js.map +0 -1
- package/dist/S2CellId.d.ts +0 -290
- package/dist/S2CellId.js +0 -983
- package/dist/S2CellId.js.map +0 -1
- package/dist/S2CellUnion.d.ts +0 -179
- package/dist/S2CellUnion.js +0 -523
- package/dist/S2CellUnion.js.map +0 -1
- package/dist/S2EdgeUtil.d.ts +0 -17
- package/dist/S2EdgeUtil.js +0 -785
- package/dist/S2EdgeUtil.js.map +0 -1
- package/dist/S2LatLng.d.ts +0 -77
- package/dist/S2LatLng.js +0 -186
- package/dist/S2LatLng.js.map +0 -1
- package/dist/S2LatLngRect.d.ts +0 -190
- package/dist/S2LatLngRect.js +0 -624
- package/dist/S2LatLngRect.js.map +0 -1
- package/dist/S2Metric.d.ts +0 -38
- package/dist/S2Metric.js +0 -79
- package/dist/S2Metric.js.map +0 -1
- package/dist/S2Point.d.ts +0 -78
- package/dist/S2Point.js +0 -250
- package/dist/S2Point.js.map +0 -1
- package/dist/S2Projections.d.ts +0 -102
- package/dist/S2Projections.js +0 -331
- package/dist/S2Projections.js.map +0 -1
- package/dist/S2Region.d.ts +0 -31
- package/dist/S2Region.js +0 -18
- package/dist/S2Region.js.map +0 -1
- package/dist/S2RegionCoverer.d.ts +0 -186
- package/dist/S2RegionCoverer.js +0 -471
- package/dist/S2RegionCoverer.js.map +0 -1
- package/dist/utils/preconditions.d.ts +0 -2
- package/dist/utils/preconditions.js +0 -16
- package/dist/utils/preconditions.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodes2ts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "a Typescript porting of the great S2 Geometry library from Google ",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/export.cjs",
|
|
7
|
+
"module": "./dist/export.js",
|
|
8
|
+
"types": "./dist/export.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/export.d.ts",
|
|
13
|
+
"default": "./dist/export.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/export.d.cts",
|
|
17
|
+
"default": "./dist/export.cjs"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
6
21
|
"homepage": "https://github.com/vekexasia/nodes2-ts",
|
|
7
22
|
"repository": {
|
|
8
23
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/vekexasia/nodes2-ts"
|
|
24
|
+
"url": "git+https://github.com/vekexasia/nodes2-ts.git"
|
|
10
25
|
},
|
|
11
26
|
"keywords": [
|
|
12
27
|
"s2",
|
|
@@ -15,66 +30,30 @@
|
|
|
15
30
|
"geohash"
|
|
16
31
|
],
|
|
17
32
|
"scripts": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"clean": "
|
|
24
|
-
"
|
|
25
|
-
"//postinstall": "npm run prepublish"
|
|
33
|
+
"build": "tsup",
|
|
34
|
+
"test": "vitest run",
|
|
35
|
+
"test:watch": "vitest",
|
|
36
|
+
"test:coverage": "vitest run --coverage",
|
|
37
|
+
"lint": "eslint src test",
|
|
38
|
+
"clean": "rm -rf dist",
|
|
39
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
26
40
|
},
|
|
27
|
-
"typings": "./dist/export.d.ts",
|
|
28
41
|
"author": {
|
|
29
42
|
"url": "http://www.andreabaccega.com/",
|
|
30
43
|
"email": "vekexasia@gmail.com",
|
|
31
44
|
"name": "Andrea Baccega"
|
|
32
45
|
},
|
|
33
46
|
"license": "MIT",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"math-float64-exponent": "^1.0.0"
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=20"
|
|
37
49
|
},
|
|
38
50
|
"devDependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"chai": "4.3.6",
|
|
47
|
-
"cross-env": "^7.0.3",
|
|
48
|
-
"eslint": "^8.17.0",
|
|
49
|
-
"gulp": "4.0.2",
|
|
50
|
-
"gulp-spawn-mocha": "6.0.0",
|
|
51
|
-
"gulp-watch": "5.0.1",
|
|
52
|
-
"karma": "6.4.0",
|
|
53
|
-
"mocha": "10.0.0",
|
|
54
|
-
"nodemon": "2.0.16",
|
|
55
|
-
"nyc": "15.1.0",
|
|
56
|
-
"shx": "0.3.4",
|
|
57
|
-
"sinon": "14.0.0",
|
|
58
|
-
"ts-node": "10.8.1",
|
|
59
|
-
"typescript": "^4.7.3"
|
|
60
|
-
},
|
|
61
|
-
"nyc": {
|
|
62
|
-
"include": [
|
|
63
|
-
"src/*.ts",
|
|
64
|
-
"src/**/*.ts"
|
|
65
|
-
],
|
|
66
|
-
"exclude": [
|
|
67
|
-
"typings"
|
|
68
|
-
],
|
|
69
|
-
"extension": [
|
|
70
|
-
".ts"
|
|
71
|
-
],
|
|
72
|
-
"require": [
|
|
73
|
-
"ts-node/register"
|
|
74
|
-
],
|
|
75
|
-
"reporter": [
|
|
76
|
-
"html"
|
|
77
|
-
],
|
|
78
|
-
"all": false
|
|
51
|
+
"@eslint/js": "^10.0.1",
|
|
52
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
53
|
+
"eslint": "^10.0.3",
|
|
54
|
+
"tsup": "^8.5.1",
|
|
55
|
+
"typescript": "^5.9.3",
|
|
56
|
+
"typescript-eslint": "^8.57.0",
|
|
57
|
+
"vitest": "^4.0.18"
|
|
79
58
|
}
|
|
80
59
|
}
|
package/.eslintignore
DELETED
package/.eslintrc.cjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: Lint CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ master ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ master ]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
build:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
strategy:
|
|
13
|
-
matrix:
|
|
14
|
-
node-version: [16.x]
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v3
|
|
17
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
18
|
-
uses: actions/setup-node@v3
|
|
19
|
-
with:
|
|
20
|
-
node-version: ${{ matrix.node-version }}
|
|
21
|
-
- run: yarn --frozen-lockfile
|
|
22
|
-
- run: yarn lint
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: Node.js CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ master ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ master ]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
build:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
strategy:
|
|
13
|
-
matrix:
|
|
14
|
-
node-version: [14.x, 16.x]
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v3
|
|
17
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
18
|
-
uses: actions/setup-node@v3
|
|
19
|
-
with:
|
|
20
|
-
node-version: ${{ matrix.node-version }}
|
|
21
|
-
- run: yarn --frozen-lockfile
|
|
22
|
-
- run: yarn test
|
package/.mocharc.js
DELETED
package/dist/Interval.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export declare abstract class Interval {
|
|
2
|
-
lo: number;
|
|
3
|
-
hi: number;
|
|
4
|
-
constructor(lo: number, hi: number);
|
|
5
|
-
/** Return true if the interval is empty, i.e. it contains no points. */
|
|
6
|
-
abstract isEmpty(): boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Return the center of the interval. For empty intervals, the result is
|
|
9
|
-
* arbitrary.
|
|
10
|
-
*/
|
|
11
|
-
abstract getCenter(): number;
|
|
12
|
-
/**
|
|
13
|
-
* Return the length of the interval. The length of an empty interval is
|
|
14
|
-
* negative.
|
|
15
|
-
*/
|
|
16
|
-
abstract getLength(): number;
|
|
17
|
-
abstract contains(p: number): boolean;
|
|
18
|
-
abstract interiorContains(p: number): boolean;
|
|
19
|
-
toString(): string;
|
|
20
|
-
/**
|
|
21
|
-
* Return true if two intervals contains the same set of points.
|
|
22
|
-
*/
|
|
23
|
-
equals(that: any): boolean;
|
|
24
|
-
}
|
package/dist/Interval.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Interval = void 0;
|
|
4
|
-
class Interval {
|
|
5
|
-
constructor(lo, hi) {
|
|
6
|
-
this.lo = lo;
|
|
7
|
-
this.hi = hi;
|
|
8
|
-
}
|
|
9
|
-
toString() {
|
|
10
|
-
return "[" + this.lo.toString() + ", " + this.hi.toString() + "]";
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Return true if two intervals contains the same set of points.
|
|
14
|
-
*/
|
|
15
|
-
equals(that) {
|
|
16
|
-
if (typeof (that) === typeof (this)) {
|
|
17
|
-
return this.lo == that.lo && this.hi == that.hi;
|
|
18
|
-
}
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.Interval = Interval;
|
|
23
|
-
//# sourceMappingURL=Interval.js.map
|
package/dist/Interval.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Interval.js","sourceRoot":"","sources":["../src/Interval.ts"],"names":[],"mappings":";;;AAAA,MAAsB,QAAQ;IAI5B,YAAY,EAAS,EAAE,EAAS;QAC9B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAsBO,QAAQ;QACd,OAAO,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,GAAG,CAAC;IACpE,CAAC;IAGD;;OAEG;IACI,MAAM,CAAC,IAAQ;QACpB,IAAI,OAAM,CAAC,IAAI,CAAC,KAAK,OAAM,CAAC,IAAI,CAAC,EAAE;YACjC,OAAO,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC;SACjD;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CAGF;AA7CD,4BA6CC"}
|
package/dist/MutableInteger.d.ts
DELETED
package/dist/MutableInteger.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MutableInteger = void 0;
|
|
4
|
-
class MutableInteger {
|
|
5
|
-
constructor(val) {
|
|
6
|
-
this.val = val;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
exports.MutableInteger = MutableInteger;
|
|
10
|
-
//# sourceMappingURL=MutableInteger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MutableInteger.js","sourceRoot":"","sources":["../src/MutableInteger.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAc;IAEzB,YAAmB,GAAU;QAAV,QAAG,GAAH,GAAG,CAAO;IAC7B,CAAC;CACF;AAJD,wCAIC"}
|
package/dist/Platform.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare class Platform {
|
|
2
|
-
static IEEEremainder(f1: number, f2: number): number;
|
|
3
|
-
/**
|
|
4
|
-
* If v is non-zero, return an integer {@code exp} such that
|
|
5
|
-
* {@code (0.5 <= |v|*2^(-exp) < 1)}. If v is zero, return 0.
|
|
6
|
-
*
|
|
7
|
-
* <p>Note that this arguably a bad definition of exponent because it makes
|
|
8
|
-
* {@code exp(9) == 4}. In decimal this would be like saying that the
|
|
9
|
-
* exponent of 1234 is 4, when in scientific 'exponent' notation 1234 is
|
|
10
|
-
* {@code 1.234 x 10^3}.
|
|
11
|
-
*
|
|
12
|
-
* TODO(dbeaumont): Replace this with "DoubleUtils.getExponent(v) - 1" ?
|
|
13
|
-
*/
|
|
14
|
-
static getExponent(v: number): number;
|
|
15
|
-
}
|
package/dist/Platform.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Platform = void 0;
|
|
4
|
-
const exponent = require("math-float64-exponent");
|
|
5
|
-
class Platform {
|
|
6
|
-
static IEEEremainder(f1, f2) {
|
|
7
|
-
// let r = f1 % f2;
|
|
8
|
-
// if (isNaN(r) || r == (f2) || r <= (Math.abs(f2) / 2)) {
|
|
9
|
-
// return r;
|
|
10
|
-
// } else {
|
|
11
|
-
// return (f1 >= (0) ? 1 : -1) * (r - f2);
|
|
12
|
-
// }
|
|
13
|
-
if (Number.isNaN(f1)) {
|
|
14
|
-
return f1;
|
|
15
|
-
}
|
|
16
|
-
if (Number.isNaN(f2)) {
|
|
17
|
-
return f2;
|
|
18
|
-
}
|
|
19
|
-
if ((f2 === Number.POSITIVE_INFINITY || f2 === Number.NEGATIVE_INFINITY) && Number.isFinite(f1)) {
|
|
20
|
-
return f1;
|
|
21
|
-
}
|
|
22
|
-
return f1 - (Math.round(f1 / f2) * f2);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* If v is non-zero, return an integer {@code exp} such that
|
|
26
|
-
* {@code (0.5 <= |v|*2^(-exp) < 1)}. If v is zero, return 0.
|
|
27
|
-
*
|
|
28
|
-
* <p>Note that this arguably a bad definition of exponent because it makes
|
|
29
|
-
* {@code exp(9) == 4}. In decimal this would be like saying that the
|
|
30
|
-
* exponent of 1234 is 4, when in scientific 'exponent' notation 1234 is
|
|
31
|
-
* {@code 1.234 x 10^3}.
|
|
32
|
-
*
|
|
33
|
-
* TODO(dbeaumont): Replace this with "DoubleUtils.getExponent(v) - 1" ?
|
|
34
|
-
*/
|
|
35
|
-
static getExponent(v) {
|
|
36
|
-
// if (v == 0) {
|
|
37
|
-
// return 0;
|
|
38
|
-
// }
|
|
39
|
-
// // IT should always be ((int)log(2,v))+1;
|
|
40
|
-
// const start = Math.floor(Math.log(v)/Math.log(2));
|
|
41
|
-
// for(let i= start; i<start+10; i++) {
|
|
42
|
-
// const curVal = Math.abs(v) * Math.pow(2,-i);
|
|
43
|
-
// if (curVal >= 0.5 && curVal < 1 ) {
|
|
44
|
-
// return i;
|
|
45
|
-
// }
|
|
46
|
-
// }
|
|
47
|
-
// throw new Error('method not written yet');
|
|
48
|
-
// // return (int)((S2.EXPONENT_MASK & bits) >> S2.EXPONENT_SHIFT) - 1022;
|
|
49
|
-
return exponent(v);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.Platform = Platform;
|
|
53
|
-
//# sourceMappingURL=Platform.js.map
|
package/dist/Platform.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Platform.js","sourceRoot":"","sources":["../src/Platform.ts"],"names":[],"mappings":";;;AAAA,kDAAmD;AACnD,MAAa,QAAQ;IACZ,MAAM,CAAC,aAAa,CAAC,EAAU,EAAE,EAAU;QAChD,mBAAmB;QAEnB,0DAA0D;QAC1D,cAAc;QACd,WAAW;QACX,4CAA4C;QAC5C,IAAI;QAEJ,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE;YACpB,OAAO,EAAE,CAAC;SACX;QAED,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE;YACpB,OAAO,EAAE,CAAA;SACV;QAED,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,iBAAiB,IAAI,EAAE,KAAK,MAAM,CAAC,iBAAiB,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE;YAC/F,OAAO,EAAE,CAAC;SACX;QAED,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IACzC,CAAC;IAED;;;;;;;;;;OAUG;IACI,MAAM,CAAC,WAAW,CAAC,CAAQ;QAChC,gBAAgB;QAChB,cAAc;QACd,IAAI;QACJ,4CAA4C;QAC5C,qDAAqD;QACrD,uCAAuC;QACvC,iDAAiD;QACjD,wCAAwC;QACxC,gBAAgB;QAChB,MAAM;QACN,IAAI;QACJ,6CAA6C;QAC7C,0EAA0E;QAC1E,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;CACF;AApDD,4BAoDC"}
|
package/dist/R1Interval.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { Interval } from "./Interval";
|
|
2
|
-
/**
|
|
3
|
-
* An R1Interval represents a closed interval on a unit circle (also known as a
|
|
4
|
-
* 1-dimensional sphere). It is capable of representing the empty interval
|
|
5
|
-
* (containing no points), the full interval (containing all points), and
|
|
6
|
-
* zero-length intervals (containing a single point).
|
|
7
|
-
*
|
|
8
|
-
* Points are represented by the angle they make with the positive x-axis in
|
|
9
|
-
* the range [-Pi, Pi]. An interval is represented by its lower and upper bounds
|
|
10
|
-
* (both inclusive, since the interval is closed). The lower bound may be
|
|
11
|
-
* greater than the upper bound, in which case the interval is "inverted" (i.e.
|
|
12
|
-
* it passes through the point (-1, 0)).
|
|
13
|
-
*
|
|
14
|
-
* Note that the point (-1, 0) has two valid representations, Pi and -Pi. The
|
|
15
|
-
* normalized representation of this point internally is Pi, so that endpoints
|
|
16
|
-
* of normal intervals are in the range (-Pi, Pi]. However, we take advantage of
|
|
17
|
-
* the point -Pi to construct two special intervals: the Full() interval is
|
|
18
|
-
* [-Pi, Pi], and the Empty() interval is [Pi, -Pi].
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
export declare class R1Interval extends Interval {
|
|
22
|
-
/** Return true if the interval is empty, i.e. it contains no points. */
|
|
23
|
-
isEmpty(): boolean;
|
|
24
|
-
getCenter(): number;
|
|
25
|
-
getLength(): number;
|
|
26
|
-
contains(p: number): boolean;
|
|
27
|
-
/** Return true if the interior of the interval contains the point 'p'. */
|
|
28
|
-
interiorContains(p: number): boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Return true if the interval contains the given interval 'y'. Works for
|
|
31
|
-
* empty, full, and singleton intervals.
|
|
32
|
-
*/
|
|
33
|
-
containsI(y: R1Interval): boolean;
|
|
34
|
-
interiorContainsI(y: R1Interval): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Return true if this interval intersects the given interval, i.e. if they
|
|
37
|
-
* have any points in common.
|
|
38
|
-
*/
|
|
39
|
-
intersects(y: R1Interval): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Return true if the interior of this interval intersects any point of the
|
|
42
|
-
* given interval (including its boundary).
|
|
43
|
-
*/
|
|
44
|
-
interiorIntersects(y: R1Interval): boolean;
|
|
45
|
-
/** Expand the interval so that it contains the given point "p". */
|
|
46
|
-
addPoint(p: number): R1Interval;
|
|
47
|
-
/**
|
|
48
|
-
* Return an interval that contains all points with a distance "radius" of a
|
|
49
|
-
* point in this interval. Note that the expansion of an empty interval is
|
|
50
|
-
* always empty.
|
|
51
|
-
*/
|
|
52
|
-
expanded(radius: number): R1Interval;
|
|
53
|
-
/**
|
|
54
|
-
* Return the smallest interval that contains this interval and the given
|
|
55
|
-
* interval "y".
|
|
56
|
-
*/
|
|
57
|
-
union(y: R1Interval): R1Interval;
|
|
58
|
-
/**
|
|
59
|
-
* Return the intersection of this interval with the given interval. Empty
|
|
60
|
-
* intervals do not need to be special-cased.
|
|
61
|
-
*/
|
|
62
|
-
intersection(y: R1Interval): R1Interval;
|
|
63
|
-
/**
|
|
64
|
-
* Return true if the length of the symmetric difference between the two
|
|
65
|
-
* intervals is at most the given tolerance.
|
|
66
|
-
*/
|
|
67
|
-
approxEquals(y: R1Interval, maxError?: number): boolean;
|
|
68
|
-
static empty(): R1Interval;
|
|
69
|
-
static fromPoint(p: number): R1Interval;
|
|
70
|
-
/**
|
|
71
|
-
* Convenience method to construct the minimal interval containing the two
|
|
72
|
-
* given points. This is equivalent to starting with an empty interval and
|
|
73
|
-
* calling AddPoint() twice, but it is more efficient.
|
|
74
|
-
*/
|
|
75
|
-
static fromPointPair(p1: number, p2: number): R1Interval;
|
|
76
|
-
}
|
package/dist/R1Interval.js
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.R1Interval = void 0;
|
|
4
|
-
const Interval_1 = require("./Interval");
|
|
5
|
-
/**
|
|
6
|
-
* An R1Interval represents a closed interval on a unit circle (also known as a
|
|
7
|
-
* 1-dimensional sphere). It is capable of representing the empty interval
|
|
8
|
-
* (containing no points), the full interval (containing all points), and
|
|
9
|
-
* zero-length intervals (containing a single point).
|
|
10
|
-
*
|
|
11
|
-
* Points are represented by the angle they make with the positive x-axis in
|
|
12
|
-
* the range [-Pi, Pi]. An interval is represented by its lower and upper bounds
|
|
13
|
-
* (both inclusive, since the interval is closed). The lower bound may be
|
|
14
|
-
* greater than the upper bound, in which case the interval is "inverted" (i.e.
|
|
15
|
-
* it passes through the point (-1, 0)).
|
|
16
|
-
*
|
|
17
|
-
* Note that the point (-1, 0) has two valid representations, Pi and -Pi. The
|
|
18
|
-
* normalized representation of this point internally is Pi, so that endpoints
|
|
19
|
-
* of normal intervals are in the range (-Pi, Pi]. However, we take advantage of
|
|
20
|
-
* the point -Pi to construct two special intervals: the Full() interval is
|
|
21
|
-
* [-Pi, Pi], and the Empty() interval is [Pi, -Pi].
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
class R1Interval extends Interval_1.Interval {
|
|
25
|
-
/** Return true if the interval is empty, i.e. it contains no points. */
|
|
26
|
-
isEmpty() {
|
|
27
|
-
return this.lo > this.hi;
|
|
28
|
-
}
|
|
29
|
-
getCenter() {
|
|
30
|
-
return (this.lo + this.hi) / 2;
|
|
31
|
-
}
|
|
32
|
-
getLength() {
|
|
33
|
-
return this.hi - this.lo;
|
|
34
|
-
}
|
|
35
|
-
contains(p) {
|
|
36
|
-
return p >= this.lo && p <= this.hi;
|
|
37
|
-
}
|
|
38
|
-
/** Return true if the interior of the interval contains the point 'p'. */
|
|
39
|
-
interiorContains(p) {
|
|
40
|
-
return p > this.lo && p < this.hi;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Return true if the interval contains the given interval 'y'. Works for
|
|
44
|
-
* empty, full, and singleton intervals.
|
|
45
|
-
*/
|
|
46
|
-
containsI(y) {
|
|
47
|
-
if (y.isEmpty()) {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
return y.lo >= this.lo && y.hi <= this.hi;
|
|
51
|
-
}
|
|
52
|
-
interiorContainsI(y) {
|
|
53
|
-
if (y.isEmpty()) {
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
return y.lo > this.lo && y.hi < this.hi;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Return true if this interval intersects the given interval, i.e. if they
|
|
60
|
-
* have any points in common.
|
|
61
|
-
*/
|
|
62
|
-
intersects(y) {
|
|
63
|
-
if (this.lo <= y.lo) {
|
|
64
|
-
return y.lo <= (this.hi) && y.lo <= (y.hi);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
return this.lo <= (y.hi) && this.lo <= (this.hi);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Return true if the interior of this interval intersects any point of the
|
|
72
|
-
* given interval (including its boundary).
|
|
73
|
-
*/
|
|
74
|
-
interiorIntersects(y) {
|
|
75
|
-
return y.lo < (this.hi) && this.lo < (y.hi) && this.lo < (this.hi) && y.lo <= (y.hi);
|
|
76
|
-
}
|
|
77
|
-
/** Expand the interval so that it contains the given point "p". */
|
|
78
|
-
addPoint(p) {
|
|
79
|
-
if (this.isEmpty()) {
|
|
80
|
-
return R1Interval.fromPoint(p);
|
|
81
|
-
}
|
|
82
|
-
else if (p < (this.lo)) {
|
|
83
|
-
return new R1Interval(p, this.hi);
|
|
84
|
-
}
|
|
85
|
-
else if (p > (this.hi)) {
|
|
86
|
-
return new R1Interval(this.lo, p);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
return new R1Interval(this.lo, this.hi);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Return an interval that contains all points with a distance "radius" of a
|
|
94
|
-
* point in this interval. Note that the expansion of an empty interval is
|
|
95
|
-
* always empty.
|
|
96
|
-
*/
|
|
97
|
-
expanded(radius) {
|
|
98
|
-
// assert (radius >= 0);
|
|
99
|
-
if (this.isEmpty()) {
|
|
100
|
-
return this;
|
|
101
|
-
}
|
|
102
|
-
return new R1Interval(this.lo - radius, this.hi + radius);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Return the smallest interval that contains this interval and the given
|
|
106
|
-
* interval "y".
|
|
107
|
-
*/
|
|
108
|
-
union(y) {
|
|
109
|
-
if (this.isEmpty()) {
|
|
110
|
-
return y;
|
|
111
|
-
}
|
|
112
|
-
if (y.isEmpty()) {
|
|
113
|
-
return this;
|
|
114
|
-
}
|
|
115
|
-
return new R1Interval(Math.min(this.lo, y.lo), Math.max(this.hi, y.hi));
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Return the intersection of this interval with the given interval. Empty
|
|
119
|
-
* intervals do not need to be special-cased.
|
|
120
|
-
*/
|
|
121
|
-
intersection(y) {
|
|
122
|
-
return new R1Interval(Math.max(this.lo, y.lo), Math.min(this.hi, y.hi));
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Return true if the length of the symmetric difference between the two
|
|
126
|
-
* intervals is at most the given tolerance.
|
|
127
|
-
*/
|
|
128
|
-
approxEquals(y, maxError = 1e-15) {
|
|
129
|
-
if (this.isEmpty()) {
|
|
130
|
-
return y.getLength() <= (maxError);
|
|
131
|
-
}
|
|
132
|
-
if (y.isEmpty()) {
|
|
133
|
-
return this.getLength() <= (maxError);
|
|
134
|
-
}
|
|
135
|
-
return Math.abs(y.lo - (this.lo)) + Math.abs(y.hi - this.hi) <= (maxError);
|
|
136
|
-
}
|
|
137
|
-
static empty() {
|
|
138
|
-
return new R1Interval(1, 0);
|
|
139
|
-
}
|
|
140
|
-
static fromPoint(p) {
|
|
141
|
-
return new R1Interval(p, p);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Convenience method to construct the minimal interval containing the two
|
|
145
|
-
* given points. This is equivalent to starting with an empty interval and
|
|
146
|
-
* calling AddPoint() twice, but it is more efficient.
|
|
147
|
-
*/
|
|
148
|
-
static fromPointPair(p1, p2) {
|
|
149
|
-
if (p1 <= (p2)) {
|
|
150
|
-
return new R1Interval(p1, p2);
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
return new R1Interval(p2, p1);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
exports.R1Interval = R1Interval;
|
|
158
|
-
//# sourceMappingURL=R1Interval.js.map
|
package/dist/R1Interval.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"R1Interval.js","sourceRoot":"","sources":["../src/R1Interval.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AACpC;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAa,UAAW,SAAQ,mBAAQ;IAEtC,wEAAwE;IACjE,OAAO;QACZ,OAAO,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;IAC3B,CAAC;IAEM,SAAS;QACd,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,GAAC,CAAC,CAAC;IAC/B,CAAC;IAEM,SAAS;QACd,OAAO,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;IAC3B,CAAC;IAEM,Q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AAI,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;SAC/B;IACH,CAAC;CACF;AA3JD,gCA2JC"}
|
package/dist/R2Vector.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { S2Point } from "./S2Point";
|
|
2
|
-
/**
|
|
3
|
-
* R2Vector represents a vector in the two-dimensional space. It defines the
|
|
4
|
-
* basic geometrical operations for 2D vectors, e.g. cross product, addition,
|
|
5
|
-
* norm, comparison etc.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
export declare class R2Vector {
|
|
9
|
-
private _x;
|
|
10
|
-
private _y;
|
|
11
|
-
constructor(_x: number, _y: number);
|
|
12
|
-
get x(): number;
|
|
13
|
-
get y(): number;
|
|
14
|
-
get(index: number): number;
|
|
15
|
-
static fromPointFace(p: S2Point, face: number): R2Vector;
|
|
16
|
-
static add(p1: R2Vector, p2: R2Vector): R2Vector;
|
|
17
|
-
static mul(p: R2Vector, m: number): R2Vector;
|
|
18
|
-
norm2(): number;
|
|
19
|
-
static dotProd(p1: R2Vector, p2: R2Vector): number;
|
|
20
|
-
dotProd(that: R2Vector): number;
|
|
21
|
-
crossProd(that: R2Vector): number;
|
|
22
|
-
lessThan(vb: R2Vector): boolean;
|
|
23
|
-
static fromSTVector(stVector: R2Vector): R2Vector;
|
|
24
|
-
static singleStTOUV(s: number): number;
|
|
25
|
-
static singleUVToST(u: number): number;
|
|
26
|
-
/**
|
|
27
|
-
* To be used only if this vector is representing uv.
|
|
28
|
-
* @param face
|
|
29
|
-
* @returns {S2Point}
|
|
30
|
-
*/
|
|
31
|
-
toPoint(face: number): S2Point;
|
|
32
|
-
toSt(which: any): number;
|
|
33
|
-
toString(): string;
|
|
34
|
-
}
|