Logo Search packages:      
Sourcecode: gamera version File versions  Download package

voxelneighborhood.hxx

/************************************************************************/
/*                                                                      */
/*     Copyright 2006-2007 by F. Heinrich, B. Seppke, Ullrich Koethe    */
/*       Cognitive Systems Group, University of Hamburg, Germany        */
/*                                                                      */
/*    This file is part of the VIGRA computer vision library.           */
/*    ( Version 1.6.0, Aug 13 2008 )                                    */
/*    The VIGRA Website is                                              */
/*        http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/      */
/*    Please direct questions, bug reports, and contributions to        */
/*        ullrich.koethe@iwr.uni-heidelberg.de    or                    */
/*        vigra@informatik.uni-hamburg.de                               */
/*                                                                      */
/*    Permission is hereby granted, free of charge, to any person       */
/*    obtaining a copy of this software and associated documentation    */
/*    files (the "Software"), to deal in the Software without           */
/*    restriction, including without limitation the rights to use,      */
/*    copy, modify, merge, publish, distribute, sublicense, and/or      */
/*    sell copies of the Software, and to permit persons to whom the    */
/*    Software is furnished to do so, subject to the following          */
/*    conditions:                                                       */
/*                                                                      */
/*    The above copyright notice and this permission notice shall be    */
/*    included in all copies or substantial portions of the             */
/*    Software.                                                         */
/*                                                                      */
/*    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND    */
/*    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES   */
/*    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND          */
/*    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT       */
/*    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,      */
/*    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      */
/*    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR     */
/*    OTHER DEALINGS IN THE SOFTWARE.                                   */                
/*                                                                      */
/************************************************************************/

#ifndef VIGRA_VOXELNEIGHBORHOOD_HXX
#define VIGRA_VOXELNEIGHBORHOOD_HXX

#include "tinyvector.hxx"
#include "pixelneighborhood.hxx"

namespace vigra {
    
/** \addtogroup VoxelNeighborhood Utilities to manage voxel neighborhoods

    6- and 26-neighborhood definitions and circulators.

    <b>\#include</b> <<a href="voxelneighborhood_8hxx-source.html">vigra/voxelneighborhood.hxx</a>><br>

    <b>See also:</b> \ref vigra::NeighborhoodCirculator
 */
//@{

    /// 3-dimensional difference vector
00057     typedef vigra::TinyVector<int, 3> Diff3D;
   
/********************************************************/
/*                                                      */
/*                      AtVolumeBorder                  */
/*                                                      */
/********************************************************/

/** \brief Encode whether a voxel is near the volume border.

        //    This enum is used with \ref isAtVolumeBorder() and 
        //    \ref vigra::RestrictedNeighborhoodCirculator.

        //<b>\#include</b> <<a href="voxelneighborhood_8hxx-source.html">vigra/voxelneighborhood.hxx</a>><br>
        //Namespace: vigra
*/

00074 typedef AtImageBorder AtVolumeBorder;


/** \brief Find out whether a voxel is at the volume border.

    This function checks if \a x == 0 or \a x == \a width - 1 and 
    \a y == 0 or \a y == \a height - 1 and so on and returns the appropriate value
    of \ref vigra::AtVolumeBorder, or zero when the voxel is not at te volume border.
    The behavior of the function is undefined if (x,y,z) is not inside the volume.
*/
00084 inline AtVolumeBorder isAtVolumeBorder(int x, int y, int z, int width, int height, int depth)
{
    return static_cast<AtVolumeBorder>((x == 0 
                                         ? LeftBorder
                                         : x == width-1
                                             ? RightBorder
                                             : NotAtBorder) |
                                       (y == 0 
                                         ? TopBorder
                                         : y == height-1
                                             ? BottomBorder
                                             : NotAtBorder) |
                                       (z == 0 
                                         ? FrontBorder
                                         : z == depth-1
                                             ? RearBorder
                                             : NotAtBorder));
};
/** \brief Find out whether a voxel is at a scan-order relevant volume border.
    This function checks if \a x == 0 or \a y == 0 or \a z == \a 0 and returns the 
        appropriate value of \ref vigra::AtVolumeBorder, or zero when the voxel is
        not at te volume border.
    The behavior of the function is undefined if (x,y,z) is not inside the volume.
*/
00108 inline AtVolumeBorder isAtVolumeBorderCausal(int x, int y, int z, int width, int height, int depth)
{
    return static_cast<AtVolumeBorder>((x == 0 
                                         ? LeftBorder
                                         : NotAtBorder) |
                                       (y == 0 
                                         ? TopBorder
                                         : NotAtBorder) |
                                       (z == 0 
                                         ? FrontBorder
                                         : NotAtBorder));
};
/** TODO: Write new comment \brief Find out whether a voxel is at a scan-order relevant volume border.
    This function checks if \a x == 0 or \a y == 0 or \a z == \a 0 and returns the 
        appropriate value of \ref vigra::AtVolumeBorder, or zero when the voxel is
        not at te volume border.
    The behavior of the function is undefined if (x,y,z) is not inside the volume.
*/
00126 inline AtVolumeBorder isAtVolumeBorderAntiCausal(int x, int y, int z, int width, int height, int depth)
{
    return static_cast<AtVolumeBorder>((x == width-1 
                                         ? RightBorder
                                         : NotAtBorder) |
                                       (y == height-1 
                                         ? BottomBorder
                                         : NotAtBorder) |
                                       (z == depth-1 
                                         ? RearBorder
                                         : NotAtBorder));
};

/********************************************************/
/*                                                      */
/*                   Neighborhood3DSix                  */
/*                                                      */
/********************************************************/

/** 3D 6-Neighborhood. */
00146 namespace Neighborhood3DSix
{

/** \brief Encapsulation of direction management of neighbors for a 3D 6-neighborhood.
*/
00151 class NeighborCode3D
{
    public:
    
    typedef Diff3D difference_type;
    
    /** provides enumeration of all directions.
        DirectionCount may be used for portable loop termination conditions.
    */
00160     enum Direction {
        Error = -1,    
        InFront= 0,         
        North,          
        West ,      
        Behind,
        South,
        East,         
        DirectionCount,
        CausalFirst = InFront,
        CausalLast  = West,
        AntiCausalFirst = Behind,
        AntiCausalLast  = East,

        InitialDirection = InFront,
        OppositeDirPrefix = 1,
        OppositeOffset = 3
    };

    static unsigned int directionBit(Direction d) 
    {
        static unsigned int b[] = { 1 << (InFront + 1),
                                    1 << (North + 1), 
                                    1 << (West + 1), 
                                    1 << (Behind + 1),
                                    1 << (South + 1), 
                                    1 << (East + 1)
                                  };
        return b[d];
    };


    /** The number of valid neighbors if the current center is at the volume border.
    */
00194     static unsigned int nearBorderDirectionCount(AtVolumeBorder b)
    {
        static unsigned int c[] = { 6, 5, 5, 0, 5, 4, 4, 0, 5, 4, 
                                    4, 0, 0, 0, 0, 0, 5, 4, 4, 0,
                                    4, 3, 3, 0, 4, 3, 3, 0, 0, 0,
                                    0, 0, 5, 4, 4, 0, 4, 3, 3, 0,
                                    4, 3, 3};
        return c[b];
    }
    
    /** The valid direction codes when the center is at the volume border.
        \a index must be in the range <tt>0...nearBorderDirectionCount(b)-1</tt>.
    */
00207     static Direction nearBorderDirections(AtVolumeBorder b, int index)
    {
        static Direction c[43][6] = {
                { InFront, North, West, Behind, South, East},   // 0 - NotAtBorder
                { InFront, North, West, Behind, South, Error},  // 1 - AtRightBorder
                { InFront, North, Behind, South, East, Error},  // 2 - AtLeftBorder
                { Error, Error, Error, Error, Error, Error},    
                { InFront, West, Behind, South, East, Error},   // 4 - AtTopBorder    
                { InFront, West, Behind, South, Error, Error},  // 5 - AtTopRightBorder
                { InFront, Behind, South, East, Error, Error},  // 6 - AtTopLeftBorder
                { Error, Error, Error, Error, Error, Error},    
                { InFront, North, West, Behind, East, Error},   // 8 - AtBottomBorder
                { InFront, North, West, Behind, Error, Error},  // 9 - AtBottomRightBorder
                { InFront, North, Behind, East, Error, Error},  //10- AtBottomLeftBorder
                { Error, Error, Error, Error, Error, Error},    
                { Error, Error, Error, Error, Error, Error},    
                { Error, Error, Error, Error, Error, Error},    
                { Error, Error, Error, Error, Error, Error},    
                { Error, Error, Error, Error, Error, Error},    
                { North, West, Behind, South, East, Error},     //16 - AtFrontBorder
                { North, West, Behind, South, Error, Error},    //17 - AtFrontRightBorder
                { North, Behind, South, East, Error, Error},    //18 - AtFrontLeftBorder
                { Error, Error, Error, Error, Error, Error},    
                { West, Behind, South, East, Error,  Error},    //20 - AtTopFrontBorder
                { West, Behind, South, Error, Error, Error},    //21 - AtTopRightFrontBorder
                { Behind, South, East, Error, Error,  Error},   //22 - AtTopLeftFrontBorder
                { Error, Error, Error, Error, Error, Error},    
                { North, West, Behind, East, Error, Error},     //24 - AtBottomFrontBorder
                { North, West, Behind, Error, Error, Error},    //25 - AtBottomRightFrontBorder
                { North, Behind, East, Error, Error, Error},    //26 - AtBottomLeftFrontBorder
                { Error, Error, Error, Error, Error, Error},    
                { Error, Error, Error, Error, Error, Error},    
                { Error, Error, Error, Error, Error, Error},    
                { Error, Error, Error, Error, Error, Error},    
                { Error, Error, Error, Error, Error, Error},    
                { InFront, North, West, South, East,Error},     //32 - AtRearBorder
                { InFront, North, West, South, Error, Error},   //33 - AtRearRightBorder
                { InFront, North, South, East, Error, Error},   //34 - AtRearLeftBorder
                { Error, Error, Error, Error, Error, Error},    
                { InFront, West, South, East, Error, Error},    //36 - AtTopRearBorder    
                { InFront, West, South, Error, Error, Error},   //37 - AtTopRightRearBorder    
                { InFront, South, East, Error, Error, Error},   //38 - AtTopLeftRearBorder
                { Error, Error, Error, Error, Error, Error},    
                { InFront, North, West, East, Error, Error},    //40 - AtBottomRearBorder
                { InFront, North, West, Error, Error, Error},   //41 - AtBottomRightRearBorder
                { InFront, North, East, Error, Error, Error}    //42 - AtBottomLeftRearBorder
               };
        return c[b][index];
    }
        
    /** The valid direction three codes in anti causal direction (means: look back in scanline
        direction)when the center is at the volume border.
        Should be used with isAtVolumeBorderCausal to determine the Directions, as this
        avoids using of the nonesense border ids (e.g. 0,1,8,9...) of this table.
        \a index must be in the range <tt>0...nearBorderDirectionCount(b)-1</tt>.
    */
00263     static Direction nearBorderDirectionsCausal(AtVolumeBorder b, int index)
    {
        static Direction c[43][3] = {
            { InFront, North, West},                    // 0 - NotAtBorder -----> should never be used
            { InFront, North, West},                    // 1 - AtRightBorder -----> should never be used
            { InFront, North, Error},                   // 2 - AtLeftBorder
            { Error, Error, Error},    
            { InFront, West, Error},                    // 4 - AtTopBorder    
            { InFront, West, Error},                    // 5 - AtTopRightBorder
            { InFront, Error,Error},                    // 6 - AtTopLeftBorder
            { Error, Error, Error},    
            { InFront, North, West},                    // 8 - AtBottomBorder -----> should never be used
            { InFront, North, West},                    // 9 - AtBottomRightBorder -----> should never be used
            { InFront, North, Error},                   //10- AtBottomLeftBorder
            { Error, Error, Error},    
            { Error, Error, Error},    
            { Error, Error, Error},    
            { Error, Error, Error},    
            { Error, Error, Error},    
            { North, West, Error},                      //16 - AtFrontBorder
            { North, West, Error},                      //17 - AtFrontRightBorder
            { North, Error, Error},                     //18 - AtFrontLeftBorder
            { Error, Error, Error},    
            { West, Error, Error},                      //20 - AtTopFrontBorder
            { West, Error, Error},                      //21 - AtTopRightFrontBorder
            { Error, Error,  Error},                    //22 - AtTopLeftFrontBorder
            { Error, Error, Error},    
            { North, West, Error},                      //24 - AtBottomFrontBorder
            { North, West, Error},                      //25 - AtBottomRightFrontBorder
            { North, Error, Error},                     //26 - AtBottomLeftFrontBorder
            { Error, Error, Error},    
            { Error, Error, Error},    
            { Error, Error, Error},    
            { Error, Error, Error},    
            { Error, Error, Error},                      
            { InFront, North, West},                    //32 - AtRearBorder -----> should never be used
            { InFront, North, West},                    //33 - AtRearRightBorder -----> should never be used
            { InFront, North, Error},                   //34 - AtRearLeftBorder
            { Error, Error, Error},    
            { InFront, West, Error},                    //36 - AtTopRearBorder    
            { InFront, West, Error},                    //37 - AtTopRightRearBorder    
            { InFront, Error, Error},                   //38 - AtTopLeftRearBorder
            { Error, Error, Error},    
            { InFront, North, West},                    //40 - AtBottomRearBorder -----> should never be used
            { InFront, North, West},                    //41 - AtBottomRightRearBorder -----> should never be used
            { InFront, North, Error}                    //42 - AtBottomLeftRearBorder
        };
        return c[b][index];
    }
    
    /** transform direction code into corresponding Diff3D offset.
        (note: there is no bounds checking on the code you pass.)
    */
00316     static Diff3D const & diff(Direction code)
    {
        static Diff3D d[] = {
                    Diff3D(  0,  0, -1),  //InFront
                    Diff3D(  0, -1,  0),  //North
                    Diff3D( -1,  0,  0),  //West
                    Diff3D(  0,  0,  1),  //Behind
                    Diff3D(  0,  1,  0),  //South
                    Diff3D(  1,  0,  0)   //East
                };
        return d[code];
    }

    /** Equivalent to <tt>diff(static_cast<Direction>(code))</tt>.
        (note: there is no bounds checking on the code you pass.)
    */
00332     static Diff3D const & diff(int code) { return diff(static_cast<Direction>(code)); }

    /**  Equivalent to <tt>diff(code)[dim]</tt> */
00335     static int diff(Direction code, int dim) { return diff(code)[dim]; }
   
    /** Get the relative offset from one neighbor to the other.
        For example, <tt>relativeDiff(East, West) == multi_differencetype(-2,0,0)</tt>.
        (note: there is no bounds checking on the code you pass.)
    */
00341     static Diff3D const & relativeDiff(Direction fromCode, Direction toCode)
    {
      static Diff3D d[6][6] = 
          {    
                //     InFront      -      North         -           West     -         Behind     -      South        -        East       
                { Diff3D( 0, 0, 0), Diff3D(0, -1, 1), Diff3D(-1, 0, 1), Diff3D( 0, 0, 2), Diff3D( 0, 1, 1),  Diff3D( 1, 0, 1)}, //InFront
                { Diff3D( 0, 1,-1), Diff3D( 0, 0, 0), Diff3D(-1, 1, 0), Diff3D( 0, 1, 1), Diff3D( 0, 2, 0),  Diff3D( 1, 1, 0)}, //North
                { Diff3D( 1, 0,-1), Diff3D( 1,-1, 0), Diff3D( 0, 0, 0), Diff3D( 1, 0, 1), Diff3D( 1, 1, 0),  Diff3D( 2, 0, 0)}, //West
                { Diff3D( 0, 0,-2), Diff3D( 0,-1,-1), Diff3D(-1, 0,-1), Diff3D( 0, 0, 0), Diff3D( 0, 1,-1),  Diff3D( 1, 0,-1)}, //Behind
                { Diff3D( 0,-1,-1), Diff3D( 0,-2, 0), Diff3D(-1,-1, 0), Diff3D( 0,-1, 1), Diff3D( 0, 0, 0),  Diff3D( 1,-1, 0)}, //South
                { Diff3D(-1, 0,-1), Diff3D(-1,-1, 0), Diff3D(-2, 0, 0), Diff3D(-1, 0, 1), Diff3D(-1, 1, 0), Diff3D( 0, 0, 0) }  //East
          };

        return d[fromCode][toCode];
    }

    /** Equivalent to relativeDiff(static_cast<Direction>(fromCode), static_cast<Direction>(toCode)).
        (note: there is no bounds checking on the code you pass.)
    */
00360     static Diff3D const & relativeDiff(int fromCode, int toCode)
    {
        return relativeDiff(static_cast<Direction>(fromCode), static_cast<Direction>(toCode));
    }

    /**  X-component of diff() */
00366     static int dX(Direction code) { return diff(code)[0]; }
    /**  Y-component of diff() */
00368     static int dY(Direction code) { return diff(code)[1]; }
    /**  Z-component of diff() */
00370     static int dZ(Direction code) { return diff(code)[2]; }
    
    /**  X-component of diff() */
00373     static int dX(int code) { return diff(code)[0]; }
    /**  Y-component of diff() */
00375     static int dY(int code) { return diff(code)[1]; }
    /**  Z-component of diff() */
00377     static int dZ(int code) { return diff(code)[2]; }
    

    /** transform Diff3D offset into corresponding direction code.
        The code <tt>Direction::Error</tt> will be returned if <tt>diff</tt>
        is not in the 3DSix-Neighborhood.
    */
00384     static Direction code(Diff3D const & diff)
    {
        switch(diff[0]) {
            case  0:
            {
                switch(diff[1]) {
                    case 0:
                        switch(diff[2]) {
                            case 1:
                                return Behind;
                            case -1:
                                return InFront;
                            default:
                                return Error;
                        }
                                
                    case 1:
                        return (diff[2] == 0) ? South : Error;
                    case -1:
                        return (diff[2] == 0) ? North : Error;
                    default:
                        return Error;
                }
        }
        case -1:
            return ((diff[1] == 0) && (diff[2] == 0)) ? West : Error;
        case  1:
            return ((diff[1] == 0) && (diff[2] == 0)) ? East : Error;
        }
        return Error;
    }
  
    /** Check whether a code refers to a diagonal direction.
        Useful if you want to abstract the differences between 6- and 26-neighborhood.
        Always <tt>false</tt> for 6-neighborhood.
    */
00420     static bool isDiagonal(Direction) { return false; }

00422     static Diff3D const & right()           { return diff(East); }          /**<  Offset to the right neighbor */
00423     static Diff3D const & top()             { return diff(North); }         /**<  Offset to the top neighbor */
00424     static Diff3D const & left()            { return diff(West); }          /**<  Offset to the left neighbor */
00425     static Diff3D const & bottom()          { return diff(South); }         /**<  Offset to the bottom neighbor */
00426     static Diff3D const & rear()            { return diff(Behind); }        /**<  Offset to the rear neighbor */
00427     static Diff3D const & front()           { return diff(InFront); }       /**<  Offset to the neighbor in front */

00429     static Diff3D const & east()            { return diff(East); }          /**<  Offset to the east neighbor */
00430     static Diff3D const & north()           { return diff(North); }         /**<  Offset to the north neighbor */
00431     static Diff3D const & west()            { return diff(West); }          /**<  Offset to the west neighbor */
00432     static Diff3D const & south()           { return diff(South); }         /**<  Offset to the south neighbor */
00433     static Diff3D const & behind()          { return diff(Behind); }        /**<  Offset to the rear neighbor */
00434     static Diff3D const & infront()         { return diff(InFront); }       /**<  Offset to the neighbor in front */

}; // class Neighborhood3DSix


/** Export NeighborCode3D::Direction into the scope of namespace Neighborhood3DSix.
*/
00441 typedef NeighborCode3D::Direction Direction;

00443 static const Direction East           = NeighborCode3D::East;               /**<  Export NeighborCode3D::East to namespace Neighborhood3DSix */
00444 static const Direction North          = NeighborCode3D::North;              /**<  Export NeighborCode3D::North to namespace Neighborhood3DSix */
00445 static const Direction West           = NeighborCode3D::West;               /**<  Export NeighborCode3D::West to namespace Neighborhood3DSix */
00446 static const Direction South          = NeighborCode3D::South;              /**<  Export NeighborCode3D::South to namespace Neighborhood3DSix */
00447 static const Direction Behind         = NeighborCode3D::Behind;             /**<  Export NeighborCode3D::Behind to namespace Neighborhood3DSix */
00448 static const Direction InFront        = NeighborCode3D::InFront;            /**<  Export NeighborCode3D::InFront to namespace Neighborhood3DSix */
00449 static const Direction DirectionCount = NeighborCode3D::DirectionCount;     /**<  Export NeighborCode3D::DirectionCount to namespace Neighborhood3DSix */


}//namespace Neighborhood3DSix
    
/** Export \ref vigra::Neighborhood3DSix::NeighborCode3D into the scope of namespace vigra.
*/
00456 typedef Neighborhood3DSix::NeighborCode3D NeighborCode3DSix;

/********************************************************/
/*                                                      */
/*                   Neighborhood3DTwentySix            */
/*                                                      */
/********************************************************/
/** 3D 26-Neighborhood. */
00464 namespace Neighborhood3DTwentySix
{

/** \brief Encapsulation of direction management of neighbors for a 3D 26-neighborhood.
*/
00469 class NeighborCode3D
{
    public:

    typedef Diff3D difference_type;
    
   /** provides enumeration of all directions.
       DirectionCount may be used for portable loop termination conditions.
     */
00478     enum Direction {
        Error = -1,
            InFrontNorthWest = 0,
            InFrontNorth,
            InFrontNorthEast,
            InFrontWest,
        InFront,
            InFrontEast,
            InFrontSouthWest,
            InFrontSouth,
            InFrontSouthEast,
        
            NorthWest,
            North,
            NorthEast,
        West,
            East,
            SouthWest,
            South,
            SouthEast,

            BehindNorthWest,
            BehindNorth,
            BehindNorthEast,
            BehindWest,
        Behind,
            BehindEast,
            BehindSouthWest,
            BehindSouth,
            BehindSouthEast,

        DirectionCount,
            CausalFirst = InFrontNorthWest,
            CausalLast  = West,
            AntiCausalFirst = BehindSouthEast,
            AntiCausalLast  = East,

            InitialDirection = InFrontNorthWest,
            OppositeDirPrefix = -1,
            OppositeOffset = 25
    };

    static unsigned int directionBit(Direction d) 
    {
        static unsigned int b[] = { 
                1 <<    (InFrontNorthWest+1),
                1 <<    (InFrontNorth+1),
                1 <<  (InFrontNorthEast+1),
                1 <<  (InFrontWest+1),
                1 <<  (InFront+1),
                1 <<  (InFrontEast+1),
                1 <<  (InFrontSouthWest+1),
                1 <<  (InFrontSouth+1),
                1 <<  (InFrontSouthEast+1),

                1 <<  (NorthWest+1),
                1 <<  (North+1),
                1 <<  (NorthEast+1),
                1 <<  (West+1),
                1 <<  (East+1),
                1 <<  (SouthWest+1),
                1 <<  (South+1),
                1 <<  (SouthEast+1),

                1 <<  (BehindNorthWest+1),
                1 <<  (BehindNorth+1),
                1 <<  (BehindNorthEast+1),
                1 <<  (BehindWest+1),
                1 <<  (Behind+1),
                1 <<  (BehindEast+1),
                1 <<  (BehindSouthWest+1),
                1 <<  (BehindSouth+1),
                1 <<  (BehindSouthEast+1)
            };
        return b[d];
    };


    /** The number of valid neighbors if the current center is at the volume border.
    */
00558     static unsigned int nearBorderDirectionCount(AtVolumeBorder b)
    {
        static unsigned int c[] = { 26, 17, 17,  0, 17, 11, 11,  0, 17, 11, 
                                    11,  0,  0,  0,  0,  0, 17, 11, 11,  0,
                                    11,  7,  7,  0, 11,  7,  7,  0,  0,  0,
                                     0,  0, 17, 11, 11,  0, 11,  7,  7,  0,
                                    11,  7,  7};
        return c[b];
    }
    
    /** The valid direction codes when the center is at the volume border.
        \a index must be in the range <tt>0...nearBorderDirectionCount(b)-1</tt>.
    */
00571     static Direction nearBorderDirections(AtVolumeBorder b, int index)
    {
        static Direction c[43][26] = {
                   //0 - NotAtBorder
                   {    InFrontNorthWest,   InFrontNorth,   InFrontNorthEast,
                        InFrontWest,        InFront,        InFrontEast,
                        InFrontSouthWest,   InFrontSouth,   InFrontSouthEast,
      
                        NorthWest, North, NorthEast,
                        West,             East,
                        SouthWest, South, SouthEast, 

                        BehindNorthWest, BehindNorth, BehindNorthEast,
                        BehindWest,      Behind,      BehindEast,
                        BehindSouthWest, BehindSouth, BehindSouthEast},    
                    //1 - AtRightBorder
                    {   InFrontNorthWest, InFrontNorth, /*InFrontNorthEast,*/
                        InFrontWest,      InFront,      /*InFrontEast,*/
                        InFrontSouthWest, InFrontSouth, /*InFrontSouthEast,*/
      
                        NorthWest, North, /*NorthEast,*/
                        West,             /*East,*/
                        SouthWest, South, /*SouthEast,*/ 

                        BehindNorthWest, BehindNorth, /*BehindNorthEast,*/
                        BehindWest,      Behind,      /*BehindEast,*/
                        BehindSouthWest, BehindSouth, /*BehindSouthEast,*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},    
                    //2 - AtLeftBorder
                    {   /*InFrontNorthWest,*/   InFrontNorth, InFrontNorthEast,
                        /*InFrontWest,*/       InFront,      InFrontEast,
                        /*InFrontSouthWest,*/   InFrontSouth, InFrontSouthEast,
                  
                        /*NorthWest,*/ North, NorthEast,
                        /*West,*/            East,
                        /*SouthWest,*/ South, SouthEast, 

                        /*BehindNorthWest,*/ BehindNorth, BehindNorthEast,
                        /*BehindWest,*/     Behind,      BehindEast,
                        /*BehindSouthWest,*/ BehindSouth, BehindSouthEast, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},
                    //3 - Nothin'
                    {   Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error,        Error, Error, Error, Error, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},    
                    //4 - AtTopBorder    
                    {   /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/
                        InFrontWest,        InFront,      InFrontEast,
                        InFrontSouthWest, InFrontSouth,   InFrontSouthEast,
                  
                        /*NorthWest, North, NorthEast,*/
                        West,             East,
                        SouthWest, South, SouthEast, 

                        /*BehindNorthWest, BehindNorth, BehindNorthEast,*/
                        BehindWest,                 Behind,                 BehindEast,
                        BehindSouthWest, BehindSouth, BehindSouthEast, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},    
                    //5 - AtTopRightBorder
                    {   /*InFrontNorthWest, InFrontNorth,   InFrontNorthEast,*/
                        InFrontWest,        InFront,        /*InFrontEast,*/
                        InFrontSouthWest, InFrontSouth,     /*InFrontSouthEast,*/
      
                        /*NorthWest, North, NorthEast,*/
                        West,             /*East,*/
                        SouthWest, South, /*SouthEast,*/ 

                        /*BehindNorthWest, BehindNorth, BehindNorthEast,*/
                        BehindWest,        Behind,      /*BehindEast,*/
                        BehindSouthWest, BehindSouth,   /*BehindSouthEast,*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error},    
                    //6 - AtTopLeftBorder
                    {   /*InFrontNorthWest,     InFrontNorth,   InFrontNorthEast,*/
                        /*InFrontWest,*/        InFront,        InFrontEast,
                        /*InFrontSouthWest,*/   InFrontSouth,   InFrontSouthEast,
       
                        /*NorthWest,    North,  NorthEast,*/
                        /*West,*/               East,
                        /*SouthWest,*/  South,  SouthEast, 

                        /*BehindNorthWest,      BehindNorth, BehindNorthEast,*/
                        /*BehindWest, */        Behind,      BehindEast,
                        /*BehindSouthWest,*/    BehindSouth, BehindSouthEast, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error},
                    //7 - Nothin'
                    {   Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error, Error, Error, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},    
                    //8 - AtBottomBorder
                    {   InFrontNorthWest, InFrontNorth,    InFrontNorthEast,
                        InFrontWest,      InFront,         InFrontEast,
                        /*InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
                  
                        NorthWest,      North,  NorthEast,
                        West,                   East,
                        /*SouthWest,    South,  SouthEast,*/

                        BehindNorthWest,    BehindNorth, BehindNorthEast,
                        BehindWest,         Behind,      BehindEast,
                        /*BehindSouthWest,  BehindSouth, BehindSouthEast*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},                    
                    //9 - AtBottomRightBorder
                    {   InFrontNorthWest, InFrontNorth,    /*InFrontNorthEast,*/
                        InFrontWest,      InFront,         /*InFrontEast,*/
                        /*InFrontSouthWest, InFrontSouth,  InFrontSouthEast,*/
      
                        NorthWest, North,   /*NorthEast,*/
                        West,               /*East,*/
                        /*SouthWest, South, SouthEast,*/

                        BehindNorthWest, BehindNorth,   /*BehindNorthEast,*/
                        BehindWest,      Behind,        /*BehindEast,*/
                        /*BehindSouthWest, BehindSouth, BehindSouthEast*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error},        
                    //10 - AtBottomLeftBorder
                    {   /*InFrontNorthWest,*/   InFrontNorth,   InFrontNorthEast,
                        /*InFrontWest,*/        InFront,        InFrontEast,
                        /*InFrontSouthWest,     InFrontSouth,   InFrontSouthEast,*/
      
                        /*NorthWest,*/  North,  NorthEast,
                        /*West,*/               East,
                        /*SouthWest,    South,  SouthEast,*/

                        /*BehindNorthWest,*/ BehindNorth,   BehindNorthEast,
                        /*BehindWest,*/      Behind,        BehindEast,
                        /*BehindSouthWest, BehindSouth,     BehindSouthEast*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error},
                    //11 - Nothin'
                    {   Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error, Error, Error, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},    
                    //12 - Nothin'
                    {   Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error, Error, Error, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},    
                    //13 - Nothin'
                    {   Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error, Error, Error, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},    
                    //14 - Nothin'
                    {   Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error, Error, Error, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},    
                    //15 - Nothin'
                    {   Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error, Error, Error, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},    
                    //16 - AtFrontBorder
                    {   /*InFrontNorthWest, InFrontNorth,    InFrontNorthEast,
                        InFrontWest,        InFront,         InFrontEast,
                        InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
      
                        NorthWest, North, NorthEast,
                        West,             East,
                        SouthWest, South, SouthEast, 

                        BehindNorthWest, BehindNorth, BehindNorthEast,
                        BehindWest,      Behind,      BehindEast,
                        BehindSouthWest, BehindSouth, BehindSouthEast, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},    
                    //17 - AtFrontRightBorder
                    {   /*InFrontNorthWest, InFrontNorth,    InFrontNorthEast,
                        InFrontWest,              InFront,                 InFrontEast,
                        InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
      
                        NorthWest, North, /*NorthEast,*/
                        West,             /*East,*/
                        SouthWest, South, /*SouthEast,*/ 

                        BehindNorthWest, BehindNorth, /*BehindNorthEast,*/
                        BehindWest,      Behind,      /*BehindEast,*/
                        BehindSouthWest, BehindSouth, /*BehindSouthEast,*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error},    
                    //18 - AtFrontLeftBorder
                    {   /*InFrontNorthWest, InFrontNorth,   InFrontNorthEast,
                        InFrontWest,        InFront,        InFrontEast,
                        InFrontSouthWest,   InFrontSouth,   InFrontSouthEast,*/
      
                        /*NorthWest,*/ North, NorthEast,
                        /*West,*/             East,
                        /*SouthWest,*/ South, SouthEast, 

                        /*BehindNorthWest,*/ BehindNorth, BehindNorthEast,
                        /*BehindWest,*/      Behind,      BehindEast,
                        /*BehindSouthWest,*/ BehindSouth, BehindSouthEast, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error},    
                    //19 - Nothin'
                    {   Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error, Error, Error, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},
                    //20 - AtTopFrontBorder
                    {   /*InFrontNorthWest, InFrontNorth,   InFrontNorthEast,
                        InFrontWest,        InFront,        InFrontEast,
                        InFrontSouthWest,   InFrontSouth,   InFrontSouthEast,*/
      
                        /*NorthWest,    North,  NorthEast,*/
                        West,                   East,
                        SouthWest,      South,  SouthEast, 

                        /*BehindNorthWest,  BehindNorth,    BehindNorthEast,*/
                        BehindWest,         Behind,         BehindEast,
                        BehindSouthWest,    BehindSouth,    BehindSouthEast, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error},    
                    //21 - AtTopRightFrontBorder
                    {   /*InFrontNorthWest, InFrontNorth,  InFrontNorthEast,
                        InFrontWest,        InFront,       InFrontEast,
                        InFrontSouthWest,   InFrontSouth,  InFrontSouthEast,*/
      
                        /*NorthWest, North, NorthEast,*/
                        West,               /*East,*/
                        SouthWest,   South, /*SouthEast,*/ 

                        /*BehindNorthWest, BehindNorth, BehindNorthEast,*/
                        BehindWest,        Behind,      /*BehindEast,*/
                        BehindSouthWest, BehindSouth,   /*BehindSouthEast,*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error},    
                    //22 - AtTopLeftFrontBorder
                    {   /*InFrontNorthWest, InFrontNorth,   InFrontNorthEast,
                        InFrontWest,        InFront,        InFrontEast,
                        InFrontSouthWest,   InFrontSouth,   InFrontSouthEast,*/
      
                        /*NorthWest,    North, NorthEast,*/
                        /*West,*/              East,
                        /*SouthWest,*/  South, SouthEast, 

                        /*BehindNorthWest,      BehindNorth, BehindNorthEast,*/
                        /*BehindWest,*/         Behind,      BehindEast,
                        /*BehindSouthWest,*/    BehindSouth, BehindSouthEast, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error},    
                    //23 - Nothin'
                    {   Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error, Error, Error, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},
                    //24 - AtBottomFrontBorder
                    {   /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,
                        InFrontWest,        InFront,      InFrontEast,
                        InFrontSouthWest,   InFrontSouth, InFrontSouthEast,*/
      
                        NorthWest,      North, NorthEast,
                        West,                  East,
                        /*SouthWest,    South, SouthEast,*/

                        BehindNorthWest,    BehindNorth, BehindNorthEast,
                        BehindWest,         Behind,      BehindEast,
                        /*BehindSouthWest,  BehindSouth, BehindSouthEast*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error},    
                    //25 - AtBottomRightFrontBorder
                    {   /*InFrontNorthWest, InFrontNorth,    InFrontNorthEast,
                        InFrontWest,        InFront,         InFrontEast,
                        InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
      
                        NorthWest,      North,  /*NorthEast,*/
                        West,                   /* East,*/
                        /*SouthWest,    South,  SouthEast,*/

                        BehindNorthWest,    BehindNorth, /*BehindNorthEast,*/
                        BehindWest,         Behind,      /*BehindEast,*/
                        /*BehindSouthWest,  BehindSouth, BehindSouthEast*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error},    
                    //26 - AtBottomLeftFrontBorder
                    { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,
                        InFrontWest,      InFront,      InFrontEast,
                        InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
      
                        /*NorthWest,*/ North, NorthEast,
                        /*West,*/             East,
                        /*SouthWest,   South, SouthEast,*/

                        /*BehindNorthWest,*/ BehindNorth, BehindNorthEast,
                        /*BehindWest,*/      Behind,      BehindEast,
                        /*BehindSouthWest,   BehindSouth, BehindSouthEast*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error},    
                    //27 - Nothin'
                    {   Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error, Error, Error, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},    
                    //28 - Nothin'
                    {   Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error, Error, Error, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},    
                    //29 - Nothin'
                    {   Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error, Error, Error, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},    
                    //30 - Nothin'
                    {   Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error, Error, Error, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},    
                    //31 - Nothin'
                    {   Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error, Error, Error, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},
                    //32 - AtRearBorder
                    {   InFrontNorthWest, InFrontNorth, InFrontNorthEast,
                        InFrontWest,      InFront,      InFrontEast,
                        InFrontSouthWest, InFrontSouth, InFrontSouthEast,
      
                        NorthWest, North, NorthEast,
                        West,             East,
                        SouthWest, South, SouthEast, 

                        /*BehindNorthWest, BehindNorth, BehindNorthEast,
                        BehindWest,        Behind,      BehindEast,
                        BehindSouthWest,   BehindSouth, BehindSouthEast,*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},    
                    //33 - AtRearRightBorder
                    {   InFrontNorthWest, InFrontNorth, /*InFrontNorthEast,*/
                        InFrontWest,      InFront,      /*InFrontEast,*/
                        InFrontSouthWest, InFrontSouth, /*InFrontSouthEast,*/
      
                        NorthWest, North, /*NorthEast,*/
                        West,             /*East,*/
                        SouthWest, South, /*SouthEast,*/

                        /*BehindNorthWest, BehindNorth, BehindNorthEast,
                        BehindWest,        Behind,      BehindEast,
                        BehindSouthWest,   BehindSouth, BehindSouthEast,*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error},    
                    //34 - AtRearLeftBorder
                    {   /*InFrontNorthWest,*/ InFrontNorth, InFrontNorthEast,
                        /*InFrontWest,*/      InFront,      InFrontEast,
                        /*InFrontSouthWest,*/ InFrontSouth, InFrontSouthEast,
      
                        /*NorthWest,*/ North, NorthEast,
                        /*West,*/             East,
                        /*SouthWest,*/ South, SouthEast, 

                        /*BehindNorthWest, BehindNorth,   BehindNorthEast,
                        BehindWest,        Behind,        BehindEast,
                        BehindSouthWest,   BehindSouth,   BehindSouthEast,*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error},        
                    //35 - Nothin'
                    {   Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error, Error, Error, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},
                    //36 - AtTopRearBorder
                    {   /*InFrontNorthWest, InFrontNorth,   InFrontNorthEast,*/
                        InFrontWest,        InFront,        InFrontEast,
                        InFrontSouthWest,   InFrontSouth,   InFrontSouthEast,
      
                        /*NorthWest,    North, NorthEast,*/
                        West,                  East,
                        SouthWest,      South, SouthEast, 

                        /*BehindNorthWest, BehindNorth,   BehindNorthEast,
                        BehindWest,        Behind,        BehindEast,
                        BehindSouthWest,   BehindSouth,   BehindSouthEast,*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error},            
                    //37 - AtTopRightRearBorder    
                    {   /*InFrontNorthWest, InFrontNorth,   InFrontNorthEast,*/
                        InFrontWest,        InFront,        /*InFrontEast,*/
                        InFrontSouthWest,   InFrontSouth,   /*InFrontSouthEast,*/
      
                        /*NorthWest, North, NorthEast,*/
                        West,               /*East,*/
                        SouthWest,   South, /*SouthEast,*/ 

                        /*BehindNorthWest,  BehindNorth, BehindNorthEast,
                        BehindWest,         Behind,      BehindEast,
                        BehindSouthWest,    BehindSouth, BehindSouthEast,*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error},    
                    //38 - AtTopLeftRearBorder
                    {   /*InFrontNorthWest,     InFrontNorth,    InFrontNorthEast,*/
                        /*InFrontWest,*/        InFront,         InFrontEast,
                        /*InFrontSouthWest,*/   InFrontSouth,   InFrontSouthEast,
      
                        /*NorthWest,    North,  NorthEast,*/
                        /*West,*/               East,
                        /*SouthWest,*/  South,  SouthEast, 

                        /*BehindNorthWest,  BehindNorth,    BehindNorthEast,
                        BehindWest,         Behind,         BehindEast,
                        BehindSouthWest,    BehindSouth,    BehindSouthEast,*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error},    
                    //39 - Nothin'
                    {   Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error, Error, Error, 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error},
                    //40 - AtBottomRearBorder
                    {   InFrontNorthWest,   InFrontNorth,   InFrontNorthEast,
                        InFrontWest,        InFront,        InFrontEast,
                        /*InFrontSouthWest, InFrontSouth,   InFrontSouthEast,*/
      
                        NorthWest,      North, NorthEast,
                        West,                  East,
                        /*SouthWest,    South, SouthEast,*/ 

                        /*BehindNorthWest,  BehindNorth, BehindNorthEast,
                        BehindWest,         Behind,      BehindEast,
                        BehindSouthWest,    BehindSouth, BehindSouthEast,*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error},    
                    //41 - AtBottomRightRearBorder
                    {   InFrontNorthWest,   InFrontNorth, /*InFrontNorthEast,*/
                        InFrontWest,        InFront,      /*InFrontEast,*/
                        /*InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
      
                        NorthWest,   North, /*NorthEast,*/
                        West,               /*East,*/
                        /*SouthWest, South, SouthEast,*/ 

                        /*BehindNorthWest, BehindNorth, BehindNorthEast,
                        BehindWest,        Behind,      BehindEast,
                        BehindSouthWest,   BehindSouth, BehindSouthEast,*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error},    
                    //42 - AtBottomLeftRearBorder
                    {   /*InFrontNorthWest,*/   InFrontNorth,   InFrontNorthEast,
                        /*InFrontWest,*/        InFront,        InFrontEast,
                        /*InFrontSouthWest,     InFrontSouth,   InFrontSouthEast,*/
      
                        /*NorthWest,*/  North,  NorthEast,
                        /*West,*/               East,
                        /*SouthWest,    South,  SouthEast,*/ 

                        /*BehindNorthWest,  BehindNorth, BehindNorthEast,
                        BehindWest,         Behind,      BehindEast,
                        BehindSouthWest,    BehindSouth, BehindSouthEast,*/ 
                        Error, Error, Error, Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error, Error, Error,
                        Error, Error, Error, Error}    
               };
        return c[b][index];
    }
        
    /** The valid direction three codes in anti causal direction (means: look back in scanline
        direction)when the center is at the volume border.
            Should be used with isAtVolumeBorderCausal to determine the Directions, as this
            avoids using of the nonesense border ids (e.g. 0,1,8,9...) of this table.
        \a index must be in the range <tt>0...nearBorderDirectionCount(b)-1</tt>.
     */
01026     static Direction nearBorderDirectionsCausal(AtVolumeBorder b, int index)
    {
        static Direction c[43][13] = {
            //0 - NotAtBorder -----> should never be used
                                { InFrontNorthWest, InFrontNorth,    InFrontNorthEast,
                                  InFrontWest,      InFront,         InFrontEast,
                                  InFrontSouthWest, InFrontSouth,    InFrontSouthEast,
                  
                                  NorthWest,        North,           NorthEast,
                                  West},                    
            //1 - AtRightBorder -----> should never be used
                                { InFrontNorthWest, InFrontNorth,    InFrontNorthEast,
                                  InFrontWest,      InFront,         InFrontEast,
                                  InFrontSouthWest, InFrontSouth,    InFrontSouthEast,
                  
                                  NorthWest,        North,           NorthEast,
                                  West},    
            //2 - AtLeftBorder
                                { /*InFrontNorthWest,*/ InFrontNorth,InFrontNorthEast,
                                  /*InFrontWest,*/  InFront,         InFrontEast,
                                  /*InFrontSouthWest,*/InFrontSouth, InFrontSouthEast,
                  
                                  /*NorthWest,*/    North,           NorthEast,
                                  /*West*/
                                  Error, Error, Error, Error, Error},    
            //3 - Nothin'
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //4 - AtTopBorder
                                { /*InFrontNorthWest,InFrontNorth,   InFrontNorthEast,*/
                                  InFrontWest,       InFront,        InFrontEast,
                                  InFrontSouthWest,  InFrontSouth,   InFrontSouthEast,
                  
                                  /*NorthWest,       North,          NorthEast,*/
                                  West,
                                  Error, Error, Error, Error, Error, Error},    
            //5 - AtTopRightBorder
                                { /*InFrontNorthWest,InFrontNorth,   InFrontNorthEast,*/
                                  InFrontWest,       InFront,        /*InFrontEast,*/
                                  InFrontSouthWest,  InFrontSouth,   /*InFrontSouthEast,*/
                  
                                  /*NorthWest, North, NorthEast,*/
                                  West,
                                  Error, Error, Error, Error, Error, Error, Error, Error},    
            //6 - AtTopLeftBorder
                                { /*InFrontNorthWest,InFrontNorth,    InFrontNorthEast,*/
                                  /*InFrontWest,*/   InFront,         InFrontEast,
                                  /*InFrontSouthWest,*/InFrontSouth,  InFrontSouthEast,
                  
                                  /*NorthWest,       North,           NorthEast,*/
                                  /*West,*/
                                  Error, Error, Error, Error, Error, Error, Error, Error, Error},
            //7 - Nothin'
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //8 - AtBottomBorder -----> should never be used
                                { InFrontNorthWest,  InFrontNorth,    InFrontNorthEast,
                                  InFrontWest,       InFront,         InFrontEast,
                                  InFrontSouthWest,  InFrontSouth,    InFrontSouthEast,
                  
                                  NorthWest,         North,           NorthEast,
                                  West},    
            //9 - AtBottomRightBorder -----> should never be used
                                { InFrontNorthWest, InFrontNorth,    InFrontNorthEast,
                                  InFrontWest,      InFront,         InFrontEast,
                                  InFrontSouthWest, InFrontSouth,    InFrontSouthEast,
                  
                                  NorthWest,        North,           NorthEast,
                                  West},    
            //10 - AtBottomLeftBorder
                                { /*InFrontNorthWest,*/InFrontNorth, InFrontNorthEast,
                                  /*InFrontWest,*/  InFront,         InFrontEast,
                                  /*InFrontSouthWest,*/InFrontSouth, InFrontSouthEast,
                  
                                  /*NorthWest,*/    North,           NorthEast,
                                  /*West*/
                                  Error, Error, Error, Error, Error},    
            //11 - Nothin'
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //12 - Nothin'
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //13 - Nothin'
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //14 - Nothin'
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //15 - Nothin'
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //16 - AtFrontBorder
                                { /*InFrontNorthWest,InFrontNorth,   InFrontNorthEast,
                                  InFrontWest,      InFront,         InFrontEast,
                                  InFrontSouthWest, InFrontSouth,    InFrontSouthEast,*/
                  
                                  NorthWest,        North,           NorthEast,
                                  West,
                                  Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //17 - AtFrontRightBorder
                                { /*InFrontNorthWest,InFrontNorth,   InFrontNorthEast,
                                  InFrontWest,      InFront,         InFrontEast,
                                  InFrontSouthWest, InFrontSouth,    InFrontSouthEast,*/
                  
                                  NorthWest,        North,           /*NorthEast,*/
                                  West,
                                  Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //18 - AtFrontLeftBorder
                                { /*InFrontNorthWest,InFrontNorth,   InFrontNorthEast,
                                  InFrontWest,      InFront,         InFrontEast,
                                  InFrontSouthWest, InFrontSouth,    InFrontSouthEast,*/
                  
                                  /*NorthWest,*/    North,           NorthEast,
                                  /*West,*/
                                  Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //19 - Nothin'
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //20 - AtTopFrontBorder
                                { /*InFrontNorthWest,InFrontNorth,   InFrontNorthEast,
                                  InFrontWest,      InFront,         InFrontEast,
                                  InFrontSouthWest, InFrontSouth,    InFrontSouthEast,*/
                  
                                  /*NorthWest, North, NorthEast,*/
                                  West,
                                  Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //21 - AtTopRightFrontBorder
                                { /*InFrontNorthWest, InFrontNorth,  InFrontNorthEast,
                                  InFrontWest,        InFront,       InFrontEast,
                                  InFrontSouthWest,   InFrontSouth,  InFrontSouthEast,*/
                  
                                  /*NorthWest,        North,         NorthEast,*/
                                  West,
                                  Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //22 - AtTopLeftFrontBorder
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //23 - Nothin
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //24 - AtBottomFrontBorder
                                { /*InFrontNorthWest, InFrontNorth,  InFrontNorthEast,
                                  InFrontWest,        InFront,       InFrontEast,
                                  InFrontSouthWest,   InFrontSouth,  InFrontSouthEast,*/
                  
                                  NorthWest,          North,         NorthEast,
                                  West,
                                  Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //25 - AtBottomRightFrontBorder
                                { /*InFrontNorthWest, InFrontNorth,  InFrontNorthEast,
                                  InFrontWest,        InFront,       InFrontEast,
                                  InFrontSouthWest,   InFrontSouth,  InFrontSouthEast,*/
                  
                                  NorthWest,          North,         /*NorthEast,*/
                                  West,
                                  Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //26 - AtBottomLeftFrontBorder
                                { /*InFrontNorthWest, InFrontNorth,  InFrontNorthEast,
                                  InFrontWest,        InFront,       InFrontEast,
                                  InFrontSouthWest,   InFrontSouth,  InFrontSouthEast,*/
                  
                                  /*NorthWest,*/      North,         NorthEast,
                                  West,
                                  Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //27 - Nothin
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //28 - Nothin
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //29 - Nothin
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //30 - Nothin
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //31 - Nothin
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //32 - AtRearBorder -----> should never be used
                                { InFrontNorthWest,   InFrontNorth,  InFrontNorthEast,
                                  InFrontWest,        InFront,       InFrontEast,
                                  InFrontSouthWest,   InFrontSouth,  InFrontSouthEast,
                  
                                  NorthWest,          North,         NorthEast,
                                  West},    
            //33 - AtRearRightBorder -----> should never be used
                                { InFrontNorthWest,   InFrontNorth,  InFrontNorthEast,
                                  InFrontWest,        InFront,       InFrontEast,
                                  InFrontSouthWest,   InFrontSouth,  InFrontSouthEast,
                  
                                  NorthWest,          North,         NorthEast,
                                  West},    
            //34 - AtRearLeftBorder
                                { /*InFrontNorthWest,*/InFrontNorth, InFrontNorthEast,
                                  /*InFrontWest,*/    InFront,       InFrontEast,
                                  /*InFrontSouthWest,*/InFrontSouth, InFrontSouthEast,
                  
                                  /*NorthWest,*/      North,         NorthEast,
                                  /*West*/
                                  Error, Error, Error, Error, Error},    
            //35 - Nothin
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //36 - AtTopRearBorder    
                                { /*InFrontNorthWest, InFrontNorth,  InFrontNorthEast,*/
                                  InFrontWest,        InFront,       InFrontEast,
                                  InFrontSouthWest,   InFrontSouth,  InFrontSouthEast,
                  
                                  /*NorthWest,        North,         NorthEast,*/
                                  West,
                                  Error, Error, Error, Error, Error, Error},    
            //37 - AtTopRightRearBorder        
                                { /*InFrontNorthWest, InFrontNorth,  InFrontNorthEast,*/
                                  InFrontWest,        InFront,       /*InFrontEast,*/
                                  InFrontSouthWest,   InFrontSouth,  /*InFrontSouthEast,*/
                  
                                  /*NorthWest,        North,         NorthEast,*/
                                  West,
                                  Error, Error, Error, Error, Error, Error, Error, Error},
            //38 - AtTopLeftRearBorder    
                                { /*InFrontNorthWest, InFrontNorth,  InFrontNorthEast,*/
                                  /*InFrontWest,*/    InFront,       InFrontEast,
                                  /*InFrontSouthWest,*/InFrontSouth, InFrontSouthEast,
                  
                                  /*NorthWest, North, NorthEast,*/
                                  /*West,*/
                                  Error, Error, Error, Error, Error, Error, Error, Error, Error},
            //39 - Nothin
                                { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},    
            //40 - AtBottomRearBorder -----> should never be used
                                { InFrontNorthWest,   InFrontNorth,  InFrontNorthEast,
                                  InFrontWest,        InFront,       InFrontEast,
                                  InFrontSouthWest,   InFrontSouth,  InFrontSouthEast,
                  
                                  NorthWest,          North,         NorthEast,
                                  West},    
            //41 - AtBottomRightRearBorder -----> should never be used
                                { InFrontNorthWest,  InFrontNorth,   InFrontNorthEast,
                                  InFrontWest,       InFront,        InFrontEast,
                                  InFrontSouthWest,  InFrontSouth,   InFrontSouthEast,
                  
                                  NorthWest,         North,          NorthEast,
                                  West},    
            //42 - AtBottomLeftRearBorder
                                { /*InFrontNorthWest,*/InFrontNorth, InFrontNorthEast,
                                  /*InFrontWest,*/   InFront,        InFrontEast,
                                  /*InFrontSouthWest,InFrontSouth,   InFrontSouthEast,*/
                  
                                  /*NorthWest,*/     North,          NorthEast,
                                  /*West*/
                                  Error, Error, Error, Error, Error, Error, Error}    
        };
        return c[b][index];
    }
    
    /** transform direction code into corresponding Diff3D offset.
        (note: there is no bounds checking on the code you pass.)
    */
01270     static Diff3D const & diff(Direction code)
    {
        static Diff3D d[] = {   Diff3D( -1, -1, -1),  //InFrontNorthWest
                                Diff3D(  0, -1, -1),  //InFrontNorth
                                Diff3D(  1, -1, -1),  //InFrontNorthEast
                                Diff3D( -1,  0, -1),  //InFrontWest
                                Diff3D(  0,  0, -1),  //InFront
                                Diff3D(  1,  0, -1),  //InFrontEast
                                Diff3D( -1,  1, -1),  //InFrontSouthWest
                                Diff3D(  0,  1, -1),  //InFrontSouth
                                Diff3D(  1,  1, -1),  //InFrontSouthEast

                                Diff3D( -1, -1,  0),  //NorthWest
                                Diff3D(  0, -1,  0),  //North
                                Diff3D(  1, -1,  0),  //NorthEast
                                Diff3D( -1,  0,  0),  //West
                                Diff3D(  1,  0,  0),  //East
                                Diff3D( -1,  1,  0),  //SouthWest
                                Diff3D(  0,  1,  0),  //South
                                Diff3D(  1,  1,  0),  //SouthEast

                                Diff3D( -1, -1,  1),  //BehindNorthWest
                                Diff3D(  0, -1,  1),  //BehindNorth
                                Diff3D(  1, -1,  1),  //BehindNorthEast
                                Diff3D( -1,  0,  1),  //BehindWest
                                Diff3D(  0,  0,  1),  //Behind
                                Diff3D(  1,  0,  1),  //BehindEast
                                Diff3D( -1,  1,  1),  //BehindSouthWest
                                Diff3D(  0,  1,  1),  //BehindSouth
                                Diff3D(  1,  1,  1),  //BehindSouthEast
                            };
        return d[code];
    }

    /** Equivalent to <tt>diff(static_cast<Direction>(code))</tt>.
        (note: there is no bounds checking on the code you pass.)
    */
01307     static Diff3D const & diff(int code) { return diff(static_cast<Direction>(code)); }

    /**  Equivalent to <tt>diff(code)[dim]</tt> */
01310     static int diff(Direction code, int dim) { return diff(code)[dim]; }
   
    /** Get the relative offset from one neighbor to the other.
    For example, <tt>relativeDiff(East, West) == multi_differencetype(-2,0,0)</tt>.
    (note: there is no bounds checking on the code you pass.)
    */
01316     static Diff3D const relativeDiff(Direction fromCode, Direction toCode)
    {
        //Uncomment the following lines may cause the program to crash because of insufficient
        //static allocatable memory on the stack
        /*
            static Diff3D d[][] = {
                //   InFront-NW    ---     InFront-N   ---     InFront-NE  ---    Infront-W    ---     InFront     ---   InFront-E     ---   InFront-SW    ---      InFront-S  ---   InFront-SE    ---    NorthWest   ---       North      ---    NorthEast    ---      West      ---       East       ---    SouthWest    ---    South        ---     SouthEast  ---     Behind-NW    ---     Behind-N    ---      Behind-NE  ---     Behind-W    ---      Behind     ---    Behind-E     ---    Behind-SW    ---      Behind-S   ---    Behind-SE  
                {    Diff3D( 0,  0,  0),    Diff3D( 1,  0,  0),    Diff3D( 2,  0,  0),    Diff3D( 0,  1,  0),    Diff3D( 1,  1,  0),    Diff3D( 2,  1,  0),    Diff3D( 0,  2,  0),    Diff3D( 1,  2,  0),    Diff3D( 2, 2,  0),    Diff3D( 0,  0,  1),    Diff3D( 1,  0,  1),    Diff3D( 2,  0,  1),    Diff3D( 0,  1,  1),    Diff3D( 2,  1,  1),    Diff3D( 0,  2,  1),    Diff3D( 1,  2,  1),    Diff3D( 2,  2,  1),    Diff3D( 0,  0,  2),    Diff3D( 1,  0,  2),    Diff3D( 2,  0,  2),    Diff3D( 0,  1,  2),    Diff3D( 1,  1,  2), Diff3D( 2,  1,  2),    Diff3D( 0,  2,  2),    Diff3D( 1,  2,  2),    Diff3D( 2,  2,  2)    },    //InFront-NW  
                {    Diff3D(-1,  0,  0),    Diff3D( 0,  0,  0),    Diff3D( 1,  0,  0),    Diff3D(-1,  1,  0),    Diff3D( 0,  1,  0),    Diff3D( 1,  1,  0),    Diff3D(-1,  2,  0),    Diff3D( 0,  2,  0),    Diff3D( 1, 2,  0),    Diff3D(-1,  0,  1),    Diff3D( 0,  0,  1),    Diff3D( 1,  0,  1),    Diff3D(-1,  1,  1),    Diff3D( 1,  1,  1),    Diff3D(-1,  2,  1),    Diff3D( 0,  2,  1),    Diff3D( 1,  2,  1),    Diff3D(-1,  0,  2),    Diff3D( 0,  0,  2),    Diff3D( 1,  0,  2),    Diff3D(-1,  1,  2),    Diff3D( 0,  1,  2), Diff3D( 1,  1,  2),    Diff3D(-1,  2,  2),    Diff3D( 0,  2,  2),    Diff3D( 1,  2,  2)    },    //InFront-N  
                {    Diff3D(-2,  0,  0),    Diff3D(-1,  0,  0),    Diff3D( 0,  0,  0),    Diff3D(-2,  1,  0),    Diff3D(-1,  1,  0),    Diff3D( 0,  1,  0),    Diff3D(-2,  2,  0),    Diff3D(-1,  2,  0),    Diff3D( 0, 2,  0),    Diff3D(-2,  0,  1),    Diff3D(-1,  0,  1),    Diff3D( 0,  0,  1),    Diff3D(-2,  1,  1),    Diff3D( 0,  1,  1),    Diff3D(-2,  2,  1),    Diff3D(-1,  2,  1),    Diff3D( 0,  2,  1),    Diff3D(-2,  0,  2),    Diff3D(-1,  0,  2),    Diff3D( 0,  0,  2),    Diff3D(-2,  1,  2),    Diff3D(-1,  1,  2), Diff3D( 0,  1,  2),    Diff3D(-2,  2,  2),    Diff3D(-1,  2,  2),    Diff3D( 0,  2,  2)    },    //InFront-NE
                {    Diff3D(0,  -1,  0),    Diff3D( 1, -1,  0),    Diff3D( 2, -1,  0),    Diff3D( 0,  0,  0),    Diff3D( 1,  0,  0),    Diff3D( 2,  0,  0),    Diff3D( 0,  1,  0),    Diff3D( 1,  1,  0),    Diff3D( 2, 1,  0),    Diff3D( 0, -1,  1),    Diff3D( 1, -1,  1),    Diff3D( 2, -1,  1),    Diff3D( 0,  0,  1),    Diff3D( 2,  0,  1),    Diff3D( 0,  1,  1),    Diff3D( 1,  1,  1),    Diff3D( 2,  1,  1),    Diff3D( 0, -1,  2),    Diff3D( 1, -1,  2),    Diff3D( 2, -1,  2),    Diff3D( 0,  0,  2),    Diff3D( 1,  0,  2), Diff3D( 2,  0,  2),    Diff3D( 0,  1,  2),    Diff3D( 1,  1,  2),    Diff3D( 2,  1,  2)    },    //Infront-W
                {    Diff3D(-1, -1,  0),    Diff3D( 0, -1,  0),    Diff3D( 1, -1,  0),    Diff3D(-1,  0,  0),    Diff3D( 0,  0,  0),    Diff3D( 1,  0,  0),    Diff3D(-1,  1,  0),    Diff3D( 0,  1,  0),    Diff3D( 1, 1,  0),    Diff3D(-1, -1,  1),    Diff3D( 0, -1,  1),    Diff3D( 1, -1,  1),    Diff3D(-1,  0,  1),    Diff3D( 1,  0,  1),    Diff3D(-1,  1,  1),    Diff3D( 0,  1,  1),    Diff3D( 1,  1,  1),    Diff3D(-1, -1,  2),    Diff3D( 0, -1,  2),    Diff3D( 1, -1,  2),    Diff3D(-1,  0,  2),    Diff3D( 0,  0,  2), Diff3D( 1,  0,  2),    Diff3D(-1,  1,  2),    Diff3D( 0,  1,  2),    Diff3D( 1,  1,  2)    },    //InFront
                {    Diff3D(-2, -1,  0),    Diff3D(-1, -1,  0),    Diff3D( 0, -1,  0),    Diff3D(-2,  0,  0),    Diff3D(-1,  0,  0),    Diff3D( 0,  0,  0),    Diff3D(-2,  1,  0),    Diff3D(-1,  1,  0),    Diff3D( 0, 1,  0),    Diff3D(-2, -1,  1),    Diff3D(-1, -1,  1),    Diff3D( 0, -1,  1),    Diff3D(-2,  0,  1),    Diff3D( 0,  0,  1),    Diff3D(-2,  1,  1),    Diff3D(-1,  1,  1),    Diff3D( 0,  1,  1),    Diff3D(-2, -1,  2),    Diff3D(-1, -1,  2),    Diff3D( 0, -1,  2),    Diff3D(-2,  0,  2),    Diff3D(-1,  0,  2), Diff3D( 0,  0,  2),    Diff3D(-2,  1,  2),    Diff3D(-1,  1,  2),    Diff3D( 0,  1,  2)    },    //InFront-E
                {    Diff3D( 0, -2,  0),    Diff3D( 1, -2,  0),    Diff3D( 2, -2,  0),    Diff3D( 0, -1,  0),    Diff3D( 1, -1,  0),    Diff3D( 2, -1,  0),    Diff3D( 0,  0,  0),    Diff3D( 1,  0,  0),    Diff3D( 2, 0,  0),    Diff3D( 0, -2,  1),    Diff3D( 1, -2,  1),    Diff3D( 2, -2,  1),    Diff3D( 0, -1,  1),    Diff3D( 2, -1,  1),    Diff3D( 0,  0,  1),    Diff3D( 1,  0,  1),    Diff3D( 2,  0,  1),    Diff3D( 0, -2,  2),    Diff3D( 1, -2,  2),    Diff3D( 2, -2,  2),    Diff3D( 0, -1,  2),    Diff3D( 1, -1,  2), Diff3D( 2, -1,  2),    Diff3D( 0,  0,  2),    Diff3D( 1,  0,  2),    Diff3D( 2,  0,  2)    },    //InFront-SW
                {    Diff3D(-1, -2,  0),    Diff3D( 0, -2,  0),    Diff3D( 1, -2,  0),    Diff3D(-1, -1,  0),    Diff3D( 0, -1,  0),    Diff3D( 1, -1,  0),    Diff3D(-1,  0,  0),    Diff3D( 0,  0,  0),    Diff3D( 1, 0,  0),    Diff3D(-1, -2,  1),    Diff3D( 0, -2,  1),    Diff3D( 1, -2,  1),    Diff3D(-1, -1,  1),    Diff3D( 1, -1,  1),    Diff3D(-1,  0,  1),    Diff3D( 0,  0,  1),    Diff3D( 1,  0,  1),    Diff3D(-1, -2,  2),    Diff3D( 0, -2,  2),    Diff3D( 1, -2,  2),    Diff3D(-1, -1,  2),    Diff3D( 0, -1,  2), Diff3D( 1, -1,  2),    Diff3D(-1,  0,  2),    Diff3D( 0,  0,  2),    Diff3D( 1,  0,  2)    },    //InFront-S 
                {    Diff3D(-2, -2,  0),    Diff3D(-1, -2,  0),    Diff3D( 0, -2,  0),    Diff3D(-2, -1,  0),    Diff3D(-1, -1,  0),    Diff3D( 0, -1,  0),    Diff3D(-2,  0,  0),    Diff3D(-1,  0,  0),    Diff3D( 0, 0,  0),    Diff3D(-2, -2,  1),    Diff3D(-1, -2,  1),    Diff3D( 0, -2,  1),    Diff3D(-2, -1,  1),    Diff3D( 0, -1,  1),    Diff3D(-2,  0,  1),    Diff3D(-1,  0,  1),    Diff3D( 0,  0,  1),    Diff3D(-2, -2,  2),    Diff3D(-1, -2,  2),    Diff3D( 0, -2,  2),    Diff3D(-2, -1,  2),    Diff3D(-1, -1,  2), Diff3D( 0, -1,  2),    Diff3D(-2,  0,  2),    Diff3D(-1,  0,  2),    Diff3D( 0,  0,  2)    },    //InFront-SE
                {    Diff3D( 0,  0, -1),    Diff3D( 1,  0, -1),    Diff3D( 2,  0, -1),    Diff3D( 0,  1, -1),    Diff3D( 1,  1, -1),    Diff3D( 2,  1, -1),    Diff3D( 0,  2, -1),    Diff3D( 1,  2, -1),    Diff3D( 2, 2, -1),    Diff3D( 0,  0,  0),    Diff3D( 1,  0,  0),    Diff3D( 2,  0,  0),    Diff3D( 0,  1,  0),    Diff3D( 2,  1,  0),    Diff3D( 0,  2,  0),    Diff3D( 1,  2,  0),    Diff3D( 2,  2,  0),    Diff3D( 0,  0,  1),    Diff3D( 1,  0,  1),    Diff3D( 2,  0,  1),    Diff3D( 0,  1,  1),    Diff3D( 1,  1,  1), Diff3D( 2,  1,  1),    Diff3D( 0,  2,  1),    Diff3D( 1,  2,  1),    Diff3D( 2,  2,  1)    },    //NorthWest
                {    Diff3D(-1,  0, -1),    Diff3D( 0,  0, -1),    Diff3D( 1,  0, -1),    Diff3D(-1,  1, -1),    Diff3D( 0,  1, -1),    Diff3D( 1,  1, -1),    Diff3D(-1,  2, -1),    Diff3D( 0,  2, -1),    Diff3D( 1, 2, -1),    Diff3D(-1,  0,  0),    Diff3D( 0,  0,  0),    Diff3D( 1,  0,  0),    Diff3D(-1,  1,  0),    Diff3D( 1,  1,  0),    Diff3D(-1,  2,  0),    Diff3D( 0,  2,  0),    Diff3D( 1,  2,  0),    Diff3D(-1,  0,  1),    Diff3D( 0,  0,  1),    Diff3D( 1,  0,  1),    Diff3D(-1,  1,  1),    Diff3D( 0,  1,  1), Diff3D( 1,  1,  1),    Diff3D(-1,  2,  1),    Diff3D( 0,  2,  1),    Diff3D( 1,  2,  1)    },    //North
                {    Diff3D(-2,  0, -1),    Diff3D(-1,  0, -1),    Diff3D( 0,  0, -1),    Diff3D(-2,  1, -1),    Diff3D(-1,  1, -1),    Diff3D( 0,  1, -1),    Diff3D(-2,  2, -1),    Diff3D(-1,  2, -1),    Diff3D( 0, 2, -1),    Diff3D(-2,  0,  0),    Diff3D(-1,  0,  0),    Diff3D( 0,  0,  0),    Diff3D(-2,  1,  0),    Diff3D( 0,  1,  0),    Diff3D(-2,  2,  0),    Diff3D(-1,  2,  0),    Diff3D( 0,  2,  0),    Diff3D(-2,  0,  1),    Diff3D(-1,  0,  1),    Diff3D( 0,  0,  1),    Diff3D(-2,  1,  1),    Diff3D(-1,  1,  1), Diff3D( 0,  1,  1),    Diff3D(-2,  2,  1),    Diff3D(-1,  2,  1),    Diff3D( 0,  2,  1)    },    //NortEast
                {    Diff3D( 0, -1, -1),    Diff3D( 1, -1, -1),    Diff3D( 2, -1, -1),    Diff3D( 0,  0, -1),    Diff3D( 1,  0, -1),    Diff3D( 2,  0, -1),    Diff3D( 0,  1, -1),    Diff3D( 1,  1, -1),    Diff3D( 2, 1, -1),    Diff3D( 0, -1,  0),    Diff3D( 1, -1,  0),    Diff3D( 2, -1,  0),    Diff3D( 0,  0,  0),    Diff3D( 2,  0,  0),    Diff3D( 0,  1,  0),    Diff3D( 1,  1,  0),    Diff3D( 2,  1,  0),    Diff3D( 0, -1,  1),    Diff3D( 1, -1,  1),    Diff3D( 2, -1,  1),    Diff3D( 0,  0,  1),    Diff3D( 1,  0,  1), Diff3D( 2,  0,  1),    Diff3D( 0,  1,  1),    Diff3D( 1,  1,  1),    Diff3D( 2,  1,  1)    },    //West
                {    Diff3D(-2, -1, -1),    Diff3D(-1, -1, -1),    Diff3D( 0, -1, -1),    Diff3D(-2,  0, -1),    Diff3D(-1,  0, -1),    Diff3D( 0,  0, -1),    Diff3D(-2,  1, -1),    Diff3D(-1,  1, -1),    Diff3D( 0, 1, -1),    Diff3D(-2, -1,  0),    Diff3D(-1, -1,  0),    Diff3D( 0, -1,  0),    Diff3D(-2,  0,  0),    Diff3D( 0,  0,  0),    Diff3D(-2,  1,  0),    Diff3D(-1,  1,  0),    Diff3D( 0,  1,  0),    Diff3D(-2, -1,  1),    Diff3D(-1, -1,  1),    Diff3D( 0, -1,  1),    Diff3D(-2,  0,  1),    Diff3D(-1,  0,  1), Diff3D( 0,  0,  1),    Diff3D(-2,  1,  1),    Diff3D(-1,  1,  1),    Diff3D( 0,  1,  1)    },    //East
                {    Diff3D( 0, -2, -1),    Diff3D( 1, -2, -1),    Diff3D( 2, -2, -1),    Diff3D( 0, -1, -1),    Diff3D( 1, -1, -1),    Diff3D( 2, -1, -1),    Diff3D( 0,  0, -1),    Diff3D( 1,  0, -1),    Diff3D( 2, 0, -1),    Diff3D( 0, -2,  0),    Diff3D( 1, -2,  0),    Diff3D( 2, -2,  0),    Diff3D( 0, -1,  0),    Diff3D( 2, -1,  0),    Diff3D( 0,  0,  0),    Diff3D( 1,  0,  0),    Diff3D( 2,  0,  0),    Diff3D( 0, -2,  1),    Diff3D( 1, -2,  1),    Diff3D( 2, -2,  1),    Diff3D( 0, -1,  1),    Diff3D( 1, -1,  1), Diff3D( 2, -1,  1),    Diff3D( 0,  0,  1),    Diff3D( 1,  0,  1),    Diff3D( 2,  0,  1)    },    //SouthWest
                {    Diff3D(-1, -2, -1),    Diff3D( 0, -2, -1),    Diff3D( 1, -2, -1),    Diff3D(-1, -1, -1),    Diff3D( 0, -1, -1),    Diff3D( 1, -1, -1),    Diff3D(-1,  0, -1),    Diff3D( 0,  0, -1),    Diff3D( 1, 0, -1),    Diff3D(-1, -2,  0),    Diff3D( 0, -2,  0),    Diff3D( 1, -2,  0),    Diff3D(-1, -1,  0),    Diff3D( 1, -1,  0),    Diff3D(-1,  0,  0),    Diff3D( 0,  0,  0),    Diff3D( 1,  0,  0),    Diff3D(-1, -2,  1),    Diff3D( 0, -2,  1),    Diff3D( 1, -2,  1),    Diff3D(-1, -1,  1),    Diff3D( 0, -1,  1), Diff3D( 1, -1,  1),    Diff3D(-1,  0,  1),    Diff3D( 0,  0,  1),    Diff3D( 1,  0,  1)    },    //South
                {    Diff3D(-2, -2, -1),    Diff3D(-1, -2, -1),    Diff3D( 0, -2, -1),    Diff3D(-2, -1, -1),    Diff3D(-1, -1, -1),    Diff3D( 0, -1, -1),    Diff3D(-2,  0, -1),    Diff3D(-1,  0, -1),    Diff3D( 0, 0, -1),    Diff3D(-2, -2,  0),    Diff3D(-1, -2,  0),    Diff3D( 0, -2,  0),    Diff3D(-2, -1,  0),    Diff3D( 0, -1,  0),    Diff3D(-2,  0,  0),    Diff3D(-1,  0,  0),    Diff3D( 0,  0,  0),    Diff3D(-2, -2,  1),    Diff3D(-1, -2,  1),    Diff3D( 0, -2,  1),    Diff3D(-2, -1,  1),    Diff3D(-1, -1,  1), Diff3D( 0, -1,  1),    Diff3D(-2,  0,  1),    Diff3D(-1,  0,  1),    Diff3D( 0,  0,  1)    },    //SouthEast
                {    Diff3D( 0,  0, -2),    Diff3D( 1,  0, -2),    Diff3D( 2,  0, -2),    Diff3D( 0,  1, -2),    Diff3D( 1,  1, -2),    Diff3D( 2,  1, -2),    Diff3D( 0,  2, -2),    Diff3D( 1,  2, -2),    Diff3D( 2, 2, -2),    Diff3D( 0,  0, -1),    Diff3D( 1,  0, -1),    Diff3D( 2,  0, -1),    Diff3D( 0,  1, -1),    Diff3D( 2,  1, -1),    Diff3D( 0,  2, -1),    Diff3D( 1,  2, -1),    Diff3D( 2,  2, -1),    Diff3D( 0,  0,  0),    Diff3D( 1,  0,  0),    Diff3D( 2,  0,  0),    Diff3D( 0,  1,  0),    Diff3D( 1,  1,  0),    Diff3D( 2,  1,  0),    Diff3D( 0,  2,  0),    Diff3D( 1,  2,  0),    Diff3D( 2,  2,  0)    },    //Behind-NW
                {    Diff3D(-1,  0, -2),    Diff3D( 0,  0, -2),    Diff3D( 1,  0, -2),    Diff3D(-1,  1, -2),    Diff3D( 0,  1, -2),    Diff3D( 1,  1, -2),    Diff3D(-1,  2, -2),    Diff3D( 0,  2, -2),    Diff3D( 1, 2, -2),    Diff3D(-1,  0, -1),    Diff3D( 0,  0, -1),    Diff3D( 1,  0, -1),    Diff3D(-1,  1, -1),    Diff3D( 1,  1, -1),    Diff3D(-1,  2, -1),    Diff3D( 0,  2, -1),    Diff3D( 1,  2, -1),    Diff3D(-1,  0,  0),    Diff3D( 0,  0,  0),    Diff3D( 1,  0,  0),    Diff3D(-1,  1,  0),    Diff3D( 0,  1,  0),    Diff3D( 1,  1,  0),    Diff3D(-1,  2,  0),    Diff3D( 0,  2,  0),    Diff3D( 1,  2,  0)    },    //Behind-N
                {    Diff3D(-2,  0, -2),    Diff3D(-1,  0, -2),    Diff3D( 0,  0, -2),    Diff3D(-2,  1, -2),    Diff3D(-1,  1, -2),    Diff3D( 0,  1, -2),    Diff3D(-2,  2, -2),    Diff3D(-1,  2, -2),    Diff3D( 0, 2, -2),    Diff3D(-2,  0, -1),    Diff3D(-1,  0, -1),    Diff3D( 0,  0, -1),    Diff3D(-2,  1, -1),    Diff3D( 0,  1, -1),    Diff3D(-2,  2, -1),    Diff3D(-1,  2, -1),    Diff3D( 0,  2, -1),    Diff3D(-2,  0,  0),    Diff3D(-1,  0,  0),    Diff3D( 0,  0,  0),    Diff3D(-2,  1,  0),    Diff3D(-1,  1,  0),    Diff3D( 0,  1,  0),    Diff3D(-2,  2,  0),    Diff3D(-1,  2,  0),    Diff3D( 0,  2,  0)    },    //Behind-NE
                {    Diff3D( 0, -1, -2),    Diff3D( 1, -1, -2),    Diff3D( 2, -1, -2),    Diff3D( 0,  0, -2),    Diff3D( 1,  0, -2),    Diff3D( 2,  0, -2),    Diff3D( 0,  1, -2),    Diff3D( 1,  1, -2),    Diff3D( 2, 1, -2),    Diff3D( 0, -1, -1),    Diff3D( 1, -1, -1),    Diff3D( 2, -1, -1),    Diff3D( 0,  0, -1),    Diff3D( 2,  0, -1),    Diff3D( 0,  1, -1),    Diff3D( 1,  1, -1),    Diff3D( 2,  1, -1),    Diff3D( 0, -1,  0),    Diff3D( 1, -1,  0),    Diff3D( 2, -1,  0),    Diff3D( 0,  0,  0),    Diff3D( 1,  0,  0), Diff3D( 2,  0,  0),    Diff3D( 0,  1,  0),    Diff3D( 1,  1,  0),    Diff3D( 2,  1,  0)    },    //Behind-W
                {    Diff3D(-1, -1, -2),    Diff3D( 0, -1, -2),    Diff3D( 1, -1, -2),    Diff3D(-1,  0, -2),    Diff3D( 0,  0, -2),    Diff3D( 1,  0, -2),    Diff3D(-1,  1, -2),    Diff3D( 0,  1, -2),    Diff3D( 1, 1, -2),    Diff3D(-1, -1, -1),    Diff3D( 0, -1, -1),    Diff3D( 1, -1, -1),    Diff3D(-1,  0, -1),    Diff3D( 1,  0, -1),    Diff3D(-1,  1, -1),    Diff3D( 0,  1, -1),    Diff3D( 1,  1, -1),    Diff3D(-1, -1,  0),    Diff3D( 0, -1,  0),    Diff3D( 1, -1,  0),    Diff3D(-1,  0,  0),    Diff3D( 0,  0,  0), Diff3D( 1,  0,  0),    Diff3D(-1,  1,  0),    Diff3D( 0,  1,  0),    Diff3D( 1,  1,  0)    },    //Behind
                {    Diff3D(-2, -1, -2),    Diff3D(-1, -1, -2),    Diff3D( 0, -1, -2),    Diff3D(-2,  0, -2),    Diff3D(-1,  0, -2),    Diff3D( 0,  0, -2),    Diff3D(-2,  1, -2),    Diff3D(-1,  1, -2),    Diff3D( 0, 1, -2),    Diff3D(-2, -1, -1),    Diff3D(-1, -1, -1),    Diff3D( 0, -1, -1),    Diff3D(-2,  0, -1),    Diff3D( 0,  0, -1),    Diff3D(-2,  1, -1),    Diff3D(-1,  1, -1),    Diff3D( 0,  1, -1),    Diff3D(-2, -1,  0),    Diff3D(-1, -1,  0),    Diff3D( 0, -1,  0),    Diff3D(-2,  0,  0),    Diff3D(-1,  0,  0), Diff3D( 0,  0,  0),    Diff3D(-2,  1,  0),    Diff3D(-1,  1,  0),    Diff3D( 0,  1,  0)    },    //Behind-E
                {    Diff3D( 0, -2, -2),    Diff3D( 1, -2, -2),    Diff3D( 2, -2, -2),    Diff3D( 0, -1, -2),    Diff3D( 1, -1, -2),    Diff3D( 2, -1, -2),    Diff3D( 0,  0, -2),    Diff3D( 1,  0, -2),    Diff3D( 2, 0, -2),    Diff3D( 0, -2, -1),    Diff3D( 1, -2, -1),    Diff3D( 2, -2, -1),    Diff3D( 0, -1, -1),    Diff3D( 2, -1, -1),    Diff3D( 0,  0, -1),    Diff3D( 1,  0, -1),    Diff3D( 2,  0, -1),    Diff3D( 0, -2,  0),    Diff3D( 1, -2,  0),    Diff3D( 2, -2,  0),    Diff3D( 0, -1,  0),    Diff3D( 1, -1,  0), Diff3D( 2, -1,  0),    Diff3D( 0,  0,  0),    Diff3D( 1,  0,  0),    Diff3D( 2,  0,  0)    },    //Behind-SW
                {    Diff3D(-1, -2, -2),    Diff3D( 0, -2, -2),    Diff3D( 1, -2, -2),    Diff3D(-1, -1, -2),    Diff3D( 0, -1, -2),    Diff3D( 1, -1, -2),    Diff3D(-1,  0, -2),    Diff3D( 0,  0, -2),    Diff3D( 1, 0, -2),    Diff3D(-1, -2, -1),    Diff3D( 0, -2, -1),    Diff3D( 1, -2, -1),    Diff3D(-1, -1, -1),    Diff3D( 1, -1, -1),    Diff3D(-1,  0, -1),    Diff3D( 0,  0, -1),    Diff3D( 1,  0, -1),    Diff3D(-1, -2,  0),    Diff3D( 0, -2,  0),    Diff3D( 1, -2,  0),    Diff3D(-1, -1,  0),    Diff3D( 0, -1,  0), Diff3D( 1, -1,  0),    Diff3D(-1,  0,  0),    Diff3D( 0,  0,  0),    Diff3D( 1,  0,  0)    },    //Behind-S
                {    Diff3D(-2, -2, -2),    Diff3D(-1, -2, -2),    Diff3D( 0, -2, -2),    Diff3D(-2, -1, -2),    Diff3D(-1, -1, -2),    Diff3D( 0, -1, -2),    Diff3D(-2,  0, -2),    Diff3D(-1,  0, -2),    Diff3D( 0, 0, -2),    Diff3D(-2, -2, -1),    Diff3D(-1, -2, -1),    Diff3D( 0, -2, -1),    Diff3D(-2, -1, -1),    Diff3D( 0, -1, -1),    Diff3D(-2,  0, -1),    Diff3D(-1,  0, -1),    Diff3D( 0,  0, -1),    Diff3D(-2, -2,  0),    Diff3D(-1, -2,  0),    Diff3D( 0, -2,  0),    Diff3D(-2, -1,  0),    Diff3D(-1, -1,  0), Diff3D( 0, -1,  0),    Diff3D(-2,  0,  0),    Diff3D(-1,  0,  0), Diff3D( 0,  0,  0)    }        //Behind-SE
            };
            return d[fromCode][toCode];
        */
        return diff(toCode)-diff(fromCode);
    }

   /** Equivalent to relativeDiff(static_cast<Direction>(fromCode), static_cast<Direction>(toCode)).
       (note: there is no bounds checking on the code you pass.)
   */
01358     static Diff3D const relativeDiff(int fromCode, int toCode)
    {
        return relativeDiff(static_cast<Direction>(fromCode), static_cast<Direction>(toCode));
    }
    
    /**  X-component of diff() */
01364     static int dX(Direction code) { return diff(code)[0]; }
    /**  Y-component of diff() */
01366     static int dY(Direction code) { return diff(code)[1]; }
    /**  Z-component of diff() */
01368     static int dZ(Direction code) { return diff(code)[2]; }
    
    /**  X-component of diff() */
01371     static int dX(int code) { return diff(code)[0]; }
    /**  Y-component of diff() */
01373     static int dY(int code) { return diff(code)[1]; }
    /**  Z-component of diff() */
01375     static int dZ(int code) { return diff(code)[2]; }
    
    /** transform 6-neighborhood code into 26-neighborhood code.
     */
01379     static Direction code(Neighborhood3DSix::Direction d)
    {
        switch (d){
            case Neighborhood3DSix::InFront :
                    return InFront;
            case Neighborhood3DSix::North :
                    return North;
            case Neighborhood3DSix::West :
                    return West;
            case Neighborhood3DSix::East :
                    return East;
            case Neighborhood3DSix::South :
                    return South;
            case Neighborhood3DSix::Behind :
                    return Behind;
        }
        return Error;
    }

    /** transform Diff3D offset into corresponding direction code.
       The code <tt>Direction::Error</tt> will be returned if <tt>diff</tt>
       is not in the 3DTwentySix-Neighborhood.
    */
01402     static Direction code(Diff3D const & diff)
    {
        switch(diff[0]){
            case -1:
                switch(diff[1]){
                    case -1:
                        switch(diff[2]){
                            case -1: return InFrontNorthWest; // ( -1, -1, -1)
                            case  0: return NorthWest;        // ( -1, -1,  0)
                            case  1: return BehindNorthWest;  // ( -1, -1,  1)
                        }
                    case  0:
                        switch(diff[2]){
                            case -1: return InFrontWest;      // ( -1,  0, -1)
                            case  0: return West;             // ( -1,  0,  0)
                            case  1: return BehindWest;       // ( -1,  0,  1)
                        }
                    case  1:
                        switch(diff[2]){
                            case -1: return InFrontSouthWest; // ( -1,  1, -1)
                            case  0: return SouthWest;        // ( -1,  1,  0)
                            case  1: return BehindSouthWest;  // ( -1,  1,  1)
                        }
                }
            case  0:
                switch(diff[1]){
                    case -1:
                        switch(diff[2]){
                            case -1: return InFrontNorth;     // (  0,  0, -1)
                            case  0: return North;            // (  0, -1,  0)
                            case  1: return BehindNorth;      // (  0, -1,  1)
                        }
                    case  0:
                        switch(diff[2]){
                            case -1: return InFront;          // (  0,  0, -1)
                            case  1: return Behind;           // (  0,  0,  1)
                        }
                    case  1: 
                        switch(diff[2]){
                            case -1: return InFrontSouth;     // (  0,  1, -1)
                            case  0: return South;            // (  0,  1,  0)
                            case  1: return BehindSouth;      // (  0,  1,  1)
                        }
                }                    
            case  1:
                switch(diff[1]){
                    case -1:
                        switch(diff[2]){
                            case -1: return InFrontNorthEast;  // (  1, -1, -1)
                            case  0: return NorthEast;         // (  1, -1,  0)
                            case  1: return BehindNorthEast;   // (  1, -1,  1)
                        }
                    case  0:
                        switch(diff[2]){
                            case -1: return InFrontEast;       // (  1,  0, -1)
                            case  0: return East;              // (  1,  0,  0)
                            case  1: return BehindEast;        // (  1,  0,  1)
                        }
                    case  1:
                        switch(diff[2]){
                            case -1: return InFrontSouthEast;  // (  1,  1, -1)
                            case  0: return SouthEast;         // (  1,  1,  0)
                            case  1: return BehindSouthEast;   // (  1,  1,  1)
                        }
                }
        }
        return Error; // better safe than sorry
    }
  
    /** Check whether a code refers to a diagonal direction.
        Useful if you want to abstract the differences between 6- and 26-neighborhood.
        Always <tt>false</tt> for 6-neighborhood.
    */
01475     static bool isDiagonal(Direction dir) {
        Diff3D d = diff(dir);
        if (abs(d[0])+abs(d[1])+abs(d[2])==1)
            return false;
        else
            return true;
    }

01483     static Diff3D const & frontTopLeft()        { return diff(InFrontNorthWest); }    /**<  Offset to the front-top-left neighbor */
01484     static Diff3D const & frontTop()            { return diff(InFrontNorth); }        /**<  Offset to the front-top neighbor */
01485     static Diff3D const & frontTopRight()       { return diff(InFrontNorthEast); }    /**<  Offset to the front-top-right neighbor */
01486     static Diff3D const & frontLeft()           { return diff(InFrontWest); }         /**<  Offset to the front-left neighbor */
01487     static Diff3D const & front()               { return diff(InFront); }             /**<  Offset to the front neighbor */
01488     static Diff3D const & frontRight()          { return diff(InFrontEast); }         /**<  Offset to the front-right neighbor */
01489     static Diff3D const & frontBottomLeft()     { return diff(InFrontSouthWest); }    /**<  Offset to the front-bottom-left neighbor */
01490     static Diff3D const & frontBottom()         { return diff(InFrontSouth); }        /**<  Offset to the front-bottom neighbor */
01491     static Diff3D const & frontBottomRight()    { return diff(InFrontSouthEast); }    /**<  Offset to the front-bottom-right neighbor */
    
01493     static Diff3D const & topLeft()             { return diff(NorthWest); }           /**<  Offset to the top-left neighbor */
01494     static Diff3D const & top()                 { return diff(North); }               /**<  Offset to the top neighbor */
01495     static Diff3D const & topRight()            { return diff(NorthEast); }           /**<  Offset to the top-right neighbor */
01496     static Diff3D const & left()                { return diff(West); }                /**<  Offset to the left neighbor */
01497     static Diff3D const & right()               { return diff(East); }                /**<  Offset to the right neighbor */
01498     static Diff3D const & bottomLeft()          { return diff(SouthWest); }           /**<  Offset to the bottom-left neighbor */
01499     static Diff3D const & bottom()              { return diff(South); }               /**<  Offset to the bottom neighbor */
01500     static Diff3D const & bottomRight()         { return diff(SouthEast); }           /**<  Offset to the bottom-right neighbor */

01502     static Diff3D const & rearTopLeft()         { return diff(BehindNorthWest); }     /**<  Offset to the rear-top-left neighbor */
01503     static Diff3D const & rearTop()             { return diff(BehindNorth); }         /**<  Offset to the rear-top neighbor */
01504     static Diff3D const & rearTopRight()        { return diff(BehindNorthEast); }     /**<  Offset to the rear-top-right neighbor */
01505     static Diff3D const & rearLeft()            { return diff(BehindWest); }          /**<  Offset to the rear-left neighbor */
01506     static Diff3D const & rear()                { return diff(Behind); }              /**<  Offset to the rear neighbor */
01507     static Diff3D const & rearRight()           { return diff(BehindEast); }          /**<  Offset to the rear-right neighbor */
01508     static Diff3D const & rearBottomLeft()      { return diff(BehindSouthWest); }     /**<  Offset to the rear-bottom-left neighbor */
01509     static Diff3D const & rearBottom()          { return diff(BehindSouth); }         /**<  Offset to the rear-bottom neighbor */
01510     static Diff3D const & rearBottomRight()     { return diff(BehindSouthEast); }     /**<  Offset to the rear-bottom-right neighbor */

    //----- other namings

01514     static Diff3D const & infrontNorthWest()    { return diff(InFrontNorthWest); }    /**<  Offset to the infront-north-west neighbor */
01515     static Diff3D const & infrontNorth()        { return diff(InFrontNorth); }        /**<  Offset to the infront-north neighbor */
01516     static Diff3D const & infrontNorthEast()    { return diff(InFrontNorthEast); }    /**<  Offset to the infront-north-east neighbor */
01517     static Diff3D const & infrontWest()         { return diff(InFrontWest); }         /**<  Offset to the infront-west neighbor */
01518     static Diff3D const & infront()             { return diff(InFront); }             /**<  Offset to the infront neighbor */
01519     static Diff3D const & infrontEast()         { return diff(InFrontEast); }         /**<  Offset to the infront-east neighbor */
01520     static Diff3D const & infrontSouthWest()    { return diff(InFrontSouthWest); }    /**<  Offset to the infront-south-west neighbor */
01521     static Diff3D const & infrontSouth()        { return diff(InFrontSouth); }        /**<  Offset to the infront-south neighbor */
01522     static Diff3D const & infrontSouthEast()    { return diff(InFrontSouthEast); }    /**<  Offset to the infront-south-east neighbor */
    
01524     static Diff3D const & northWest()           { return diff(NorthWest); }            /**<  Offset to the north-west neighbor */
01525     static Diff3D const & north()               { return diff(North); }                /**<  Offset to the north neighbor */
01526     static Diff3D const & northEast()           { return diff(NorthEast); }            /**<  Offset to the north-east neighbor */
01527     static Diff3D const & west()                { return diff(West); }                 /**<  Offset to the west neighbor */
01528     static Diff3D const & east()                { return diff(East); }                 /**<  Offset to the right neighbor */
01529     static Diff3D const & southWest()           { return diff(SouthWest); }            /**<  Offset to the south-west neighbor */
01530     static Diff3D const & south()               { return diff(South); }                /**<  Offset to the south neighbor */
01531     static Diff3D const & southEast()           { return diff(SouthEast); }            /**<  Offset to the south-east neighbor */

01533     static Diff3D const & behindNorthWest()     { return diff(BehindNorthWest); }      /**<  Offset to the behind-north-west neighbor */
01534     static Diff3D const & behindNorth()         { return diff(BehindNorth); }          /**<  Offset to the behind-north neighbor */
01535     static Diff3D const & behindNorthEast()     { return diff(BehindNorthEast); }      /**<  Offset to the behind-north-east neighbor */
01536     static Diff3D const & behindEast()          { return diff(BehindWest); }           /**<  Offset to the behind-west neighbor */
01537     static Diff3D const & behind()              { return diff(Behind); }               /**<  Offset to the behind neighbor */
01538     static Diff3D const & behindWest()          { return diff(BehindEast); }           /**<  Offset to the behind-right neighbor */
01539     static Diff3D const & behindSouthWest()     { return diff(BehindSouthWest); }      /**<  Offset to the behind-south-west neighbor */
01540     static Diff3D const & behindSouth()         { return diff(BehindSouth); }          /**<  Offset to the behind-south neighbor */
01541     static Diff3D const & behindSouthEast()     { return diff(BehindSouthEast); }      /**<  Offset to the behind-south-east neighbor */
}; // class Neighborhood3D


/** Export NeighborCode3D::Direction into the scope of namespace Neighborhood3DSix.
 */
01547 typedef NeighborCode3D::Direction Direction;

01549 static const Direction InFrontNorthWest   = NeighborCode3D::InFrontNorthWest;     /**<  Export NeighborCode3D::InFrontNorthWest to namespace Neighborhood3DTwentySix */
01550 static const Direction InFrontNorth       = NeighborCode3D::InFrontNorth;         /**<  Export NeighborCode3D::InFrontNorth to namespace Neighborhood3DTwentySix */
01551 static const Direction InFrontNorthEast   = NeighborCode3D::InFrontNorthEast;     /**<  Export NeighborCode3D::InFrontNorthEast to namespace Neighborhood3DTwentySix */
01552 static const Direction InFrontWest        = NeighborCode3D::InFrontWest;          /**<  Export NeighborCode3D::InFrontWest to namespace Neighborhood3DTwentySix */
01553 static const Direction InFront            = NeighborCode3D::InFront;              /**<  Export NeighborCode3D::InFront to namespace Neighborhood3DTwentySix */
01554 static const Direction InFrontEast        = NeighborCode3D::InFrontEast;          /**<  Export NeighborCode3D::InFrontEast to namespace Neighborhood3DTwentySix */
01555 static const Direction InFrontSouthWest   = NeighborCode3D::InFrontSouthWest;     /**<  Export NeighborCode3D::InFrontSouthWest to namespace Neighborhood3DTwentySix */
01556 static const Direction InFrontSouth       = NeighborCode3D::InFrontSouth;         /**<  Export NeighborCode3D::InFrontSouth to namespace Neighborhood3DTwentySix */
01557 static const Direction InFrontSouthEast   = NeighborCode3D::InFrontSouthEast;     /**<  Export NeighborCode3D::InFrontSouthEast to namespace Neighborhood3DTwentySix */

01559 static const Direction NorthWest          = NeighborCode3D::NorthWest;            /**<  Export NeighborCode3D::NorthWest to namespace Neighborhood3DTwentySix */
01560 static const Direction North              = NeighborCode3D::North;                /**<  Export NeighborCode3D::North to namespace Neighborhood3DTwentySix */
01561 static const Direction NorthEast          = NeighborCode3D::NorthEast;            /**<  Export NeighborCode3D::NorthEast to namespace Neighborhood3DTwentySix */
01562 static const Direction West               = NeighborCode3D::West;                 /**<  Export NeighborCode3D::West to namespace Neighborhood3DTwentySix */
01563 static const Direction East               = NeighborCode3D::East;                 /**<  Export NeighborCode3D::East to namespace Neighborhood3DTwentySix */
01564 static const Direction SouthWest          = NeighborCode3D::SouthWest;            /**<  Export NeighborCode3D::SouthWest to namespace Neighborhood3DTwentySix */
01565 static const Direction South              = NeighborCode3D::South;                /**<  Export NeighborCode3D::South to namespace Neighborhood3DTwentySix */
01566 static const Direction SouthEast          = NeighborCode3D::SouthEast;            /**<  Export NeighborCode3D::SouthEast to namespace Neighborhood3DTwentySix */

01568 static const Direction BehindNorthWest    = NeighborCode3D::BehindNorthWest;      /**<  Export NeighborCode3D::BehindNorthWest to namespace Neighborhood3DTwentySix */
01569 static const Direction BehindNorth        = NeighborCode3D::BehindNorth;          /**<  Export NeighborCode3D::BehindNorth to namespace Neighborhood3DTwentySix */
01570 static const Direction BehindNorthEast    = NeighborCode3D::BehindNorthEast;      /**<  Export NeighborCode3D::BehindNorthEast to namespace Neighborhood3DTwentySix */
01571 static const Direction BehindWest         = NeighborCode3D::BehindWest;           /**<  Export NeighborCode3D::BehindWest to namespace Neighborhood3DTwentySix */
01572 static const Direction Behind             = NeighborCode3D::Behind;               /**<  Export NeighborCode3D::Behind to namespace Neighborhood3DTwentySix */
01573 static const Direction BehindEast         = NeighborCode3D::BehindEast;           /**<  Export NeighborCode3D::BehindEast to namespace Neighborhood3DTwentySix */
01574 static const Direction BehindSouthWest    = NeighborCode3D::BehindSouthWest;      /**<  Export NeighborCode3D::BehindSouthWest to namespace Neighborhood3DTwentySix */
01575 static const Direction BehindSouth        = NeighborCode3D::BehindSouth;          /**<  Export NeighborCode3D::BehindSouth to namespace Neighborhood3DTwentySix */
01576 static const Direction BehindSouthEast    = NeighborCode3D::BehindSouthEast;      /**<  Export NeighborCode3D::BehindSouthEast to namespace Neighborhood3DTwentySix */

01578 static const Direction DirectionCount     = NeighborCode3D::DirectionCount;       /**<  Export NeighborCode3D::DirectionCount to namespace Neighborhood3DTwentySix */

}//namespace Neighborhood3DTwentySix
    
/** Export \ref vigra::Neighborhood3DTwentySix::NeighborCode3D into the scope of namespace vigra.
 */
01584 typedef Neighborhood3DTwentySix::NeighborCode3D NeighborCode3DTwentySix;

//@}

} // namespace vigra

#endif /* VIGRA_VOXELNEIGHBORHOOD_HXX */

Generated by  Doxygen 1.6.0   Back to index