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

Function insertPoleVertices

docs/app/js/sanddance-app.js:102530–102542  ·  view source on GitHub ↗
(positions, size, startIndex, endIndex, maxLatitude = DEFAULT_MAX_LATITUDE)

Source from the content-addressed store, hash-verified

102528 return pointIndex;
102529}
102530function insertPoleVertices(positions, size, startIndex, endIndex, maxLatitude = DEFAULT_MAX_LATITUDE) {
102531 const firstLng = positions[startIndex];
102532 const lastLng = positions[endIndex - size];
102533 if (Math.abs(firstLng - lastLng) > 180) {
102534 const p = (0, _utils.getPointAtIndex)(positions, 0, size, startIndex);
102535 p[0] += Math.round((lastLng - firstLng) / 360) * 360;
102536 (0, _utils.push)(positions, p);
102537 p[1] = Math.sign(p[1]) * maxLatitude;
102538 (0, _utils.push)(positions, p);
102539 p[0] = firstLng;
102540 (0, _utils.push)(positions, p);
102541 }
102542}
102543function wrapLongitudesForShortestPath(positions, size, startIndex, endIndex) {
102544 let prevLng = positions[0];
102545 let lng;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected