Octree.cpp
// Gets the octant the current position is in, given the high and low limits.
Gets the octant the current position is in, given the high and low limits.
Gets the octant the current position is in given the high and low limits .
inline Octree::CubeOctant Octree::GetOctant(double xL, double yL, double zL, double xH, double yH, double zH, double x, double y, double z)
{
    bool isLowerX = (x < (xH - xL) * 0.5 + xL);
    bool isLowerY = (y < (yH - yL) * 0.5 + yL);
    bool isLowerZ = (z < (zH - zL) * 0.5 + zL);
    if (isLowerX)
    {
        if (isLowerY)
        {
            if (isLowerZ)
            {
                return XLYLZL;
            }
            return XLYLZH;
        }
        else
        {
            if (isLowerZ)
            {
                return XLYHZL;
            }
            return XLYHZH;
        }
    }
    else
    {
        if (isLowerY)
        {
            if (isLowerZ)
            {
                return XHYLZL;
            }
            return XHYLZH;
        }
        else
        {
            if (isLowerZ)
            {
                return XHYHZL;
            }
            return XHYHZH;
        }
    }
}
inline Octree :: CubeOctant Octree :: GetOctant ( double xL , double yL , double zL , double xH , double yH , double zH , double x , double y , double z ) { bool isLowerX = ( x < ( xH - xL ) * 0.5 + xL ) ; bool isLowerY = ( y < ( yH - yL ) * 0.5 + yL ) ; bool isLowerZ = ( z < ( zH - zL ) * 0.5 + zL ) ; if ( isLowerX ) { if ( isLowerY ) { if ( isLowerZ ) { return XLYLZL ; } return XLYLZH ; } else { if ( isLowerZ ) { return XLYHZL ; } return XLYHZH ; } } else { if ( isLowerY ) { if ( isLowerZ ) { return XHYLZL ; } return XHYLZH ; } else { if ( isLowerZ ) { return XHYHZL ; } return XHYHZH ; } } }
Gets the octant the current position is in, given the high and low limits.
Gets the octant the current position is in given the high and low limits .