/************** Domain Access ****************/ Point DA::getNextOffset(Point p, unsigned char d) { #ifdef __DEBUG_DA_PUBLIC__ assert(m_bIamActive); #endif unsigned int len = (unsigned int)(1u<<( m_uiMaxDepth - d ) ); unsigned int len_par = (unsigned int)(1u<<( m_uiMaxDepth - d +1 ) ); unsigned int i,j,k; i = p.xint(); i %= len_par; j = p.yint(); j %= len_par; k = p.zint(); k %= len_par; i /= len; j /= len; k /= len; unsigned int childNum = 4*k + 2*j + i; Point p2; switch (childNum) { case 7: p2.x() = p.x() -len; p2.y() = p.y() - len; p2.z() = p.z() -len; return getNextOffset(p2, d-1); case 0: p2.x() = p.x() +len; p2.y() = p.y(); p2.z() = p.z(); break; case 1: p2.x() = p.x() -len; p2.y() = p.y() +len; p2.z() = p.z(); break; case 2: p2.x() = p.x() +len; p2.y() = p.y(); p2.z() = p.z(); break; case 3: p2.x() = p.x() -len; p2.y() = p.y() - len; p2.z() = p.z() +len; break; case 4: p2.x() = p.x() +len; p2.y() = p.y(); p2.z() = p.z(); break; case 5: p2.x() = p.x() -len; p2.y() = p.y()+len; p2.z() = p.z(); break; case 6: p2.x() = p.x() +len; p2.y() = p.y(); p2.z() = p.z(); break; default: std::cerr << "Wrong child number in " << __func__ << std::endl; assert(false); break; } // switch (childNum) return p2; }
uint32 TilesNotice::updateOffset( uint32 startOffset ) { m_offset = startOffset; return getNextOffset(); }
void DA::incrementCurrentOffset() { #ifdef __DEBUG_DA_PUBLIC__ assert(m_bIamActive); #endif // if it is the first element, simply return the stored offset ... if ( m_uiCurrent == (m_uiElementBegin-1)) { m_ptCurrentOffset = m_ptOffset; return; } #ifdef __DEBUG_DA_PUBLIC__ if ( m_ucpOctLevels[m_uiCurrent] & ot::TreeNode::BOUNDARY ) { std::cerr << RED"ERROR, Boundary eleme in incre Curr offset"NRM << std::endl; assert(false); } #endif unsigned char d = (m_ucpOctLevels[m_uiCurrent] & ot::TreeNode::MAX_LEVEL ); unsigned int len = (unsigned int)(1u<<( m_uiMaxDepth - d ) ); unsigned int len_par = (unsigned int)(1u<<( m_uiMaxDepth - d +1 ) ); unsigned int i,j,k; i = m_ptCurrentOffset.xint(); j = m_ptCurrentOffset.yint(); k = m_ptCurrentOffset.zint(); i %= len_par; j %= len_par; k %= len_par; i /= len; j /= len; k /= len; unsigned int childNum = 4*k + 2*j + i; Point p = m_ptCurrentOffset; Point p2; switch (childNum) { case 7: p2.x() = p.x() -len; p2.y() = p.y() - len; p2.z() = p.z() -len; p2 = getNextOffset(p2, d-1); break; case 0: p2.x() = p.x() +len; p2.y() = p.y(); p2.z() = p.z(); break; case 1: p2.x() = p.x() -len; p2.y() = p.y() +len; p2.z() = p.z(); break; case 2: p2.x() = p.x() +len; p2.y() = p.y(); p2.z() = p.z(); break; case 3: p2.x() = p.x() -len; p2.y() = p.y() - len; p2.z() = p.z() +len; break; case 4: p2.x() = p.x() +len; p2.y() = p.y(); p2.z() = p.z(); break; case 5: p2.x() = p.x() -len; p2.y() = p.y()+len; p2.z() = p.z(); break; case 6: p2.x() = p.x() +len; p2.y() = p.y(); p2.z() = p.z(); break; default: std::cerr << "Wrong child number in " << __func__ << std::endl; assert(false); break; } // switch (childNum) m_ptCurrentOffset = p2; }