t03-pan-direction-probe.mjs 1.5 KB

123456789101112131415161718192021222324252627282930
  1. import * as c from '../../../src/modules/cockpit/domain/camera.js'
  2. const mpp = 31598 // 全球视角下的一像素米数(约 31.6km/px,40px 就是 1264km,最坏情况)
  3. const show = (name, start, dyPx) => {
  4. process.stdout.write('== ' + name + ' ==\n')
  5. let p = start
  6. for (let i = 1; i <= 6; i += 1) {
  7. const off = c.pivotOffsetMeters({ headingDeg: 0, dxPx: 0, dyPx, metersPerPx: mpp })
  8. const n = c.shiftPivot(p, off)
  9. process.stdout.write(
  10. ' ' + i + ': north=' + Math.round(off.north) + ' → ' + n.lon.toFixed(4) + ',' + n.lat.toFixed(4) + '\n',
  11. )
  12. p = n
  13. }
  14. }
  15. // dy>0 → north>0 → 向北(朝北极方向)
  16. show('北极界上 85°,继续向北(应钉在 85)', { lon: 0, lat: 85, height: 0 }, 60)
  17. show('赤道附近向北(应正常推进)', { lon: 0, lat: 10, height: 0 }, 60)
  18. show('南极界上 -85°,继续向南(应钉在 -85)', { lon: 0, lat: -85, height: 0 }, -60)
  19. show('界内侧 82°,向北(应停在 85)', { lon: -170, lat: 82, height: 0 }, 60)
  20. process.stdout.write('== 界上东西向(应绕极轴有界移动,纬度不变) ==\n')
  21. let p = { lon: 0, lat: 85, height: 0 }
  22. for (let i = 1; i <= 4; i += 1) {
  23. const off = c.pivotOffsetMeters({ headingDeg: 0, dxPx: 200, dyPx: 0, metersPerPx: mpp })
  24. const n = c.shiftPivot(p, off)
  25. process.stdout.write(' ' + i + ': east=' + Math.round(off.east) + ' → ' + n.lon.toFixed(4) + ',' + n.lat.toFixed(4) + '\n')
  26. p = n
  27. }