function hilbertIndex(point, options) { // :: [Int, Int, ..] -> {} -> Int
    options = options || {}
    var index = 0, code,
        entry = options.entry || 0,
        direction = options.direction || 0,
        i = options.precision || bitwise.bitPrecision(Math.max.apply(null, point)) - 1,
        dim = point.length

    console.log(i)
    while (i >= 0) {

        var bits = 0
        var mask = 1 << dim - 1

        for (var k = 0; k < point.length; k++) {
            if (point[dim - (k+1)] & (1 << i)) {
                bits |= mask
            }
            mask >>>= 1
        }

        bits = grayTransform(entry, direction, bits, dim)
        code = grayInverse(bits)

        entry = entry ^ bitwise.rotateLeft(entrySequence(code), dim, 0, direction + 1)
        direction = (direction + directionSequence(code, dim) + 1) % dim
        index = (index << dim) | code

        i--
    }

    return index
}
function hilbertIndex(point, options) { 
    options = options || {}
    var index = 0, code,
        entry = options.entry || 0,
        direction = options.direction || 0,
        i = options.precision || bitwise.bitPrecision(Math.max.apply(null, point)) - 1,
        dim = point.length

    console.log(i)
    while (i >= 0) {

        var bits = 0
        var mask = 1 << dim - 1

        for (var k = 0; k < point.length; k++) {
            if (point[dim - (k+1)] & (1 << i)) {
                bits |= mask
            }
            mask >>>= 1
        }

        bits = grayTransform(entry, direction, bits, dim)
        code = grayInverse(bits)

        entry = entry ^ bitwise.rotateLeft(entrySequence(code), dim, 0, direction + 1)
        direction = (direction + directionSequence(code, dim) + 1) % dim
        index = (index << dim) | code

        i--
    }

    return index
}
function hilbertIndex ( point , options ) { // :: [Int, Int, ..] -> {} -> Int options = options || { } var index = 0 , code , entry = options . entry || 0 , direction = options . direction || 0 , i = options . precision || bitwise . bitPrecision ( Math . max . apply ( null , point ) ) - 1 , dim = point . length console . log ( i ) while ( i >= 0 ) { var bits = 0 var mask = 1 << dim - 1 for ( var k = 0 ; k < point . length ; k ++ ) { if ( point [ dim - ( k + 1 ) ] & ( 1 << i ) ) { bits |= mask } mask >>>= 1 } bits = grayTransform ( entry , direction , bits , dim ) code = grayInverse ( bits ) entry = entry ^ bitwise . rotateLeft ( entrySequence ( code ) , dim , 0 , direction + 1 ) direction = ( direction + directionSequence ( code , dim ) + 1 ) % dim index = ( index << dim ) | code i -- } return index }
Hilbert conversions Returns Hilbert index of given cardinal point
Hilbert conversions Returns Hilbert index of given cardinal point