t03-pole-domain-probe.mjs 1.2 KB

123456789101112131415161718192021222324
  1. /** 南极平移动向的定点诊断:直接调 shiftPivot,看每一步落点。 */
  2. import * as camera from '../../../src/modules/cockpit/domain/camera.js'
  3. const mpp = camera.metersPerPixel({ range: 25996782, fovYRad: (60 * Math.PI) / 180, viewportHeight: 950 })
  4. console.log(`米/像素 = ${Math.round(mpp)};40px = ${(40 * mpp / 1000).toFixed(0)} km`)
  5. for (const [name, start, dyPx] of [
  6. ['北极上空向南拖', { lon: 0, lat: 89.5, height: 0 }, -40],
  7. ['南极上空向南拖', { lon: 0, lat: -89.5, height: 0 }, -40],
  8. ['南极上空向北拖', { lon: 0, lat: -89.5, height: 0 }, +40],
  9. ]) {
  10. console.log(`\n== ${name}(起始 ${start.lon},${start.lat})==`)
  11. let pivot = start
  12. for (let i = 1; i <= 6; i += 1) {
  13. const offset = camera.pivotOffsetMeters({ headingDeg: 0, dxPx: 0, dyPx, metersPerPx: mpp })
  14. const next = camera.shiftPivot(pivot, offset)
  15. console.log(
  16. ` ${i}: east=${Math.round(offset.east)} north=${Math.round(offset.north)}` +
  17. ` → ${next.lon.toFixed(4)},${next.lat.toFixed(4)}` +
  18. ` |Δlat|=${Math.abs(next.lat - pivot.lat).toFixed(4)}`,
  19. )
  20. pivot = next
  21. }
  22. }