MCPcopy Create free account
hub / github.com/microsoft/SandDance / wrapLongitudesForShortestPath

Function wrapLongitudesForShortestPath

docs/app/js/sanddance-app.js:102543–102552  ·  view source on GitHub ↗
(positions, size, startIndex, endIndex)

Source from the content-addressed store, hash-verified

102541 }
102542}
102543function wrapLongitudesForShortestPath(positions, size, startIndex, endIndex) {
102544 let prevLng = positions[0];
102545 let lng;
102546 for(let i = startIndex; i < endIndex; i += size){
102547 lng = positions[i];
102548 const delta = lng - prevLng;
102549 if (delta > 180 || delta < -180) lng -= Math.round(delta / 360) * 360;
102550 positions[i] = prevLng = lng;
102551 }
102552}
102553function shiftLongitudesIntoRange(positions, size) {
102554 let refLng;
102555 const pointCount = positions.length / size;

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected