HiVecMap_code/src/plotTile.cpp
// find the node of each pix in VPQTree by pix_center_pt
find the node of each pix in VPQTree by pix_center_pt
find the node of each pix in VPQTree by pix_center_pt
VPQTreeNodeS * locatePixNode(int z, float tile_box[], float pix_x, float pix_y, VPQTreeNodeS *seek, VPQTreeNodeS *rootNode){
    float min_x = tile_box[0];
    float max_x = tile_box[1];
    float min_y = tile_box[2];
    float max_y = tile_box[3];
    float mid_x, mid_y;
    if (abs(pix_x) <= L && abs(pix_y) <= L){
        if (pix_x < min_x || pix_x > max_x || pix_y < min_y || pix_y > max_y){
            while(1){
                seek = rootNode;
                min_x = -L;
                max_x = L;
                min_y = -L;
                max_y = L;
                break;
            }
        }
    }
    else{
        seek = nullptr;
        return seek;
    }
    int level = 8 + z - seek->level;
    int divided_num = 0;
    while (divided_num < level){
        mid_x = (min_x + max_x) / 2;
        mid_y = (min_y + max_y) / 2;
        if (pix_x < mid_x && pix_y >= mid_y){
            if (seek->upLeftNode == nullptr){
                seek = nullptr;
                break;
            }
            seek = seek->upLeftNode;
            max_x = mid_x;
            min_y = mid_y;
        }
        else if (pix_x >= mid_x && pix_y >= mid_y){
            if (seek->upRightNode == nullptr){
                seek = nullptr;
                break;
            } 
            seek = seek->upRightNode;
            min_x = mid_x;
            min_y = mid_y;
        }
        else if (pix_x < mid_x && pix_y < mid_y){
            if (seek->bottomLeftNode == nullptr){
                seek = nullptr;
                break;
            }
            seek = seek->bottomLeftNode;
            max_x = mid_x;
            max_y = mid_y;
        }
        else if (pix_x >= mid_x && pix_y < mid_y){
            if (seek->bottomRightNode == nullptr){
                seek = nullptr;
                break;
            }
            seek = seek->bottomRightNode;
            min_x = mid_x;
            max_y = mid_y;
        }
        divided_num++;
    }
    return seek;
}
VPQTreeNodeS * locatePixNode ( int z , float tile_box [ ] , float pix_x , float pix_y , VPQTreeNodeS * seek , VPQTreeNodeS * rootNode ) { float min_x = tile_box [ 0 ] ; float max_x = tile_box [ 1 ] ; float min_y = tile_box [ 2 ] ; float max_y = tile_box [ 3 ] ; float mid_x , mid_y ; if ( abs ( pix_x ) <= L && abs ( pix_y ) <= L ) { if ( pix_x < min_x || pix_x > max_x || pix_y < min_y || pix_y > max_y ) { while ( 1 ) { seek = rootNode ; min_x = - L ; max_x = L ; min_y = - L ; max_y = L ; break ; } } } else { seek = nullptr ; return seek ; } int level = 8 + z - seek -> level ; int divided_num = 0 ; while ( divided_num < level ) { mid_x = ( min_x + max_x ) / 2 ; mid_y = ( min_y + max_y ) / 2 ; if ( pix_x < mid_x && pix_y >= mid_y ) { if ( seek -> upLeftNode == nullptr ) { seek = nullptr ; break ; } seek = seek -> upLeftNode ; max_x = mid_x ; min_y = mid_y ; } else if ( pix_x >= mid_x && pix_y >= mid_y ) { if ( seek -> upRightNode == nullptr ) { seek = nullptr ; break ; } seek = seek -> upRightNode ; min_x = mid_x ; min_y = mid_y ; } else if ( pix_x < mid_x && pix_y < mid_y ) { if ( seek -> bottomLeftNode == nullptr ) { seek = nullptr ; break ; } seek = seek -> bottomLeftNode ; max_x = mid_x ; max_y = mid_y ; } else if ( pix_x >= mid_x && pix_y < mid_y ) { if ( seek -> bottomRightNode == nullptr ) { seek = nullptr ; break ; } seek = seek -> bottomRightNode ; min_x = mid_x ; max_y = mid_y ; } divided_num ++ ; } return seek ; }
find the node of each pix in VPQTree by pix_center_pt
find the node of each pix in VPQTree by pix_center_pt
// 判断点是否在全球范围内 // 当点不在结点范围内，向上寻找包含点的结点 // when point in upLeftNode // when point in upRightNode // when point in bottomLeftNode // when point in bottomRightNode