mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 10:42:22 +00:00
fix(tools): wrap whole-degree headings at 360 to 0
The query tools rounded courses, headings, bearings and azimuths with Number(value.toFixed(0)) and no wrap, so a direction of 359.5 degrees or more came back as 360: find_vessel with course 359.7 and heading 359.6 returned course_deg 360 and heading_deg 360. Round them through the shared roundHeadingDegrees helper the layers and UI already use (src/data/headingDegrees.js), which wraps into 0 to 359: course_deg and heading_deg (vessels), course_deg (aircraft), bearing_deg (transit), heading_deg (cameras), and rise_azimuth_deg and azimuth_deg (satellites). Other rounding is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
f3adccd01a
commit
ae55963a0e
11 files changed
+97
-8
No files matched your search
@@ -10,6 +10,7 @@ import { parseTleText, tleCatalogNumber } from '../../sources/tle.js';
|
||||
import { POINT_SCHEMA, resolvePoint } from '../area.js';
|
||||
import { defineTool, ToolError } from '../catalog.js';
|
||||
import { LIMIT_SCHEMA, capRows, countNoun, isoTime } from '../results.js';
|
||||
import { roundHeadingDegrees } from '../../data/headingDegrees.js';
|
||||
|
||||
const text = (value) => (typeof value === 'string' && value ? value : null);
|
||||
|
||||
@@ -241,7 +242,7 @@ export const nextSatellitePass = defineTool({
|
||||
peak: isoTime(pass.maxElevMs),
|
||||
set: isoTime(pass.setMs),
|
||||
max_elevation_deg: round(pass.maxElevDeg, 1),
|
||||
rise_azimuth_deg: round(pass.riseAzDeg, 0),
|
||||
rise_azimuth_deg: roundHeadingDegrees(pass.riseAzDeg),
|
||||
rise_direction: compass(pass.riseAzDeg),
|
||||
visible: pass.visible,
|
||||
},
|
||||
@@ -283,7 +284,7 @@ export const satellitesOverhead = defineTool({
|
||||
name: entry.name,
|
||||
norad: entry.norad,
|
||||
elevation_deg: round(look.elevDeg, 1),
|
||||
azimuth_deg: round(look.azDeg, 0),
|
||||
azimuth_deg: roundHeadingDegrees(look.azDeg),
|
||||
direction: compass(look.azDeg),
|
||||
},
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user