@itowns/geographic 2.46.1-next.0 → 2.46.1-next.2

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/Crs.d.ts DELETED
@@ -1,93 +0,0 @@
1
- /**
2
- * A projection as a CRS identifier string. This identifier references a
3
- * projection definition previously defined with
4
- * [`proj4.defs`](https://github.com/proj4js/proj4js#named-projections).
5
- */
6
- export type ProjectionAlias = string;
7
- /**
8
- * System units supported for a coordinate system. See
9
- * [proj](https://proj4.org/en/9.5/operations/conversions/unitconvert.html#angular-units).
10
- * Note that only degree and meters units are supported for now.
11
- */
12
- export declare const UNIT: {
13
- /**
14
- * Angular unit in degree.
15
- */
16
- readonly DEGREE: 1;
17
- /**
18
- * Distance unit in meter.
19
- */
20
- readonly METER: 2;
21
- /**
22
- * Distance unit in foot.
23
- */
24
- readonly FOOT: 3;
25
- };
26
- /**
27
- * Checks that the CRS is EPSG:4326.
28
- * @internal
29
- *
30
- * @param crs - The CRS to test.
31
- */
32
- export declare function is4326(crs: ProjectionAlias): crs is "EPSG:4326";
33
- /**
34
- * Returns the horizontal coordinates system units associated with this CRS.
35
- *
36
- * @param crs - The CRS to extract the unit from.
37
- * @returns Either `UNIT.METER`, `UNIT.DEGREE`, `UNIT.FOOT` or `undefined`.
38
- */
39
- export declare function getUnit(crs: ProjectionAlias): 1 | 2 | 3 | undefined;
40
- /**
41
- * Asserts that the CRS is using metric units.
42
- *
43
- * @param crs - The CRS to check.
44
- * @throws {@link Error} if the CRS is not valid.
45
- */
46
- export declare function isMetricUnit(crs: ProjectionAlias): boolean;
47
- /**
48
- * Asserts that the CRS is geographic.
49
- *
50
- * @param crs - The CRS to check.
51
- * @throws {@link Error} if the CRS is not valid.
52
- */
53
- export declare function isGeographic(crs: ProjectionAlias): boolean;
54
- /**
55
- * Asserts that the CRS is geocentric.
56
- *
57
- * @param crs - The CRS to test.
58
- * @returns false if the crs isn't defined.
59
- */
60
- export declare function isGeocentric(crs: ProjectionAlias): boolean;
61
- /**
62
- * Asserts that the CRS is valid, meaning it has been previously defined and
63
- * includes an unit.
64
- *
65
- * @param crs - The CRS to test.
66
- * @throws {@link Error} if the crs is not valid.
67
- */
68
- export declare function isValid(crs: ProjectionAlias): void;
69
- /**
70
- * Gives a reasonable epsilon for this CRS.
71
- *
72
- * @param crs - The CRS to use.
73
- * @returns 0.01 if the CRS is EPSG:4326, 0.001 otherwise.
74
- */
75
- export declare function reasonableEpsilon(crs: ProjectionAlias): 0.01 | 0.001;
76
- /**
77
- * Returns the axis parameter defined in proj4 for the provided crs.
78
- * Might be undefined depending on crs definition.
79
- *
80
- * @param crs - The CRS to get axis from.
81
- * @returns the matching proj4 axis string, 'enu' for instance (east, north, up)
82
- */
83
- export declare function axisOrder(crs: ProjectionAlias): string | undefined;
84
- /**
85
- * Defines a proj4 projection as a named alias.
86
- * This function is a specialized wrapper over the
87
- * [`proj4.defs`](https://github.com/proj4js/proj4js#named-projections)
88
- * function.
89
- *
90
- * @param code - Named alias of the currently defined projection.
91
- * @param proj4def - Proj4 or WKT string of the defined projection.
92
- */
93
- export declare const defs: (code: string, proj4def: string) => void;
@@ -1,74 +0,0 @@
1
- import * as THREE from 'three';
2
- import Coordinates from './Coordinates';
3
- /**
4
- * Length of the semi-axes of the WGS84 ellipsoid.
5
- * @internal
6
- */
7
- export declare const ellipsoidSizes: THREE.Vector3;
8
- declare class Ellipsoid {
9
- /**
10
- * Length of the semi-axes of the ellipsoid.
11
- */
12
- size: THREE.Vector3;
13
- /**
14
- * Eccentricity of the ellipsoid.
15
- */
16
- eccentricity: number;
17
- private _radiiSquared;
18
- private _invRadiiSquared;
19
- /**
20
- * @param size - Length of the semi-axes of the ellipsoid. Defaults to those
21
- * defined by the WGS84 ellipsoid.
22
- */
23
- constructor(size?: THREE.Vector3);
24
- /**
25
- * Computes the normal vector to an ellipsoid at the given cartesian
26
- * coordinate `(x, y, z)`.
27
- *
28
- * @param cartesian - The given cartesian coordinate.
29
- * @param target - An object to store this vector to. If this is not
30
- * specified, a new vector will be created.
31
- */
32
- geodeticSurfaceNormal(cartesian: Coordinates, target?: THREE.Vector3): THREE.Vector3;
33
- /**
34
- * Computes the normal vector to an ellipsoid at the given geographic
35
- * coordinate `(longitude, latitude, altitude)`.
36
- *
37
- * @param coordCarto - The given geographic coordinate.
38
- * @param target - An object to store this vector to. If this is not
39
- * specified, a new vector will be created.
40
- */
41
- geodeticSurfaceNormalCartographic(coordCarto: Coordinates, target?: THREE.Vector3): THREE.Vector3;
42
- /**
43
- * Sets the length of the semi-axes of this ellipsoid from a 3-dimensional
44
- * vector-like object. The object shall have both `x`, `y` and `z`
45
- * properties.
46
- *
47
- * @param size - The source vector.
48
- */
49
- setSize(size: THREE.Vector3Like): this;
50
- cartographicToCartesian(coordCarto: Coordinates, target?: THREE.Vector3): THREE.Vector3;
51
- /**
52
- * Convert cartesian coordinates to geographic according to the current
53
- * ellipsoid of revolution.
54
- * @param position - The coordinate to convert
55
- * @param target - coordinate to copy result
56
- * @returns an object describing the coordinates on the reference ellipsoid,
57
- * angles are in degree
58
- */
59
- cartesianToCartographic(position: THREE.Vector3Like, target?: Coordinates): Coordinates;
60
- cartographicToCartesianArray(coordCartoArray: Coordinates[]): THREE.Vector3[];
61
- intersection(ray: THREE.Ray): THREE.Vector3 | false;
62
- /**
63
- * Calculate the geodesic distance, between coordCarto1 and coordCarto2.
64
- * It's most short distance on ellipsoid surface between coordCarto1 and
65
- * coordCarto2.
66
- * It's called orthodromy.
67
- *
68
- * @param coordCarto1 - The coordinate carto 1
69
- * @param coordCarto2 - The coordinate carto 2
70
- * @returns The orthodromic distance between the two given coordinates.
71
- */
72
- geodesicDistance(coordCarto1: Coordinates, coordCarto2: Coordinates): number;
73
- }
74
- export default Ellipsoid;
package/lib/Extent.d.ts DELETED
@@ -1,246 +0,0 @@
1
- import * as THREE from 'three';
2
- import Coordinates from './Coordinates';
3
- import type { ProjectionAlias } from './Crs';
4
- export interface ExtentLike {
5
- readonly west: number;
6
- readonly east: number;
7
- readonly south: number;
8
- readonly north: number;
9
- }
10
- /**
11
- * A class representing a geographical extent.
12
- *
13
- * An extent is a geographical bounding rectangle defined by 4 limits: west,
14
- * east, south and north.
15
- *
16
- * **Warning**: Using a geocentric projection is not suitable for representing a
17
- * geographical extent. Please use a geographic projection.
18
- */
19
- declare class Extent {
20
- /**
21
- * Read-only flag to check if a given object is of type `Extent`.
22
- */
23
- readonly isExtent: true;
24
- /**
25
- * A default or user-defined CRS (see {@link ProjectionAlias}).
26
- */
27
- crs: ProjectionAlias;
28
- /**
29
- * West longitude bound of this extent.
30
- */
31
- west: number;
32
- /**
33
- * East longitude bound of this extent.
34
- */
35
- east: number;
36
- /**
37
- * South latitude bound of this extent.
38
- */
39
- south: number;
40
- /**
41
- * North latitude bound of this extent.
42
- */
43
- north: number;
44
- /**
45
- * @param crs - A default or user-defined CRS (see {@link ProjectionAlias}).
46
- * @param west - the `west` value of this extent. Default is 0.
47
- * @param east - the `east` value of this extent. Default is 0.
48
- * @param south - the `south` value of this extent. Default is 0.
49
- * @param north - the `north` value of this extent. Default is 0.
50
- */
51
- constructor(crs: ProjectionAlias, west?: number, east?: number, south?: number, north?: number);
52
- /**
53
- * Returns a new extent with the same bounds and crs as this one.
54
- */
55
- clone(): Extent;
56
- /**
57
- * Projects this extent to the specified projection.
58
- *
59
- * @param crs - target's projection.
60
- * @param target - The target to store the projected extent. If this not
61
- * provided a new extent will be created.
62
- */
63
- as(crs: string, target?: Extent): Extent;
64
- /**
65
- * Returns the center of the extent.
66
- *
67
- * @param target - The target to store the center coordinate. If this not
68
- * provided a new coordinate will be created.
69
- */
70
- center(target?: Coordinates): Coordinates;
71
- /**
72
- * Returns the planar dimensions as two-vector planar distances west/east
73
- * and south/north.
74
- * The planar distance is a straight-line Euclidean distance calculated in a
75
- * 2D Cartesian coordinate system.
76
- *
77
- * @param target - optional target
78
- */
79
- planarDimensions(target?: THREE.Vector2): THREE.Vector2;
80
- /**
81
- * Returns the geodetic dimensions as two-vector planar distances west/east
82
- * and south/north.
83
- * Geodetic distance is calculated in an ellispoid space as the distance
84
- * across the curved surface of the ellipsoid.
85
- *
86
- * @param target - optional target
87
- */
88
- geodeticDimensions(target?: THREE.Vector2): THREE.Vector2;
89
- /**
90
- * Returns the spatial euclidean dimensions as a two-vector spatial
91
- * euclidean distances between west/east corner and south/north corner.
92
- * Spatial euclidean distance chord is calculated in an ellispoid space.
93
- *
94
- * @param target - optional target
95
- */
96
- spatialEuclideanDimensions(target?: THREE.Vector2): THREE.Vector2;
97
- /**
98
- * Checks whether a coordinates is inside the extent.
99
- *
100
- * @param coord - the given coordinates.
101
- * @param epsilon - error margin when comparing to the coordinates.
102
- * Default is 0.
103
- */
104
- isPointInside(coord: Coordinates, epsilon?: number): boolean;
105
- /**
106
- * Checks whether another extent is inside the extent.
107
- *
108
- * @param extent - the extent to check
109
- * @param epsilon - error margin when comparing the extent bounds.
110
- */
111
- isInside(extent: Extent, epsilon?: number): boolean;
112
- /**
113
- * Return the translation and scale to transform this extent to the input
114
- * extent.
115
- *
116
- * @param extent - input extent
117
- * @param target - copy the result to target.
118
- * @returns A {@link THREE.Vector4} where the `x` property encodes the
119
- * translation on west-east, the `y` property the translation on
120
- * south-north, the `z` property the scale on west-east, the `w` property
121
- * the scale on south-north.
122
- */
123
- offsetToParent(extent: Extent, target?: THREE.Vector4): THREE.Vector4;
124
- /**
125
- * Checks wheter this bounding box intersects with the given extent
126
- * parameter.
127
- * @param extent - the provided extent
128
- */
129
- intersectsExtent(extent: Extent): boolean;
130
- static intersectsExtent(extentA: Extent, extentB: Extent): boolean;
131
- /**
132
- * Returns the intersection of this extent with another one.
133
- * @param extent - extent to intersect
134
- */
135
- intersect(extent: Extent): Extent;
136
- /**
137
- * Set west, east, south and north values.
138
- *
139
- * @param v0 - the `west` value of this extent. Default is 0.
140
- * @param v1 - the `east` value of this extent. Default is 0.
141
- * @param v2 - the `south` value of this extent. Default is 0.
142
- * @param v3 - the `north` value of this extent. Default is 0.
143
- */
144
- set(v0: number, v1: number, v2: number, v3: number): this;
145
- /**
146
- * Sets this extent `west` property to `array[offset + 0]`, `east` property
147
- * to `array[offset + 1]`, `south` property to `array[offset + 2]` and
148
- * `north` property to `array[offset + 3]`.
149
- * @param array - the source array
150
- * @param offset - offset into the array. Default is 0.
151
- */
152
- setFromArray(array: ArrayLike<number>, offset?: number): this;
153
- /**
154
- * Sets this extent `west`, `east`, `south` and `north` properties from an
155
- * `extent` bounds.
156
- * @param extent - the source extent
157
- */
158
- setFromExtent(extent: ExtentLike): this;
159
- /**
160
- * Copies the passed extent to this extent.
161
- * @param extent - extent to copy.
162
- */
163
- copy(extent: Extent): this;
164
- /**
165
- * Union this extent with the input extent.
166
- * @param extent - the extent to union.
167
- */
168
- union(extent: Extent): void;
169
- /**
170
- * expandByCoordinates perfoms the minimal extension
171
- * for the coordinates to belong to this Extent object
172
- * @param coordinates - The coordinates to belong
173
- */
174
- expandByCoordinates(coordinates: Coordinates): void;
175
- /**
176
- * expandByValuesCoordinates perfoms the minimal extension
177
- * for the coordinates values to belong to this Extent object
178
- * @param we - The coordinate on west-east
179
- * @param sn - The coordinate on south-north
180
- *
181
- */
182
- expandByValuesCoordinates(we: number, sn: number): void;
183
- /**
184
- * Instance Extent with THREE.Box3.
185
- *
186
- * If crs is a geocentric projection, the `box3.min` and `box3.max`
187
- * should be the geocentric coordinates of `min` and `max` of a `box3`
188
- * in local tangent plane.
189
- *
190
- * @param crs - Projection of extent to instancied.
191
- * @param box - Bounding-box
192
- */
193
- static fromBox3(crs: ProjectionAlias, box: THREE.Box3): Extent;
194
- /**
195
- * Return values of extent in string, separated by the separator input.
196
- * @param sep - string separator
197
- */
198
- toString(sep?: string): string;
199
- /**
200
- * Subdivide equally an extent from its center to return four extents:
201
- * north-west, north-east, south-west and south-east.
202
- *
203
- * @returns An array containing the four sections of the extent. The order
204
- * of the sections is [NW, NE, SW, SE].
205
- */
206
- subdivision(): Extent[];
207
- /**
208
- * subdivise extent by scheme.x on west-east and scheme.y on south-north.
209
- *
210
- * @param scheme - The scheme to subdivise.
211
- * @returns subdivised extents.
212
- */
213
- subdivisionByScheme(scheme?: THREE.Vector2): Extent[];
214
- /**
215
- * Multiplies all extent `coordinates` (with an implicit 1 in the 4th
216
- * dimension) and `matrix`.
217
- *
218
- * @param matrix - The matrix
219
- * @returns return this extent instance.
220
- */
221
- applyMatrix4(matrix: THREE.Matrix4): this;
222
- /**
223
- * clamp south and north values
224
- *
225
- * @param south - The min south
226
- * @param north - The max north
227
- * @returns this extent
228
- */
229
- clampSouthNorth(south?: number, north?: number): this;
230
- /**
231
- * clamp west and east values
232
- *
233
- * @param west - The min west
234
- * @param east - The max east
235
- * @returns this extent
236
- */
237
- clampWestEast(west?: number, east?: number): this;
238
- /**
239
- * clamp this extent by passed extent
240
- *
241
- * @param extent - The maximum extent.
242
- * @returns this extent.
243
- */
244
- clampByExtent(extent: ExtentLike): this;
245
- }
246
- export default Extent;
package/lib/Main.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export { default as Extent } from './Extent';
2
- export { default as Coordinates } from './Coordinates';
3
- export * as CRS from './Crs';
4
- export { default as CoordStars } from './CoordStars';
5
- export * as OrientationUtils from './OrientationUtils';
6
- export { default as Ellipsoid, ellipsoidSizes } from './Ellipsoid';
@@ -1,105 +0,0 @@
1
- import { Quaternion } from 'three';
2
- import type { ProjectionDefinition } from 'proj4/dist/lib/defs';
3
- import Coordinates from './Coordinates';
4
- interface EulerAngles {
5
- /** angle in degrees */
6
- roll: number;
7
- /** angle in degrees */
8
- pitch: number;
9
- /** angle in degrees */
10
- heading: number;
11
- }
12
- interface PhotogrammetryAngles {
13
- /** angle in degrees */
14
- omega: number;
15
- /** angle in degrees */
16
- phi: number;
17
- /** angle in degrees */
18
- kappa: number;
19
- }
20
- type Attitude = Partial<EulerAngles> | Partial<PhotogrammetryAngles>;
21
- type QuaternionFunction = (coords: Coordinates, target?: Quaternion) => Quaternion;
22
- type ProjectionLike = ProjectionDefinition | string;
23
- type LCCProjection = {
24
- long0: number;
25
- lat0: number;
26
- };
27
- type TMercProjection = {
28
- a: number;
29
- b: number;
30
- e?: number;
31
- long0: number;
32
- };
33
- /**
34
- * The transform from the platform frame to the local East, North, Up (ENU)
35
- * frame is `RotationZ(heading).RotationX(pitch).RotationY(roll)`.
36
- *
37
- * @param roll - angle in degrees. Default is 0.
38
- * @param pitch - angle in degrees. Default is 0.
39
- * @param heading - angle in degrees. Default is 0
40
- * @param target - output Quaternion
41
- *
42
- * @returns The target quaternion
43
- */
44
- export declare function quaternionFromRollPitchHeading(roll?: number, pitch?: number, heading?: number, target?: Quaternion): Quaternion;
45
- /**
46
- * From
47
- * [DocMicMac](https://github.com/micmacIGN/Documentation/raw/master/DocMicMac.pdf),
48
- * the transform from the platform frame to the local East, North, Up (ENU)
49
- * frame is:
50
- *
51
- * ```
52
- * RotationX(omega).RotationY(phi).RotationZ(kappa).RotationX(PI)
53
- * Converts between the 2 conventions for the camera local frame:
54
- * RotationX(PI) <=> Quaternion(1,0,0,0)
55
- * X right, Y bottom, Z front : convention in photogrammetry and computer vision
56
- * X right, Y top, Z back : convention in webGL, threejs
57
- * ```
58
- *
59
- * @param omega - angle in degrees. Default is 0.
60
- * @param phi - angle in degrees. Default is 0.
61
- * @param kappa - angle in degrees. Default is 0.
62
- * @param target - output quaternion
63
- *
64
- * @returns The target quaternion
65
- */
66
- export declare function quaternionFromOmegaPhiKappa(omega?: number, phi?: number, kappa?: number, target?: Quaternion): Quaternion;
67
- /**
68
- * Sets the quaternion according to the rotation from the platform frame to the
69
- * local frame.
70
- *
71
- * @param attitude - either euler angles or photogrammetry angles
72
- * @param target - output Quaternion
73
- *
74
- * @returns The target quaternion
75
- */
76
- export declare function quaternionFromAttitude(attitude: Attitude, target?: Quaternion): Quaternion;
77
- export declare function quaternionFromEnuToGeocent(): QuaternionFunction;
78
- export declare function quaternionFromEnuToGeocent(coords: Coordinates, target?: Quaternion): Quaternion;
79
- export declare function quaternionFromGeocentToEnu(): QuaternionFunction;
80
- export declare function quaternionFromGeocentToEnu(coords: Coordinates, target?: Quaternion): Quaternion;
81
- export declare function quaternionFromLCCToEnu(proj: LCCProjection): QuaternionFunction;
82
- export declare function quaternionFromLCCToEnu(proj: LCCProjection, coords: Coordinates, target?: Quaternion): Quaternion;
83
- export declare function quaternionFromEnuToLCC(proj: LCCProjection): QuaternionFunction;
84
- export declare function quaternionFromEnuToLCC(proj: LCCProjection, coords: Coordinates, target?: Quaternion): Quaternion;
85
- export declare function quaternionFromTMercToEnu(proj: TMercProjection): QuaternionFunction;
86
- export declare function quaternionFromTMercToEnu(proj: TMercProjection, coords: Coordinates, target?: Quaternion): Quaternion;
87
- export declare function quaternionFromEnuToTMerc(proj: TMercProjection): QuaternionFunction;
88
- export declare function quaternionFromEnuToTMerc(proj: TMercProjection, coords: Coordinates, target?: Quaternion): Quaternion;
89
- export declare function quaternionFromLongLatToEnu(): QuaternionFunction;
90
- export declare function quaternionFromLongLatToEnu(coords: Coordinates, target?: Quaternion): Quaternion;
91
- export declare function quaternionFromEnuToLongLat(): QuaternionFunction;
92
- export declare function quaternionFromEnuToLongLat(coords: Coordinates, target?: Quaternion): Quaternion;
93
- export declare function quaternionUnimplemented(proj: {
94
- projName?: string;
95
- }): QuaternionFunction;
96
- export declare function quaternionUnimplemented(proj: {
97
- projName?: string;
98
- }, coords: Coordinates, target?: Quaternion): Quaternion;
99
- export declare function quaternionFromEnuToCRS(proj: ProjectionLike): QuaternionFunction;
100
- export declare function quaternionFromEnuToCRS(proj: ProjectionLike, coords: Coordinates, target?: Quaternion): Quaternion;
101
- export declare function quaternionFromCRSToEnu(proj: ProjectionLike): QuaternionFunction;
102
- export declare function quaternionFromCRSToEnu(proj: ProjectionLike, coords: Coordinates, target?: Quaternion): Quaternion;
103
- export declare function quaternionFromCRSToCRS(crsIn: ProjectionLike, crsOut: ProjectionLike): QuaternionFunction;
104
- export declare function quaternionFromCRSToCRS(crsIn: ProjectionLike, crsOut: ProjectionLike, coords: Coordinates, target?: Quaternion): Quaternion;
105
- export {};
File without changes