@tak-ps/node-cot 14.55.0 → 14.56.0

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/CHANGELOG.md CHANGED
@@ -12,6 +12,10 @@
12
12
 
13
13
  ### Pending Fixed
14
14
 
15
+ ### v14.56.0 - 2026-10-22
16
+
17
+ - :bug: More closely mirror ATAK's sensor math for consistent sensor display
18
+
15
19
  ### v14.55.0 - 2026-10-20
16
20
 
17
21
  - :tada: Add `device` Link attribute marking a CoT as the projection of a CloudTAK Core Device
@@ -5,5 +5,9 @@ export default class Sensor {
5
5
  center: Static<typeof Position>;
6
6
  sensor: Static<typeof SensorAttributes>;
7
7
  constructor(center: Static<typeof Position>, sensor: Static<typeof SensorAttributes>);
8
+ /**
9
+ * Ground footprint of the sensor cone, centred on the azimuth.
10
+ * `range` is a slant range so it is projected to the ground via the elevation
11
+ */
8
12
  to_geojson(): Static<typeof Polygon> | null;
9
13
  }
@@ -8,14 +8,23 @@ export default class Sensor {
8
8
  this.center = center;
9
9
  this.sensor = sensor;
10
10
  }
11
+ /**
12
+ * Ground footprint of the sensor cone, centred on the azimuth.
13
+ * `range` is a slant range so it is projected to the ground via the elevation
14
+ */
11
15
  to_geojson() {
12
16
  if (!this.sensor.range)
13
17
  return null;
14
- if (!this.sensor.azimuth)
18
+ if (typeof this.sensor.azimuth !== 'number')
15
19
  return null;
16
20
  if (!this.sensor.fov)
17
21
  return null;
18
- return sector(this.center, this.sensor.range / 1000, this.sensor.azimuth, this.sensor.azimuth + this.sensor.fov).geometry;
22
+ const elevation = this.sensor.elevation || 0;
23
+ const ground = this.sensor.range * Math.cos(elevation * Math.PI / 180);
24
+ if (ground < 1)
25
+ return null;
26
+ const half = this.sensor.fov / 2;
27
+ return sector(this.center, ground / 1000, this.sensor.azimuth - half, this.sensor.azimuth + half).geometry;
19
28
  }
20
29
  }
21
30
  //# sourceMappingURL=sensor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sensor.js","sourceRoot":"","sources":["../../lib/sensor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,CAAC,OAAO,OAAO,MAAM;IACvB,MAAM,CAA0B;IAChC,MAAM,CAAkC;IAExC,YACI,MAA+B,EAC/B,MAAuC;QAEvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,UAAU;QACN,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC;QAElC,OAAO,MAAM,CACT,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,EACxB,IAAI,CAAC,MAAM,CAAC,OAAO,EACnB,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CACxC,CAAC,QAAQ,CAAC;IACf,CAAC;CACJ"}
1
+ {"version":3,"file":"sensor.js","sourceRoot":"","sources":["../../lib/sensor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,CAAC,OAAO,OAAO,MAAM;IACvB,MAAM,CAA0B;IAChC,MAAM,CAAkC;IAExC,YACI,MAA+B,EAC/B,MAAuC;QAEvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED;;;OAGG;IACH,UAAU;QACN,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QACpC,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QACzD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC;QAElC,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC;QAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;QACvE,IAAI,MAAM,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAE5B,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC;QAEjC,OAAO,MAAM,CACT,IAAI,CAAC,MAAM,EACX,MAAM,GAAG,IAAI,EACb,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,EAC1B,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAC7B,CAAC,QAAQ,CAAC;IACf,CAAC;CACJ"}
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/node-cot",
3
3
  "type": "module",
4
- "version": "14.55.0",
4
+ "version": "14.56.0",
5
5
  "description": "Lightweight JavaScript library for parsing and manipulating TAK messages",
6
6
  "author": "Nick Ingalls <nick@ingalls.ca>",
7
7
  "types": "index.ts",
package/lib/sensor.ts CHANGED
@@ -15,16 +15,26 @@ export default class Sensor {
15
15
  this.sensor = sensor;
16
16
  }
17
17
 
18
+ /**
19
+ * Ground footprint of the sensor cone, centred on the azimuth.
20
+ * `range` is a slant range so it is projected to the ground via the elevation
21
+ */
18
22
  to_geojson(): Static<typeof Polygon> | null {
19
23
  if (!this.sensor.range) return null;
20
- if (!this.sensor.azimuth) return null;
24
+ if (typeof this.sensor.azimuth !== 'number') return null;
21
25
  if (!this.sensor.fov) return null;
22
26
 
27
+ const elevation = this.sensor.elevation || 0;
28
+ const ground = this.sensor.range * Math.cos(elevation * Math.PI / 180);
29
+ if (ground < 1) return null;
30
+
31
+ const half = this.sensor.fov / 2;
32
+
23
33
  return sector(
24
34
  this.center,
25
- this.sensor.range / 1000,
26
- this.sensor.azimuth,
27
- this.sensor.azimuth + this.sensor.fov,
35
+ ground / 1000,
36
+ this.sensor.azimuth - half,
37
+ this.sensor.azimuth + half,
28
38
  ).geometry;
29
39
  }
30
40
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/node-cot",
3
3
  "type": "module",
4
- "version": "14.55.0",
4
+ "version": "14.56.0",
5
5
  "description": "Lightweight JavaScript library for parsing and manipulating TAK messages",
6
6
  "author": "Nick Ingalls <nick@ingalls.ca>",
7
7
  "types": "index.ts",