drone-path-core 1.2.0 → 1.2.1

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/dist/geo.d.ts CHANGED
@@ -15,6 +15,7 @@ export interface MercatorPixel {
15
15
  export declare const EARTH_RADIUS_M = 6371008.8;
16
16
  export declare const DEG_TO_RAD: number;
17
17
  export declare const RAD_TO_DEG: number;
18
+ export declare function clampMercatorLatitude(lat: number): number;
18
19
  export declare function isGpsFix(lat: number, lon: number): boolean;
19
20
  export declare function gpsFixOrNull(lat: number | null, lon: number | null): LatLon | null;
20
21
  export declare function haversineM(a: LatLon, b: LatLon): number;
package/dist/geo.js CHANGED
@@ -1,6 +1,10 @@
1
1
  export const EARTH_RADIUS_M = 6371008.8;
2
2
  export const DEG_TO_RAD = Math.PI / 180;
3
3
  export const RAD_TO_DEG = 180 / Math.PI;
4
+ const MAX_MERCATOR_LAT = 85.05112878;
5
+ export function clampMercatorLatitude(lat) {
6
+ return Math.max(-MAX_MERCATOR_LAT, Math.min(MAX_MERCATOR_LAT, lat));
7
+ }
4
8
  // (0, 0) is DJI's "no GPS lock" placeholder before the first fix, not a real fix.
5
9
  export function isGpsFix(lat, lon) {
6
10
  return (Number.isFinite(lat) &&
@@ -47,7 +51,7 @@ export function circularMeanDeg(degList) {
47
51
  export function project(lon, lat, zoom) {
48
52
  const scale = 256 * 2 ** zoom;
49
53
  const x = ((lon + 180) / 360) * scale;
50
- const sinLat = Math.sin(Math.max(-85.05112878, Math.min(85.05112878, lat)) * DEG_TO_RAD);
54
+ const sinLat = Math.sin(clampMercatorLatitude(lat) * DEG_TO_RAD);
51
55
  const y = (0.5 - Math.log((1 + sinLat) / (1 - sinLat)) / (4 * Math.PI)) * scale;
52
56
  return { x, y };
53
57
  }
@@ -0,0 +1 @@
1
+ export declare function roundTo(value: number, decimals: number): number;
@@ -0,0 +1,5 @@
1
+ export function roundTo(value, decimals) {
2
+ const factor = 10 ** decimals;
3
+ const rounded = Math.round(value * factor) / factor;
4
+ return rounded === 0 ? 0 : rounded;
5
+ }
package/dist/sharpness.js CHANGED
@@ -2,6 +2,7 @@ import { StringDecoder } from 'node:string_decoder';
2
2
  import { runTool, spawnTool } from './exec-tool.js';
3
3
  import { probeVideo } from './ffmpeg.js';
4
4
  import { timeAt } from './frametime.js';
5
+ import { roundTo } from './rounding.js';
5
6
  export const SHARPNESS_ANALYZER_METHOD = 'ffmpeg-blurdetect';
6
7
  export const SHARPNESS_ANALYZER_VERSION = '1';
7
8
  export const SHARPNESS_ANALYSIS_WIDTH = 640;
@@ -9,11 +10,6 @@ export const DEFAULT_MIN_EDGE_COVERAGE = 0.002;
9
10
  function clamp(value, min, max) {
10
11
  return Math.min(max, Math.max(min, value));
11
12
  }
12
- function roundTo(value, decimals) {
13
- const factor = 10 ** decimals;
14
- const rounded = Math.round(value * factor) / factor;
15
- return rounded === 0 ? 0 : rounded;
16
- }
17
13
  function parseFiniteOrNull(raw) {
18
14
  const num = Number(raw.trim());
19
15
  return Number.isFinite(num) ? num : null;
@@ -1,4 +1,5 @@
1
1
  import { bearingDeg, gpsFixOrNull, haversineM } from './geo.js';
2
+ import { roundTo } from './rounding.js';
2
3
  export const SHOT_TYPES = [
3
4
  'takeoff',
4
5
  'landing',
@@ -16,11 +17,6 @@ const EXPOSURE_REL_THRESHOLD = 0.25;
16
17
  const EXPOSURE_CCT_THRESHOLD_K = 200;
17
18
  const SHORT_CLIP_MAX_S = 4;
18
19
  const BLIP_MAX_DURATION_S = 2;
19
- function roundTo(value, decimals) {
20
- const factor = 10 ** decimals;
21
- const rounded = Math.round(value * factor) / factor;
22
- return rounded === 0 ? 0 : rounded;
23
- }
24
20
  function shortestAngleDiffDeg(fromDeg, toDeg) {
25
21
  return ((((toDeg - fromDeg + 540) % 360) + 360) % 360) - 180;
26
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drone-path-core",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Extract drone telemetry from DJI CAM-meta video streams and SRT sidecars.",
5
5
  "type": "module",
6
6
  "exports": {