@math.gl/web-mercator 3.5.7 → 3.6.0-alpha.3

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.
Files changed (92) hide show
  1. package/dist/assert.d.ts +2 -0
  2. package/dist/assert.d.ts.map +1 -0
  3. package/dist/assert.js +8 -0
  4. package/dist/es5/assert.js.map +1 -1
  5. package/dist/es5/fit-bounds.js +27 -24
  6. package/dist/es5/fit-bounds.js.map +1 -1
  7. package/dist/es5/fly-to-viewport.js +23 -16
  8. package/dist/es5/fly-to-viewport.js.map +1 -1
  9. package/dist/es5/get-bounds.js +1 -1
  10. package/dist/es5/get-bounds.js.map +1 -1
  11. package/dist/es5/index.js.map +1 -1
  12. package/dist/es5/math-utils.js +3 -9
  13. package/dist/es5/math-utils.js.map +1 -1
  14. package/dist/es5/normalize-viewport-props.js +10 -10
  15. package/dist/es5/normalize-viewport-props.js.map +1 -1
  16. package/dist/es5/web-mercator-utils.js +44 -60
  17. package/dist/es5/web-mercator-utils.js.map +1 -1
  18. package/dist/es5/web-mercator-viewport.js +69 -51
  19. package/dist/es5/web-mercator-viewport.js.map +1 -1
  20. package/dist/esm/assert.js.map +1 -1
  21. package/dist/esm/fit-bounds.js +24 -22
  22. package/dist/esm/fit-bounds.js.map +1 -1
  23. package/dist/esm/fly-to-viewport.js +13 -9
  24. package/dist/esm/fly-to-viewport.js.map +1 -1
  25. package/dist/esm/get-bounds.js +1 -1
  26. package/dist/esm/get-bounds.js.map +1 -1
  27. package/dist/esm/index.js.map +1 -1
  28. package/dist/esm/math-utils.js +3 -3
  29. package/dist/esm/math-utils.js.map +1 -1
  30. package/dist/esm/normalize-viewport-props.js +13 -9
  31. package/dist/esm/normalize-viewport-props.js.map +1 -1
  32. package/dist/esm/web-mercator-utils.js +46 -52
  33. package/dist/esm/web-mercator-utils.js.map +1 -1
  34. package/dist/esm/web-mercator-viewport.js +76 -34
  35. package/dist/esm/web-mercator-viewport.js.map +1 -1
  36. package/dist/fit-bounds.d.ts +50 -0
  37. package/dist/fit-bounds.d.ts.map +1 -0
  38. package/dist/fit-bounds.js +63 -0
  39. package/dist/fly-to-viewport.d.ts +19 -0
  40. package/dist/fly-to-viewport.d.ts.map +1 -0
  41. package/dist/fly-to-viewport.js +87 -0
  42. package/dist/get-bounds.d.ts +3 -0
  43. package/dist/get-bounds.d.ts.map +1 -0
  44. package/dist/get-bounds.js +51 -0
  45. package/dist/index.d.ts +11 -0
  46. package/dist/index.d.ts.map +1 -0
  47. package/dist/index.js +8 -0
  48. package/dist/math-utils.d.ts +7 -0
  49. package/dist/math-utils.d.ts.map +1 -0
  50. package/dist/math-utils.js +26 -0
  51. package/dist/normalize-viewport-props.d.ts +16 -0
  52. package/dist/normalize-viewport-props.d.ts.map +1 -0
  53. package/dist/normalize-viewport-props.js +41 -0
  54. package/dist/{es5/web-mercator-utils.d.ts → web-mercator-utils.d.ts} +78 -95
  55. package/dist/web-mercator-utils.d.ts.map +1 -0
  56. package/dist/web-mercator-utils.js +290 -0
  57. package/dist/web-mercator-viewport.d.ts +182 -0
  58. package/dist/web-mercator-viewport.d.ts.map +1 -0
  59. package/dist/web-mercator-viewport.js +281 -0
  60. package/package.json +4 -4
  61. package/src/{assert.js → assert.ts} +1 -1
  62. package/src/fit-bounds.ts +127 -0
  63. package/src/{fly-to-viewport.js → fly-to-viewport.ts} +52 -14
  64. package/src/{get-bounds.js → get-bounds.ts} +7 -5
  65. package/src/{index.js → index.ts} +4 -0
  66. package/src/math-utils.ts +32 -0
  67. package/src/{normalize-viewport-props.js → normalize-viewport-props.ts} +19 -10
  68. package/src/{web-mercator-utils.js → web-mercator-utils.ts} +184 -76
  69. package/src/web-mercator-viewport.ts +415 -0
  70. package/dist/es5/fit-bounds.d.ts +0 -64
  71. package/dist/es5/fly-to-viewport.d.ts +0 -31
  72. package/dist/es5/get-bounds.d.ts +0 -3
  73. package/dist/es5/index.d.ts +0 -24
  74. package/dist/es5/normalize-viewport-props.d.ts +0 -16
  75. package/dist/es5/web-mercator-viewport.d.ts +0 -187
  76. package/dist/esm/fit-bounds.d.ts +0 -64
  77. package/dist/esm/fly-to-viewport.d.ts +0 -31
  78. package/dist/esm/get-bounds.d.ts +0 -3
  79. package/dist/esm/index.d.ts +0 -24
  80. package/dist/esm/normalize-viewport-props.d.ts +0 -16
  81. package/dist/esm/web-mercator-utils.d.ts +0 -190
  82. package/dist/esm/web-mercator-viewport.d.ts +0 -187
  83. package/src/fit-bounds.d.ts +0 -64
  84. package/src/fit-bounds.js +0 -76
  85. package/src/fly-to-viewport.d.ts +0 -31
  86. package/src/get-bounds.d.ts +0 -3
  87. package/src/index.d.ts +0 -24
  88. package/src/math-utils.js +0 -32
  89. package/src/normalize-viewport-props.d.ts +0 -16
  90. package/src/web-mercator-utils.d.ts +0 -190
  91. package/src/web-mercator-viewport.d.ts +0 -187
  92. package/src/web-mercator-viewport.js +0 -262
@@ -1,187 +0,0 @@
1
- import { Bounds, FitBoundsOptions } from "./fit-bounds";
2
-
3
- type WebMercatorViewportOptions = {
4
- // Map state
5
- width: number;
6
- height: number;
7
- latitude?: number;
8
- longitude?: number;
9
- position?: number[];
10
- zoom?: number;
11
- pitch?: number;
12
- bearing?: number;
13
- altitude?: number;
14
- fovy?: number;
15
- nearZMultiplier?: number;
16
- farZMultiplier?: number;
17
- };
18
-
19
- /**
20
- * Creates view/projection matrices and "uniform values" from mercator params
21
- *
22
- * Note: `Viewport` instances are immutable in the sense that they only have accessors.
23
- * A new viewport instance should be created if any parameters have changed.
24
- */
25
- export default class WebMercatorViewport {
26
- latitude: number;
27
- longitude: number;
28
- zoom: number;
29
- pitch: number;
30
- bearing: number;
31
- altitude: number;
32
- fovy: number;
33
-
34
- meterOffset: number[];
35
- center: number[];
36
-
37
- width: number;
38
- height: number;
39
- scale: number;
40
- distanceScales: {
41
- unitsPerMeter: number[]
42
- };
43
-
44
- viewMatrix: number[];
45
- projectionMatrix: number[];
46
-
47
- viewProjectionMatrix: number[];
48
- pixelProjectionMatrix: number[];
49
- pixelUnprojectionMatrix: number[];
50
-
51
- /**
52
- * @classdesc
53
- * Creates view/projection matrices from mercator params
54
- * Note: The Viewport is immutable in the sense that it only has accessors.
55
- * A new viewport instance should be created if any parameters have changed.
56
- *
57
- * @class
58
- * @param {WebMercatorViewportOptions} opt - options
59
- *
60
- * @param [opt.width=1] - Width of "viewport" or window
61
- * @param [opt.height=1] - Height of "viewport" or window
62
- * @param [opt.scale=1] - Either use scale or zoom
63
- * @param [opt.pitch=0] - Camera angle in degrees (0 is straight down)
64
- * @param [opt.bearing=0] - Map rotation in degrees (0 means north is up)
65
- * @param [opt.fovy=] - Field of view of camera in degrees
66
- * @param [opt.altitude=] - Altitude of camera in screen units
67
- *
68
- * Web mercator projection short-hand parameters
69
- * @param [opt.latitude] - Center of viewport on map
70
- * @param [opt.longitude] - Center of viewport on map
71
- * @param [opt.zoom] - Scale = Math.pow(2,zoom) on map
72
-
73
- * Notes:
74
- * - Only one of center or [latitude, longitude] can be specified
75
- * - [latitude, longitude] can only be specified when "mercator" is true
76
- * - Altitude has a default value that matches assumptions in mapbox-gl
77
- * - Field of view is independent from altitude, provide `altitudeToFovy(1.5)` (default value) to match assumptions in mapbox-gl
78
- * - width and height are forced to 1 if supplied as 0, to avoid
79
- * division by zero. This is intended to reduce the burden of apps to
80
- * to check values before instantiating a Viewport.
81
- */
82
- constructor(options?: WebMercatorViewportOptions);
83
-
84
- /** Two viewports are equal if width and height are identical, and if
85
- * their view and projection matrices are (approximately) equal.
86
- */
87
- equals(viewport: WebMercatorViewport | null): boolean;
88
-
89
- /**
90
- * Projects xyz (possibly latitude and longitude) to pixel coordinates in window
91
- * using viewport projection parameters
92
- * - [longitude, latitude] to [x, y]
93
- * - [longitude, latitude, Z] => [x, y, z]
94
- * Note: By default, returns top-left coordinates for canvas/SVG type render
95
- *
96
- * @param lngLatZ - [lng, lat] or [lng, lat, Z]
97
- * @param options - options
98
- * @param options.topLeft=true - Whether projected coords are top left
99
- * @return - screen coordinates [x, y] or [x, y, z], z as pixel depth
100
- */
101
- project(lngLatZ: number[], options?: {topLeft?: boolean}): number[];
102
-
103
- /**
104
- * Unproject pixel coordinates on screen onto world coordinates, possibly `[lon, lat]` on map.
105
- *
106
- * - [x, y] => [lng, lat]
107
- * - [x, y, z] => [lng, lat, Z]
108
- *
109
- * @param xyz - screen coordinates, z as pixel depth
110
- * @param options - options
111
- * @param options.topLeft=true - Whether projected coords are top left
112
- * @param options.targetZ=0 - If pixel depth is unknown, targetZ is used as
113
- * the elevation plane to unproject onto
114
- * @return - [lng, lat, Z] or [X, Y, Z]
115
- */
116
- unproject(xyz: number[], options?: {topLeft?: boolean; targetZ?: number}): number[];
117
-
118
- /**
119
- * Project [lng,lat] on sphere onto [x,y] on 512*512 Mercator Zoom 0 tile.
120
- * Performs the nonlinear part of the web mercator projection.
121
- * Remaining projection is done with 4x4 matrices which also handles
122
- * perspective.
123
- *
124
- * @param lngLat - [lng, lat] coordinates
125
- * Specifies a point on the sphere to project onto the map.
126
- * @return [x,y] coordinates.
127
- */
128
- projectFlat(lngLat: number[]): number[];
129
-
130
- /**
131
- * Unproject world point [x,y] on map onto {lat, lon} on sphere
132
- *
133
- * @param xy - array with [x,y] members
134
- * representing point on projected map plane
135
- * @return - array with [lat,lon] of point on sphere.
136
- * Has toArray method if you need a GeoJSON Array.
137
- * Per cartographic tradition, lat and lon are specified as degrees.
138
- */
139
- unprojectFlat(xy: number[]): number[];
140
-
141
- /**
142
- * Get the map center that place a given [lng, lat] coordinate at screen
143
- * point [x, y]
144
- *
145
- * @param {object} opt
146
- * @param opt.lngLat - [lng,lat] coordinates
147
- * Specifies a point on the sphere.
148
- * @param opt.pos - [x,y] coordinates
149
- * Specifies a point on the screen.
150
- * @return [lng,lat] new map center.
151
- */
152
- getMapCenterByLngLatPosition({lngLat, pos}: {lngLat: number[], pos: number[]}): number[];
153
-
154
- /** @deprecated Legacy method name */
155
- getLocationAtPoint({lngLat, pos}: {lngLat: number[], pos: number[]}): number[];
156
-
157
- /**
158
- * Returns a new viewport that fit around the given rectangle.
159
- * Only supports non-perspective mode.
160
- * @param {Array} bounds - [[lon, lat], [lon, lat]]
161
- * @param {Object} [options]
162
- * @param {Number} [options.padding] - The amount of padding in pixels to add to the given bounds.
163
- * @param {Array} [options.offset] - The center of the given bounds relative to the map's center,
164
- * [x, y] measured in pixels.
165
- * @returns {WebMercatorViewport}
166
- */
167
- fitBounds(
168
- bounds: [[number, number], [number, number]],
169
- options?: Omit<FitBoundsOptions, 'width' | 'height' | 'bounds'>,
170
- ): WebMercatorViewport;
171
-
172
- /**
173
- * Returns the bounding box of the viewport.
174
- * @param {Object} [options]
175
- * @param {Number} [options.z] - The altitude at which the bounds should be calculated.
176
- * @returns {Array} bounds - [[lon, lat], [lon, lat]]
177
- */
178
- getBounds(options?: {z?: number}) : Array<number[]>;
179
-
180
- /**
181
- * Returns the bounding box of the viewport.
182
- * @param {Object} [options]
183
- * @param {Number} [options.z] - The altitude at which the bounds should be calculated.
184
- * @returns {Array} an array of 4 points that define the visible region
185
- */
186
- getBoundingRegion(options?: {z?: number}) : Array<number[]>;
187
- }
@@ -1,64 +0,0 @@
1
- /**
2
- * An object describing the padding to add to the bounds.
3
- *
4
- * @property top - Padding from top in pixels to add to the given bounds
5
- * @property bottom - Padding from bottom in pixels to add to the given bounds
6
- * @property left - Padding from left in pixels to add to the given bounds
7
- * @property right - Padding from right in pixels to add to the given bounds
8
- */
9
- export type Padding = {
10
- top: number;
11
- bottom: number;
12
- left: number;
13
- right: number;
14
- };
15
-
16
- /**
17
- * Options for fitBounds
18
- *
19
- * @param options fit bounds parameters
20
- * @param options.width - viewport width
21
- * @param options.height - viewport height
22
- * @param options.bounds - [[lon, lat], [lon, lat]]
23
- * @param options.minExtent - The width/height of the bounded area will never be smaller than this
24
- * @param options.padding - The amount of padding in pixels
25
- * to add to the given bounds. Can also be an object with top, bottom, left and right
26
- * properties defining the padding.
27
- * @param [options.offset] - The center of the given bounds relative to the map's center,
28
- */
29
- export type FitBoundsOptions = {
30
- width: number;
31
- height: number;
32
- bounds: [[number, number], [number, number]];
33
- minExtent?: number; // 0.01 would be about 1000 meters (degree is ~110KM)
34
- maxZoom?: number; // ~x4,000,000 => About 10 meter extents
35
- // options
36
- padding?: number | Padding;
37
- offset?: number[];
38
- };
39
-
40
- export type Bounds = {
41
- longitude: number;
42
- latitude: number;
43
- zoom: number;
44
- };
45
-
46
- /**
47
- * Returns map settings {latitude, longitude, zoom}
48
- * that will contain the provided corners within the provided width.
49
- *
50
- * > _Note: Only supports non-perspective mode._
51
- *
52
- * @param options fit bounds parameters
53
- * @param options.width - viewport width
54
- * @param options.height - viewport height
55
- * @param options.bounds - [[lon, lat], [lon, lat]]
56
- * @param options.minExtent - The width/height of the bounded area will never be smaller than this
57
- * @param options.padding - The amount of padding in pixels
58
- * to add to the given bounds. Can also be an object with top, bottom, left and right
59
- * properties defining the padding.
60
- * @param [options.offset] - The center of the given bounds relative to the map's center,
61
- * [x, y] measured in pixels.
62
- * @returns {Object} - latitude, longitude and zoom
63
- */
64
- export default function fitBounds(options: FitBoundsOptions): Bounds;
@@ -1,31 +0,0 @@
1
- type FlytoTransitionOptions = {
2
- curve?: number;
3
- speed?: number;
4
- screenSpeed?: number;
5
- maxDuration?: number;
6
- };
7
-
8
- type ViewportProps = {
9
- longitude: number;
10
- latitude: number;
11
- zoom: number;
12
- };
13
-
14
- /**
15
- * mapbox-gl-js flyTo : https://www.mapbox.com/mapbox-gl-js/api/#map#flyto.
16
- * It implements “Smooth and efficient zooming and panning.” algorithm by
17
- * "Jarke J. van Wijk and Wim A.A. Nuij"
18
- */
19
- export default function flyToViewport(
20
- startProps: ViewportProps,
21
- endProps: ViewportProps,
22
- t: number,
23
- options?: FlytoTransitionOptions
24
- ): ViewportProps;
25
-
26
- // returns transition duration in milliseconds
27
- export function getFlyToDuration(
28
- startProps: ViewportProps,
29
- endProps: ViewportProps,
30
- options?: FlytoTransitionOptions
31
- ): number;
@@ -1,3 +0,0 @@
1
- import WebMercatorViewport from './web-mercator-viewport';
2
-
3
- export default function getBounds(viewport : WebMercatorViewport, z? : number) : Array<number[]>;
@@ -1,24 +0,0 @@
1
- // Classic web-mercator-project
2
- export {default} from './web-mercator-viewport';
3
- export {default as WebMercatorViewport} from './web-mercator-viewport';
4
-
5
- export {default as getBounds} from './get-bounds';
6
- export {default as fitBounds} from './fit-bounds';
7
- export {default as normalizeViewportProps} from './normalize-viewport-props';
8
- export {default as flyToViewport, getFlyToDuration} from './fly-to-viewport';
9
-
10
- export {
11
- MAX_LATITUDE,
12
- lngLatToWorld,
13
- worldToLngLat,
14
- worldToPixels,
15
- pixelsToWorld,
16
- zoomToScale,
17
- scaleToZoom,
18
- getMeterZoom,
19
- getDistanceScales,
20
- addMetersToLngLat,
21
- getViewMatrix,
22
- getProjectionMatrix,
23
- getProjectionParameters
24
- } from './web-mercator-utils';
@@ -1,16 +0,0 @@
1
- /** Description of viewport */
2
- type ViewportProps = {
3
- width: number;
4
- height: number;
5
- longitude: number;
6
- latitude: number;
7
- zoom: number;
8
- pitch?: number;
9
- bearing?: number;
10
- };
11
-
12
- /**
13
- * Apply mathematical constraints to viewport props
14
- * @param props
15
- */
16
- export default function normalizeViewportProps(props: ViewportProps): ViewportProps;
@@ -1,190 +0,0 @@
1
- // TODO - THE UTILITIES IN THIS FILE SHOULD BE IMPORTED FROM WEB-MERCATOR-VIEWPORT MODULE
2
- export const MAX_LATITUDE: number;
3
-
4
- /** Mapbox default altitude */
5
- export const DEFAULT_ALTITUDE: number;
6
-
7
- /** Util functions **/
8
- export function zoomToScale(zoom: number): number;
9
-
10
- export function scaleToZoom(scale: number): number;
11
-
12
- /**
13
- * Project [lng,lat] on sphere onto [x,y] on 512*512 Mercator Zoom 0 tile.
14
- * Performs the nonlinear part of the web mercator projection.
15
- * Remaining projection is done with 4x4 matrices which also handles
16
- * perspective.
17
- *
18
- * @param lngLat - [lng, lat] coordinates
19
- * Specifies a point on the sphere to project onto the map.
20
- * @return [x,y] coordinates.
21
- */
22
- export function lngLatToWorld(lngLat: number[]): number[];
23
-
24
- /**
25
- * Unproject world point [x,y] on map onto {lat, lon} on sphere
26
- *
27
- * @param xy - array with [x,y] members
28
- * representing point on projected map plane
29
- * @return - array with [x,y] of point on sphere.
30
- * Has toArray method if you need a GeoJSON Array.
31
- * Per cartographic tradition, lat and lon are specified as degrees.
32
- */
33
- export function worldToLngLat(xy: number[]): number[];
34
-
35
- // Returns the zoom level that gives a 1 meter pixel at a certain latitude
36
- // 1 = C*cos(y)/2^z/TILE_SIZE = C*cos(y)/2^(z+9)
37
- export function getMeterZoom(options: {latitude: number}): number;
38
-
39
- export type DistanceScales = {
40
- unitsPerMeter: number[];
41
- metersPerUnit: number[];
42
- unitsPerMeter2?: number[];
43
- unitsPerDegree: number[];
44
- degreesPerUnit: number[];
45
- unitsPerDegree2?: number[];
46
- };
47
-
48
- /**
49
- * Calculate distance scales in meters around current lat/lon, both for
50
- * degrees and pixels.
51
- * In mercator projection mode, the distance scales vary significantly
52
- * with latitude.
53
- */
54
- export function getDistanceScales(options: {
55
- latitude: number;
56
- longitude: number;
57
- highPrecision?: boolean;
58
- }): DistanceScales;
59
-
60
- /**
61
- * Offset a lng/lat position by meterOffset (northing, easting)
62
- */
63
- export function addMetersToLngLat(lngLatZ: number[], xyz: number[]): number[];
64
-
65
- // ATTRIBUTION:
66
- // view and projection matrix creation is intentionally kept compatible with
67
- // mapbox-gl's implementation to ensure that seamless interoperation
68
- // with mapbox and react-map-gl. See: https://github.com/mapbox/mapbox-gl-js
69
-
70
- export function getViewMatrix(options: {
71
- // Viewport props
72
- height: number;
73
- pitch: number;
74
- bearing: number;
75
- altitude: number;
76
- // Pre-calculated parameters
77
- scale: number;
78
- center: number[];
79
- }): number[];
80
-
81
- /**
82
- * PROJECTION MATRIX PARAMETERS
83
- *
84
- * TODO how to document mebers
85
- * @param fov in radians. fov is variable, depends on pitch and altitude
86
- * @param aspect width/height
87
- * @param focalDistance distance at which visual scale factor is 1
88
- * @param near near clipping plane
89
- * @param far far clipping plane
90
- */
91
- type ProjectionParameters = {
92
- fov: number;
93
- aspect: number;
94
- focalDistance: number;
95
- near: number;
96
- far: number;
97
- };
98
-
99
- /**
100
- * Calculates mapbox compatible projection matrix from parameters
101
- *
102
- * @param options.width Width of "viewport" or window
103
- * @param options.height Height of "viewport" or window
104
- * @param options.pitch Camera angle in degrees (0 is straight down)
105
- * @param options.fovy field of view in degrees
106
- * @param options.altitude if provided, field of view is calculated using `altitudeToFovy()`
107
- * @param options.nearZMultiplier control z buffer
108
- * @param options.farZMultiplier control z buffer
109
- * @returns project parameters object
110
- */
111
- export function getProjectionParameters(options: {
112
- width: number;
113
- height: number;
114
- fovy?: number;
115
- altitude?: number;
116
- pitch?: number;
117
- nearZMultiplier?: number;
118
- farZMultiplier?: number;
119
- }): ProjectionParameters;
120
-
121
- /**
122
- * CALCULATE PROJECTION MATRIX: PROJECTS FROM CAMERA (VIEW) SPACE TO CLIPSPACE
123
- *
124
- * To match mapbox's z buffer:
125
- * - \<= 0.28: nearZMultiplier: 0.1, farZmultiplier: 1
126
- * - \>= 0.29: nearZMultiplier: 1 / height, farZMultiplier: 1.01
127
- *
128
- * @param options Viewport options
129
- * @param options.width Width of "viewport" or window
130
- * @param options.height Height of "viewport" or window
131
- * @param options.pitch Camera angle in degrees (0 is straight down)
132
- * @param options.fovy field of view in degrees
133
- * @param options.altitude if provided, field of view is calculated using `altitudeToFovy()`
134
- * @param options.nearZMultiplier control z buffer
135
- * @param options.farZMultiplier control z buffer
136
- * @returns 4x4 projection matrix
137
- */
138
- export function getProjectionMatrix(options: {
139
- width: number;
140
- height: number;
141
- pitch: number;
142
- fovy?: number;
143
- altitude?: number;
144
- nearZMultiplier: number;
145
- farZMultiplier: number;
146
- }): number[];
147
-
148
- /**
149
- *
150
- * Convert an altitude to field of view such that the
151
- * focal distance is equal to the altitude
152
- *
153
- * @param altitude - altitude of camera in screen units
154
- * @return fovy field of view in degrees
155
- */
156
- export function altitudeToFovy(altitude: number): number;
157
-
158
- /**
159
- *
160
- * Convert an field of view such that the
161
- * focal distance is equal to the altitude
162
- *
163
- * @param fovy - field of view in degrees
164
- * @return altitude altitude of camera in screen units
165
- */
166
- export function fovyToAltitude(fovy: number): number;
167
-
168
- /**
169
- * Project flat coordinates to pixels on screen.
170
- *
171
- * @param xyz - flat coordinate on 512*512 Mercator Zoom 0 tile
172
- * @param pixelProjectionMatrix - projection matrix 4x4
173
- * @return [x, y, depth] pixel coordinate on screen.
174
- */
175
- export function worldToPixels(xyz: number[], pixelProjectionMatrix: number[]): number[];
176
-
177
- /**
178
- * Unproject pixels on screen to flat coordinates.
179
- *
180
- * @param xyz - pixel coordinate on screen.
181
- * @param pixelUnprojectionMatrix - unprojection matrix 4x4
182
- * @param targetZ - if pixel coordinate does not have a 3rd component (depth),
183
- * targetZ is used as the elevation plane to unproject onto
184
- * @return [x, y, Z] flat coordinates on 512*512 Mercator Zoom 0 tile.
185
- */
186
- export function pixelsToWorld(
187
- xyz: number[],
188
- pixelUnprojectionMatrix: number[],
189
- targetZ?: number
190
- ): number[];