nodes2ts 1.1.9 → 3.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/.eslintignore +3 -0
- package/.eslintrc.cjs +11 -0
- package/.github/workflows/lint.js.yml +22 -0
- package/.github/workflows/node.js.yml +22 -0
- package/.mocharc.js +7 -0
- package/README.md +22 -5
- package/dist/Interval.d.ts +7 -8
- package/dist/Interval.js +12 -12
- package/dist/Interval.js.map +1 -1
- package/dist/MutableInteger.js +5 -4
- package/dist/MutableInteger.js.map +1 -1
- package/dist/Platform.d.ts +15 -0
- package/dist/Platform.js +53 -0
- package/dist/Platform.js.map +1 -0
- package/dist/R1Interval.d.ts +8 -9
- package/dist/R1Interval.js +59 -78
- package/dist/R1Interval.js.map +1 -1
- package/dist/R2Vector.d.ts +12 -13
- package/dist/R2Vector.js +65 -85
- package/dist/R2Vector.js.map +1 -1
- package/dist/S1Angle.d.ts +38 -5
- package/dist/S1Angle.js +89 -37
- package/dist/S1Angle.js.map +1 -1
- package/dist/S1ChordAngle.d.ts +166 -0
- package/dist/S1ChordAngle.js +318 -0
- package/dist/S1ChordAngle.js.map +1 -0
- package/dist/S1Interval.d.ts +11 -12
- package/dist/S1Interval.js +134 -140
- package/dist/S1Interval.js.map +1 -1
- package/dist/S2.d.ts +8 -5
- package/dist/S2.js +91 -108
- package/dist/S2.js.map +1 -1
- package/dist/S2Cap.d.ts +33 -25
- package/dist/S2Cap.js +199 -203
- package/dist/S2Cap.js.map +1 -1
- package/dist/S2Cell.d.ts +15 -13
- package/dist/S2Cell.js +196 -206
- package/dist/S2Cell.js.map +1 -1
- package/dist/S2CellId.d.ts +37 -14
- package/dist/S2CellId.js +407 -359
- package/dist/S2CellId.js.map +1 -1
- package/dist/S2CellUnion.d.ts +1 -2
- package/dist/S2CellUnion.js +137 -133
- package/dist/S2CellUnion.js.map +1 -1
- package/dist/S2EdgeUtil.js +14 -17
- package/dist/S2EdgeUtil.js.map +1 -1
- package/dist/S2LatLng.d.ts +15 -11
- package/dist/S2LatLng.js +100 -114
- package/dist/S2LatLng.js.map +1 -1
- package/dist/S2LatLngRect.d.ts +8 -4
- package/dist/S2LatLngRect.js +215 -197
- package/dist/S2LatLngRect.js.map +1 -1
- package/dist/S2Metric.d.ts +4 -5
- package/dist/S2Metric.js +30 -27
- package/dist/S2Metric.js.map +1 -1
- package/dist/S2Point.d.ts +48 -14
- package/dist/S2Point.js +156 -109
- package/dist/S2Point.js.map +1 -1
- package/dist/S2Projections.d.ts +43 -9
- package/dist/S2Projections.js +226 -47
- package/dist/S2Projections.js.map +1 -1
- package/dist/S2Region.js +2 -1
- package/dist/S2Region.js.map +1 -1
- package/dist/S2RegionCoverer.d.ts +21 -6
- package/dist/S2RegionCoverer.js +144 -109
- package/dist/S2RegionCoverer.js.map +1 -1
- package/dist/export.d.ts +0 -1
- package/dist/export.js +42 -32
- package/dist/export.js.map +1 -1
- package/dist/utils/preconditions.d.ts +2 -0
- package/dist/utils/preconditions.js +16 -0
- package/dist/utils/preconditions.js.map +1 -0
- package/package.json +28 -34
- package/.npmignore +0 -8
- package/.nyc_output/1eb1f420a13c15f529aac41a40bcaa21.json +0 -1
- package/.nyc_output/5ff62256eb1c111254ba0b469fb547da.json +0 -1
- package/.nyc_output/949d6e8c2061067f3bdfd27dfff5ba83.json +0 -1
- package/coverage/Interval.ts.html +0 -203
- package/coverage/MutableInteger.ts.html +0 -77
- package/coverage/R1Interval.ts.html +0 -647
- package/coverage/R2Vector.ts.html +0 -587
- package/coverage/S1Angle.ts.html +0 -344
- package/coverage/S1Interval.ts.html +0 -1349
- package/coverage/S2.ts.html +0 -1178
- package/coverage/S2Cap.ts.html +0 -1433
- package/coverage/S2Cell.ts.html +0 -1415
- package/coverage/S2CellId.ts.html +0 -3329
- package/coverage/S2EdgeUtil.ts.html +0 -2534
- package/coverage/S2LatLng.ts.html +0 -848
- package/coverage/S2LatLngRect.ts.html +0 -2222
- package/coverage/S2Point.ts.html +0 -758
- package/coverage/S2Projections.ts.html +0 -518
- package/coverage/base.css +0 -212
- package/coverage/decimal.ts.html +0 -68
- package/coverage/index.html +0 -288
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -1
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -158
- package/dist/decimal.d.ts +0 -3
- package/dist/decimal.js +0 -4
- package/dist/decimal.js.map +0 -1
- package/dist/decimal_augmentation.d.ts +0 -24
- package/dist/decimal_augmentation.js +0 -2
- package/dist/decimal_augmentation.js.map +0 -1
package/dist/R2Vector.js
CHANGED
|
@@ -1,74 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.R2Vector = void 0;
|
|
4
|
+
const S2Point_1 = require("./S2Point");
|
|
5
5
|
/**
|
|
6
6
|
* R2Vector represents a vector in the two-dimensional space. It defines the
|
|
7
7
|
* basic geometrical operations for 2D vectors, e.g. cross product, addition,
|
|
8
8
|
* norm, comparison etc.
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this._x =
|
|
14
|
-
this._y =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Object.defineProperty(R2Vector.prototype, "y", {
|
|
26
|
-
get: function () {
|
|
27
|
-
return this._y;
|
|
28
|
-
},
|
|
29
|
-
enumerable: true,
|
|
30
|
-
configurable: true
|
|
31
|
-
});
|
|
32
|
-
R2Vector.prototype.get = function (index) {
|
|
33
|
-
if (index > 1) {
|
|
34
|
-
throw new Error("Index out fo bounds error " + index);
|
|
11
|
+
class R2Vector {
|
|
12
|
+
constructor(_x, _y) {
|
|
13
|
+
this._x = _x;
|
|
14
|
+
this._y = _y;
|
|
15
|
+
}
|
|
16
|
+
get x() {
|
|
17
|
+
return this._x;
|
|
18
|
+
}
|
|
19
|
+
get y() {
|
|
20
|
+
return this._y;
|
|
21
|
+
}
|
|
22
|
+
get(index) {
|
|
23
|
+
if (index < 0 || index > 1) {
|
|
24
|
+
throw new Error(`Index out fo bounds error ${index}`);
|
|
35
25
|
}
|
|
36
26
|
return index == 0 ? this._x : this._y;
|
|
37
|
-
}
|
|
38
|
-
|
|
27
|
+
}
|
|
28
|
+
static fromPointFace(p, face) {
|
|
39
29
|
return p.toR2Vector(face);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return new R2Vector(p1._x
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
R2Vector.prototype.dotProd = function (that) {
|
|
30
|
+
}
|
|
31
|
+
static add(p1, p2) {
|
|
32
|
+
return new R2Vector(p1._x + (p2._x), p1._y + (p2._y));
|
|
33
|
+
}
|
|
34
|
+
static mul(p, m) {
|
|
35
|
+
return new R2Vector(m * (p._x), m * (p._y));
|
|
36
|
+
}
|
|
37
|
+
norm2() {
|
|
38
|
+
return this.x * this.x + this.y * this.y;
|
|
39
|
+
}
|
|
40
|
+
static dotProd(p1, p2) {
|
|
41
|
+
return p1.x * (p2.x) + (p1.y * (p2.y));
|
|
42
|
+
}
|
|
43
|
+
dotProd(that) {
|
|
55
44
|
return R2Vector.dotProd(this, that);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return this.x
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (this.x
|
|
45
|
+
}
|
|
46
|
+
crossProd(that) {
|
|
47
|
+
return this.x * (that.y) - (this.y * (that.x));
|
|
48
|
+
}
|
|
49
|
+
lessThan(vb) {
|
|
50
|
+
if (this.x < (vb.x)) {
|
|
62
51
|
return true;
|
|
63
52
|
}
|
|
64
|
-
if (vb.x
|
|
53
|
+
if (vb.x < (this.x)) {
|
|
65
54
|
return false;
|
|
66
55
|
}
|
|
67
|
-
if (this.y
|
|
56
|
+
if (this.y < (vb.y)) {
|
|
68
57
|
return true;
|
|
69
58
|
}
|
|
70
59
|
return false;
|
|
71
|
-
}
|
|
60
|
+
}
|
|
72
61
|
//
|
|
73
62
|
// @Override
|
|
74
63
|
// public boolean equals(Object that) {
|
|
@@ -90,62 +79,53 @@ var R2Vector = (function () {
|
|
|
90
79
|
// return (int) (value ^ (value >>> 32));
|
|
91
80
|
// }
|
|
92
81
|
//
|
|
93
|
-
|
|
82
|
+
static fromSTVector(stVector) {
|
|
94
83
|
return new R2Vector(R2Vector.singleStTOUV(stVector.x), R2Vector.singleStTOUV(stVector.y));
|
|
95
|
-
}
|
|
84
|
+
}
|
|
96
85
|
// from S2Projections.stToUV (QUADRATIC)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return S2_1.S2.toDecimal(1)
|
|
101
|
-
.dividedBy(3)
|
|
102
|
-
.times(s.plus(1).pow(2).minus(1));
|
|
86
|
+
static singleStTOUV(s) {
|
|
87
|
+
if (s >= 0.5) {
|
|
88
|
+
return (1 / 3) * (4 * s * s - 1);
|
|
103
89
|
}
|
|
104
90
|
else {
|
|
105
|
-
return
|
|
106
|
-
.dividedBy(3)
|
|
107
|
-
.times(S2_1.S2.toDecimal(1)
|
|
108
|
-
.minus(S2_1.S2.toDecimal(1).minus(s).pow(2)));
|
|
91
|
+
return (1 / 3) * (1 - 4 * (1 - s) * (1 - s));
|
|
109
92
|
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return decimal_1.Decimal.sqrt(x.times(3).plus(1)).minus(1);
|
|
93
|
+
}
|
|
94
|
+
static singleUVToST(u) {
|
|
95
|
+
if (u >= 0) {
|
|
96
|
+
return 0.5 * Math.sqrt(1 + 3 * u);
|
|
115
97
|
}
|
|
116
98
|
else {
|
|
117
|
-
return
|
|
118
|
-
.minus(decimal_1.Decimal.sqrt(S2_1.S2.toDecimal(1).minus(x.times(3))));
|
|
99
|
+
return 1 - 0.5 * Math.sqrt(1 - 3 * u);
|
|
119
100
|
}
|
|
120
|
-
}
|
|
101
|
+
}
|
|
121
102
|
/**
|
|
122
103
|
* To be used only if this vector is representing uv.
|
|
123
104
|
* @param face
|
|
124
105
|
* @returns {S2Point}
|
|
125
106
|
*/
|
|
126
|
-
|
|
107
|
+
toPoint(face) {
|
|
127
108
|
switch (face) {
|
|
128
109
|
case 0:
|
|
129
110
|
return new S2Point_1.S2Point(1, this.x, this.y);
|
|
130
111
|
case 1:
|
|
131
|
-
return new S2Point_1.S2Point(this.x
|
|
112
|
+
return new S2Point_1.S2Point(this.x * -1, 1, this.y);
|
|
132
113
|
case 2:
|
|
133
|
-
return new S2Point_1.S2Point(this.x
|
|
114
|
+
return new S2Point_1.S2Point(this.x * -1, this.y * -1, 1);
|
|
134
115
|
case 3:
|
|
135
|
-
return new S2Point_1.S2Point(-1, this.y
|
|
116
|
+
return new S2Point_1.S2Point(-1, this.y * -1, this.x * -1);
|
|
136
117
|
case 4:
|
|
137
|
-
return new S2Point_1.S2Point(this.y, -1, this.x
|
|
118
|
+
return new S2Point_1.S2Point(this.y, -1, this.x * -1);
|
|
138
119
|
default:
|
|
139
120
|
return new S2Point_1.S2Point(this.y, this.x, -1);
|
|
140
121
|
}
|
|
141
|
-
}
|
|
142
|
-
|
|
122
|
+
}
|
|
123
|
+
toSt(which) {
|
|
143
124
|
return which == 0 ? R2Vector.singleUVToST(this.x) : R2Vector.singleUVToST(this.y);
|
|
144
|
-
}
|
|
145
|
-
|
|
125
|
+
}
|
|
126
|
+
toString() {
|
|
146
127
|
return "(" + this.x.toString() + ", " + this.y.toString() + ")";
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
}());
|
|
128
|
+
}
|
|
129
|
+
}
|
|
150
130
|
exports.R2Vector = R2Vector;
|
|
151
131
|
//# sourceMappingURL=R2Vector.js.map
|
package/dist/R2Vector.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"R2Vector.js","sourceRoot":"","sources":["../src/R2Vector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"R2Vector.js","sourceRoot":"","sources":["../src/R2Vector.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAClC;;;;;GAKG;AACH,MAAa,QAAQ;IAGnB,YAAY,EAAS,EAAE,EAAS;QAC9B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IAGM,GAAG,CAAC,KAAY;QACrB,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,6BAA6B,KAAK,EAAE,CAAC,CAAC;SACvD;QACD,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,aAAa,CAAC,CAAS,EAAE,IAAW;QACzC,OAAO,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IACM,MAAM,CAAE,GAAG,CAAC,EAAW,EAAE,EAAW;QACzC,OAAO,IAAI,QAAQ,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACxD,CAAC;IAEM,MAAM,CAAC,GAAG,CAAC,CAAU,EAAE,CAAQ;QACpC,OAAO,IAAI,QAAQ,CAAC,CAAC,GAAG,CA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
6
|
-
|
|
3
|
+
static INFINITY: S1Angle;
|
|
4
|
+
static ZERO: S1Angle;
|
|
5
|
+
radians: number;
|
|
6
|
+
constructor(radians: number);
|
|
7
|
+
degrees(): number;
|
|
7
8
|
/**
|
|
8
9
|
* Return the angle between two points, which is also equal to the distance
|
|
9
10
|
* between these points on the unit sphere. The points do not need to be
|
|
@@ -16,7 +17,38 @@ export declare class S1Angle {
|
|
|
16
17
|
greaterOrEquals(that: S1Angle): boolean;
|
|
17
18
|
static max(left: S1Angle, right: S1Angle): S1Angle;
|
|
18
19
|
static min(left: S1Angle, right: S1Angle): S1Angle;
|
|
19
|
-
static
|
|
20
|
+
static radians(radians: number): S1Angle;
|
|
21
|
+
static degrees(degrees: number): S1Angle;
|
|
22
|
+
/**
|
|
23
|
+
* Retuns an {@link S1Angle} whose angle is <code>(this + a)</code>.
|
|
24
|
+
*/
|
|
25
|
+
add(a: S1Angle): S1Angle;
|
|
26
|
+
/**
|
|
27
|
+
* Retuns an {@link S1Angle} whose angle is <code>(this - a)</code>.
|
|
28
|
+
*/
|
|
29
|
+
sub(a: S1Angle): S1Angle;
|
|
30
|
+
/**
|
|
31
|
+
* Retuns an {@link S1Angle} whose angle is <code>(this * m)</code>.
|
|
32
|
+
*/
|
|
33
|
+
mul(m: number): S1Angle;
|
|
34
|
+
/**
|
|
35
|
+
* Retuns an {@link S1Angle} whose angle is <code>(this / d)</code>.
|
|
36
|
+
*/
|
|
37
|
+
div(d: number): S1Angle;
|
|
38
|
+
/**
|
|
39
|
+
* Returns the trigonometric cosine of the angle.
|
|
40
|
+
*/
|
|
41
|
+
cos(): number;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the trigonometric sine of the angle.
|
|
44
|
+
*/
|
|
45
|
+
sin(): number;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the trigonometric tangent of the angle.
|
|
48
|
+
*/
|
|
49
|
+
tan(): number;
|
|
50
|
+
/** Returns the distance along the surface of a sphere of the given radius. */
|
|
51
|
+
distance(radius: number): number;
|
|
20
52
|
/**
|
|
21
53
|
* Writes the angle in degrees with a "d" suffix, e.g. "17.3745d". By default
|
|
22
54
|
* 6 digits are printed; this can be changed using setprecision(). Up to 17
|
|
@@ -24,4 +56,5 @@ export declare class S1Angle {
|
|
|
24
56
|
*/
|
|
25
57
|
toString(): string;
|
|
26
58
|
compareTo(that: S1Angle): number;
|
|
59
|
+
equals(that: S1Angle): boolean;
|
|
27
60
|
}
|
package/dist/S1Angle.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
this.radians =
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
return
|
|
10
|
-
}
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.S1Angle = void 0;
|
|
4
|
+
class S1Angle {
|
|
5
|
+
constructor(radians) {
|
|
6
|
+
this.radians = radians;
|
|
7
|
+
}
|
|
8
|
+
degrees() {
|
|
9
|
+
return this.radians * 180 / Math.PI;
|
|
10
|
+
}
|
|
11
11
|
//
|
|
12
12
|
// public long e5() {
|
|
13
13
|
// return Math.round(degrees() * 1e5);
|
|
@@ -25,31 +25,79 @@ var S1Angle = (function () {
|
|
|
25
25
|
* between these points on the unit sphere. The points do not need to be
|
|
26
26
|
* normalized.
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
static fromPoints(x, y) {
|
|
29
29
|
return new S1Angle(x.angle(y));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return this.radians
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return this.radians
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return this.radians
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return this.radians
|
|
42
|
-
}
|
|
43
|
-
|
|
30
|
+
}
|
|
31
|
+
lessThan(that) {
|
|
32
|
+
return this.radians < (that.radians);
|
|
33
|
+
}
|
|
34
|
+
greaterThan(that) {
|
|
35
|
+
return this.radians > (that.radians);
|
|
36
|
+
}
|
|
37
|
+
lessOrEquals(that) {
|
|
38
|
+
return this.radians <= (that.radians);
|
|
39
|
+
}
|
|
40
|
+
greaterOrEquals(that) {
|
|
41
|
+
return this.radians >= (that.radians);
|
|
42
|
+
}
|
|
43
|
+
static max(left, right) {
|
|
44
44
|
return right.greaterThan(left) ? right : left;
|
|
45
|
-
}
|
|
46
|
-
|
|
45
|
+
}
|
|
46
|
+
static min(left, right) {
|
|
47
47
|
return right.greaterThan(left) ? left : right;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
}
|
|
49
|
+
static radians(radians) {
|
|
50
|
+
return new S1Angle(radians);
|
|
51
|
+
}
|
|
52
|
+
static degrees(degrees) {
|
|
53
|
+
return new S1Angle(degrees * (Math.PI / 180));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Retuns an {@link S1Angle} whose angle is <code>(this + a)</code>.
|
|
57
|
+
*/
|
|
58
|
+
add(a) {
|
|
59
|
+
return new S1Angle(this.radians + a.radians);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Retuns an {@link S1Angle} whose angle is <code>(this - a)</code>.
|
|
63
|
+
*/
|
|
64
|
+
sub(a) {
|
|
65
|
+
return new S1Angle(this.radians - a.radians);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Retuns an {@link S1Angle} whose angle is <code>(this * m)</code>.
|
|
69
|
+
*/
|
|
70
|
+
mul(m) {
|
|
71
|
+
return new S1Angle(this.radians * m);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Retuns an {@link S1Angle} whose angle is <code>(this / d)</code>.
|
|
75
|
+
*/
|
|
76
|
+
div(d) {
|
|
77
|
+
return new S1Angle(this.radians / d);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Returns the trigonometric cosine of the angle.
|
|
81
|
+
*/
|
|
82
|
+
cos() {
|
|
83
|
+
return Math.cos(this.radians);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Returns the trigonometric sine of the angle.
|
|
87
|
+
*/
|
|
88
|
+
sin() {
|
|
89
|
+
return Math.sin(this.radians);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Returns the trigonometric tangent of the angle.
|
|
93
|
+
*/
|
|
94
|
+
tan() {
|
|
95
|
+
return Math.tan(this.radians);
|
|
96
|
+
}
|
|
97
|
+
/** Returns the distance along the surface of a sphere of the given radius. */
|
|
98
|
+
distance(radius) {
|
|
99
|
+
return this.radians * radius;
|
|
100
|
+
}
|
|
53
101
|
//
|
|
54
102
|
// public static S1Angle e5(long e5) {
|
|
55
103
|
// return degrees(e5 * 1e-5);
|
|
@@ -69,13 +117,17 @@ var S1Angle = (function () {
|
|
|
69
117
|
* 6 digits are printed; this can be changed using setprecision(). Up to 17
|
|
70
118
|
* digits are required to distinguish one angle from another.
|
|
71
119
|
*/
|
|
72
|
-
|
|
120
|
+
toString() {
|
|
73
121
|
return this.degrees() + "d";
|
|
74
|
-
}
|
|
75
|
-
|
|
122
|
+
}
|
|
123
|
+
compareTo(that) {
|
|
76
124
|
return this.radians < that.radians ? -1 : this.radians > that.radians ? 1 : 0;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
125
|
+
}
|
|
126
|
+
equals(that) {
|
|
127
|
+
return this.compareTo(that) === 0;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
80
130
|
exports.S1Angle = S1Angle;
|
|
131
|
+
S1Angle.INFINITY = new S1Angle(Number.POSITIVE_INFINITY);
|
|
132
|
+
S1Angle.ZERO = new S1Angle(0);
|
|
81
133
|
//# sourceMappingURL=S1Angle.js.map
|
package/dist/S1Angle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"S1Angle.js","sourceRoot":"","sources":["../src/S1Angle.ts"],"names":[],"mappings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,MAAM,CAAC;IAC/B,CAAC;IAED,EAAE;IACF,sCAAsC;IACtC,+BAA+B;IAC/B,IAAI;IACJ,EAAE;IACF,sCAAsC;IACtC,uEAAuE;IACvE,qEAAqE;IACrE,+BAA+B;IAC/B,IAAI;IACJ,EAAE;IACF,sCAAsC;IACtC,+BAA+B;IAC/B,IAAI;IAEJ;;;;OAIG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC;IAC9B,CAAC;IAEM,SAAS,CAAC,IAAa;QAC5B,OAAO,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChF,CAAC;IAEM,MAAM,CAAC,IAAa;QACzB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAzJH,0BA0JC;AAzJe,gBAAQ,GAAY,IAAI,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAC1D,YAAI,GAAY,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S1ChordAngle represents the angle subtended by a chord (i.e., the straight 3D Cartesian line
|
|
3
|
+
* segment connecting two points on the unit sphere). Its representation makes it very efficient for
|
|
4
|
+
* computing and comparing distances, but unlike S1Angle it is only capable of representing angles
|
|
5
|
+
* between 0 and Pi radians. Generally, S1ChordAngle should only be used in loops where many angles
|
|
6
|
+
* need to be calculated and compared. Otherwise it is simpler to use S1Angle.
|
|
7
|
+
*
|
|
8
|
+
* <p>S1ChordAngle also loses some accuracy as the angle approaches Pi radians. Specifically, the
|
|
9
|
+
* representation of (Pi - x) radians can be expected to have an error of about (1e-15 / x), with a
|
|
10
|
+
* maximum error of about 1e-7.
|
|
11
|
+
*/
|
|
12
|
+
import { S1Angle } from './S1Angle';
|
|
13
|
+
import { S2Point } from './S2Point';
|
|
14
|
+
export declare class S1ChordAngle {
|
|
15
|
+
/** Max value that can be returned from {@link #getLength2()}. */
|
|
16
|
+
static MAX_LENGTH2: number;
|
|
17
|
+
/** The zero chord angle. */
|
|
18
|
+
static ZERO: S1ChordAngle;
|
|
19
|
+
/** The chord angle of 90 degrees (a "right angle"). */
|
|
20
|
+
static RIGHT: S1ChordAngle;
|
|
21
|
+
/** The chord angle of 180 degrees (a "straight angle"). This is the max finite chord angle. */
|
|
22
|
+
static STRAIGHT: S1ChordAngle;
|
|
23
|
+
/**
|
|
24
|
+
* A chord angle larger than any finite chord angle. The only valid operations on {@code INFINITY}
|
|
25
|
+
* are comparisons and {@link S1Angle} conversions.
|
|
26
|
+
*/
|
|
27
|
+
static INFINITY: S1ChordAngle;
|
|
28
|
+
/**
|
|
29
|
+
* A chord angle smaller than {@link #ZERO}. The only valid operations on {@code NEGATIVE} are
|
|
30
|
+
* comparisons and {@link S1Angle} conversions.
|
|
31
|
+
*/
|
|
32
|
+
static NEGATIVE: S1ChordAngle;
|
|
33
|
+
private length2;
|
|
34
|
+
/**
|
|
35
|
+
* S1ChordAngles are represented by the squared chord length, which can range from 0 to {@code
|
|
36
|
+
* MAX_LENGTH2}. {@link #INFINITY} uses an infinite squared length.
|
|
37
|
+
*/
|
|
38
|
+
constructor(length2: number);
|
|
39
|
+
/**
|
|
40
|
+
* Constructs the S1ChordAngle corresponding to the distance between the two given points. The
|
|
41
|
+
* points must be unit length.
|
|
42
|
+
*/
|
|
43
|
+
static fromS2Point(x: S2Point, y: S2Point): S1ChordAngle;
|
|
44
|
+
/**
|
|
45
|
+
* Returns a new chord angle approximated from {@code angle} (see {@link
|
|
46
|
+
* #getS1AngleConstructorMaxError()} for the max magnitude of the error).
|
|
47
|
+
*
|
|
48
|
+
* <p>Angles outside the range [0, Pi] are handled as follows:
|
|
49
|
+
*
|
|
50
|
+
* <ul>
|
|
51
|
+
* <li>{@link S1Angle#INFINITY} is mapped to {@link #INFINITY}
|
|
52
|
+
* <li>negative angles are mapped to {@link #NEGATIVE}
|
|
53
|
+
* <li>finite angles larger than Pi are mapped to {@link #STRAIGHT}
|
|
54
|
+
* </ul>
|
|
55
|
+
*
|
|
56
|
+
* <p>Note that this operation is relatively expensive and should be avoided. To use {@link
|
|
57
|
+
* S1ChordAngle} effectively, you should structure your code so that input arguments are converted
|
|
58
|
+
* to S1ChordAngles at the beginning of your algorithm, and results are converted back to {@link
|
|
59
|
+
* S1Angle}s only at the end.
|
|
60
|
+
*/
|
|
61
|
+
static fromS1Angle(angle: S1Angle): S1ChordAngle;
|
|
62
|
+
/**
|
|
63
|
+
* Construct an S1ChordAngle from the squared chord length. Note that the argument is
|
|
64
|
+
* automatically clamped to a maximum of {@code MAX_LENGTH2} to handle possible roundoff errors.
|
|
65
|
+
* The argument must be non-negative.
|
|
66
|
+
*/
|
|
67
|
+
static fromLength2(length2: number): S1ChordAngle;
|
|
68
|
+
/** Returns whether the chord distance is exactly 0. */
|
|
69
|
+
isZero(): boolean;
|
|
70
|
+
/** Returns whether the chord distance is negative. */
|
|
71
|
+
isNegative(): boolean;
|
|
72
|
+
/** Returns whether the chord distance is exactly (positive) infinity. */
|
|
73
|
+
isInfinity(): boolean;
|
|
74
|
+
/** Returns true if the angle is negative or infinity. */
|
|
75
|
+
isSpecial(): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Returns true if getLength2() is within the normal range of 0 to 4 (inclusive) or the angle is
|
|
78
|
+
* special.
|
|
79
|
+
*/
|
|
80
|
+
isValid(): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Convert the chord angle to an {@link S1Angle}. {@link #INFINITY} is converted to {@link
|
|
83
|
+
* S1Angle#INFINITY}, and {@link #NEGATIVE} is converted to a negative {@link S1Angle}. This
|
|
84
|
+
* operation is relatively expensive.
|
|
85
|
+
*/
|
|
86
|
+
toAngle(): S1Angle;
|
|
87
|
+
/** The squared length of the chord. (Most clients will not need this.) */
|
|
88
|
+
getLength2(): number;
|
|
89
|
+
/**
|
|
90
|
+
* Returns the smallest representable S1ChordAngle larger than this object. This can be used to
|
|
91
|
+
* convert a "<" comparison to a "<=" comparison.
|
|
92
|
+
*
|
|
93
|
+
* <p>Note the following special cases:
|
|
94
|
+
*
|
|
95
|
+
* <ul>
|
|
96
|
+
* <li>NEGATIVE.successor() == ZERO
|
|
97
|
+
* <li>STRAIGHT.successor() == INFINITY
|
|
98
|
+
* <li>INFINITY.Successor() == INFINITY
|
|
99
|
+
* </ul>
|
|
100
|
+
*/
|
|
101
|
+
/**
|
|
102
|
+
* As {@link #successor}, but returns the largest representable S1ChordAngle less than this
|
|
103
|
+
* object.
|
|
104
|
+
*
|
|
105
|
+
* <p>Note the following special cases:
|
|
106
|
+
*
|
|
107
|
+
* <ul>
|
|
108
|
+
* <li>INFINITY.predecessor() == STRAIGHT
|
|
109
|
+
* <li>ZERO.predecessor() == NEGATIVE
|
|
110
|
+
* <li>NEGATIVE.predecessor() == NEGATIVE
|
|
111
|
+
* </ul>
|
|
112
|
+
*/
|
|
113
|
+
/**
|
|
114
|
+
* Returns a new S1ChordAngle whose chord distance represents the sum of the angular distances
|
|
115
|
+
* represented by the 'a' and 'b' chord angles.
|
|
116
|
+
*
|
|
117
|
+
* <p>Note that this method is much more efficient than converting the chord angles to S1Angles
|
|
118
|
+
* and adding those. It requires only one square root plus a few additions and multiplications.
|
|
119
|
+
*/
|
|
120
|
+
static add(a: S1ChordAngle, b: S1ChordAngle): S1ChordAngle;
|
|
121
|
+
/**
|
|
122
|
+
* Subtract one S1ChordAngle from another.
|
|
123
|
+
*
|
|
124
|
+
* <p>Note that this method is much more efficient than converting the chord angles to S1Angles
|
|
125
|
+
* and adding those. It requires only one square root plus a few additions and multiplications.
|
|
126
|
+
*/
|
|
127
|
+
static sub(a: S1ChordAngle, b: S1ChordAngle): S1ChordAngle;
|
|
128
|
+
/** Returns the smaller of the given instances. */
|
|
129
|
+
static min(a: S1ChordAngle, b: S1ChordAngle): S1ChordAngle;
|
|
130
|
+
/** Returns the larger of the given instances. */
|
|
131
|
+
static max(a: S1ChordAngle, b: S1ChordAngle): S1ChordAngle;
|
|
132
|
+
/** Returns the square of Math.sin(toAngle().radians()), but computed more efficiently. */
|
|
133
|
+
static sin2(a: S1ChordAngle): number;
|
|
134
|
+
/** Returns Math.sin(toAngle().radians()), but computed more efficiently. */
|
|
135
|
+
static sin(a: S1ChordAngle): number;
|
|
136
|
+
/** Returns Math.cos(toAngle().radians()), but computed more efficiently. */
|
|
137
|
+
static cos(a: S1ChordAngle): number;
|
|
138
|
+
/** Returns Math.tan(toAngle().radians()), but computed more efficiently. */
|
|
139
|
+
static tan(a: S1ChordAngle): number;
|
|
140
|
+
/**
|
|
141
|
+
* Returns a new S1ChordAngle that has been adjusted by the given error bound (which can be
|
|
142
|
+
* positive or negative). {@code error} should be the value returned by one of the error bound
|
|
143
|
+
* methods below. For example:
|
|
144
|
+
*
|
|
145
|
+
* <pre>
|
|
146
|
+
* {@code S1ChordAngle a = new S1ChordAngle(x, y);}
|
|
147
|
+
* {@code S1ChordAngle a1 = a.plusError(a.getS2PointConstructorMaxError());}
|
|
148
|
+
* </pre>
|
|
149
|
+
*
|
|
150
|
+
* <p>If this {@link #isSpecial}, we return {@code this}.
|
|
151
|
+
*/
|
|
152
|
+
plusError(error: number): S1ChordAngle;
|
|
153
|
+
/** Returns the error in {@link #fromS1Angle}. */
|
|
154
|
+
getS1AngleConstructorMaxError(): number;
|
|
155
|
+
/**
|
|
156
|
+
* There is a relative error of {@code 2.5 * DBL_EPSILON} when computing the squared distance,
|
|
157
|
+
* plus a relative error of {@code 2 * DBL_EPSILON} and an absolute error of {@code 16 *
|
|
158
|
+
* DBL_EPSILON^2} because the lengths of the input points may differ from 1 by up to {@code 2 *
|
|
159
|
+
* DBL_EPSILON} each. (This is the maximum length error in {@link S2Point#normalize}).
|
|
160
|
+
*/
|
|
161
|
+
getS2PointConstructorMaxError(): number;
|
|
162
|
+
/** Returns the string of the closest {@link S1Angle} to this chord distance. */
|
|
163
|
+
toString(): string;
|
|
164
|
+
compareTo(that: S1ChordAngle): number;
|
|
165
|
+
equals(that: S1ChordAngle): boolean;
|
|
166
|
+
}
|