function densifyLine(interpolate, fromProjection, toProjection, squaredTolerance) {
    const transform = proj4(fromProjection, toProjection).forward;

    let {fractions, line, reprojectedLine} = interpolationStepList([0, 1], interpolate, transform);
    let coordinates = [];
    coordinates = addPoint(coordinates, reprojectedLine[0]);

    let iteration = 0;
    while (iteration < MAX_INTERPOLATION_ITERATIONS && fractions.length > 0) {
        const fractionA = fractions.shift();
        const fractionB = fractions.shift();

        const a = line.shift();
        const b = line.shift();

        const reprojectedA = reprojectedLine.shift();
        const reprojectedB = reprojectedLine.shift();

        const {fraction: newFraction, point: newPoint, reprojected: reprojectedPoint} =
            interpolationStep((fractionA + fractionB) / 2, interpolate, transform);

        if (squaredSegmentDistance(reprojectedPoint, reprojectedA, reprojectedB) < squaredTolerance) {
            coordinates.push(reprojectedB[0]);
            coordinates.push(reprojectedB[1]);
        } else {
            fractions.unshift(fractionA, newFraction, newFraction, fractionB);
            line.unshift(a, newPoint, newPoint, b);
            reprojectedLine.unshift(reprojectedA, reprojectedPoint, reprojectedPoint, reprojectedB);
        }
        iteration++;
    }

    return coordinates;
}
/**
 * Densifies a line, so that it is properly curved after reprojection.
 *
 * @param {function} interpolate interpolation function, receives a number from 0 to 1 and returns a point along
 * the line at the given fraction.
 * @param {string} fromProjection source line projection
 * @param {string} toProjection destination line projection
 * @param {number} squaredTolerance tolerance used to identify straight / curved lines
 * @return a densified line
 */
Densifies a line, so that it is properly curved after reprojection.
@param {function} interpolate interpolation function, receives a number from 0 to 1 and returns a point along
the line at the given fraction.
@param {string} fromProjection source line projection
@param {string} toProjection destination line projection
@param {number} squaredTolerance tolerance used to identify straight / curved lines
@return a densified line
Densifies a line so that it is properly curved after reprojection . @param { function } interpolate interpolation function receives a number from 0 to 1 and returns a point along the line at the given fraction . @param { string } fromProjection source line projection @param { string } toProjection destination line projection @param { number } squaredTolerance tolerance used to identify straight / curved lines @return a densified line
function densifyLine(interpolate, fromProjection, toProjection, squaredTolerance) {
    const transform = proj4(fromProjection, toProjection).forward;
    let {fractions, line, reprojectedLine} = interpolationStepList([0, 1], interpolate, transform);
    let coordinates = [];
    coordinates = addPoint(coordinates, reprojectedLine[0]);
    let iteration = 0;
    while (iteration < MAX_INTERPOLATION_ITERATIONS && fractions.length > 0) {
        const fractionA = fractions.shift();
        const fractionB = fractions.shift();
        const a = line.shift();
        const b = line.shift();
        const reprojectedA = reprojectedLine.shift();
        const reprojectedB = reprojectedLine.shift();
        const {fraction: newFraction, point: newPoint, reprojected: reprojectedPoint} =
            interpolationStep((fractionA + fractionB) / 2, interpolate, transform);
        if (squaredSegmentDistance(reprojectedPoint, reprojectedA, reprojectedB) < squaredTolerance) {
            coordinates.push(reprojectedB[0]);
            coordinates.push(reprojectedB[1]);
        } else {
            fractions.unshift(fractionA, newFraction, newFraction, fractionB);
            line.unshift(a, newPoint, newPoint, b);
            reprojectedLine.unshift(reprojectedA, reprojectedPoint, reprojectedPoint, reprojectedB);
        }
        iteration++;
    }
    return coordinates;
}
function densifyLine ( interpolate , fromProjection , toProjection , squaredTolerance ) { const transform = proj4 ( fromProjection , toProjection ) . forward ; let { fractions , line , reprojectedLine } = interpolationStepList ( [ 0 , 1 ] , interpolate , transform ) ; let coordinates = [ ] ; coordinates = addPoint ( coordinates , reprojectedLine [ 0 ] ) ; let iteration = 0 ; while ( iteration < MAX_INTERPOLATION_ITERATIONS && fractions . length > 0 ) { const fractionA = fractions . shift ( ) ; const fractionB = fractions . shift ( ) ; const a = line . shift ( ) ; const b = line . shift ( ) ; const reprojectedA = reprojectedLine . shift ( ) ; const reprojectedB = reprojectedLine . shift ( ) ; const { fraction : newFraction , point : newPoint , reprojected : reprojectedPoint } = interpolationStep ( ( fractionA + fractionB ) / 2 , interpolate , transform ) ; if ( squaredSegmentDistance ( reprojectedPoint , reprojectedA , reprojectedB ) < squaredTolerance ) { coordinates . push ( reprojectedB [ 0 ] ) ; coordinates . push ( reprojectedB [ 1 ] ) ; } else { fractions . unshift ( fractionA , newFraction , newFraction , fractionB ) ; line . unshift ( a , newPoint , newPoint , b ) ; reprojectedLine . unshift ( reprojectedA , reprojectedPoint , reprojectedPoint , reprojectedB ) ; } iteration ++ ; } return coordinates ; }
Densifies a line, so that it is properly curved after reprojection.
Densifies a line so that it is properly curved after reprojection .