nodes2ts 2.0.0 → 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 +21 -5
- package/dist/Interval.js +9 -8
- 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.js +39 -48
- package/dist/R1Interval.js.map +1 -1
- package/dist/R2Vector.d.ts +3 -3
- package/dist/R2Vector.js +50 -57
- package/dist/R2Vector.js.map +1 -1
- package/dist/S1Angle.d.ts +34 -0
- package/dist/S1Angle.js +81 -26
- 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.js +78 -83
- package/dist/S1Interval.js.map +1 -1
- package/dist/S2.d.ts +5 -0
- package/dist/S2.js +80 -85
- package/dist/S2.js.map +1 -1
- package/dist/S2Cap.d.ts +31 -22
- package/dist/S2Cap.js +194 -187
- package/dist/S2Cap.js.map +1 -1
- package/dist/S2Cell.d.ts +14 -11
- package/dist/S2Cell.js +194 -197
- package/dist/S2Cell.js.map +1 -1
- package/dist/S2CellId.d.ts +37 -14
- package/dist/S2CellId.js +406 -356
- package/dist/S2CellId.js.map +1 -1
- package/dist/S2CellUnion.d.ts +1 -2
- package/dist/S2CellUnion.js +131 -126
- package/dist/S2CellUnion.js.map +1 -1
- package/dist/S2EdgeUtil.js +12 -14
- package/dist/S2EdgeUtil.js.map +1 -1
- package/dist/S2LatLng.d.ts +7 -2
- package/dist/S2LatLng.js +85 -81
- package/dist/S2LatLng.js.map +1 -1
- package/dist/S2LatLngRect.d.ts +7 -2
- package/dist/S2LatLngRect.js +203 -184
- package/dist/S2LatLngRect.js.map +1 -1
- package/dist/S2Metric.d.ts +1 -1
- package/dist/S2Metric.js +28 -24
- package/dist/S2Metric.js.map +1 -1
- package/dist/S2Point.d.ts +35 -0
- package/dist/S2Point.js +116 -66
- package/dist/S2Point.js.map +1 -1
- package/dist/S2Projections.d.ts +40 -5
- 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 -108
- package/dist/S2RegionCoverer.js.map +1 -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 +27 -21
- package/yarn.lock +0 -4381
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,KAA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AC1C;IACH,CAAC;IAEM,IAAI,CAAC,KAAK;QACf,OAAO,KAAK,IAAI,CAAC,CAAA,CAAC,CAAA,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC;IACM,QAAQ;QACb,OAAO,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,GAAG,CAAC;IAClE,CAAC;CAEF;AA7ID,4BA6IC"}
|
package/dist/S1Angle.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { S2Point } from "./S2Point";
|
|
2
2
|
export declare class S1Angle {
|
|
3
|
+
static INFINITY: S1Angle;
|
|
4
|
+
static ZERO: S1Angle;
|
|
3
5
|
radians: number;
|
|
4
6
|
constructor(radians: number);
|
|
5
7
|
degrees(): number;
|
|
@@ -15,7 +17,38 @@ export declare class S1Angle {
|
|
|
15
17
|
greaterOrEquals(that: S1Angle): boolean;
|
|
16
18
|
static max(left: S1Angle, right: S1Angle): S1Angle;
|
|
17
19
|
static min(left: S1Angle, right: S1Angle): S1Angle;
|
|
20
|
+
static radians(radians: number): S1Angle;
|
|
18
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;
|
|
19
52
|
/**
|
|
20
53
|
* Writes the angle in degrees with a "d" suffix, e.g. "17.3745d". By default
|
|
21
54
|
* 6 digits are printed; this can be changed using setprecision(). Up to 17
|
|
@@ -23,4 +56,5 @@ export declare class S1Angle {
|
|
|
23
56
|
*/
|
|
24
57
|
toString(): string;
|
|
25
58
|
compareTo(that: S1Angle): number;
|
|
59
|
+
equals(that: S1Angle): boolean;
|
|
26
60
|
}
|
package/dist/S1Angle.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.S1Angle = void 0;
|
|
4
|
+
class S1Angle {
|
|
5
|
+
constructor(radians) {
|
|
4
6
|
this.radians = radians;
|
|
5
7
|
}
|
|
6
|
-
|
|
8
|
+
degrees() {
|
|
7
9
|
return this.radians * 180 / Math.PI;
|
|
8
|
-
}
|
|
10
|
+
}
|
|
9
11
|
//
|
|
10
12
|
// public long e5() {
|
|
11
13
|
// return Math.round(degrees() * 1e5);
|
|
@@ -23,30 +25,79 @@ var S1Angle = (function () {
|
|
|
23
25
|
* between these points on the unit sphere. The points do not need to be
|
|
24
26
|
* normalized.
|
|
25
27
|
*/
|
|
26
|
-
|
|
28
|
+
static fromPoints(x, y) {
|
|
27
29
|
return new S1Angle(x.angle(y));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
+
}
|
|
31
|
+
lessThan(that) {
|
|
30
32
|
return this.radians < (that.radians);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
+
}
|
|
34
|
+
greaterThan(that) {
|
|
33
35
|
return this.radians > (that.radians);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
+
}
|
|
37
|
+
lessOrEquals(that) {
|
|
36
38
|
return this.radians <= (that.radians);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
+
}
|
|
40
|
+
greaterOrEquals(that) {
|
|
39
41
|
return this.radians >= (that.radians);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
+
}
|
|
43
|
+
static max(left, right) {
|
|
42
44
|
return right.greaterThan(left) ? right : left;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
+
}
|
|
46
|
+
static min(left, right) {
|
|
45
47
|
return right.greaterThan(left) ? left : right;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
+
}
|
|
49
|
+
static radians(radians) {
|
|
50
|
+
return new S1Angle(radians);
|
|
51
|
+
}
|
|
52
|
+
static degrees(degrees) {
|
|
48
53
|
return new S1Angle(degrees * (Math.PI / 180));
|
|
49
|
-
}
|
|
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
|
+
}
|
|
50
101
|
//
|
|
51
102
|
// public static S1Angle e5(long e5) {
|
|
52
103
|
// return degrees(e5 * 1e-5);
|
|
@@ -66,13 +117,17 @@ var S1Angle = (function () {
|
|
|
66
117
|
* 6 digits are printed; this can be changed using setprecision(). Up to 17
|
|
67
118
|
* digits are required to distinguish one angle from another.
|
|
68
119
|
*/
|
|
69
|
-
|
|
120
|
+
toString() {
|
|
70
121
|
return this.degrees() + "d";
|
|
71
|
-
}
|
|
72
|
-
|
|
122
|
+
}
|
|
123
|
+
compareTo(that) {
|
|
73
124
|
return this.radians < that.radians ? -1 : this.radians > that.radians ? 1 : 0;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
125
|
+
}
|
|
126
|
+
equals(that) {
|
|
127
|
+
return this.compareTo(that) === 0;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
77
130
|
exports.S1Angle = S1Angle;
|
|
131
|
+
S1Angle.INFINITY = new S1Angle(Number.POSITIVE_INFINITY);
|
|
132
|
+
S1Angle.ZERO = new S1Angle(0);
|
|
78
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":"
|
|
1
|
+
{"version":3,"file":"S1Angle.js","sourceRoot":"","sources":["../src/S1Angle.ts"],"names":[],"mappings":";;;AAEA,MAAa,OAAO;IAMlB,YAAY,OAAe;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAGM,OAAO;QACZ,OAAO,IAAI,CAAC,OAAO,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;IACtC,CAAC;IAED,EAAE;IACF,qBAAqB;IACrB,wCAAwC;IACxC,IAAI;IACJ,EAAE;IACF,qBAAqB;IACrB,wCAAwC;IACxC,IAAI;IACJ,EAAE;IACF,qBAAqB;IACrB,wCAAwC;IACxC,IAAI;IAEJ;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,CAAU,EAAE,CAAU;QACtC,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;IAEM,QAAQ,CAAC,IAAa;QAC3B,OAAO,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAEM,WAAW,CAAC,IAAa;QAC9B,OAAO,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAEM,YAAY,CAAC,IAAa;QAC/B,OAAO,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAEM,eAAe,CAAC,IAAa;QAClC,OAAO,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,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AC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACI,GAAG;QACR,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,8EAA8E;IACvE,QAAQ,CAAC,MAAc;QAC5B,OAAO,IAAI,CAAC,OAAO,GAAG,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
|
+
}
|