@math.gl/web-mercator 3.5.6 → 3.6.0-alpha.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.
Files changed (94) 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 +33 -37
  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 +6 -0
  12. package/dist/es5/index.js.map +1 -1
  13. package/dist/es5/math-utils.js +8 -9
  14. package/dist/es5/math-utils.js.map +1 -1
  15. package/dist/es5/normalize-viewport-props.js +10 -10
  16. package/dist/es5/normalize-viewport-props.js.map +1 -1
  17. package/dist/es5/web-mercator-utils.js +47 -61
  18. package/dist/es5/web-mercator-utils.js.map +1 -1
  19. package/dist/es5/web-mercator-viewport.js +69 -51
  20. package/dist/es5/web-mercator-viewport.js.map +1 -1
  21. package/dist/esm/assert.js.map +1 -1
  22. package/dist/esm/fit-bounds.js +29 -34
  23. package/dist/esm/fit-bounds.js.map +1 -1
  24. package/dist/esm/fly-to-viewport.js +13 -9
  25. package/dist/esm/fly-to-viewport.js.map +1 -1
  26. package/dist/esm/get-bounds.js +1 -1
  27. package/dist/esm/get-bounds.js.map +1 -1
  28. package/dist/esm/index.js +1 -1
  29. package/dist/esm/index.js.map +1 -1
  30. package/dist/esm/math-utils.js +6 -3
  31. package/dist/esm/math-utils.js.map +1 -1
  32. package/dist/esm/normalize-viewport-props.js +13 -9
  33. package/dist/esm/normalize-viewport-props.js.map +1 -1
  34. package/dist/esm/web-mercator-utils.js +47 -52
  35. package/dist/esm/web-mercator-utils.js.map +1 -1
  36. package/dist/esm/web-mercator-viewport.js +76 -34
  37. package/dist/esm/web-mercator-viewport.js.map +1 -1
  38. package/dist/fit-bounds.d.ts +50 -0
  39. package/dist/fit-bounds.d.ts.map +1 -0
  40. package/dist/fit-bounds.js +63 -0
  41. package/dist/fly-to-viewport.d.ts +19 -0
  42. package/dist/fly-to-viewport.d.ts.map +1 -0
  43. package/dist/fly-to-viewport.js +87 -0
  44. package/dist/get-bounds.d.ts +3 -0
  45. package/dist/get-bounds.d.ts.map +1 -0
  46. package/dist/get-bounds.js +51 -0
  47. package/dist/index.d.ts +11 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +8 -0
  50. package/dist/math-utils.d.ts +7 -0
  51. package/dist/math-utils.d.ts.map +1 -0
  52. package/dist/math-utils.js +26 -0
  53. package/dist/normalize-viewport-props.d.ts +16 -0
  54. package/dist/normalize-viewport-props.d.ts.map +1 -0
  55. package/dist/normalize-viewport-props.js +41 -0
  56. package/dist/{es5/web-mercator-utils.d.ts → web-mercator-utils.d.ts} +78 -94
  57. package/dist/web-mercator-utils.d.ts.map +1 -0
  58. package/dist/web-mercator-utils.js +290 -0
  59. package/dist/web-mercator-viewport.d.ts +182 -0
  60. package/dist/web-mercator-viewport.d.ts.map +1 -0
  61. package/dist/web-mercator-viewport.js +281 -0
  62. package/package.json +4 -4
  63. package/src/{assert.js → assert.ts} +1 -1
  64. package/src/fit-bounds.ts +127 -0
  65. package/src/{fly-to-viewport.js → fly-to-viewport.ts} +52 -14
  66. package/src/{get-bounds.js → get-bounds.ts} +7 -5
  67. package/src/{index.js → index.ts} +5 -0
  68. package/src/math-utils.ts +32 -0
  69. package/src/{normalize-viewport-props.js → normalize-viewport-props.ts} +19 -10
  70. package/src/{web-mercator-utils.js → web-mercator-utils.ts} +186 -76
  71. package/src/web-mercator-viewport.ts +415 -0
  72. package/dist/es5/fit-bounds.d.ts +0 -64
  73. package/dist/es5/fly-to-viewport.d.ts +0 -31
  74. package/dist/es5/get-bounds.d.ts +0 -3
  75. package/dist/es5/index.d.ts +0 -23
  76. package/dist/es5/normalize-viewport-props.d.ts +0 -16
  77. package/dist/es5/web-mercator-viewport.d.ts +0 -187
  78. package/dist/esm/fit-bounds.d.ts +0 -64
  79. package/dist/esm/fly-to-viewport.d.ts +0 -31
  80. package/dist/esm/get-bounds.d.ts +0 -3
  81. package/dist/esm/index.d.ts +0 -23
  82. package/dist/esm/normalize-viewport-props.d.ts +0 -16
  83. package/dist/esm/web-mercator-utils.d.ts +0 -189
  84. package/dist/esm/web-mercator-viewport.d.ts +0 -187
  85. package/src/fit-bounds.d.ts +0 -64
  86. package/src/fit-bounds.js +0 -84
  87. package/src/fly-to-viewport.d.ts +0 -31
  88. package/src/get-bounds.d.ts +0 -3
  89. package/src/index.d.ts +0 -23
  90. package/src/math-utils.js +0 -28
  91. package/src/normalize-viewport-props.d.ts +0 -16
  92. package/src/web-mercator-utils.d.ts +0 -189
  93. package/src/web-mercator-viewport.d.ts +0 -187
  94. package/src/web-mercator-viewport.js +0 -262
@@ -4,17 +4,26 @@ import {mod, log2} from './math-utils';
4
4
  // defined by mapbox-gl
5
5
  const TILE_SIZE = 512;
6
6
 
7
- // Apply mathematical constraints to viewport props
7
+ /** Description of viewport */
8
+ export type ViewportProps = {
9
+ width: number;
10
+ height: number;
11
+ longitude: number;
12
+ latitude: number;
13
+ zoom: number;
14
+ pitch?: number;
15
+ bearing?: number;
16
+ };
17
+
18
+ /**
19
+ * Apply mathematical constraints to viewport props
20
+ * @param props
21
+ */
8
22
  // eslint-disable-next-line complexity
9
- export default function normalizeViewportProps({
10
- width,
11
- height,
12
- longitude,
13
- latitude,
14
- zoom,
15
- pitch = 0,
16
- bearing = 0
17
- }) {
23
+ export default function normalizeViewportProps(props: ViewportProps): ViewportProps {
24
+ const {width, height, pitch = 0} = props;
25
+ let {longitude, latitude, zoom, bearing = 0} = props;
26
+
18
27
  // Normalize degrees
19
28
  if (longitude < -180 || longitude > 180) {
20
29
  longitude = mod(longitude + 180, 360) - 180;
@@ -15,16 +15,46 @@ const RADIANS_TO_DEGREES = 180 / PI;
15
15
  const TILE_SIZE = 512;
16
16
  // Average circumference (40075 km equatorial, 40007 km meridional)
17
17
  const EARTH_CIRCUMFERENCE = 40.03e6;
18
+ // Latitude that makes a square world, 2 * atan(E ** PI) - PI / 2
19
+ export const MAX_LATITUDE = 85.051129;
18
20
 
19
21
  // Mapbox default altitude
20
22
  export const DEFAULT_ALTITUDE = 1.5;
21
23
 
22
- /** Util functions **/
23
- export function zoomToScale(zoom) {
24
+ export type DistanceScales = {
25
+ unitsPerMeter: number[];
26
+ metersPerUnit: number[];
27
+ unitsPerMeter2?: number[];
28
+ unitsPerDegree: number[];
29
+ degreesPerUnit: number[];
30
+ unitsPerDegree2?: number[];
31
+ };
32
+
33
+ /**
34
+ * PROJECTION MATRIX PARAMETERS
35
+ *
36
+ * TODO how to document mebers
37
+ * @param fov in radians. fov is variable, depends on pitch and altitude
38
+ * @param aspect width/height
39
+ * @param focalDistance distance at which visual scale factor is 1
40
+ * @param near near clipping plane
41
+ * @param far far clipping plane
42
+ */
43
+ type ProjectionParameters = {
44
+ fov: number;
45
+ aspect: number;
46
+ focalDistance: number;
47
+ near: number;
48
+ far: number;
49
+ };
50
+
51
+ /** Logarithimic zoom to linear scale **/
52
+ export function zoomToScale(zoom: number): number {
24
53
  return Math.pow(2, zoom);
25
54
  }
26
55
 
27
- export function scaleToZoom(scale) {
56
+ /** Linear scale to logarithimic zoom **/
57
+ export function scaleToZoom(scale: number): number {
28
58
  return log2(scale);
29
59
  }
30
60
 
@@ -38,7 +68,8 @@ export function scaleToZoom(scale) {
38
68
  * Specifies a point on the sphere to project onto the map.
39
69
  * @return [x,y] coordinates.
40
70
  */
41
- export function lngLatToWorld([lng, lat]) {
71
+ export function lngLatToWorld(lngLat: number[]): [number, number] {
72
+ const [lng, lat] = lngLat;
42
73
  assert(Number.isFinite(lng));
43
74
  assert(Number.isFinite(lat) && lat >= -90 && lat <= 90, 'invalid latitude');
44
75
 
@@ -49,16 +80,28 @@ export function lngLatToWorld([lng, lat]) {
49
80
  return [x, y];
50
81
  }
51
82
 
52
- // Unproject world point [x,y] on map onto {lat, lon} on sphere
53
- export function worldToLngLat([x, y]) {
83
+ /**
84
+ * Unproject world point [x,y] on map onto {lat, lon} on sphere
85
+ *
86
+ * @param xy - array with [x,y] members
87
+ * representing point on projected map plane
88
+ * @return - array with [x,y] of point on sphere.
89
+ * Has toArray method if you need a GeoJSON Array.
90
+ * Per cartographic tradition, lat and lon are specified as degrees.
91
+ */
92
+ export function worldToLngLat(xy: number[]): [number, number] {
93
+ const [x, y] = xy;
54
94
  const lambda2 = (x / TILE_SIZE) * (2 * PI) - PI;
55
95
  const phi2 = 2 * (Math.atan(Math.exp((y / TILE_SIZE) * (2 * PI) - PI)) - PI_4);
56
96
  return [lambda2 * RADIANS_TO_DEGREES, phi2 * RADIANS_TO_DEGREES];
57
97
  }
58
98
 
59
- // Returns the zoom level that gives a 1 meter pixel at a certain latitude
60
- // 1 = C*cos(y)/2^z/TILE_SIZE = C*cos(y)/2^(z+9)
61
- export function getMeterZoom({latitude}) {
99
+ /**
100
+ * Returns the zoom level that gives a 1 meter pixel at a certain latitude
101
+ * 1 = C*cos(y)/2^z/TILE_SIZE = C*cos(y)/2^(z+9)
102
+ */
103
+ export function getMeterZoom(options: {latitude: number}): number {
104
+ const {latitude} = options;
62
105
  assert(Number.isFinite(latitude));
63
106
  const latCosine = Math.cos(latitude * DEGREES_TO_RADIANS);
64
107
  return scaleToZoom(EARTH_CIRCUMFERENCE * latCosine) - 9;
@@ -70,11 +113,14 @@ export function getMeterZoom({latitude}) {
70
113
  * In mercator projection mode, the distance scales vary significantly
71
114
  * with latitude.
72
115
  */
73
-
74
- export function getDistanceScales({latitude, longitude, highPrecision = false}) {
116
+ export function getDistanceScales(options: {
117
+ latitude: number;
118
+ longitude: number;
119
+ highPrecision?: boolean;
120
+ }): DistanceScales {
121
+ const {latitude, longitude, highPrecision = false} = options;
75
122
  assert(Number.isFinite(latitude) && Number.isFinite(longitude));
76
123
 
77
- const result = {};
78
124
  const worldSize = TILE_SIZE;
79
125
  const latCosine = Math.cos(latitude * DEGREES_TO_RADIANS);
80
126
 
@@ -100,11 +146,13 @@ export function getDistanceScales({latitude, longitude, highPrecision = false})
100
146
  *
101
147
  * Y needs to be flipped when converting delta degree/meter to delta pixels
102
148
  */
103
- result.unitsPerMeter = [altUnitsPerMeter, altUnitsPerMeter, altUnitsPerMeter];
104
- result.metersPerUnit = [1 / altUnitsPerMeter, 1 / altUnitsPerMeter, 1 / altUnitsPerMeter];
149
+ const result: DistanceScales = {
150
+ unitsPerMeter: [altUnitsPerMeter, altUnitsPerMeter, altUnitsPerMeter],
151
+ metersPerUnit: [1 / altUnitsPerMeter, 1 / altUnitsPerMeter, 1 / altUnitsPerMeter],
105
152
 
106
- result.unitsPerDegree = [unitsPerDegreeX, unitsPerDegreeY, altUnitsPerMeter];
107
- result.degreesPerUnit = [1 / unitsPerDegreeX, 1 / unitsPerDegreeY, 1 / altUnitsPerMeter];
153
+ unitsPerDegree: [unitsPerDegreeX, unitsPerDegreeY, altUnitsPerMeter],
154
+ degreesPerUnit: [1 / unitsPerDegreeX, 1 / unitsPerDegreeY, 1 / altUnitsPerMeter]
155
+ };
108
156
 
109
157
  /**
110
158
  * Taylor series 2nd order for 1/latCosine
@@ -129,7 +177,7 @@ export function getDistanceScales({latitude, longitude, highPrecision = false})
129
177
  /**
130
178
  * Offset a lng/lat position by meterOffset (northing, easting)
131
179
  */
132
- export function addMetersToLngLat(lngLatZ, xyz) {
180
+ export function addMetersToLngLat(lngLatZ: number[], xyz: number[]): number[] {
133
181
  const [longitude, latitude, z0] = lngLatZ;
134
182
  const [x, y, z] = xyz;
135
183
 
@@ -143,28 +191,38 @@ export function addMetersToLngLat(lngLatZ, xyz) {
143
191
  worldspace[0] += x * (unitsPerMeter[0] + unitsPerMeter2[0] * y);
144
192
  worldspace[1] += y * (unitsPerMeter[1] + unitsPerMeter2[1] * y);
145
193
 
146
- // @ts-ignore
147
194
  const newLngLat = worldToLngLat(worldspace);
148
195
  const newZ = (z0 || 0) + (z || 0);
149
196
 
150
197
  return Number.isFinite(z0) || Number.isFinite(z) ? [newLngLat[0], newLngLat[1], newZ] : newLngLat;
151
198
  }
152
199
 
153
- // ATTRIBUTION:
154
- // view and projection matrix creation is intentionally kept compatible with
155
- // mapbox-gl's implementation to ensure that seamless interoperation
156
- // with mapbox and react-map-gl. See: https://github.com/mapbox/mapbox-gl-js
157
-
158
- export function getViewMatrix({
200
+ /**
201
+ *
202
+ * view and projection matrix creation is intentionally kept compatible with
203
+ * mapbox-gl's implementation to ensure that seamless interoperation
204
+ * with mapbox and react-map-gl. See: https://github.com/mapbox/mapbox-gl-js
205
+ */
206
+ export function getViewMatrix(options: {
159
207
  // Viewport props
160
- height,
161
- pitch,
162
- bearing,
163
- altitude,
208
+ height: number;
209
+ pitch: number;
210
+ bearing: number;
211
+ altitude: number;
164
212
  // Pre-calculated parameters
165
- scale,
166
- center = null
167
- }) {
213
+ scale: number;
214
+ center?: number[];
215
+ }): number[] {
216
+ const {
217
+ // Viewport props
218
+ height,
219
+ pitch,
220
+ bearing,
221
+ altitude,
222
+ // Pre-calculated parameters
223
+ scale,
224
+ center
225
+ } = options;
168
226
  // VIEW MATRIX: PROJECTS MERCATOR WORLD COORDINATES
169
227
  // Note that mercator world coordinates typically need to be flipped
170
228
  //
@@ -179,8 +237,8 @@ export function getViewMatrix({
179
237
  mat4.rotateX(vm, vm, -pitch * DEGREES_TO_RADIANS);
180
238
  mat4.rotateZ(vm, vm, bearing * DEGREES_TO_RADIANS);
181
239
 
182
- scale /= height;
183
- mat4.scale(vm, vm, [scale, scale, scale]);
240
+ const relativeScale = scale / height;
241
+ mat4.scale(vm, vm, [relativeScale, relativeScale, relativeScale]);
184
242
 
185
243
  if (center) {
186
244
  mat4.translate(vm, vm, vec3.negate([], center));
@@ -189,17 +247,30 @@ export function getViewMatrix({
189
247
  return vm;
190
248
  }
191
249
 
192
- // PROJECTION MATRIX PARAMETERS
193
- // Variable fov (in radians)
194
- export function getProjectionParameters({
195
- width,
196
- height,
197
- fovy = altitudeToFovy(DEFAULT_ALTITUDE),
198
- altitude,
199
- pitch = 0,
200
- nearZMultiplier = 1,
201
- farZMultiplier = 1
202
- }) {
250
+ /**
251
+ * Calculates mapbox compatible projection matrix from parameters
252
+ *
253
+ * @param options.width Width of "viewport" or window
254
+ * @param options.height Height of "viewport" or window
255
+ * @param options.pitch Camera angle in degrees (0 is straight down)
256
+ * @param options.fovy field of view in degrees
257
+ * @param options.altitude if provided, field of view is calculated using `altitudeToFovy()`
258
+ * @param options.nearZMultiplier control z buffer
259
+ * @param options.farZMultiplier control z buffer
260
+ * @returns project parameters object
261
+ */
262
+ export function getProjectionParameters(options: {
263
+ width: number;
264
+ height: number;
265
+ fovy?: number;
266
+ altitude?: number;
267
+ pitch?: number;
268
+ nearZMultiplier?: number;
269
+ farZMultiplier?: number;
270
+ }): ProjectionParameters {
271
+ const {width, height, altitude, pitch = 0, nearZMultiplier = 1, farZMultiplier = 1} = options;
272
+ let {fovy = altitudeToFovy(DEFAULT_ALTITUDE)} = options;
273
+
203
274
  // For back-compatibility allow field of view to be
204
275
  // derived from altitude
205
276
  if (altitude !== undefined) {
@@ -227,31 +298,36 @@ export function getProjectionParameters({
227
298
  };
228
299
  }
229
300
 
230
- // PROJECTION MATRIX: PROJECTS FROM CAMERA (VIEW) SPACE TO CLIPSPACE
231
- // To match mapbox's z buffer:
232
- // <= 0.28 - nearZMultiplier: 0.1, farZmultiplier: 1
233
- // >= 0.29 - nearZMultiplier: 1 / height, farZMultiplier: 1.01
234
- export function getProjectionMatrix({
235
- width,
236
- height,
237
- pitch,
238
- altitude,
239
- fovy,
240
- nearZMultiplier,
241
- farZMultiplier
242
- }) {
243
- const {fov, aspect, near, far} = getProjectionParameters({
244
- width,
245
- height,
246
- altitude,
247
- fovy,
248
- pitch,
249
- nearZMultiplier,
250
- farZMultiplier
251
- });
301
+ /**
302
+ * CALCULATE PROJECTION MATRIX: PROJECTS FROM CAMERA (VIEW) SPACE TO CLIPSPACE
303
+ *
304
+ * To match mapbox's z buffer:
305
+ * - \<= 0.28: nearZMultiplier: 0.1, farZmultiplier: 1
306
+ * - \>= 0.29: nearZMultiplier: 1 / height, farZMultiplier: 1.01
307
+ *
308
+ * @param options Viewport options
309
+ * @param options.width Width of "viewport" or window
310
+ * @param options.height Height of "viewport" or window
311
+ * @param options.pitch Camera angle in degrees (0 is straight down)
312
+ * @param options.fovy field of view in degrees
313
+ * @param options.altitude if provided, field of view is calculated using `altitudeToFovy()`
314
+ * @param options.nearZMultiplier control z buffer
315
+ * @param options.farZMultiplier control z buffer
316
+ * @returns 4x4 projection matrix
317
+ */
318
+ export function getProjectionMatrix(options: {
319
+ width: number;
320
+ height: number;
321
+ pitch: number;
322
+ fovy?: number;
323
+ altitude?: number;
324
+ nearZMultiplier: number;
325
+ farZMultiplier: number;
326
+ }): number[] {
327
+ const {fov, aspect, near, far} = getProjectionParameters(options);
252
328
 
253
329
  const projectionMatrix = mat4.perspective(
254
- [],
330
+ [] as number[],
255
331
  fov, // fov in radians
256
332
  aspect, // aspect ratio
257
333
  near, // near plane
@@ -261,27 +337,61 @@ export function getProjectionMatrix({
261
337
  return projectionMatrix;
262
338
  }
263
339
 
264
- // Utility function to calculate the field of view such that
265
- // the focal distance is equal to the ground distance. This
266
- // is how mapbox's z fov is calculated
267
- export function altitudeToFovy(altitude) {
340
+ /**
341
+ *
342
+ * Convert an altitude to field of view such that the
343
+ * focal distance is equal to the altitude
344
+ *
345
+ * @param altitude - altitude of camera in screen units
346
+ * @return fovy field of view in degrees
347
+ */
348
+ export function altitudeToFovy(altitude: number): number {
268
349
  return 2 * Math.atan(0.5 / altitude) * RADIANS_TO_DEGREES;
269
350
  }
270
351
 
271
- export function fovyToAltitude(fovy) {
352
+ /**
353
+ *
354
+ * Convert an field of view such that the
355
+ * focal distance is equal to the altitude
356
+ *
357
+ * @param fovy - field of view in degrees
358
+ * @return altitude altitude of camera in screen units
359
+ */
360
+ export function fovyToAltitude(fovy: number): number {
272
361
  return 0.5 / Math.tan(0.5 * fovy * DEGREES_TO_RADIANS);
273
362
  }
274
363
 
364
+ /**
365
+ * Project flat coordinates to pixels on screen.
366
+ *
367
+ * @param xyz - flat coordinate on 512*512 Mercator Zoom 0 tile
368
+ * @param pixelProjectionMatrix - projection matrix 4x4
369
+ * @return [x, y, depth] pixel coordinate on screen.
370
+ */
371
+ export function worldToPixels(xyz: number[], pixelProjectionMatrix: number[]): number[];
372
+
275
373
  // Project flat coordinates to pixels on screen.
276
- export function worldToPixels(xyz, pixelProjectionMatrix) {
374
+ export function worldToPixels(xyz: number[], pixelProjectionMatrix: number[]): number[] {
277
375
  const [x, y, z = 0] = xyz;
278
376
  assert(Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(z));
279
377
 
280
378
  return transformVector(pixelProjectionMatrix, [x, y, z, 1]);
281
379
  }
282
380
 
283
- // Unproject pixels on screen to flat coordinates.
284
- export function pixelsToWorld(xyz, pixelUnprojectionMatrix, targetZ = 0) {
381
+ /**
382
+ * Unproject pixels on screen to flat coordinates.
383
+ *
384
+ * @param xyz - pixel coordinate on screen.
385
+ * @param pixelUnprojectionMatrix - unprojection matrix 4x4
386
+ * @param targetZ - if pixel coordinate does not have a 3rd component (depth),
387
+ * targetZ is used as the elevation plane to unproject onto
388
+ * @return [x, y, Z] flat coordinates on 512*512 Mercator Zoom 0 tile.
389
+ */
390
+ export function pixelsToWorld(
391
+ xyz: number[],
392
+ pixelUnprojectionMatrix: number[],
393
+ targetZ: number = 0
394
+ ): number[] {
285
395
  const [x, y, z] = xyz;
286
396
  assert(Number.isFinite(x) && Number.isFinite(y), 'invalid pixel coordinate');
287
397
 
@@ -300,5 +410,5 @@ export function pixelsToWorld(xyz, pixelUnprojectionMatrix, targetZ = 0) {
300
410
  const z1 = coord1[2];
301
411
 
302
412
  const t = z0 === z1 ? 0 : ((targetZ || 0) - z0) / (z1 - z0);
303
- return vec2.lerp([], coord0, coord1, t);
413
+ return vec2.lerp([] as number[], coord0, coord1, t);
304
414
  }