src/modules/misc/utils.js
// finds ScalingPattern and inital Size of 2d array for scaling algorithms used later in genImageData.js
finds ScalingPattern and inital Size of 2d array for scaling algorithms used later in genImageData.js
finds ScalingPattern and inital Size of 2d array for scaling algorithms used later in genImageData . js
function findScalingPatternAndInitialSize(size, initSize, minScale) {
    let scaledSize = Math.floor(size / initSize);
    const smallestFittingPair = findSmallestFittingPair(scaledSize);
    let newList = smallestFittingPair;
    let notDone = true;
    while (notDone) {
        for (let i = 0; i < newList.length; i++) {
            const value = newList[i];
            if (value > minScale && isPrime(value)) return {
                scalingPattern: newList,
                initSize
            };
            if (value > minScale) {
                const smallestFittingPair = findSmallestFittingPair(value);
                newList = replaceAndSpreadIntoArray(value, smallestFittingPair, newList);
            }
        }
        notDone = !forAllSmallerThanValue(newList);
    }
    return {
        scalingPattern: newList,
        initSize
    };
}
function findScalingPatternAndInitialSize ( size , initSize , minScale ) { let scaledSize = Math . floor ( size / initSize ) ; const smallestFittingPair = findSmallestFittingPair ( scaledSize ) ; let newList = smallestFittingPair ; let notDone = true ; while ( notDone ) { for ( let i = 0 ; i < newList . length ; i ++ ) { const value = newList [ i ] ; if ( value > minScale && isPrime ( value ) ) return { scalingPattern : newList , initSize } ; if ( value > minScale ) { const smallestFittingPair = findSmallestFittingPair ( value ) ; newList = replaceAndSpreadIntoArray ( value , smallestFittingPair , newList ) ; } } notDone = ! forAllSmallerThanValue ( newList ) ; } return { scalingPattern : newList , initSize } ; }
finds ScalingPattern and inital Size of 2d array for scaling algorithms used later in genImageData.js
finds ScalingPattern and inital Size of 2d array for scaling algorithms used later in genImageData . js
/*
            if there are primes that are bigger than 
            the min they cant be factored further anyways
            so we just return the new list its as good as it gets
            */