@itowns/geographic 2.46.1-next.53 → 2.46.1-next.55
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/lib/Coordinates.d.ts +12 -0
- package/lib/Coordinates.js +12 -0
- package/lib/Crs.d.ts +6 -3
- package/lib/Crs.js +6 -3
- package/lib/Ellipsoid.d.ts +3 -0
- package/lib/Ellipsoid.js +4 -1
- package/lib/Extent.d.ts +21 -6
- package/lib/Extent.js +21 -6
- package/lib/OrientationUtils.d.ts +4 -4
- package/lib/OrientationUtils.js +1 -0
- package/package.json +1 -1
- package/src/Coordinates.ts +16 -4
- package/src/Crs.ts +12 -9
- package/src/Ellipsoid.ts +6 -3
- package/src/Extent.ts +28 -13
- package/src/OrientationUtils.ts +3 -2
package/lib/Coordinates.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ declare class Coordinates {
|
|
|
65
65
|
/**
|
|
66
66
|
* Sets the Coordinate Reference System.
|
|
67
67
|
* @param crs - Coordinate Reference System (e.g. 'EPSG:4978')
|
|
68
|
+
* @returns
|
|
68
69
|
*/
|
|
69
70
|
setCrs(crs: ProjectionLike): this;
|
|
70
71
|
/**
|
|
@@ -73,6 +74,7 @@ declare class Coordinates {
|
|
|
73
74
|
* @param x - x or longitude value.
|
|
74
75
|
* @param y - y or latitude value.
|
|
75
76
|
* @param z - z or altitude value.
|
|
77
|
+
* @returns
|
|
76
78
|
*/
|
|
77
79
|
setFromValues(x?: number, y?: number, z?: number): this;
|
|
78
80
|
/**
|
|
@@ -83,6 +85,7 @@ declare class Coordinates {
|
|
|
83
85
|
*
|
|
84
86
|
* @param array - The source array.
|
|
85
87
|
* @param offset - Optional offset into the array. Default is 0.
|
|
88
|
+
* @returns
|
|
86
89
|
*/
|
|
87
90
|
setFromArray(array: number[], offset?: number): this;
|
|
88
91
|
/**
|
|
@@ -91,11 +94,13 @@ declare class Coordinates {
|
|
|
91
94
|
* properties.
|
|
92
95
|
*
|
|
93
96
|
* @param v - The source object.
|
|
97
|
+
* @returns
|
|
94
98
|
*/
|
|
95
99
|
setFromVector3(v: Vector3Like): this;
|
|
96
100
|
/**
|
|
97
101
|
* Returns a new coordinate with the same `(x, y, z)` vector and crs as this
|
|
98
102
|
* one.
|
|
103
|
+
* @returns
|
|
99
104
|
*/
|
|
100
105
|
clone(): Coordinates;
|
|
101
106
|
/**
|
|
@@ -103,6 +108,7 @@ declare class Coordinates {
|
|
|
103
108
|
* to this coordinate.
|
|
104
109
|
*
|
|
105
110
|
* @param src - The source coordinate to copy from.
|
|
111
|
+
* @returns
|
|
106
112
|
*/
|
|
107
113
|
copy(src: CoordinatesLike): this;
|
|
108
114
|
get longitude(): number;
|
|
@@ -111,6 +117,7 @@ declare class Coordinates {
|
|
|
111
117
|
set altitude(value: number);
|
|
112
118
|
/**
|
|
113
119
|
* The geodesic normal of the coordinate.
|
|
120
|
+
* @returns
|
|
114
121
|
*/
|
|
115
122
|
get geodesicNormal(): Vector3;
|
|
116
123
|
/**
|
|
@@ -138,12 +145,16 @@ declare class Coordinates {
|
|
|
138
145
|
* Computes the planar distance from this coordinates to `coord`.
|
|
139
146
|
* **Planar distance** is the straight-line euclidean distance calculated in
|
|
140
147
|
* a 2D cartesian coordinate system.
|
|
148
|
+
* @param coord
|
|
149
|
+
* @returns
|
|
141
150
|
*/
|
|
142
151
|
planarDistanceTo(coord: Coordinates): number;
|
|
143
152
|
/**
|
|
144
153
|
* Computes the geodetic distance from this coordinates to `coord`.
|
|
145
154
|
* **Geodetic distance** is calculated in an ellipsoid space as the shortest
|
|
146
155
|
* distance across the curved surface of the ellipsoid.
|
|
156
|
+
* @param coord
|
|
157
|
+
* @returns
|
|
147
158
|
*/
|
|
148
159
|
geodeticDistanceTo(coord: Coordinates): number;
|
|
149
160
|
/**
|
|
@@ -159,6 +170,7 @@ declare class Coordinates {
|
|
|
159
170
|
* by `mat`, and divides by perspective.
|
|
160
171
|
*
|
|
161
172
|
* @param mat - The matrix.
|
|
173
|
+
* @returns
|
|
162
174
|
*/
|
|
163
175
|
applyMatrix4(mat: Matrix4): this;
|
|
164
176
|
/**
|
package/lib/Coordinates.js
CHANGED
|
@@ -93,6 +93,7 @@ class Coordinates {
|
|
|
93
93
|
/**
|
|
94
94
|
* Sets the Coordinate Reference System.
|
|
95
95
|
* @param crs - Coordinate Reference System (e.g. 'EPSG:4978')
|
|
96
|
+
* @returns
|
|
96
97
|
*/
|
|
97
98
|
setCrs(crs) {
|
|
98
99
|
CRS.isValid(crs);
|
|
@@ -106,6 +107,7 @@ class Coordinates {
|
|
|
106
107
|
* @param x - x or longitude value.
|
|
107
108
|
* @param y - y or latitude value.
|
|
108
109
|
* @param z - z or altitude value.
|
|
110
|
+
* @returns
|
|
109
111
|
*/
|
|
110
112
|
setFromValues(x = 0, y = 0, z = 0) {
|
|
111
113
|
this.x = x;
|
|
@@ -123,6 +125,7 @@ class Coordinates {
|
|
|
123
125
|
*
|
|
124
126
|
* @param array - The source array.
|
|
125
127
|
* @param offset - Optional offset into the array. Default is 0.
|
|
128
|
+
* @returns
|
|
126
129
|
*/
|
|
127
130
|
setFromArray(array, offset = 0) {
|
|
128
131
|
return this.setFromValues(array[offset], array[offset + 1], array[offset + 2]);
|
|
@@ -134,6 +137,7 @@ class Coordinates {
|
|
|
134
137
|
* properties.
|
|
135
138
|
*
|
|
136
139
|
* @param v - The source object.
|
|
140
|
+
* @returns
|
|
137
141
|
*/
|
|
138
142
|
setFromVector3(v) {
|
|
139
143
|
return this.setFromValues(v.x, v.y, v.z);
|
|
@@ -142,6 +146,7 @@ class Coordinates {
|
|
|
142
146
|
/**
|
|
143
147
|
* Returns a new coordinate with the same `(x, y, z)` vector and crs as this
|
|
144
148
|
* one.
|
|
149
|
+
* @returns
|
|
145
150
|
*/
|
|
146
151
|
clone() {
|
|
147
152
|
return new Coordinates(this.crs, this.x, this.y, this.z);
|
|
@@ -152,6 +157,7 @@ class Coordinates {
|
|
|
152
157
|
* to this coordinate.
|
|
153
158
|
*
|
|
154
159
|
* @param src - The source coordinate to copy from.
|
|
160
|
+
* @returns
|
|
155
161
|
*/
|
|
156
162
|
copy(src) {
|
|
157
163
|
this.crs = src.crs;
|
|
@@ -172,6 +178,7 @@ class Coordinates {
|
|
|
172
178
|
|
|
173
179
|
/**
|
|
174
180
|
* The geodesic normal of the coordinate.
|
|
181
|
+
* @returns
|
|
175
182
|
*/
|
|
176
183
|
get geodesicNormal() {
|
|
177
184
|
if (this._normalNeedsUpdate) {
|
|
@@ -218,6 +225,8 @@ class Coordinates {
|
|
|
218
225
|
* Computes the planar distance from this coordinates to `coord`.
|
|
219
226
|
* **Planar distance** is the straight-line euclidean distance calculated in
|
|
220
227
|
* a 2D cartesian coordinate system.
|
|
228
|
+
* @param coord
|
|
229
|
+
* @returns
|
|
221
230
|
*/
|
|
222
231
|
planarDistanceTo(coord) {
|
|
223
232
|
this.toVector3(v0).setZ(0);
|
|
@@ -229,6 +238,8 @@ class Coordinates {
|
|
|
229
238
|
* Computes the geodetic distance from this coordinates to `coord`.
|
|
230
239
|
* **Geodetic distance** is calculated in an ellipsoid space as the shortest
|
|
231
240
|
* distance across the curved surface of the ellipsoid.
|
|
241
|
+
* @param coord
|
|
242
|
+
* @returns
|
|
232
243
|
*/
|
|
233
244
|
geodeticDistanceTo(coord) {
|
|
234
245
|
this.as('EPSG:4326', coord0);
|
|
@@ -254,6 +265,7 @@ class Coordinates {
|
|
|
254
265
|
* by `mat`, and divides by perspective.
|
|
255
266
|
*
|
|
256
267
|
* @param mat - The matrix.
|
|
268
|
+
* @returns
|
|
257
269
|
*/
|
|
258
270
|
applyMatrix4(mat) {
|
|
259
271
|
Vector3.prototype.applyMatrix4.call(this, mat);
|
package/lib/Crs.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export declare const UNIT: {
|
|
|
31
31
|
* @internal
|
|
32
32
|
*
|
|
33
33
|
* @param crs - The CRS to test.
|
|
34
|
+
* @returns
|
|
34
35
|
*/
|
|
35
36
|
export declare function is4326(crs: ProjectionLike): crs is "EPSG:4326";
|
|
36
37
|
/**
|
|
@@ -44,14 +45,16 @@ export declare function getUnit(crs: ProjectionLike): 1 | 2 | 3 | undefined;
|
|
|
44
45
|
* Asserts that the CRS is using metric units.
|
|
45
46
|
*
|
|
46
47
|
* @param crs - The CRS to check.
|
|
47
|
-
* @
|
|
48
|
+
* @returns
|
|
49
|
+
* @throws {Error} if the CRS is not valid.
|
|
48
50
|
*/
|
|
49
51
|
export declare function isMetricUnit(crs: ProjectionLike): boolean;
|
|
50
52
|
/**
|
|
51
53
|
* Asserts that the CRS is geographic.
|
|
52
54
|
*
|
|
53
55
|
* @param crs - The CRS to check.
|
|
54
|
-
* @
|
|
56
|
+
* @returns
|
|
57
|
+
* @throws {Error} if the CRS is not valid.
|
|
55
58
|
*/
|
|
56
59
|
export declare function isGeographic(crs: ProjectionLike): boolean;
|
|
57
60
|
/**
|
|
@@ -66,7 +69,7 @@ export declare function isGeocentric(crs: ProjectionLike): boolean;
|
|
|
66
69
|
* includes an unit.
|
|
67
70
|
*
|
|
68
71
|
* @param crs - The CRS to test.
|
|
69
|
-
* @throws {
|
|
72
|
+
* @throws {Error} if the crs is not valid.
|
|
70
73
|
*/
|
|
71
74
|
export declare function isValid(crs: ProjectionLike): void;
|
|
72
75
|
/**
|
package/lib/Crs.js
CHANGED
|
@@ -58,6 +58,7 @@ export const UNIT = {
|
|
|
58
58
|
* @internal
|
|
59
59
|
*
|
|
60
60
|
* @param crs - The CRS to test.
|
|
61
|
+
* @returns
|
|
61
62
|
*/
|
|
62
63
|
export function is4326(crs) {
|
|
63
64
|
return crs === 'EPSG:4326';
|
|
@@ -97,7 +98,8 @@ export function getUnit(crs) {
|
|
|
97
98
|
* Asserts that the CRS is using metric units.
|
|
98
99
|
*
|
|
99
100
|
* @param crs - The CRS to check.
|
|
100
|
-
* @
|
|
101
|
+
* @returns
|
|
102
|
+
* @throws {Error} if the CRS is not valid.
|
|
101
103
|
*/
|
|
102
104
|
export function isMetricUnit(crs) {
|
|
103
105
|
return getUnit(crs) === UNIT.METER;
|
|
@@ -107,7 +109,8 @@ export function isMetricUnit(crs) {
|
|
|
107
109
|
* Asserts that the CRS is geographic.
|
|
108
110
|
*
|
|
109
111
|
* @param crs - The CRS to check.
|
|
110
|
-
* @
|
|
112
|
+
* @returns
|
|
113
|
+
* @throws {Error} if the CRS is not valid.
|
|
111
114
|
*/
|
|
112
115
|
export function isGeographic(crs) {
|
|
113
116
|
return getUnit(crs) === UNIT.DEGREE;
|
|
@@ -130,7 +133,7 @@ export function isGeocentric(crs) {
|
|
|
130
133
|
* includes an unit.
|
|
131
134
|
*
|
|
132
135
|
* @param crs - The CRS to test.
|
|
133
|
-
* @throws {
|
|
136
|
+
* @throws {Error} if the crs is not valid.
|
|
134
137
|
*/
|
|
135
138
|
export function isValid(crs) {
|
|
136
139
|
const proj = proj4.defs(crs);
|
package/lib/Ellipsoid.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ declare class Ellipsoid {
|
|
|
28
28
|
* @param cartesian - The given cartesian coordinate.
|
|
29
29
|
* @param target - An object to store this vector to. If this is not
|
|
30
30
|
* specified, a new vector will be created.
|
|
31
|
+
* @returns
|
|
31
32
|
*/
|
|
32
33
|
geodeticSurfaceNormal(cartesian: Coordinates, target?: Vector3): Vector3;
|
|
33
34
|
/**
|
|
@@ -37,6 +38,7 @@ declare class Ellipsoid {
|
|
|
37
38
|
* @param coordCarto - The given geographic coordinate.
|
|
38
39
|
* @param target - An object to store this vector to. If this is not
|
|
39
40
|
* specified, a new vector will be created.
|
|
41
|
+
* @returns
|
|
40
42
|
*/
|
|
41
43
|
geodeticSurfaceNormalCartographic(coordCarto: Coordinates, target?: Vector3): Vector3;
|
|
42
44
|
/**
|
|
@@ -45,6 +47,7 @@ declare class Ellipsoid {
|
|
|
45
47
|
* properties.
|
|
46
48
|
*
|
|
47
49
|
* @param size - The source vector.
|
|
50
|
+
* @returns
|
|
48
51
|
*/
|
|
49
52
|
setSize(size: Vector3Like): this;
|
|
50
53
|
cartographicToCartesian(coordCarto: Coordinates, target?: Vector3): Vector3;
|
package/lib/Ellipsoid.js
CHANGED
|
@@ -36,6 +36,7 @@ class Ellipsoid {
|
|
|
36
36
|
* @param cartesian - The given cartesian coordinate.
|
|
37
37
|
* @param target - An object to store this vector to. If this is not
|
|
38
38
|
* specified, a new vector will be created.
|
|
39
|
+
* @returns
|
|
39
40
|
*/
|
|
40
41
|
geodeticSurfaceNormal(cartesian, target = new Vector3()) {
|
|
41
42
|
return cartesian.toVector3(target).multiply(this._invRadiiSquared).normalize();
|
|
@@ -48,6 +49,7 @@ class Ellipsoid {
|
|
|
48
49
|
* @param coordCarto - The given geographic coordinate.
|
|
49
50
|
* @param target - An object to store this vector to. If this is not
|
|
50
51
|
* specified, a new vector will be created.
|
|
52
|
+
* @returns
|
|
51
53
|
*/
|
|
52
54
|
geodeticSurfaceNormalCartographic(coordCarto, target = new Vector3()) {
|
|
53
55
|
const longitude = MathUtils.degToRad(coordCarto.longitude);
|
|
@@ -62,6 +64,7 @@ class Ellipsoid {
|
|
|
62
64
|
* properties.
|
|
63
65
|
*
|
|
64
66
|
* @param size - The source vector.
|
|
67
|
+
* @returns
|
|
65
68
|
*/
|
|
66
69
|
setSize(size) {
|
|
67
70
|
this.size.set(size.x, size.y, size.z);
|
|
@@ -134,7 +137,7 @@ class Ellipsoid {
|
|
|
134
137
|
// both intersections are behind the ray origin
|
|
135
138
|
return false;
|
|
136
139
|
}
|
|
137
|
-
let t
|
|
140
|
+
let t;
|
|
138
141
|
if (t1 <= EPSILON) {
|
|
139
142
|
t = t2;
|
|
140
143
|
} else if (t2 <= EPSILON) {
|
package/lib/Extent.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ declare class Extent {
|
|
|
51
51
|
constructor(crs: ProjectionLike, west?: number, east?: number, south?: number, north?: number);
|
|
52
52
|
/**
|
|
53
53
|
* Returns a new extent with the same bounds and crs as this one.
|
|
54
|
+
* @returns
|
|
54
55
|
*/
|
|
55
56
|
clone(): Extent;
|
|
56
57
|
/**
|
|
@@ -59,6 +60,7 @@ declare class Extent {
|
|
|
59
60
|
* @param crs - target's projection.
|
|
60
61
|
* @param target - The target to store the projected extent. If this not
|
|
61
62
|
* provided a new extent will be created.
|
|
63
|
+
* @returns
|
|
62
64
|
*/
|
|
63
65
|
as(crs: string, target?: Extent): Extent;
|
|
64
66
|
/**
|
|
@@ -66,6 +68,7 @@ declare class Extent {
|
|
|
66
68
|
*
|
|
67
69
|
* @param target - The target to store the center coordinate. If this not
|
|
68
70
|
* provided a new coordinate will be created.
|
|
71
|
+
* @returns
|
|
69
72
|
*/
|
|
70
73
|
center(target?: Coordinates): Coordinates;
|
|
71
74
|
/**
|
|
@@ -75,6 +78,7 @@ declare class Extent {
|
|
|
75
78
|
* 2D Cartesian coordinate system.
|
|
76
79
|
*
|
|
77
80
|
* @param target - optional target
|
|
81
|
+
* @returns
|
|
78
82
|
*/
|
|
79
83
|
planarDimensions(target?: Vector2): Vector2;
|
|
80
84
|
/**
|
|
@@ -84,6 +88,7 @@ declare class Extent {
|
|
|
84
88
|
* across the curved surface of the ellipsoid.
|
|
85
89
|
*
|
|
86
90
|
* @param target - optional target
|
|
91
|
+
* @returns
|
|
87
92
|
*/
|
|
88
93
|
geodeticDimensions(target?: Vector2): Vector2;
|
|
89
94
|
/**
|
|
@@ -92,6 +97,7 @@ declare class Extent {
|
|
|
92
97
|
* Spatial euclidean distance chord is calculated in an ellispoid space.
|
|
93
98
|
*
|
|
94
99
|
* @param target - optional target
|
|
100
|
+
* @returns
|
|
95
101
|
*/
|
|
96
102
|
spatialEuclideanDimensions(target?: Vector2): Vector2;
|
|
97
103
|
/**
|
|
@@ -100,6 +106,7 @@ declare class Extent {
|
|
|
100
106
|
* @param coord - the given coordinates.
|
|
101
107
|
* @param epsilon - error margin when comparing to the coordinates.
|
|
102
108
|
* Default is 0.
|
|
109
|
+
* @returns
|
|
103
110
|
*/
|
|
104
111
|
isPointInside(coord: Coordinates, epsilon?: number): boolean;
|
|
105
112
|
/**
|
|
@@ -107,6 +114,7 @@ declare class Extent {
|
|
|
107
114
|
*
|
|
108
115
|
* @param extent - the extent to check
|
|
109
116
|
* @param epsilon - error margin when comparing the extent bounds.
|
|
117
|
+
* @returns
|
|
110
118
|
*/
|
|
111
119
|
isInside(extent: Extent, epsilon?: number): boolean;
|
|
112
120
|
/**
|
|
@@ -125,6 +133,7 @@ declare class Extent {
|
|
|
125
133
|
* Checks wheter this bounding box intersects with the given extent
|
|
126
134
|
* parameter.
|
|
127
135
|
* @param extent - the provided extent
|
|
136
|
+
* @returns
|
|
128
137
|
*/
|
|
129
138
|
intersectsExtent(extent: Extent): boolean;
|
|
130
139
|
/**
|
|
@@ -166,6 +175,7 @@ declare class Extent {
|
|
|
166
175
|
* @param v1 - the `east` value of this extent. Default is 0.
|
|
167
176
|
* @param v2 - the `south` value of this extent. Default is 0.
|
|
168
177
|
* @param v3 - the `north` value of this extent. Default is 0.
|
|
178
|
+
* @returns
|
|
169
179
|
*/
|
|
170
180
|
set(v0: number, v1: number, v2: number, v3: number): this;
|
|
171
181
|
/**
|
|
@@ -174,22 +184,26 @@ declare class Extent {
|
|
|
174
184
|
* `north` property to `array[offset + 3]`.
|
|
175
185
|
* @param array - the source array
|
|
176
186
|
* @param offset - offset into the array. Default is 0.
|
|
187
|
+
* @returns
|
|
177
188
|
*/
|
|
178
189
|
setFromArray(array: ArrayLike<number>, offset?: number): this;
|
|
179
190
|
/**
|
|
180
191
|
* Sets this extent `west`, `east`, `south` and `north` properties from an
|
|
181
192
|
* `extent` bounds.
|
|
182
193
|
* @param extent - the source extent
|
|
194
|
+
* @returns
|
|
183
195
|
*/
|
|
184
196
|
setFromExtent(extent: ExtentLike): this;
|
|
185
197
|
/**
|
|
186
198
|
* Copies the passed extent to this extent.
|
|
187
199
|
* @param extent - extent to copy.
|
|
200
|
+
* @returns
|
|
188
201
|
*/
|
|
189
202
|
copy(extent: Extent): this;
|
|
190
203
|
/**
|
|
191
204
|
* Union this extent with the input extent.
|
|
192
205
|
* @param extent - the extent to union.
|
|
206
|
+
* @returns
|
|
193
207
|
*/
|
|
194
208
|
union(extent: Extent): this;
|
|
195
209
|
/**
|
|
@@ -199,12 +213,11 @@ declare class Extent {
|
|
|
199
213
|
*/
|
|
200
214
|
expandByCoordinates(coordinates: Coordinates): void;
|
|
201
215
|
/**
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
*/
|
|
216
|
+
* expandByValuesCoordinates perfoms the minimal extension
|
|
217
|
+
* for the coordinates values to belong to this Extent object
|
|
218
|
+
* @param we - The coordinate on west-east
|
|
219
|
+
* @param sn - The coordinate on south-north
|
|
220
|
+
*/
|
|
208
221
|
expandByValuesCoordinates(we: number, sn: number): void;
|
|
209
222
|
/**
|
|
210
223
|
* Instance Extent with THREE.Box3.
|
|
@@ -215,11 +228,13 @@ declare class Extent {
|
|
|
215
228
|
*
|
|
216
229
|
* @param crs - Projection of extent to instancied.
|
|
217
230
|
* @param box - Bounding-box
|
|
231
|
+
* @returns
|
|
218
232
|
*/
|
|
219
233
|
static fromBox3(crs: ProjectionLike, box: Box3): Extent;
|
|
220
234
|
/**
|
|
221
235
|
* Return values of extent in string, separated by the separator input.
|
|
222
236
|
* @param sep - string separator
|
|
237
|
+
* @returns
|
|
223
238
|
*/
|
|
224
239
|
toString(sep?: string): string;
|
|
225
240
|
/**
|
package/lib/Extent.js
CHANGED
|
@@ -69,6 +69,7 @@ class Extent {
|
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* Returns a new extent with the same bounds and crs as this one.
|
|
72
|
+
* @returns
|
|
72
73
|
*/
|
|
73
74
|
clone() {
|
|
74
75
|
return new Extent(this.crs, this.west, this.east, this.south, this.north);
|
|
@@ -80,6 +81,7 @@ class Extent {
|
|
|
80
81
|
* @param crs - target's projection.
|
|
81
82
|
* @param target - The target to store the projected extent. If this not
|
|
82
83
|
* provided a new extent will be created.
|
|
84
|
+
* @returns
|
|
83
85
|
*/
|
|
84
86
|
as(crs, target = new Extent('EPSG:4326')) {
|
|
85
87
|
CRS.isValid(crs);
|
|
@@ -120,6 +122,7 @@ class Extent {
|
|
|
120
122
|
*
|
|
121
123
|
* @param target - The target to store the center coordinate. If this not
|
|
122
124
|
* provided a new coordinate will be created.
|
|
125
|
+
* @returns
|
|
123
126
|
*/
|
|
124
127
|
center(target = new Coordinates(this.crs)) {
|
|
125
128
|
this.planarDimensions(_dim);
|
|
@@ -135,6 +138,7 @@ class Extent {
|
|
|
135
138
|
* 2D Cartesian coordinate system.
|
|
136
139
|
*
|
|
137
140
|
* @param target - optional target
|
|
141
|
+
* @returns
|
|
138
142
|
*/
|
|
139
143
|
planarDimensions(target = new Vector2()) {
|
|
140
144
|
// Calculte the dimensions for x and y
|
|
@@ -148,6 +152,7 @@ class Extent {
|
|
|
148
152
|
* across the curved surface of the ellipsoid.
|
|
149
153
|
*
|
|
150
154
|
* @param target - optional target
|
|
155
|
+
* @returns
|
|
151
156
|
*/
|
|
152
157
|
geodeticDimensions(target = new Vector2()) {
|
|
153
158
|
// set 3 corners extent
|
|
@@ -168,6 +173,7 @@ class Extent {
|
|
|
168
173
|
* Spatial euclidean distance chord is calculated in an ellispoid space.
|
|
169
174
|
*
|
|
170
175
|
* @param target - optional target
|
|
176
|
+
* @returns
|
|
171
177
|
*/
|
|
172
178
|
spatialEuclideanDimensions(target = new Vector2()) {
|
|
173
179
|
// set 3 corners extent
|
|
@@ -188,6 +194,7 @@ class Extent {
|
|
|
188
194
|
* @param coord - the given coordinates.
|
|
189
195
|
* @param epsilon - error margin when comparing to the coordinates.
|
|
190
196
|
* Default is 0.
|
|
197
|
+
* @returns
|
|
191
198
|
*/
|
|
192
199
|
isPointInside(coord, epsilon = 0) {
|
|
193
200
|
if (this.crs == coord.crs) {
|
|
@@ -205,6 +212,7 @@ class Extent {
|
|
|
205
212
|
*
|
|
206
213
|
* @param extent - the extent to check
|
|
207
214
|
* @param epsilon - error margin when comparing the extent bounds.
|
|
215
|
+
* @returns
|
|
208
216
|
*/
|
|
209
217
|
isInside(extent, epsilon = CRS.reasonableEpsilon(this.crs)) {
|
|
210
218
|
extent.as(this.crs, _extent);
|
|
@@ -239,6 +247,7 @@ class Extent {
|
|
|
239
247
|
* Checks wheter this bounding box intersects with the given extent
|
|
240
248
|
* parameter.
|
|
241
249
|
* @param extent - the provided extent
|
|
250
|
+
* @returns
|
|
242
251
|
*/
|
|
243
252
|
intersectsExtent(extent) {
|
|
244
253
|
return Extent.intersectsExtent(this, extent);
|
|
@@ -296,6 +305,7 @@ class Extent {
|
|
|
296
305
|
* @param v1 - the `east` value of this extent. Default is 0.
|
|
297
306
|
* @param v2 - the `south` value of this extent. Default is 0.
|
|
298
307
|
* @param v3 - the `north` value of this extent. Default is 0.
|
|
308
|
+
* @returns
|
|
299
309
|
*/
|
|
300
310
|
set(v0, v1, v2, v3) {
|
|
301
311
|
if (v0 == undefined) {
|
|
@@ -327,6 +337,7 @@ class Extent {
|
|
|
327
337
|
* `north` property to `array[offset + 3]`.
|
|
328
338
|
* @param array - the source array
|
|
329
339
|
* @param offset - offset into the array. Default is 0.
|
|
340
|
+
* @returns
|
|
330
341
|
*/
|
|
331
342
|
setFromArray(array, offset = 0) {
|
|
332
343
|
this.west = array[offset];
|
|
@@ -340,6 +351,7 @@ class Extent {
|
|
|
340
351
|
* Sets this extent `west`, `east`, `south` and `north` properties from an
|
|
341
352
|
* `extent` bounds.
|
|
342
353
|
* @param extent - the source extent
|
|
354
|
+
* @returns
|
|
343
355
|
*/
|
|
344
356
|
setFromExtent(extent) {
|
|
345
357
|
this.west = extent.west;
|
|
@@ -352,6 +364,7 @@ class Extent {
|
|
|
352
364
|
/**
|
|
353
365
|
* Copies the passed extent to this extent.
|
|
354
366
|
* @param extent - extent to copy.
|
|
367
|
+
* @returns
|
|
355
368
|
*/
|
|
356
369
|
copy(extent) {
|
|
357
370
|
this.crs = extent.crs;
|
|
@@ -361,6 +374,7 @@ class Extent {
|
|
|
361
374
|
/**
|
|
362
375
|
* Union this extent with the input extent.
|
|
363
376
|
* @param extent - the extent to union.
|
|
377
|
+
* @returns
|
|
364
378
|
*/
|
|
365
379
|
union(extent) {
|
|
366
380
|
if (extent.crs != this.crs) {
|
|
@@ -400,12 +414,11 @@ class Extent {
|
|
|
400
414
|
}
|
|
401
415
|
|
|
402
416
|
/**
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
*/
|
|
417
|
+
* expandByValuesCoordinates perfoms the minimal extension
|
|
418
|
+
* for the coordinates values to belong to this Extent object
|
|
419
|
+
* @param we - The coordinate on west-east
|
|
420
|
+
* @param sn - The coordinate on south-north
|
|
421
|
+
*/
|
|
409
422
|
expandByValuesCoordinates(we, sn) {
|
|
410
423
|
if (we < this.west) {
|
|
411
424
|
this.west = we;
|
|
@@ -430,6 +443,7 @@ class Extent {
|
|
|
430
443
|
*
|
|
431
444
|
* @param crs - Projection of extent to instancied.
|
|
432
445
|
* @param box - Bounding-box
|
|
446
|
+
* @returns
|
|
433
447
|
*/
|
|
434
448
|
static fromBox3(crs, box) {
|
|
435
449
|
if (CRS.isGeocentric(crs)) {
|
|
@@ -452,6 +466,7 @@ class Extent {
|
|
|
452
466
|
/**
|
|
453
467
|
* Return values of extent in string, separated by the separator input.
|
|
454
468
|
* @param sep - string separator
|
|
469
|
+
* @returns
|
|
455
470
|
*/
|
|
456
471
|
toString(sep = '') {
|
|
457
472
|
return `${this.east}${sep}${this.north}${sep}${this.west}${sep}${this.south}`;
|
|
@@ -20,16 +20,16 @@ interface PhotogrammetryAngles {
|
|
|
20
20
|
type Attitude = Partial<EulerAngles> | Partial<PhotogrammetryAngles>;
|
|
21
21
|
type QuaternionFunction = (coords: Coordinates, target?: Quaternion) => Quaternion;
|
|
22
22
|
type ProjectionLike = ProjectionDefinition | string;
|
|
23
|
-
|
|
23
|
+
interface LCCProjection {
|
|
24
24
|
long0: number;
|
|
25
25
|
lat0: number;
|
|
26
|
-
}
|
|
27
|
-
|
|
26
|
+
}
|
|
27
|
+
interface TMercProjection {
|
|
28
28
|
a: number;
|
|
29
29
|
b: number;
|
|
30
30
|
e?: number;
|
|
31
31
|
long0: number;
|
|
32
|
-
}
|
|
32
|
+
}
|
|
33
33
|
/**
|
|
34
34
|
* The transform from the platform frame to the local East, North, Up (ENU)
|
|
35
35
|
* frame is `RotationZ(heading).RotationX(pitch).RotationY(roll)`.
|
package/lib/OrientationUtils.js
CHANGED
|
@@ -263,6 +263,7 @@ export function quaternionFromEnuToLongLat(coordinates, target = new Quaternion(
|
|
|
263
263
|
* identity (0,0,0,1).
|
|
264
264
|
*
|
|
265
265
|
* @param proj - the unimplemented projection (may be parsed using proj4)
|
|
266
|
+
* @param proj.projName - the name of the projection
|
|
266
267
|
* @param coordinates - the origin of the local East North Up (ENU) frame
|
|
267
268
|
* @param target - output Quaternion
|
|
268
269
|
* @returns The target quaternion if coordinates is defined, otherwise, a
|
package/package.json
CHANGED
package/src/Coordinates.ts
CHANGED
|
@@ -77,7 +77,7 @@ class Coordinates {
|
|
|
77
77
|
* @param y - y or latitude value.
|
|
78
78
|
* @param z - z or altitude value.
|
|
79
79
|
*/
|
|
80
|
-
constructor(crs: ProjectionLike, x
|
|
80
|
+
constructor(crs: ProjectionLike, x = 0, y = 0, z = 0) {
|
|
81
81
|
this.isCoordinates = true;
|
|
82
82
|
|
|
83
83
|
CRS.isValid(crs);
|
|
@@ -118,6 +118,7 @@ class Coordinates {
|
|
|
118
118
|
/**
|
|
119
119
|
* Sets the Coordinate Reference System.
|
|
120
120
|
* @param crs - Coordinate Reference System (e.g. 'EPSG:4978')
|
|
121
|
+
* @returns
|
|
121
122
|
*/
|
|
122
123
|
setCrs(crs: ProjectionLike): this {
|
|
123
124
|
CRS.isValid(crs);
|
|
@@ -131,8 +132,9 @@ class Coordinates {
|
|
|
131
132
|
* @param x - x or longitude value.
|
|
132
133
|
* @param y - y or latitude value.
|
|
133
134
|
* @param z - z or altitude value.
|
|
135
|
+
* @returns
|
|
134
136
|
*/
|
|
135
|
-
setFromValues(x
|
|
137
|
+
setFromValues(x = 0, y = 0, z = 0): this {
|
|
136
138
|
this.x = x;
|
|
137
139
|
this.y = y;
|
|
138
140
|
this.z = z;
|
|
@@ -149,8 +151,9 @@ class Coordinates {
|
|
|
149
151
|
*
|
|
150
152
|
* @param array - The source array.
|
|
151
153
|
* @param offset - Optional offset into the array. Default is 0.
|
|
154
|
+
* @returns
|
|
152
155
|
*/
|
|
153
|
-
setFromArray(array: number[], offset
|
|
156
|
+
setFromArray(array: number[], offset = 0): this {
|
|
154
157
|
return this.setFromValues(
|
|
155
158
|
array[offset],
|
|
156
159
|
array[offset + 1],
|
|
@@ -164,6 +167,7 @@ class Coordinates {
|
|
|
164
167
|
* properties.
|
|
165
168
|
*
|
|
166
169
|
* @param v - The source object.
|
|
170
|
+
* @returns
|
|
167
171
|
*/
|
|
168
172
|
setFromVector3(v: Vector3Like): this {
|
|
169
173
|
return this.setFromValues(v.x, v.y, v.z);
|
|
@@ -172,6 +176,7 @@ class Coordinates {
|
|
|
172
176
|
/**
|
|
173
177
|
* Returns a new coordinate with the same `(x, y, z)` vector and crs as this
|
|
174
178
|
* one.
|
|
179
|
+
* @returns
|
|
175
180
|
*/
|
|
176
181
|
clone(): Coordinates {
|
|
177
182
|
return new Coordinates(this.crs, this.x, this.y, this.z);
|
|
@@ -182,6 +187,7 @@ class Coordinates {
|
|
|
182
187
|
* to this coordinate.
|
|
183
188
|
*
|
|
184
189
|
* @param src - The source coordinate to copy from.
|
|
190
|
+
* @returns
|
|
185
191
|
*/
|
|
186
192
|
copy(src: CoordinatesLike): this {
|
|
187
193
|
this.crs = src.crs;
|
|
@@ -206,6 +212,7 @@ class Coordinates {
|
|
|
206
212
|
|
|
207
213
|
/**
|
|
208
214
|
* The geodesic normal of the coordinate.
|
|
215
|
+
* @returns
|
|
209
216
|
*/
|
|
210
217
|
get geodesicNormal() {
|
|
211
218
|
if (this._normalNeedsUpdate) {
|
|
@@ -246,7 +253,7 @@ class Coordinates {
|
|
|
246
253
|
* @returns An array [x, y, z], or copies x, y and z into the provided
|
|
247
254
|
* array.
|
|
248
255
|
*/
|
|
249
|
-
toArray(array: number[] = [], offset
|
|
256
|
+
toArray(array: number[] = [], offset = 0): ArrayLike<number> {
|
|
250
257
|
return Vector3.prototype.toArray.call(this, array, offset);
|
|
251
258
|
}
|
|
252
259
|
|
|
@@ -254,6 +261,8 @@ class Coordinates {
|
|
|
254
261
|
* Computes the planar distance from this coordinates to `coord`.
|
|
255
262
|
* **Planar distance** is the straight-line euclidean distance calculated in
|
|
256
263
|
* a 2D cartesian coordinate system.
|
|
264
|
+
* @param coord
|
|
265
|
+
* @returns
|
|
257
266
|
*/
|
|
258
267
|
planarDistanceTo(coord: Coordinates): number {
|
|
259
268
|
this.toVector3(v0).setZ(0);
|
|
@@ -265,6 +274,8 @@ class Coordinates {
|
|
|
265
274
|
* Computes the geodetic distance from this coordinates to `coord`.
|
|
266
275
|
* **Geodetic distance** is calculated in an ellipsoid space as the shortest
|
|
267
276
|
* distance across the curved surface of the ellipsoid.
|
|
277
|
+
* @param coord
|
|
278
|
+
* @returns
|
|
268
279
|
*/
|
|
269
280
|
geodeticDistanceTo(coord: Coordinates): number {
|
|
270
281
|
this.as('EPSG:4326', coord0);
|
|
@@ -290,6 +301,7 @@ class Coordinates {
|
|
|
290
301
|
* by `mat`, and divides by perspective.
|
|
291
302
|
*
|
|
292
303
|
* @param mat - The matrix.
|
|
304
|
+
* @returns
|
|
293
305
|
*/
|
|
294
306
|
applyMatrix4(mat: Matrix4): this {
|
|
295
307
|
Vector3.prototype.applyMatrix4.call(this, mat);
|
package/src/Crs.ts
CHANGED
|
@@ -2,12 +2,12 @@ import proj4 from 'proj4';
|
|
|
2
2
|
import type { Converter } from 'proj4';
|
|
3
3
|
import type { ProjectionDefinition } from 'proj4/dist/lib/defs';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
type: string
|
|
7
|
-
PROJCS: proj4Def
|
|
8
|
-
unknown?: string
|
|
9
|
-
(alias: string): proj4Def & { name: string }
|
|
10
|
-
title: string
|
|
5
|
+
interface proj4Def {
|
|
6
|
+
type: string;
|
|
7
|
+
PROJCS: proj4Def;
|
|
8
|
+
unknown?: string;
|
|
9
|
+
(alias: string): proj4Def & { name: string };
|
|
10
|
+
title: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
proj4.defs('EPSG:4978', '+proj=geocent +datum=WGS84 +units=m +no_defs');
|
|
@@ -74,6 +74,7 @@ export const UNIT = {
|
|
|
74
74
|
* @internal
|
|
75
75
|
*
|
|
76
76
|
* @param crs - The CRS to test.
|
|
77
|
+
* @returns
|
|
77
78
|
*/
|
|
78
79
|
export function is4326(crs: ProjectionLike) {
|
|
79
80
|
return crs === 'EPSG:4326';
|
|
@@ -114,7 +115,8 @@ export function getUnit(crs: ProjectionLike) {
|
|
|
114
115
|
* Asserts that the CRS is using metric units.
|
|
115
116
|
*
|
|
116
117
|
* @param crs - The CRS to check.
|
|
117
|
-
* @
|
|
118
|
+
* @returns
|
|
119
|
+
* @throws {Error} if the CRS is not valid.
|
|
118
120
|
*/
|
|
119
121
|
export function isMetricUnit(crs: ProjectionLike) {
|
|
120
122
|
return getUnit(crs) === UNIT.METER;
|
|
@@ -124,7 +126,8 @@ export function isMetricUnit(crs: ProjectionLike) {
|
|
|
124
126
|
* Asserts that the CRS is geographic.
|
|
125
127
|
*
|
|
126
128
|
* @param crs - The CRS to check.
|
|
127
|
-
* @
|
|
129
|
+
* @returns
|
|
130
|
+
* @throws {Error} if the CRS is not valid.
|
|
128
131
|
*/
|
|
129
132
|
export function isGeographic(crs: ProjectionLike) {
|
|
130
133
|
return getUnit(crs) === UNIT.DEGREE;
|
|
@@ -147,7 +150,7 @@ export function isGeocentric(crs: ProjectionLike) {
|
|
|
147
150
|
* includes an unit.
|
|
148
151
|
*
|
|
149
152
|
* @param crs - The CRS to test.
|
|
150
|
-
* @throws {
|
|
153
|
+
* @throws {Error} if the crs is not valid.
|
|
151
154
|
*/
|
|
152
155
|
export function isValid(crs: ProjectionLike) {
|
|
153
156
|
const proj = proj4.defs(crs);
|
package/src/Ellipsoid.ts
CHANGED
|
@@ -47,6 +47,7 @@ class Ellipsoid {
|
|
|
47
47
|
* @param cartesian - The given cartesian coordinate.
|
|
48
48
|
* @param target - An object to store this vector to. If this is not
|
|
49
49
|
* specified, a new vector will be created.
|
|
50
|
+
* @returns
|
|
50
51
|
*/
|
|
51
52
|
geodeticSurfaceNormal(
|
|
52
53
|
cartesian: Coordinates,
|
|
@@ -62,6 +63,7 @@ class Ellipsoid {
|
|
|
62
63
|
* @param coordCarto - The given geographic coordinate.
|
|
63
64
|
* @param target - An object to store this vector to. If this is not
|
|
64
65
|
* specified, a new vector will be created.
|
|
66
|
+
* @returns
|
|
65
67
|
*/
|
|
66
68
|
geodeticSurfaceNormalCartographic(
|
|
67
69
|
coordCarto: Coordinates,
|
|
@@ -82,6 +84,7 @@ class Ellipsoid {
|
|
|
82
84
|
* properties.
|
|
83
85
|
*
|
|
84
86
|
* @param size - The source vector.
|
|
87
|
+
* @returns
|
|
85
88
|
*/
|
|
86
89
|
setSize(size: Vector3Like): this {
|
|
87
90
|
this.size.set(size.x, size.y, size.z);
|
|
@@ -146,7 +149,7 @@ class Ellipsoid {
|
|
|
146
149
|
|
|
147
150
|
const phi = Math.atan(
|
|
148
151
|
(position.z * (1 - f) + e * a * sinu * sinu * sinu) /
|
|
149
|
-
|
|
152
|
+
((1 - f) * (rsqXY - e * a * cosu * cosu * cosu)));
|
|
150
153
|
|
|
151
154
|
const h = (rsqXY * Math.cos(phi)) +
|
|
152
155
|
position.z * Math.sin(phi) -
|
|
@@ -202,7 +205,7 @@ class Ellipsoid {
|
|
|
202
205
|
return false;
|
|
203
206
|
}
|
|
204
207
|
|
|
205
|
-
let t
|
|
208
|
+
let t;
|
|
206
209
|
if (t1 <= EPSILON) { t = t2; } else
|
|
207
210
|
if (t2 <= EPSILON) { t = t1; } else { t = (t1 < t2) ? t1 : t2; }
|
|
208
211
|
|
|
@@ -236,7 +239,7 @@ class Ellipsoid {
|
|
|
236
239
|
|
|
237
240
|
const distRad = Math.acos(
|
|
238
241
|
Math.sin(latitude1) * Math.sin(latitude2) +
|
|
239
|
-
|
|
242
|
+
Math.cos(latitude1) * Math.cos(latitude2) * Math.cos(longitude2 - longitude1));
|
|
240
243
|
|
|
241
244
|
const e = this.eccentricity;
|
|
242
245
|
const latMoy = (latitude1 + latitude2) * 0.5;
|
package/src/Extent.ts
CHANGED
|
@@ -100,6 +100,7 @@ class Extent {
|
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
102
|
* Returns a new extent with the same bounds and crs as this one.
|
|
103
|
+
* @returns
|
|
103
104
|
*/
|
|
104
105
|
clone() {
|
|
105
106
|
return new Extent(this.crs, this.west, this.east, this.south, this.north);
|
|
@@ -111,6 +112,7 @@ class Extent {
|
|
|
111
112
|
* @param crs - target's projection.
|
|
112
113
|
* @param target - The target to store the projected extent. If this not
|
|
113
114
|
* provided a new extent will be created.
|
|
115
|
+
* @returns
|
|
114
116
|
*/
|
|
115
117
|
as(crs: string, target: Extent = new Extent('EPSG:4326')) {
|
|
116
118
|
CRS.isValid(crs);
|
|
@@ -155,6 +157,7 @@ class Extent {
|
|
|
155
157
|
*
|
|
156
158
|
* @param target - The target to store the center coordinate. If this not
|
|
157
159
|
* provided a new coordinate will be created.
|
|
160
|
+
* @returns
|
|
158
161
|
*/
|
|
159
162
|
center(target = new Coordinates(this.crs)) {
|
|
160
163
|
this.planarDimensions(_dim);
|
|
@@ -172,6 +175,7 @@ class Extent {
|
|
|
172
175
|
* 2D Cartesian coordinate system.
|
|
173
176
|
*
|
|
174
177
|
* @param target - optional target
|
|
178
|
+
* @returns
|
|
175
179
|
*/
|
|
176
180
|
planarDimensions(target = new Vector2()) {
|
|
177
181
|
// Calculte the dimensions for x and y
|
|
@@ -185,6 +189,7 @@ class Extent {
|
|
|
185
189
|
* across the curved surface of the ellipsoid.
|
|
186
190
|
*
|
|
187
191
|
* @param target - optional target
|
|
192
|
+
* @returns
|
|
188
193
|
*/
|
|
189
194
|
geodeticDimensions(target = new Vector2()) {
|
|
190
195
|
// set 3 corners extent
|
|
@@ -209,6 +214,7 @@ class Extent {
|
|
|
209
214
|
* Spatial euclidean distance chord is calculated in an ellispoid space.
|
|
210
215
|
*
|
|
211
216
|
* @param target - optional target
|
|
217
|
+
* @returns
|
|
212
218
|
*/
|
|
213
219
|
spatialEuclideanDimensions(target = new Vector2()) {
|
|
214
220
|
// set 3 corners extent
|
|
@@ -233,6 +239,7 @@ class Extent {
|
|
|
233
239
|
* @param coord - the given coordinates.
|
|
234
240
|
* @param epsilon - error margin when comparing to the coordinates.
|
|
235
241
|
* Default is 0.
|
|
242
|
+
* @returns
|
|
236
243
|
*/
|
|
237
244
|
isPointInside(coord: Coordinates, epsilon = 0) {
|
|
238
245
|
if (this.crs == coord.crs) {
|
|
@@ -243,9 +250,9 @@ class Extent {
|
|
|
243
250
|
|
|
244
251
|
// TODO this ignores altitude
|
|
245
252
|
return _c.x <= this.east + epsilon &&
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
253
|
+
_c.x >= this.west - epsilon &&
|
|
254
|
+
_c.y <= this.north + epsilon &&
|
|
255
|
+
_c.y >= this.south - epsilon;
|
|
249
256
|
}
|
|
250
257
|
|
|
251
258
|
/**
|
|
@@ -253,13 +260,14 @@ class Extent {
|
|
|
253
260
|
*
|
|
254
261
|
* @param extent - the extent to check
|
|
255
262
|
* @param epsilon - error margin when comparing the extent bounds.
|
|
263
|
+
* @returns
|
|
256
264
|
*/
|
|
257
265
|
isInside(extent: Extent, epsilon = CRS.reasonableEpsilon(this.crs)) {
|
|
258
266
|
extent.as(this.crs, _extent);
|
|
259
267
|
return this.east - _extent.east <= epsilon &&
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
268
|
+
_extent.west - this.west <= epsilon &&
|
|
269
|
+
this.north - _extent.north <= epsilon &&
|
|
270
|
+
_extent.south - this.south <= epsilon;
|
|
263
271
|
}
|
|
264
272
|
|
|
265
273
|
/**
|
|
@@ -294,6 +302,7 @@ class Extent {
|
|
|
294
302
|
* Checks wheter this bounding box intersects with the given extent
|
|
295
303
|
* parameter.
|
|
296
304
|
* @param extent - the provided extent
|
|
305
|
+
* @returns
|
|
297
306
|
*/
|
|
298
307
|
intersectsExtent(extent: Extent) {
|
|
299
308
|
return Extent.intersectsExtent(this, extent);
|
|
@@ -359,6 +368,7 @@ class Extent {
|
|
|
359
368
|
* @param v1 - the `east` value of this extent. Default is 0.
|
|
360
369
|
* @param v2 - the `south` value of this extent. Default is 0.
|
|
361
370
|
* @param v3 - the `north` value of this extent. Default is 0.
|
|
371
|
+
* @returns
|
|
362
372
|
*/
|
|
363
373
|
set(v0: number, v1: number, v2: number, v3: number): this {
|
|
364
374
|
if (v0 == undefined) {
|
|
@@ -396,8 +406,9 @@ class Extent {
|
|
|
396
406
|
* `north` property to `array[offset + 3]`.
|
|
397
407
|
* @param array - the source array
|
|
398
408
|
* @param offset - offset into the array. Default is 0.
|
|
409
|
+
* @returns
|
|
399
410
|
*/
|
|
400
|
-
setFromArray(array: ArrayLike<number>, offset
|
|
411
|
+
setFromArray(array: ArrayLike<number>, offset = 0): this {
|
|
401
412
|
this.west = array[offset];
|
|
402
413
|
this.east = array[offset + 1];
|
|
403
414
|
this.south = array[offset + 2];
|
|
@@ -409,6 +420,7 @@ class Extent {
|
|
|
409
420
|
* Sets this extent `west`, `east`, `south` and `north` properties from an
|
|
410
421
|
* `extent` bounds.
|
|
411
422
|
* @param extent - the source extent
|
|
423
|
+
* @returns
|
|
412
424
|
*/
|
|
413
425
|
setFromExtent(extent: ExtentLike): this {
|
|
414
426
|
this.west = extent.west;
|
|
@@ -421,6 +433,7 @@ class Extent {
|
|
|
421
433
|
/**
|
|
422
434
|
* Copies the passed extent to this extent.
|
|
423
435
|
* @param extent - extent to copy.
|
|
436
|
+
* @returns
|
|
424
437
|
*/
|
|
425
438
|
copy(extent: Extent): this {
|
|
426
439
|
this.crs = extent.crs;
|
|
@@ -430,6 +443,7 @@ class Extent {
|
|
|
430
443
|
/**
|
|
431
444
|
* Union this extent with the input extent.
|
|
432
445
|
* @param extent - the extent to union.
|
|
446
|
+
* @returns
|
|
433
447
|
*/
|
|
434
448
|
union(extent: Extent) {
|
|
435
449
|
if (extent.crs != this.crs) {
|
|
@@ -473,12 +487,11 @@ class Extent {
|
|
|
473
487
|
}
|
|
474
488
|
|
|
475
489
|
/**
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
*/
|
|
490
|
+
* expandByValuesCoordinates perfoms the minimal extension
|
|
491
|
+
* for the coordinates values to belong to this Extent object
|
|
492
|
+
* @param we - The coordinate on west-east
|
|
493
|
+
* @param sn - The coordinate on south-north
|
|
494
|
+
*/
|
|
482
495
|
expandByValuesCoordinates(we: number, sn: number) {
|
|
483
496
|
if (we < this.west) {
|
|
484
497
|
this.west = we;
|
|
@@ -503,6 +516,7 @@ class Extent {
|
|
|
503
516
|
*
|
|
504
517
|
* @param crs - Projection of extent to instancied.
|
|
505
518
|
* @param box - Bounding-box
|
|
519
|
+
* @returns
|
|
506
520
|
*/
|
|
507
521
|
static fromBox3(crs: ProjectionLike, box: Box3) {
|
|
508
522
|
if (CRS.isGeocentric(crs)) {
|
|
@@ -527,6 +541,7 @@ class Extent {
|
|
|
527
541
|
/**
|
|
528
542
|
* Return values of extent in string, separated by the separator input.
|
|
529
543
|
* @param sep - string separator
|
|
544
|
+
* @returns
|
|
530
545
|
*/
|
|
531
546
|
toString(sep = '') {
|
|
532
547
|
return `${this.east}${sep}${this.north}${sep}${this.west}${sep}${this.south}`;
|
package/src/OrientationUtils.ts
CHANGED
|
@@ -34,8 +34,8 @@ type QuaternionFunction = (coords: Coordinates, target?: Quaternion) => Quaterni
|
|
|
34
34
|
|
|
35
35
|
// To unify with Crs.js ProjectionLike type ?
|
|
36
36
|
type ProjectionLike = ProjectionDefinition | string;
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
interface LCCProjection { long0: number; lat0: number }
|
|
38
|
+
interface TMercProjection { a: number; b: number; e?: number; long0: number }
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* The transform from the platform frame to the local East, North, Up (ENU)
|
|
@@ -367,6 +367,7 @@ export function quaternionUnimplemented(
|
|
|
367
367
|
* identity (0,0,0,1).
|
|
368
368
|
*
|
|
369
369
|
* @param proj - the unimplemented projection (may be parsed using proj4)
|
|
370
|
+
* @param proj.projName - the name of the projection
|
|
370
371
|
* @param coordinates - the origin of the local East North Up (ENU) frame
|
|
371
372
|
* @param target - output Quaternion
|
|
372
373
|
* @returns The target quaternion if coordinates is defined, otherwise, a
|