[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

voxelneighborhood.hxx
1 /************************************************************************/
2 /* */
3 /* Copyright 2006-2007 by F. Heinrich, B. Seppke, Ullrich Koethe */
4 /* */
5 /* This file is part of the VIGRA computer vision library. */
6 /* The VIGRA Website is */
7 /* http://hci.iwr.uni-heidelberg.de/vigra/ */
8 /* Please direct questions, bug reports, and contributions to */
9 /* ullrich.koethe@iwr.uni-heidelberg.de or */
10 /* vigra@informatik.uni-hamburg.de */
11 /* */
12 /* Permission is hereby granted, free of charge, to any person */
13 /* obtaining a copy of this software and associated documentation */
14 /* files (the "Software"), to deal in the Software without */
15 /* restriction, including without limitation the rights to use, */
16 /* copy, modify, merge, publish, distribute, sublicense, and/or */
17 /* sell copies of the Software, and to permit persons to whom the */
18 /* Software is furnished to do so, subject to the following */
19 /* conditions: */
20 /* */
21 /* The above copyright notice and this permission notice shall be */
22 /* included in all copies or substantial portions of the */
23 /* Software. */
24 /* */
25 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND */
26 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */
27 /* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
28 /* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */
29 /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
30 /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
31 /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
32 /* OTHER DEALINGS IN THE SOFTWARE. */
33 /* */
34 /************************************************************************/
35 
36 #ifndef VIGRA_VOXELNEIGHBORHOOD_HXX
37 #define VIGRA_VOXELNEIGHBORHOOD_HXX
38 
39 #include "tinyvector.hxx"
40 #include "pixelneighborhood.hxx"
41 
42 namespace vigra {
43 
44 /** \addtogroup VoxelNeighborhood Utilities to manage voxel neighborhoods
45 
46  6- and 26-neighborhood definitions and circulators.
47 
48  <b>\#include</b> <<a href="voxelneighborhood_8hxx-source.html">vigra/voxelneighborhood.hxx</a>><br>
49 
50  <b>See also:</b> \ref vigra::NeighborhoodCirculator
51  */
52 //@{
53 
54  /// 3-dimensional difference vector
56 
57 /********************************************************/
58 /* */
59 /* AtVolumeBorder */
60 /* */
61 /********************************************************/
62 
63 /** \brief Encode whether a voxel is near the volume border.
64 
65  // This enum is used with \ref isAtVolumeBorder() and
66  // \ref vigra::RestrictedNeighborhoodCirculator.
67 
68  //<b>\#include</b> <<a href="voxelneighborhood_8hxx-source.html">vigra/voxelneighborhood.hxx</a>><br>
69  //Namespace: vigra
70 */
71 
73 
74 
75 /** \brief Find out whether a voxel is at the volume border.
76 
77  This function checks if \a x == 0 or \a x == \a width - 1 and
78  \a y == 0 or \a y == \a height - 1 and so on and returns the appropriate value
79  of \ref vigra::AtVolumeBorder, or zero when the voxel is not at te volume border.
80  The behavior of the function is undefined if (x,y,z) is not inside the volume.
81 */
82 inline AtVolumeBorder isAtVolumeBorder(int x, int y, int z, int width, int height, int depth)
83 {
84  return static_cast<AtVolumeBorder>((x == 0
85  ? LeftBorder
86  : x == width-1
87  ? RightBorder
88  : NotAtBorder) |
89  (y == 0
90  ? TopBorder
91  : y == height-1
92  ? BottomBorder
93  : NotAtBorder) |
94  (z == 0
95  ? FrontBorder
96  : z == depth-1
97  ? RearBorder
98  : NotAtBorder));
99 }
100 
101 inline AtVolumeBorder isAtVolumeBorder(Diff3D const & p, Diff3D const & shape)
102 {
103  return isAtVolumeBorder(p[0], p[1], p[2], shape[0], shape[1], shape[2]);
104 }
105 
106 /** \brief Find out whether a voxel is at a scan-order relevant volume border.
107  This function checks if \a x == 0 or \a y == 0 or \a z == \a 0 and returns the
108  appropriate value of \ref vigra::AtVolumeBorder, or zero when the voxel is
109  not at te volume border.
110  The behavior of the function is undefined if (x,y,z) is not inside the volume.
111 */
112 inline AtVolumeBorder isAtVolumeBorderCausal(int x, int y, int z, int width, int height, int /* depth */)
113 {
114  return static_cast<AtVolumeBorder>((x == 0
115  ? LeftBorder
116  : x == width-1
117  ? RightBorder
118  : NotAtBorder) |
119  (y == 0
120  ? TopBorder
121  : y == height-1
122  ? BottomBorder
123  : NotAtBorder) |
124  (z == 0
125  ? FrontBorder
126  : NotAtBorder));
127 }
128 /** TODO: Write new comment \brief Find out whether a voxel is at a scan-order relevant volume border.
129  This function checks if \a x == 0 or \a y == 0 or \a z == \a 0 and returns the
130  appropriate value of \ref vigra::AtVolumeBorder, or zero when the voxel is
131  not at te volume border.
132  The behavior of the function is undefined if (x,y,z) is not inside the volume.
133 */
134 inline AtVolumeBorder isAtVolumeBorderAntiCausal(int x, int y, int z, int width, int height, int depth)
135 {
136  return static_cast<AtVolumeBorder>((x == 0
137  ? LeftBorder
138  : x == width-1
139  ? RightBorder
140  : NotAtBorder) |
141  (y == 0
142  ? TopBorder
143  : y == height-1
144  ? BottomBorder
145  : NotAtBorder) |
146  (z == depth-1
147  ? RearBorder
148  : NotAtBorder));
149 }
150 
151 /********************************************************/
152 /* */
153 /* Neighborhood3DSix */
154 /* */
155 /********************************************************/
156 
157 /** 3D 6-Neighborhood. */
158 namespace Neighborhood3DSix
159 {
160 
161 /** \brief Encapsulation of direction management of neighbors for a 3D 6-neighborhood.
162 */
164 {
165  public:
166 
167  typedef Diff3D difference_type;
168 
169  /** provides enumeration of all directions.
170  DirectionCount may be used for portable loop termination conditions.
171  */
172  enum Direction {
173  Error = -1,
174  InFront= 0,
175  North,
176  West ,
177  Behind,
178  South,
179  East,
180  DirectionCount,
181  CausalFirst = InFront,
182  CausalLast = West,
183  AntiCausalFirst = Behind,
184  AntiCausalLast = East,
185 
186  InitialDirection = InFront,
187  OppositeDirPrefix = 1,
188  OppositeOffset = 3
189  };
190 
191  static unsigned int directionBit(Direction d)
192  {
193  static unsigned int b[] = { 1 << InFront,
194  1 << North,
195  1 << West,
196  1 << Behind,
197  1 << South,
198  1 << East
199  };
200  return b[d];
201  };
202 
203 
204  /** The number of valid neighbors if the current center is at the volume border.
205  */
207  {
208  static unsigned int c[] = { 6, 5, 5, 0, 5, 4, 4, 0, 5, 4,
209  4, 0, 0, 0, 0, 0, 5, 4, 4, 0,
210  4, 3, 3, 0, 4, 3, 3, 0, 0, 0,
211  0, 0, 5, 4, 4, 0, 4, 3, 3, 0,
212  4, 3, 3};
213  return c[b];
214  }
215 
216  /** The valid direction codes when the center is at the volume border.
217  \a index must be in the range <tt>0...nearBorderDirectionCount(b)-1</tt>.
218  */
220  {
221  static Direction c[43][6] = {
222  { InFront, North, West, Behind, South, East}, // 0 - NotAtBorder
223  { InFront, North, West, Behind, South, Error}, // 1 - AtRightBorder
224  { InFront, North, Behind, South, East, Error}, // 2 - AtLeftBorder
225  { Error, Error, Error, Error, Error, Error},
226  { InFront, West, Behind, South, East, Error}, // 4 - AtTopBorder
227  { InFront, West, Behind, South, Error, Error}, // 5 - AtTopRightBorder
228  { InFront, Behind, South, East, Error, Error}, // 6 - AtTopLeftBorder
229  { Error, Error, Error, Error, Error, Error},
230  { InFront, North, West, Behind, East, Error}, // 8 - AtBottomBorder
231  { InFront, North, West, Behind, Error, Error}, // 9 - AtBottomRightBorder
232  { InFront, North, Behind, East, Error, Error}, //10- AtBottomLeftBorder
233  { Error, Error, Error, Error, Error, Error},
234  { Error, Error, Error, Error, Error, Error},
235  { Error, Error, Error, Error, Error, Error},
236  { Error, Error, Error, Error, Error, Error},
237  { Error, Error, Error, Error, Error, Error},
238  { North, West, Behind, South, East, Error}, //16 - AtFrontBorder
239  { North, West, Behind, South, Error, Error}, //17 - AtFrontRightBorder
240  { North, Behind, South, East, Error, Error}, //18 - AtFrontLeftBorder
241  { Error, Error, Error, Error, Error, Error},
242  { West, Behind, South, East, Error, Error}, //20 - AtTopFrontBorder
243  { West, Behind, South, Error, Error, Error}, //21 - AtTopRightFrontBorder
244  { Behind, South, East, Error, Error, Error}, //22 - AtTopLeftFrontBorder
245  { Error, Error, Error, Error, Error, Error},
246  { North, West, Behind, East, Error, Error}, //24 - AtBottomFrontBorder
247  { North, West, Behind, Error, Error, Error}, //25 - AtBottomRightFrontBorder
248  { North, Behind, East, Error, Error, Error}, //26 - AtBottomLeftFrontBorder
249  { Error, Error, Error, Error, Error, Error},
250  { Error, Error, Error, Error, Error, Error},
251  { Error, Error, Error, Error, Error, Error},
252  { Error, Error, Error, Error, Error, Error},
253  { Error, Error, Error, Error, Error, Error},
254  { InFront, North, West, South, East,Error}, //32 - AtRearBorder
255  { InFront, North, West, South, Error, Error}, //33 - AtRearRightBorder
256  { InFront, North, South, East, Error, Error}, //34 - AtRearLeftBorder
257  { Error, Error, Error, Error, Error, Error},
258  { InFront, West, South, East, Error, Error}, //36 - AtTopRearBorder
259  { InFront, West, South, Error, Error, Error}, //37 - AtTopRightRearBorder
260  { InFront, South, East, Error, Error, Error}, //38 - AtTopLeftRearBorder
261  { Error, Error, Error, Error, Error, Error},
262  { InFront, North, West, East, Error, Error}, //40 - AtBottomRearBorder
263  { InFront, North, West, Error, Error, Error}, //41 - AtBottomRightRearBorder
264  { InFront, North, East, Error, Error, Error} //42 - AtBottomLeftRearBorder
265  };
266  return c[b][index];
267  }
268 
269  /** The valid direction three codes in anti causal direction (means: look back in scanline
270  direction)when the center is at the volume border.
271  Should be used with isAtVolumeBorderCausal to determine the Directions, as this
272  avoids using of the nonesense border ids (e.g. 0,1,8,9...) of this table.
273  \a index must be in the range <tt>0...nearBorderDirectionCount(b)-1</tt>.
274  */
276  {
277  static Direction c[43][3] = {
278  { InFront, North, West}, // 0 - NotAtBorder
279  { InFront, North, West}, // 1 - AtRightBorder
280  { InFront, North, Error}, // 2 - AtLeftBorder
281  { Error, Error, Error},
282  { InFront, West, Error}, // 4 - AtTopBorder
283  { InFront, West, Error}, // 5 - AtTopRightBorder
284  { InFront, Error,Error}, // 6 - AtTopLeftBorder
285  { Error, Error, Error},
286  { InFront, North, West}, // 8 - AtBottomBorder
287  { InFront, North, West}, // 9 - AtBottomRightBorder
288  { InFront, North, Error}, //10- AtBottomLeftBorder
289  { Error, Error, Error},
290  { Error, Error, Error},
291  { Error, Error, Error},
292  { Error, Error, Error},
293  { Error, Error, Error},
294  { North, West, Error}, //16 - AtFrontBorder
295  { North, West, Error}, //17 - AtFrontRightBorder
296  { North, Error, Error}, //18 - AtFrontLeftBorder
297  { Error, Error, Error},
298  { West, Error, Error}, //20 - AtTopFrontBorder
299  { West, Error, Error}, //21 - AtTopRightFrontBorder
300  { Error, Error, Error}, //22 - AtTopLeftFrontBorder
301  { Error, Error, Error},
302  { North, West, Error}, //24 - AtBottomFrontBorder
303  { North, West, Error}, //25 - AtBottomRightFrontBorder
304  { North, Error, Error}, //26 - AtBottomLeftFrontBorder
305  { Error, Error, Error},
306  { Error, Error, Error},
307  { Error, Error, Error},
308  { Error, Error, Error},
309  { Error, Error, Error},
310  { InFront, North, West}, //32 - AtRearBorder
311  { InFront, North, West}, //33 - AtRearRightBorder
312  { InFront, North, Error}, //34 - AtRearLeftBorder
313  { Error, Error, Error},
314  { InFront, West, Error}, //36 - AtTopRearBorder
315  { InFront, West, Error}, //37 - AtTopRightRearBorder
316  { InFront, Error, Error}, //38 - AtTopLeftRearBorder
317  { Error, Error, Error},
318  { InFront, North, West}, //40 - AtBottomRearBorder
319  { InFront, North, West}, //41 - AtBottomRightRearBorder
320  { InFront, North, Error} //42 - AtBottomLeftRearBorder
321  };
322  return c[b][index];
323  }
324 
325  /** transform direction code into corresponding Diff3D offset.
326  (note: there is no bounds checking on the code you pass.)
327  */
328  static Diff3D const & diff(Direction code)
329  {
330  static Diff3D d[] = {
331  Diff3D( 0, 0, -1), //InFront
332  Diff3D( 0, -1, 0), //North
333  Diff3D( -1, 0, 0), //West
334  Diff3D( 0, 0, 1), //Behind
335  Diff3D( 0, 1, 0), //South
336  Diff3D( 1, 0, 0) //East
337  };
338  return d[code];
339  }
340 
341  /** Equivalent to <tt>diff(static_cast<Direction>(code))</tt>.
342  (note: there is no bounds checking on the code you pass.)
343  */
344  static Diff3D const & diff(int code) { return diff(static_cast<Direction>(code)); }
345 
346  /** Equivalent to <tt>diff(code)[dim]</tt> */
347  static int diff(Direction code, int dim) { return diff(code)[dim]; }
348 
349  /** Get the relative offset from one neighbor to the other.
350  For example, <tt>relativeDiff(East, West) == multi_differencetype(-2,0,0)</tt>.
351  (note: there is no bounds checking on the code you pass.)
352  */
353  static Diff3D const & relativeDiff(Direction fromCode, Direction toCode)
354  {
355  static Diff3D d[6][6] =
356  {
357  // InFront - North - West - Behind - South - East
358  { 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
359  { 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
360  { 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
361  { 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
362  { 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
363  { 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
364  };
365 
366  return d[fromCode][toCode];
367  }
368 
369  /** Equivalent to relativeDiff(static_cast<Direction>(fromCode), static_cast<Direction>(toCode)).
370  (note: there is no bounds checking on the code you pass.)
371  */
372  static Diff3D const & relativeDiff(int fromCode, int toCode)
373  {
374  return relativeDiff(static_cast<Direction>(fromCode), static_cast<Direction>(toCode));
375  }
376 
377  /** X-component of diff() */
378  static int dX(Direction code) { return diff(code)[0]; }
379  /** Y-component of diff() */
380  static int dY(Direction code) { return diff(code)[1]; }
381  /** Z-component of diff() */
382  static int dZ(Direction code) { return diff(code)[2]; }
383 
384  /** X-component of diff() */
385  static int dX(int code) { return diff(code)[0]; }
386  /** Y-component of diff() */
387  static int dY(int code) { return diff(code)[1]; }
388  /** Z-component of diff() */
389  static int dZ(int code) { return diff(code)[2]; }
390 
391 
392  /** transform Diff3D offset into corresponding direction code.
393  The code <tt>Direction::Error</tt> will be returned if <tt>diff</tt>
394  is not in the 3DSix-Neighborhood.
395  */
396  static Direction code(Diff3D const & diff)
397  {
398  switch(diff[0]) {
399  case 0:
400  {
401  switch(diff[1]) {
402  case 0:
403  switch(diff[2]) {
404  case 1:
405  return Behind;
406  case -1:
407  return InFront;
408  default:
409  return Error;
410  }
411 
412  case 1:
413  return (diff[2] == 0) ? South : Error;
414  case -1:
415  return (diff[2] == 0) ? North : Error;
416  default:
417  return Error;
418  }
419  }
420  case -1:
421  return ((diff[1] == 0) && (diff[2] == 0)) ? West : Error;
422  case 1:
423  return ((diff[1] == 0) && (diff[2] == 0)) ? East : Error;
424  }
425  return Error;
426  }
427 
428  /** Check whether a code refers to a diagonal direction.
429  Useful if you want to abstract the differences between 6- and 26-neighborhood.
430  Always <tt>false</tt> for 6-neighborhood.
431  */
432  static bool isDiagonal(Direction) { return false; }
433 
434  static Diff3D const & right() { return diff(East); } /**< Offset to the right neighbor */
435  static Diff3D const & top() { return diff(North); } /**< Offset to the top neighbor */
436  static Diff3D const & left() { return diff(West); } /**< Offset to the left neighbor */
437  static Diff3D const & bottom() { return diff(South); } /**< Offset to the bottom neighbor */
438  static Diff3D const & rear() { return diff(Behind); } /**< Offset to the rear neighbor */
439  static Diff3D const & front() { return diff(InFront); } /**< Offset to the neighbor in front */
440 
441  static Diff3D const & east() { return diff(East); } /**< Offset to the east neighbor */
442  static Diff3D const & north() { return diff(North); } /**< Offset to the north neighbor */
443  static Diff3D const & west() { return diff(West); } /**< Offset to the west neighbor */
444  static Diff3D const & south() { return diff(South); } /**< Offset to the south neighbor */
445  static Diff3D const & behind() { return diff(Behind); } /**< Offset to the rear neighbor */
446  static Diff3D const & infront() { return diff(InFront); } /**< Offset to the neighbor in front */
447 
448 }; // class Neighborhood3DSix
449 
450 
451 /** Export NeighborCode3D::Direction into the scope of namespace Neighborhood3DSix.
452 */
454 
455 static const Direction East = NeighborCode3D::East; /**< Export NeighborCode3D::East to namespace Neighborhood3DSix */
456 static const Direction North = NeighborCode3D::North; /**< Export NeighborCode3D::North to namespace Neighborhood3DSix */
457 static const Direction West = NeighborCode3D::West; /**< Export NeighborCode3D::West to namespace Neighborhood3DSix */
458 static const Direction South = NeighborCode3D::South; /**< Export NeighborCode3D::South to namespace Neighborhood3DSix */
459 static const Direction Behind = NeighborCode3D::Behind; /**< Export NeighborCode3D::Behind to namespace Neighborhood3DSix */
460 static const Direction InFront = NeighborCode3D::InFront; /**< Export NeighborCode3D::InFront to namespace Neighborhood3DSix */
461 static const Direction DirectionCount = NeighborCode3D::DirectionCount; /**< Export NeighborCode3D::DirectionCount to namespace Neighborhood3DSix */
462 
463 
464 }//namespace Neighborhood3DSix
465 
466 /** Export \ref vigra::Neighborhood3DSix::NeighborCode3D into the scope of namespace vigra.
467 */
469 
470 /********************************************************/
471 /* */
472 /* Neighborhood3DTwentySix */
473 /* */
474 /********************************************************/
475 /** 3D 26-Neighborhood. */
476 namespace Neighborhood3DTwentySix
477 {
478 
479 /** \brief Encapsulation of direction management of neighbors for a 3D 26-neighborhood.
480 */
482 {
483  public:
484 
485  typedef Diff3D difference_type;
486 
487  /** provides enumeration of all directions.
488  DirectionCount may be used for portable loop termination conditions.
489  */
490  enum Direction {
491  Error = -1,
492  InFrontNorthWest = 0,
493  InFrontNorth,
494  InFrontNorthEast,
495  InFrontWest,
496  InFront,
497  InFrontEast,
498  InFrontSouthWest,
499  InFrontSouth,
500  InFrontSouthEast,
501 
502  NorthWest,
503  North,
504  NorthEast,
505  West,
506  East,
507  SouthWest,
508  South,
509  SouthEast,
510 
511  BehindNorthWest,
512  BehindNorth,
513  BehindNorthEast,
514  BehindWest,
515  Behind,
516  BehindEast,
517  BehindSouthWest,
518  BehindSouth,
519  BehindSouthEast,
520 
521  DirectionCount,
522  CausalFirst = InFrontNorthWest,
523  CausalLast = West,
524  AntiCausalFirst = BehindSouthEast,
525  AntiCausalLast = East,
526 
527  InitialDirection = InFrontNorthWest,
528  OppositeDirPrefix = -1,
529  OppositeOffset = 25
530  };
531 
532  static unsigned int directionBit(Direction d)
533  {
534  static unsigned int b[] = {
535  1 << InFrontNorthWest,
536  1 << InFrontNorth,
537  1 << InFrontNorthEast,
538  1 << InFrontWest,
539  1 << InFront,
540  1 << InFrontEast,
541  1 << InFrontSouthWest,
542  1 << InFrontSouth,
543  1 << InFrontSouthEast,
544 
545  1 << NorthWest,
546  1 << North,
547  1 << NorthEast,
548  1 << West,
549  1 << East,
550  1 << SouthWest,
551  1 << South,
552  1 << SouthEast,
553 
554  1 << BehindNorthWest,
555  1 << BehindNorth,
556  1 << BehindNorthEast,
557  1 << BehindWest,
558  1 << Behind,
559  1 << BehindEast,
560  1 << BehindSouthWest,
561  1 << BehindSouth,
562  1 << BehindSouthEast
563  };
564  return b[d];
565  };
566 
567 
568 
569  /** The number of valid neighbors if the current center is at the volume border.
570  */
572  {
573  static unsigned int c[] = { 26, 17, 17, 0, 17, 11, 11, 0, 17, 11,
574  11, 0, 0, 0, 0, 0, 17, 11, 11, 0,
575  11, 7, 7, 0, 11, 7, 7, 0, 0, 0,
576  0, 0, 17, 11, 11, 0, 11, 7, 7, 0,
577  11, 7, 7};
578  return c[b];
579  }
580 
581  /** The valid direction codes when the center is at the volume border.
582  \a index must be in the range <tt>0...nearBorderDirectionCount(b)-1</tt>.
583  */
585  {
586  static Direction c[43][26] = {
587  //0 - NotAtBorder
588  { InFrontNorthWest, InFrontNorth, InFrontNorthEast,
589  InFrontWest, InFront, InFrontEast,
590  InFrontSouthWest, InFrontSouth, InFrontSouthEast,
591 
592  NorthWest, North, NorthEast,
593  West, East,
594  SouthWest, South, SouthEast,
595 
596  BehindNorthWest, BehindNorth, BehindNorthEast,
597  BehindWest, Behind, BehindEast,
598  BehindSouthWest, BehindSouth, BehindSouthEast},
599  //1 - AtRightBorder
600  { InFrontNorthWest, InFrontNorth, /*InFrontNorthEast,*/
601  InFrontWest, InFront, /*InFrontEast,*/
602  InFrontSouthWest, InFrontSouth, /*InFrontSouthEast,*/
603 
604  NorthWest, North, /*NorthEast,*/
605  West, /*East,*/
606  SouthWest, South, /*SouthEast,*/
607 
608  BehindNorthWest, BehindNorth, /*BehindNorthEast,*/
609  BehindWest, Behind, /*BehindEast,*/
610  BehindSouthWest, BehindSouth, /*BehindSouthEast,*/
611  Error, Error, Error, Error, Error, Error, Error, Error, Error},
612  //2 - AtLeftBorder
613  { /*InFrontNorthWest,*/ InFrontNorth, InFrontNorthEast,
614  /*InFrontWest,*/ InFront, InFrontEast,
615  /*InFrontSouthWest,*/ InFrontSouth, InFrontSouthEast,
616 
617  /*NorthWest,*/ North, NorthEast,
618  /*West,*/ East,
619  /*SouthWest,*/ South, SouthEast,
620 
621  /*BehindNorthWest,*/ BehindNorth, BehindNorthEast,
622  /*BehindWest,*/ Behind, BehindEast,
623  /*BehindSouthWest,*/ BehindSouth, BehindSouthEast,
624  Error, Error, Error, Error, Error, Error, Error, Error, Error},
625  //3 - Nothin'
626  { Error, Error, Error, Error, Error, Error, Error, Error, Error,
627  Error, Error, Error, Error, Error, Error, Error, Error,
628  Error, Error, Error, Error, Error, Error, Error, Error, Error},
629  //4 - AtTopBorder
630  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/
631  InFrontWest, InFront, InFrontEast,
632  InFrontSouthWest, InFrontSouth, InFrontSouthEast,
633 
634  /*NorthWest, North, NorthEast,*/
635  West, East,
636  SouthWest, South, SouthEast,
637 
638  /*BehindNorthWest, BehindNorth, BehindNorthEast,*/
639  BehindWest, Behind, BehindEast,
640  BehindSouthWest, BehindSouth, BehindSouthEast,
641  Error, Error, Error, Error, Error, Error, Error, Error, Error},
642  //5 - AtTopRightBorder
643  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/
644  InFrontWest, InFront, /*InFrontEast,*/
645  InFrontSouthWest, InFrontSouth, /*InFrontSouthEast,*/
646 
647  /*NorthWest, North, NorthEast,*/
648  West, /*East,*/
649  SouthWest, South, /*SouthEast,*/
650 
651  /*BehindNorthWest, BehindNorth, BehindNorthEast,*/
652  BehindWest, Behind, /*BehindEast,*/
653  BehindSouthWest, BehindSouth, /*BehindSouthEast,*/
654  Error, Error, Error, Error, Error, Error, Error, Error, Error,
655  Error, Error, Error, Error, Error, Error},
656  //6 - AtTopLeftBorder
657  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/
658  /*InFrontWest,*/ InFront, InFrontEast,
659  /*InFrontSouthWest,*/ InFrontSouth, InFrontSouthEast,
660 
661  /*NorthWest, North, NorthEast,*/
662  /*West,*/ East,
663  /*SouthWest,*/ South, SouthEast,
664 
665  /*BehindNorthWest, BehindNorth, BehindNorthEast,*/
666  /*BehindWest, */ Behind, BehindEast,
667  /*BehindSouthWest,*/ BehindSouth, BehindSouthEast,
668  Error, Error, Error, Error, Error, Error, Error, Error, Error,
669  Error, Error, Error, Error, Error, Error},
670  //7 - Nothin'
671  { Error, Error, Error, Error, Error, Error, Error, Error, Error,
672  Error, Error, Error, Error, Error, Error, Error, Error,
673  Error, Error, Error, Error, Error, Error, Error, Error, Error},
674  //8 - AtBottomBorder
675  { InFrontNorthWest, InFrontNorth, InFrontNorthEast,
676  InFrontWest, InFront, InFrontEast,
677  /*InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
678 
679  NorthWest, North, NorthEast,
680  West, East,
681  /*SouthWest, South, SouthEast,*/
682 
683  BehindNorthWest, BehindNorth, BehindNorthEast,
684  BehindWest, Behind, BehindEast,
685  /*BehindSouthWest, BehindSouth, BehindSouthEast*/
686  Error, Error, Error, Error, Error, Error, Error, Error, Error},
687  //9 - AtBottomRightBorder
688  { InFrontNorthWest, InFrontNorth, /*InFrontNorthEast,*/
689  InFrontWest, InFront, /*InFrontEast,*/
690  /*InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
691 
692  NorthWest, North, /*NorthEast,*/
693  West, /*East,*/
694  /*SouthWest, South, SouthEast,*/
695 
696  BehindNorthWest, BehindNorth, /*BehindNorthEast,*/
697  BehindWest, Behind, /*BehindEast,*/
698  /*BehindSouthWest, BehindSouth, BehindSouthEast*/
699  Error, Error, Error, Error, Error, Error, Error, Error, Error,
700  Error, Error, Error, Error, Error, Error},
701  //10 - AtBottomLeftBorder
702  { /*InFrontNorthWest,*/ InFrontNorth, InFrontNorthEast,
703  /*InFrontWest,*/ InFront, InFrontEast,
704  /*InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
705 
706  /*NorthWest,*/ North, NorthEast,
707  /*West,*/ East,
708  /*SouthWest, South, SouthEast,*/
709 
710  /*BehindNorthWest,*/ BehindNorth, BehindNorthEast,
711  /*BehindWest,*/ Behind, BehindEast,
712  /*BehindSouthWest, BehindSouth, BehindSouthEast*/
713  Error, Error, Error, Error, Error, Error, Error, Error, Error,
714  Error, Error, Error, Error, Error, Error},
715  //11 - Nothin'
716  { Error, Error, Error, Error, Error, Error, Error, Error, Error,
717  Error, Error, Error, Error, Error, Error, Error, Error,
718  Error, Error, Error, Error, Error, Error, Error, Error, Error},
719  //12 - Nothin'
720  { Error, Error, Error, Error, Error, Error, Error, Error, Error,
721  Error, Error, Error, Error, Error, Error, Error, Error,
722  Error, Error, Error, Error, Error, Error, Error, Error, Error},
723  //13 - Nothin'
724  { Error, Error, Error, Error, Error, Error, Error, Error, Error,
725  Error, Error, Error, Error, Error, Error, Error, Error,
726  Error, Error, Error, Error, Error, Error, Error, Error, Error},
727  //14 - Nothin'
728  { Error, Error, Error, Error, Error, Error, Error, Error, Error,
729  Error, Error, Error, Error, Error, Error, Error, Error,
730  Error, Error, Error, Error, Error, Error, Error, Error, Error},
731  //15 - Nothin'
732  { Error, Error, Error, Error, Error, Error, Error, Error, Error,
733  Error, Error, Error, Error, Error, Error, Error, Error,
734  Error, Error, Error, Error, Error, Error, Error, Error, Error},
735  //16 - AtFrontBorder
736  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,
737  InFrontWest, InFront, InFrontEast,
738  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
739 
740  NorthWest, North, NorthEast,
741  West, East,
742  SouthWest, South, SouthEast,
743 
744  BehindNorthWest, BehindNorth, BehindNorthEast,
745  BehindWest, Behind, BehindEast,
746  BehindSouthWest, BehindSouth, BehindSouthEast,
747  Error, Error, Error, Error, Error, Error, Error, Error, Error},
748  //17 - AtFrontRightBorder
749  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,
750  InFrontWest, InFront, InFrontEast,
751  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
752 
753  NorthWest, North, /*NorthEast,*/
754  West, /*East,*/
755  SouthWest, South, /*SouthEast,*/
756 
757  BehindNorthWest, BehindNorth, /*BehindNorthEast,*/
758  BehindWest, Behind, /*BehindEast,*/
759  BehindSouthWest, BehindSouth, /*BehindSouthEast,*/
760  Error, Error, Error, Error, Error, Error, Error, Error, Error,
761  Error, Error, Error, Error, Error, Error},
762  //18 - AtFrontLeftBorder
763  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,
764  InFrontWest, InFront, InFrontEast,
765  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
766 
767  /*NorthWest,*/ North, NorthEast,
768  /*West,*/ East,
769  /*SouthWest,*/ South, SouthEast,
770 
771  /*BehindNorthWest,*/ BehindNorth, BehindNorthEast,
772  /*BehindWest,*/ Behind, BehindEast,
773  /*BehindSouthWest,*/ BehindSouth, BehindSouthEast,
774  Error, Error, Error, Error, Error, Error, Error, Error, Error,
775  Error, Error, Error, Error, Error, Error},
776  //19 - Nothin'
777  { Error, Error, Error, Error, Error, Error, Error, Error, Error,
778  Error, Error, Error, Error, Error, Error, Error, Error,
779  Error, Error, Error, Error, Error, Error, Error, Error, Error},
780  //20 - AtTopFrontBorder
781  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,
782  InFrontWest, InFront, InFrontEast,
783  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
784 
785  /*NorthWest, North, NorthEast,*/
786  West, East,
787  SouthWest, South, SouthEast,
788 
789  /*BehindNorthWest, BehindNorth, BehindNorthEast,*/
790  BehindWest, Behind, BehindEast,
791  BehindSouthWest, BehindSouth, BehindSouthEast,
792  Error, Error, Error, Error, Error, Error, Error, Error, Error,
793  Error, Error, Error, Error, Error, Error},
794  //21 - AtTopRightFrontBorder
795  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,
796  InFrontWest, InFront, InFrontEast,
797  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
798 
799  /*NorthWest, North, NorthEast,*/
800  West, /*East,*/
801  SouthWest, South, /*SouthEast,*/
802 
803  /*BehindNorthWest, BehindNorth, BehindNorthEast,*/
804  BehindWest, Behind, /*BehindEast,*/
805  BehindSouthWest, BehindSouth, /*BehindSouthEast,*/
806  Error, Error, Error, Error, Error, Error, Error, Error, Error,
807  Error, Error, Error, Error, Error, Error,
808  Error, Error, Error, Error},
809  //22 - AtTopLeftFrontBorder
810  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,
811  InFrontWest, InFront, InFrontEast,
812  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
813 
814  /*NorthWest, North, NorthEast,*/
815  /*West,*/ East,
816  /*SouthWest,*/ South, SouthEast,
817 
818  /*BehindNorthWest, BehindNorth, BehindNorthEast,*/
819  /*BehindWest,*/ Behind, BehindEast,
820  /*BehindSouthWest,*/ BehindSouth, BehindSouthEast,
821  Error, Error, Error, Error, Error, Error, Error, Error, Error,
822  Error, Error, Error, Error, Error, Error,
823  Error, Error, Error, Error},
824  //23 - Nothin'
825  { Error, Error, Error, Error, Error, Error, Error, Error, Error,
826  Error, Error, Error, Error, Error, Error, Error, Error,
827  Error, Error, Error, Error, Error, Error, Error, Error, Error},
828  //24 - AtBottomFrontBorder
829  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,
830  InFrontWest, InFront, InFrontEast,
831  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
832 
833  NorthWest, North, NorthEast,
834  West, East,
835  /*SouthWest, South, SouthEast,*/
836 
837  BehindNorthWest, BehindNorth, BehindNorthEast,
838  BehindWest, Behind, BehindEast,
839  /*BehindSouthWest, BehindSouth, BehindSouthEast*/
840  Error, Error, Error, Error, Error, Error, Error, Error, Error,
841  Error, Error, Error, Error, Error, Error},
842  //25 - AtBottomRightFrontBorder
843  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,
844  InFrontWest, InFront, InFrontEast,
845  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
846 
847  NorthWest, North, /*NorthEast,*/
848  West, /* East,*/
849  /*SouthWest, South, SouthEast,*/
850 
851  BehindNorthWest, BehindNorth, /*BehindNorthEast,*/
852  BehindWest, Behind, /*BehindEast,*/
853  /*BehindSouthWest, BehindSouth, BehindSouthEast*/
854  Error, Error, Error, Error, Error, Error, Error, Error, Error,
855  Error, Error, Error, Error, Error, Error,
856  Error, Error, Error, Error},
857  //26 - AtBottomLeftFrontBorder
858  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,
859  InFrontWest, InFront, InFrontEast,
860  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
861 
862  /*NorthWest,*/ North, NorthEast,
863  /*West,*/ East,
864  /*SouthWest, South, SouthEast,*/
865 
866  /*BehindNorthWest,*/ BehindNorth, BehindNorthEast,
867  /*BehindWest,*/ Behind, BehindEast,
868  /*BehindSouthWest, BehindSouth, BehindSouthEast*/
869  Error, Error, Error, Error, Error, Error, Error, Error, Error,
870  Error, Error, Error, Error, Error, Error,
871  Error, Error, Error, Error},
872  //27 - Nothin'
873  { Error, Error, Error, Error, Error, Error, Error, Error, Error,
874  Error, Error, Error, Error, Error, Error, Error, Error,
875  Error, Error, Error, Error, Error, Error, Error, Error, Error},
876  //28 - Nothin'
877  { Error, Error, Error, Error, Error, Error, Error, Error, Error,
878  Error, Error, Error, Error, Error, Error, Error, Error,
879  Error, Error, Error, Error, Error, Error, Error, Error, Error},
880  //29 - Nothin'
881  { Error, Error, Error, Error, Error, Error, Error, Error, Error,
882  Error, Error, Error, Error, Error, Error, Error, Error,
883  Error, Error, Error, Error, Error, Error, Error, Error, Error},
884  //30 - Nothin'
885  { Error, Error, Error, Error, Error, Error, Error, Error, Error,
886  Error, Error, Error, Error, Error, Error, Error, Error,
887  Error, Error, Error, Error, Error, Error, Error, Error, Error},
888  //31 - Nothin'
889  { Error, Error, Error, Error, Error, Error, Error, Error, Error,
890  Error, Error, Error, Error, Error, Error, Error, Error,
891  Error, Error, Error, Error, Error, Error, Error, Error, Error},
892  //32 - AtRearBorder
893  { InFrontNorthWest, InFrontNorth, InFrontNorthEast,
894  InFrontWest, InFront, InFrontEast,
895  InFrontSouthWest, InFrontSouth, InFrontSouthEast,
896 
897  NorthWest, North, NorthEast,
898  West, East,
899  SouthWest, South, SouthEast,
900 
901  /*BehindNorthWest, BehindNorth, BehindNorthEast,
902  BehindWest, Behind, BehindEast,
903  BehindSouthWest, BehindSouth, BehindSouthEast,*/
904  Error, Error, Error, Error, Error, Error, Error, Error, Error},
905  //33 - AtRearRightBorder
906  { InFrontNorthWest, InFrontNorth, /*InFrontNorthEast,*/
907  InFrontWest, InFront, /*InFrontEast,*/
908  InFrontSouthWest, InFrontSouth, /*InFrontSouthEast,*/
909 
910  NorthWest, North, /*NorthEast,*/
911  West, /*East,*/
912  SouthWest, South, /*SouthEast,*/
913 
914  /*BehindNorthWest, BehindNorth, BehindNorthEast,
915  BehindWest, Behind, BehindEast,
916  BehindSouthWest, BehindSouth, BehindSouthEast,*/
917  Error, Error, Error, Error, Error, Error, Error, Error, Error,
918  Error, Error, Error, Error, Error, Error},
919  //34 - AtRearLeftBorder
920  { /*InFrontNorthWest,*/ InFrontNorth, InFrontNorthEast,
921  /*InFrontWest,*/ InFront, InFrontEast,
922  /*InFrontSouthWest,*/ InFrontSouth, InFrontSouthEast,
923 
924  /*NorthWest,*/ North, NorthEast,
925  /*West,*/ East,
926  /*SouthWest,*/ South, SouthEast,
927 
928  /*BehindNorthWest, BehindNorth, BehindNorthEast,
929  BehindWest, Behind, BehindEast,
930  BehindSouthWest, BehindSouth, BehindSouthEast,*/
931  Error, Error, Error, Error, Error, Error, Error, Error, Error,
932  Error, Error, Error, Error, Error, Error},
933  //35 - Nothin'
934  { Error, Error, Error, Error, Error, Error, Error, Error, Error,
935  Error, Error, Error, Error, Error, Error, Error, Error,
936  Error, Error, Error, Error, Error, Error, Error, Error, Error},
937  //36 - AtTopRearBorder
938  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/
939  InFrontWest, InFront, InFrontEast,
940  InFrontSouthWest, InFrontSouth, InFrontSouthEast,
941 
942  /*NorthWest, North, NorthEast,*/
943  West, East,
944  SouthWest, South, SouthEast,
945 
946  /*BehindNorthWest, BehindNorth, BehindNorthEast,
947  BehindWest, Behind, BehindEast,
948  BehindSouthWest, BehindSouth, BehindSouthEast,*/
949  Error, Error, Error, Error, Error, Error, Error, Error, Error,
950  Error, Error, Error, Error, Error, Error},
951  //37 - AtTopRightRearBorder
952  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/
953  InFrontWest, InFront, /*InFrontEast,*/
954  InFrontSouthWest, InFrontSouth, /*InFrontSouthEast,*/
955 
956  /*NorthWest, North, NorthEast,*/
957  West, /*East,*/
958  SouthWest, South, /*SouthEast,*/
959 
960  /*BehindNorthWest, BehindNorth, BehindNorthEast,
961  BehindWest, Behind, BehindEast,
962  BehindSouthWest, BehindSouth, BehindSouthEast,*/
963  Error, Error, Error, Error, Error, Error, Error, Error, Error,
964  Error, Error, Error, Error, Error, Error,
965  Error, Error, Error, Error},
966  //38 - AtTopLeftRearBorder
967  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/
968  /*InFrontWest,*/ InFront, InFrontEast,
969  /*InFrontSouthWest,*/ InFrontSouth, InFrontSouthEast,
970 
971  /*NorthWest, North, NorthEast,*/
972  /*West,*/ East,
973  /*SouthWest,*/ South, SouthEast,
974 
975  /*BehindNorthWest, BehindNorth, BehindNorthEast,
976  BehindWest, Behind, BehindEast,
977  BehindSouthWest, BehindSouth, BehindSouthEast,*/
978  Error, Error, Error, Error, Error, Error, Error, Error, Error,
979  Error, Error, Error, Error, Error, Error,
980  Error, Error, Error, Error},
981  //39 - Nothin'
982  { Error, Error, Error, Error, Error, Error, Error, Error, Error,
983  Error, Error, Error, Error, Error, Error, Error, Error,
984  Error, Error, Error, Error, Error, Error, Error, Error, Error},
985  //40 - AtBottomRearBorder
986  { InFrontNorthWest, InFrontNorth, InFrontNorthEast,
987  InFrontWest, InFront, InFrontEast,
988  /*InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
989 
990  NorthWest, North, NorthEast,
991  West, East,
992  /*SouthWest, South, SouthEast,*/
993 
994  /*BehindNorthWest, BehindNorth, BehindNorthEast,
995  BehindWest, Behind, BehindEast,
996  BehindSouthWest, BehindSouth, BehindSouthEast,*/
997  Error, Error, Error, Error, Error, Error, Error, Error, Error,
998  Error, Error, Error, Error, Error, Error},
999  //41 - AtBottomRightRearBorder
1000  { InFrontNorthWest, InFrontNorth, /*InFrontNorthEast,*/
1001  InFrontWest, InFront, /*InFrontEast,*/
1002  /*InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
1003 
1004  NorthWest, North, /*NorthEast,*/
1005  West, /*East,*/
1006  /*SouthWest, South, SouthEast,*/
1007 
1008  /*BehindNorthWest, BehindNorth, BehindNorthEast,
1009  BehindWest, Behind, BehindEast,
1010  BehindSouthWest, BehindSouth, BehindSouthEast,*/
1011  Error, Error, Error, Error, Error, Error, Error, Error, Error,
1012  Error, Error, Error, Error, Error, Error,
1013  Error, Error, Error, Error},
1014  //42 - AtBottomLeftRearBorder
1015  { /*InFrontNorthWest,*/ InFrontNorth, InFrontNorthEast,
1016  /*InFrontWest,*/ InFront, InFrontEast,
1017  /*InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
1018 
1019  /*NorthWest,*/ North, NorthEast,
1020  /*West,*/ East,
1021  /*SouthWest, South, SouthEast,*/
1022 
1023  /*BehindNorthWest, BehindNorth, BehindNorthEast,
1024  BehindWest, Behind, BehindEast,
1025  BehindSouthWest, BehindSouth, BehindSouthEast,*/
1026  Error, Error, Error, Error, Error, Error, Error, Error, Error,
1027  Error, Error, Error, Error, Error, Error,
1028  Error, Error, Error, Error}
1029  };
1030  return c[b][index];
1031  }
1032 
1033  /** The valid direction three codes in anti causal direction (means: look back in scanline
1034  direction)when the center is at the volume border.
1035  Should be used with isAtVolumeBorderCausal to determine the Directions, as this
1036  avoids using of the nonesense border ids (e.g. 0,1,8,9...) of this table.
1037  \a index must be in the range <tt>0...nearBorderDirectionCount(b)-1</tt>.
1038  */
1040  {
1041  static Direction c[43][13] = {
1042  //0 - NotAtBorder -----> should never be used
1043  { InFrontNorthWest, InFrontNorth, InFrontNorthEast,
1044  InFrontWest, InFront, InFrontEast,
1045  InFrontSouthWest, InFrontSouth, InFrontSouthEast,
1046 
1047  NorthWest, North, NorthEast,
1048  West},
1049  //1 - AtRightBorder
1050  { InFrontNorthWest, InFrontNorth, /* InFrontNorthEast, */
1051  InFrontWest, InFront, /* InFrontEast, */
1052  InFrontSouthWest, InFrontSouth, /* InFrontSouthEast, */
1053 
1054  NorthWest, North, /* NorthEast, */
1055  West,
1056  Error, Error, Error, Error},
1057  //2 - AtLeftBorder
1058  { /*InFrontNorthWest,*/ InFrontNorth,InFrontNorthEast,
1059  /*InFrontWest,*/ InFront, InFrontEast,
1060  /*InFrontSouthWest,*/InFrontSouth, InFrontSouthEast,
1061 
1062  /*NorthWest,*/ North, NorthEast,
1063  /*West*/
1064  Error, Error, Error, Error, Error},
1065  //3 - Nothin'
1066  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1067  //4 - AtTopBorder
1068  { /*InFrontNorthWest,InFrontNorth, InFrontNorthEast,*/
1069  InFrontWest, InFront, InFrontEast,
1070  InFrontSouthWest, InFrontSouth, InFrontSouthEast,
1071 
1072  /*NorthWest, North, NorthEast,*/
1073  West,
1074  Error, Error, Error, Error, Error, Error},
1075  //5 - AtTopRightBorder
1076  { /*InFrontNorthWest,InFrontNorth, InFrontNorthEast,*/
1077  InFrontWest, InFront, /*InFrontEast,*/
1078  InFrontSouthWest, InFrontSouth, /*InFrontSouthEast,*/
1079 
1080  /*NorthWest, North, NorthEast,*/
1081  West,
1082  Error, Error, Error, Error, Error, Error, Error, Error},
1083  //6 - AtTopLeftBorder
1084  { /*InFrontNorthWest,InFrontNorth, InFrontNorthEast,*/
1085  /*InFrontWest,*/ InFront, InFrontEast,
1086  /*InFrontSouthWest,*/InFrontSouth, InFrontSouthEast,
1087 
1088  /*NorthWest, North, NorthEast,*/
1089  /*West,*/
1090  Error, Error, Error, Error, Error, Error, Error, Error, Error},
1091  //7 - Nothin'
1092  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1093  //8 - AtBottomBorder
1094  { InFrontNorthWest, InFrontNorth, InFrontNorthEast,
1095  InFrontWest, InFront, InFrontEast,
1096  /* InFrontSouthWest, InFrontSouth, InFrontSouthEast, */
1097 
1098  NorthWest, North, NorthEast,
1099  West,
1100  Error, Error, Error},
1101  //9 - AtBottomRightBorder
1102  { InFrontNorthWest, InFrontNorth, /* InFrontNorthEast, */
1103  InFrontWest, InFront, /* InFrontEast, */
1104  /* InFrontSouthWest, InFrontSouth, InFrontSouthEast, */
1105 
1106  NorthWest, North, /* NorthEast, */
1107  West,
1108  Error, Error, Error,Error, Error, Error},
1109  //10 - AtBottomLeftBorder
1110  { /*InFrontNorthWest,*/InFrontNorth, InFrontNorthEast,
1111  /*InFrontWest,*/ InFront, InFrontEast,
1112  /*InFrontSouthWest, InFrontSouth, InFrontSouthEast, */
1113 
1114  /*NorthWest,*/ North, NorthEast,
1115  /*West*/
1116  Error, Error, Error, Error, Error, Error, Error},
1117  //11 - Nothin'
1118  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1119  //12 - Nothin'
1120  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1121  //13 - Nothin'
1122  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1123  //14 - Nothin'
1124  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1125  //15 - Nothin'
1126  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1127  //16 - AtFrontBorder
1128  { /*InFrontNorthWest,InFrontNorth, InFrontNorthEast,
1129  InFrontWest, InFront, InFrontEast,
1130  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
1131 
1132  NorthWest, North, NorthEast,
1133  West,
1134  Error, Error, Error, Error, Error, Error, Error, Error, Error},
1135  //17 - AtFrontRightBorder
1136  { /*InFrontNorthWest,InFrontNorth, InFrontNorthEast,
1137  InFrontWest, InFront, InFrontEast,
1138  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
1139 
1140  NorthWest, North, /*NorthEast,*/
1141  West,
1142  Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1143  //18 - AtFrontLeftBorder
1144  { /*InFrontNorthWest,InFrontNorth, InFrontNorthEast,
1145  InFrontWest, InFront, InFrontEast,
1146  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
1147 
1148  /*NorthWest,*/ North, NorthEast,
1149  /*West,*/
1150  Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1151  //19 - Nothin'
1152  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1153  //20 - AtTopFrontBorder
1154  { /*InFrontNorthWest,InFrontNorth, InFrontNorthEast,
1155  InFrontWest, InFront, InFrontEast,
1156  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
1157 
1158  /*NorthWest, North, NorthEast,*/
1159  West,
1160  Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1161  //21 - AtTopRightFrontBorder
1162  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,
1163  InFrontWest, InFront, InFrontEast,
1164  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
1165 
1166  /*NorthWest, North, NorthEast,*/
1167  West,
1168  Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1169  //22 - AtTopLeftFrontBorder
1170  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1171  //23 - Nothin
1172  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1173  //24 - AtBottomFrontBorder
1174  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,
1175  InFrontWest, InFront, InFrontEast,
1176  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
1177 
1178  NorthWest, North, NorthEast,
1179  West,
1180  Error, Error, Error, Error, Error, Error, Error, Error, Error},
1181  //25 - AtBottomRightFrontBorder
1182  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,
1183  InFrontWest, InFront, InFrontEast,
1184  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
1185 
1186  NorthWest, North, /*NorthEast,*/
1187  West,
1188  Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1189  //26 - AtBottomLeftFrontBorder
1190  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,
1191  InFrontWest, InFront, InFrontEast,
1192  InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/
1193 
1194  /*NorthWest,*/ North, NorthEast,
1195  West,
1196  Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1197  //27 - Nothin
1198  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1199  //28 - Nothin
1200  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1201  //29 - Nothin
1202  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1203  //30 - Nothin
1204  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1205  //31 - Nothin
1206  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1207  //32 - AtRearBorder
1208  { InFrontNorthWest, InFrontNorth, InFrontNorthEast,
1209  InFrontWest, InFront, InFrontEast,
1210  InFrontSouthWest, InFrontSouth, InFrontSouthEast,
1211 
1212  NorthWest, North, NorthEast,
1213  West},
1214  //33 - AtRearRightBorder
1215  { InFrontNorthWest, InFrontNorth, InFrontNorthEast,
1216  InFrontWest, InFront, InFrontEast,
1217  InFrontSouthWest, InFrontSouth, InFrontSouthEast,
1218 
1219  NorthWest, North, NorthEast,
1220  West},
1221  //34 - AtRearLeftBorder
1222  { /*InFrontNorthWest,*/InFrontNorth, InFrontNorthEast,
1223  /*InFrontWest,*/ InFront, InFrontEast,
1224  /*InFrontSouthWest,*/InFrontSouth, InFrontSouthEast,
1225 
1226  /*NorthWest,*/ North, NorthEast,
1227  /*West*/
1228  Error, Error, Error, Error, Error},
1229  //35 - Nothin
1230  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1231  //36 - AtTopRearBorder
1232  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/
1233  InFrontWest, InFront, InFrontEast,
1234  InFrontSouthWest, InFrontSouth, InFrontSouthEast,
1235 
1236  /*NorthWest, North, NorthEast,*/
1237  West,
1238  Error, Error, Error, Error, Error, Error},
1239  //37 - AtTopRightRearBorder
1240  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/
1241  InFrontWest, InFront, /*InFrontEast,*/
1242  InFrontSouthWest, InFrontSouth, /*InFrontSouthEast,*/
1243 
1244  /*NorthWest, North, NorthEast,*/
1245  West,
1246  Error, Error, Error, Error, Error, Error, Error, Error},
1247  //38 - AtTopLeftRearBorder
1248  { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/
1249  /*InFrontWest,*/ InFront, InFrontEast,
1250  /*InFrontSouthWest,*/InFrontSouth, InFrontSouthEast,
1251 
1252  /*NorthWest, North, NorthEast,*/
1253  /*West,*/
1254  Error, Error, Error, Error, Error, Error, Error, Error, Error},
1255  //39 - Nothin
1256  { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error},
1257  //40 - AtBottomRearBorder
1258  { InFrontNorthWest, InFrontNorth, InFrontNorthEast,
1259  InFrontWest, InFront, InFrontEast,
1260  InFrontSouthWest, InFrontSouth, InFrontSouthEast,
1261 
1262  NorthWest, North, NorthEast,
1263  West},
1264  //41 - AtBottomRightRearBorder
1265  { InFrontNorthWest, InFrontNorth, InFrontNorthEast,
1266  InFrontWest, InFront, InFrontEast,
1267  InFrontSouthWest, InFrontSouth, InFrontSouthEast,
1268 
1269  NorthWest, North, NorthEast,
1270  West},
1271  //42 - AtBottomLeftRearBorder
1272  { /*InFrontNorthWest,*/InFrontNorth, InFrontNorthEast,
1273  /*InFrontWest,*/ InFront, InFrontEast,
1274  /*InFrontSouthWest,InFrontSouth, InFrontSouthEast,*/
1275 
1276  /*NorthWest,*/ North, NorthEast,
1277  /*West*/
1278  Error, Error, Error, Error, Error, Error, Error}
1279  };
1280  return c[b][index];
1281  }
1282 
1283  /** transform direction code into corresponding Diff3D offset.
1284  (note: there is no bounds checking on the code you pass.)
1285  */
1286  static Diff3D const & diff(Direction code)
1287  {
1288  static Diff3D d[] = { Diff3D( -1, -1, -1), //InFrontNorthWest
1289  Diff3D( 0, -1, -1), //InFrontNorth
1290  Diff3D( 1, -1, -1), //InFrontNorthEast
1291  Diff3D( -1, 0, -1), //InFrontWest
1292  Diff3D( 0, 0, -1), //InFront
1293  Diff3D( 1, 0, -1), //InFrontEast
1294  Diff3D( -1, 1, -1), //InFrontSouthWest
1295  Diff3D( 0, 1, -1), //InFrontSouth
1296  Diff3D( 1, 1, -1), //InFrontSouthEast
1297 
1298  Diff3D( -1, -1, 0), //NorthWest
1299  Diff3D( 0, -1, 0), //North
1300  Diff3D( 1, -1, 0), //NorthEast
1301  Diff3D( -1, 0, 0), //West
1302  Diff3D( 1, 0, 0), //East
1303  Diff3D( -1, 1, 0), //SouthWest
1304  Diff3D( 0, 1, 0), //South
1305  Diff3D( 1, 1, 0), //SouthEast
1306 
1307  Diff3D( -1, -1, 1), //BehindNorthWest
1308  Diff3D( 0, -1, 1), //BehindNorth
1309  Diff3D( 1, -1, 1), //BehindNorthEast
1310  Diff3D( -1, 0, 1), //BehindWest
1311  Diff3D( 0, 0, 1), //Behind
1312  Diff3D( 1, 0, 1), //BehindEast
1313  Diff3D( -1, 1, 1), //BehindSouthWest
1314  Diff3D( 0, 1, 1), //BehindSouth
1315  Diff3D( 1, 1, 1), //BehindSouthEast
1316  };
1317  return d[code];
1318  }
1319 
1320  /** Equivalent to <tt>diff(static_cast<Direction>(code))</tt>.
1321  (note: there is no bounds checking on the code you pass.)
1322  */
1323  static Diff3D const & diff(int code) { return diff(static_cast<Direction>(code)); }
1324 
1325  /** Equivalent to <tt>diff(code)[dim]</tt> */
1326  static int diff(Direction code, int dim) { return diff(code)[dim]; }
1327 
1328  /** Get the relative offset from one neighbor to the other.
1329  For example, <tt>relativeDiff(East, West) == multi_differencetype(-2,0,0)</tt>.
1330  (note: there is no bounds checking on the code you pass.)
1331  */
1332  static Diff3D const relativeDiff(Direction fromCode, Direction toCode)
1333  {
1334  //Uncomment the following lines may cause the program to crash because of insufficient
1335  //static allocatable memory on the stack
1336  /*
1337  static Diff3D d[][] = {
1338  // 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
1339  { 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
1340  { 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
1341  { 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
1342  { 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
1343  { 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
1344  { 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
1345  { 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
1346  { 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
1347  { 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
1348  { 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
1349  { 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
1350  { 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
1351  { 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
1352  { 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
1353  { 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
1354  { 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
1355  { 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
1356  { 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
1357  { 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
1358  { 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
1359  { 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
1360  { 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
1361  { 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
1362  { 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
1363  { 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
1364  { 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
1365  };
1366  return d[fromCode][toCode];
1367  */
1368  return diff(toCode)-diff(fromCode);
1369  }
1370 
1371  /** Equivalent to relativeDiff(static_cast<Direction>(fromCode), static_cast<Direction>(toCode)).
1372  (note: there is no bounds checking on the code you pass.)
1373  */
1374  static Diff3D const relativeDiff(int fromCode, int toCode)
1375  {
1376  return relativeDiff(static_cast<Direction>(fromCode), static_cast<Direction>(toCode));
1377  }
1378 
1379  /** X-component of diff() */
1380  static int dX(Direction code) { return diff(code)[0]; }
1381  /** Y-component of diff() */
1382  static int dY(Direction code) { return diff(code)[1]; }
1383  /** Z-component of diff() */
1384  static int dZ(Direction code) { return diff(code)[2]; }
1385 
1386  /** X-component of diff() */
1387  static int dX(int code) { return diff(code)[0]; }
1388  /** Y-component of diff() */
1389  static int dY(int code) { return diff(code)[1]; }
1390  /** Z-component of diff() */
1391  static int dZ(int code) { return diff(code)[2]; }
1392 
1393  /** transform 6-neighborhood code into 26-neighborhood code.
1394  */
1396  {
1397  switch (d){
1399  return InFront;
1401  return North;
1403  return West;
1405  return East;
1407  return South;
1409  return Behind;
1410  default:
1411  vigra_fail("NeighborCode3D::code(): Internal error -- invalid direction code.");
1412  }
1413  return Error;
1414  }
1415 
1416  /** transform Diff3D offset into corresponding direction code.
1417  The code <tt>Direction::Error</tt> will be returned if <tt>diff</tt>
1418  is not in the 3DTwentySix-Neighborhood.
1419  */
1420  static Direction code(Diff3D const & diff)
1421  {
1422  switch(diff[0]){
1423  case -1:
1424  switch(diff[1]){
1425  case -1:
1426  switch(diff[2]){
1427  case -1: return InFrontNorthWest; // ( -1, -1, -1)
1428  case 0: return NorthWest; // ( -1, -1, 0)
1429  case 1: return BehindNorthWest; // ( -1, -1, 1)
1430  }
1431  case 0:
1432  switch(diff[2]){
1433  case -1: return InFrontWest; // ( -1, 0, -1)
1434  case 0: return West; // ( -1, 0, 0)
1435  case 1: return BehindWest; // ( -1, 0, 1)
1436  }
1437  case 1:
1438  switch(diff[2]){
1439  case -1: return InFrontSouthWest; // ( -1, 1, -1)
1440  case 0: return SouthWest; // ( -1, 1, 0)
1441  case 1: return BehindSouthWest; // ( -1, 1, 1)
1442  }
1443  }
1444  case 0:
1445  switch(diff[1]){
1446  case -1:
1447  switch(diff[2]){
1448  case -1: return InFrontNorth; // ( 0, 0, -1)
1449  case 0: return North; // ( 0, -1, 0)
1450  case 1: return BehindNorth; // ( 0, -1, 1)
1451  }
1452  case 0:
1453  switch(diff[2]){
1454  case -1: return InFront; // ( 0, 0, -1)
1455  case 1: return Behind; // ( 0, 0, 1)
1456  }
1457  case 1:
1458  switch(diff[2]){
1459  case -1: return InFrontSouth; // ( 0, 1, -1)
1460  case 0: return South; // ( 0, 1, 0)
1461  case 1: return BehindSouth; // ( 0, 1, 1)
1462  }
1463  }
1464  case 1:
1465  switch(diff[1]){
1466  case -1:
1467  switch(diff[2]){
1468  case -1: return InFrontNorthEast; // ( 1, -1, -1)
1469  case 0: return NorthEast; // ( 1, -1, 0)
1470  case 1: return BehindNorthEast; // ( 1, -1, 1)
1471  }
1472  case 0:
1473  switch(diff[2]){
1474  case -1: return InFrontEast; // ( 1, 0, -1)
1475  case 0: return East; // ( 1, 0, 0)
1476  case 1: return BehindEast; // ( 1, 0, 1)
1477  }
1478  case 1:
1479  switch(diff[2]){
1480  case -1: return InFrontSouthEast; // ( 1, 1, -1)
1481  case 0: return SouthEast; // ( 1, 1, 0)
1482  case 1: return BehindSouthEast; // ( 1, 1, 1)
1483  }
1484  }
1485  }
1486  return Error; // better safe than sorry
1487  }
1488 
1489  /** Check whether a code refers to a diagonal direction.
1490  Useful if you want to abstract the differences between 6- and 26-neighborhood.
1491  Always <tt>false</tt> for 6-neighborhood.
1492  */
1493  static bool isDiagonal(Direction dir) {
1494  Diff3D d = diff(dir);
1495  if (abs(d[0])+abs(d[1])+abs(d[2])==1)
1496  return false;
1497  else
1498  return true;
1499  }
1500 
1501  static Diff3D const & frontTopLeft() { return diff(InFrontNorthWest); } /**< Offset to the front-top-left neighbor */
1502  static Diff3D const & frontTop() { return diff(InFrontNorth); } /**< Offset to the front-top neighbor */
1503  static Diff3D const & frontTopRight() { return diff(InFrontNorthEast); } /**< Offset to the front-top-right neighbor */
1504  static Diff3D const & frontLeft() { return diff(InFrontWest); } /**< Offset to the front-left neighbor */
1505  static Diff3D const & front() { return diff(InFront); } /**< Offset to the front neighbor */
1506  static Diff3D const & frontRight() { return diff(InFrontEast); } /**< Offset to the front-right neighbor */
1507  static Diff3D const & frontBottomLeft() { return diff(InFrontSouthWest); } /**< Offset to the front-bottom-left neighbor */
1508  static Diff3D const & frontBottom() { return diff(InFrontSouth); } /**< Offset to the front-bottom neighbor */
1509  static Diff3D const & frontBottomRight() { return diff(InFrontSouthEast); } /**< Offset to the front-bottom-right neighbor */
1510 
1511  static Diff3D const & topLeft() { return diff(NorthWest); } /**< Offset to the top-left neighbor */
1512  static Diff3D const & top() { return diff(North); } /**< Offset to the top neighbor */
1513  static Diff3D const & topRight() { return diff(NorthEast); } /**< Offset to the top-right neighbor */
1514  static Diff3D const & left() { return diff(West); } /**< Offset to the left neighbor */
1515  static Diff3D const & right() { return diff(East); } /**< Offset to the right neighbor */
1516  static Diff3D const & bottomLeft() { return diff(SouthWest); } /**< Offset to the bottom-left neighbor */
1517  static Diff3D const & bottom() { return diff(South); } /**< Offset to the bottom neighbor */
1518  static Diff3D const & bottomRight() { return diff(SouthEast); } /**< Offset to the bottom-right neighbor */
1519 
1520  static Diff3D const & rearTopLeft() { return diff(BehindNorthWest); } /**< Offset to the rear-top-left neighbor */
1521  static Diff3D const & rearTop() { return diff(BehindNorth); } /**< Offset to the rear-top neighbor */
1522  static Diff3D const & rearTopRight() { return diff(BehindNorthEast); } /**< Offset to the rear-top-right neighbor */
1523  static Diff3D const & rearLeft() { return diff(BehindWest); } /**< Offset to the rear-left neighbor */
1524  static Diff3D const & rear() { return diff(Behind); } /**< Offset to the rear neighbor */
1525  static Diff3D const & rearRight() { return diff(BehindEast); } /**< Offset to the rear-right neighbor */
1526  static Diff3D const & rearBottomLeft() { return diff(BehindSouthWest); } /**< Offset to the rear-bottom-left neighbor */
1527  static Diff3D const & rearBottom() { return diff(BehindSouth); } /**< Offset to the rear-bottom neighbor */
1528  static Diff3D const & rearBottomRight() { return diff(BehindSouthEast); } /**< Offset to the rear-bottom-right neighbor */
1529 
1530  //----- other namings
1531 
1532  static Diff3D const & infrontNorthWest() { return diff(InFrontNorthWest); } /**< Offset to the infront-north-west neighbor */
1533  static Diff3D const & infrontNorth() { return diff(InFrontNorth); } /**< Offset to the infront-north neighbor */
1534  static Diff3D const & infrontNorthEast() { return diff(InFrontNorthEast); } /**< Offset to the infront-north-east neighbor */
1535  static Diff3D const & infrontWest() { return diff(InFrontWest); } /**< Offset to the infront-west neighbor */
1536  static Diff3D const & infront() { return diff(InFront); } /**< Offset to the infront neighbor */
1537  static Diff3D const & infrontEast() { return diff(InFrontEast); } /**< Offset to the infront-east neighbor */
1538  static Diff3D const & infrontSouthWest() { return diff(InFrontSouthWest); } /**< Offset to the infront-south-west neighbor */
1539  static Diff3D const & infrontSouth() { return diff(InFrontSouth); } /**< Offset to the infront-south neighbor */
1540  static Diff3D const & infrontSouthEast() { return diff(InFrontSouthEast); } /**< Offset to the infront-south-east neighbor */
1541 
1542  static Diff3D const & northWest() { return diff(NorthWest); } /**< Offset to the north-west neighbor */
1543  static Diff3D const & north() { return diff(North); } /**< Offset to the north neighbor */
1544  static Diff3D const & northEast() { return diff(NorthEast); } /**< Offset to the north-east neighbor */
1545  static Diff3D const & west() { return diff(West); } /**< Offset to the west neighbor */
1546  static Diff3D const & east() { return diff(East); } /**< Offset to the right neighbor */
1547  static Diff3D const & southWest() { return diff(SouthWest); } /**< Offset to the south-west neighbor */
1548  static Diff3D const & south() { return diff(South); } /**< Offset to the south neighbor */
1549  static Diff3D const & southEast() { return diff(SouthEast); } /**< Offset to the south-east neighbor */
1550 
1551  static Diff3D const & behindNorthWest() { return diff(BehindNorthWest); } /**< Offset to the behind-north-west neighbor */
1552  static Diff3D const & behindNorth() { return diff(BehindNorth); } /**< Offset to the behind-north neighbor */
1553  static Diff3D const & behindNorthEast() { return diff(BehindNorthEast); } /**< Offset to the behind-north-east neighbor */
1554  static Diff3D const & behindEast() { return diff(BehindWest); } /**< Offset to the behind-west neighbor */
1555  static Diff3D const & behind() { return diff(Behind); } /**< Offset to the behind neighbor */
1556  static Diff3D const & behindWest() { return diff(BehindEast); } /**< Offset to the behind-right neighbor */
1557  static Diff3D const & behindSouthWest() { return diff(BehindSouthWest); } /**< Offset to the behind-south-west neighbor */
1558  static Diff3D const & behindSouth() { return diff(BehindSouth); } /**< Offset to the behind-south neighbor */
1559  static Diff3D const & behindSouthEast() { return diff(BehindSouthEast); } /**< Offset to the behind-south-east neighbor */
1560 }; // class Neighborhood3D
1561 
1562 
1563 /** Export NeighborCode3D::Direction into the scope of namespace Neighborhood3DSix.
1564  */
1566 
1567 static const Direction InFrontNorthWest = NeighborCode3D::InFrontNorthWest; /**< Export NeighborCode3D::InFrontNorthWest to namespace Neighborhood3DTwentySix */
1568 static const Direction InFrontNorth = NeighborCode3D::InFrontNorth; /**< Export NeighborCode3D::InFrontNorth to namespace Neighborhood3DTwentySix */
1569 static const Direction InFrontNorthEast = NeighborCode3D::InFrontNorthEast; /**< Export NeighborCode3D::InFrontNorthEast to namespace Neighborhood3DTwentySix */
1570 static const Direction InFrontWest = NeighborCode3D::InFrontWest; /**< Export NeighborCode3D::InFrontWest to namespace Neighborhood3DTwentySix */
1571 static const Direction InFront = NeighborCode3D::InFront; /**< Export NeighborCode3D::InFront to namespace Neighborhood3DTwentySix */
1572 static const Direction InFrontEast = NeighborCode3D::InFrontEast; /**< Export NeighborCode3D::InFrontEast to namespace Neighborhood3DTwentySix */
1573 static const Direction InFrontSouthWest = NeighborCode3D::InFrontSouthWest; /**< Export NeighborCode3D::InFrontSouthWest to namespace Neighborhood3DTwentySix */
1574 static const Direction InFrontSouth = NeighborCode3D::InFrontSouth; /**< Export NeighborCode3D::InFrontSouth to namespace Neighborhood3DTwentySix */
1575 static const Direction InFrontSouthEast = NeighborCode3D::InFrontSouthEast; /**< Export NeighborCode3D::InFrontSouthEast to namespace Neighborhood3DTwentySix */
1576 
1577 static const Direction NorthWest = NeighborCode3D::NorthWest; /**< Export NeighborCode3D::NorthWest to namespace Neighborhood3DTwentySix */
1578 static const Direction North = NeighborCode3D::North; /**< Export NeighborCode3D::North to namespace Neighborhood3DTwentySix */
1579 static const Direction NorthEast = NeighborCode3D::NorthEast; /**< Export NeighborCode3D::NorthEast to namespace Neighborhood3DTwentySix */
1580 static const Direction West = NeighborCode3D::West; /**< Export NeighborCode3D::West to namespace Neighborhood3DTwentySix */
1581 static const Direction East = NeighborCode3D::East; /**< Export NeighborCode3D::East to namespace Neighborhood3DTwentySix */
1582 static const Direction SouthWest = NeighborCode3D::SouthWest; /**< Export NeighborCode3D::SouthWest to namespace Neighborhood3DTwentySix */
1583 static const Direction South = NeighborCode3D::South; /**< Export NeighborCode3D::South to namespace Neighborhood3DTwentySix */
1584 static const Direction SouthEast = NeighborCode3D::SouthEast; /**< Export NeighborCode3D::SouthEast to namespace Neighborhood3DTwentySix */
1585 
1586 static const Direction BehindNorthWest = NeighborCode3D::BehindNorthWest; /**< Export NeighborCode3D::BehindNorthWest to namespace Neighborhood3DTwentySix */
1587 static const Direction BehindNorth = NeighborCode3D::BehindNorth; /**< Export NeighborCode3D::BehindNorth to namespace Neighborhood3DTwentySix */
1588 static const Direction BehindNorthEast = NeighborCode3D::BehindNorthEast; /**< Export NeighborCode3D::BehindNorthEast to namespace Neighborhood3DTwentySix */
1589 static const Direction BehindWest = NeighborCode3D::BehindWest; /**< Export NeighborCode3D::BehindWest to namespace Neighborhood3DTwentySix */
1590 static const Direction Behind = NeighborCode3D::Behind; /**< Export NeighborCode3D::Behind to namespace Neighborhood3DTwentySix */
1591 static const Direction BehindEast = NeighborCode3D::BehindEast; /**< Export NeighborCode3D::BehindEast to namespace Neighborhood3DTwentySix */
1592 static const Direction BehindSouthWest = NeighborCode3D::BehindSouthWest; /**< Export NeighborCode3D::BehindSouthWest to namespace Neighborhood3DTwentySix */
1593 static const Direction BehindSouth = NeighborCode3D::BehindSouth; /**< Export NeighborCode3D::BehindSouth to namespace Neighborhood3DTwentySix */
1594 static const Direction BehindSouthEast = NeighborCode3D::BehindSouthEast; /**< Export NeighborCode3D::BehindSouthEast to namespace Neighborhood3DTwentySix */
1595 
1596 static const Direction DirectionCount = NeighborCode3D::DirectionCount; /**< Export NeighborCode3D::DirectionCount to namespace Neighborhood3DTwentySix */
1597 
1598 }//namespace Neighborhood3DTwentySix
1599 
1600 /** Export \ref vigra::Neighborhood3DTwentySix::NeighborCode3D into the scope of namespace vigra.
1601  */
1603 
1604 //@}
1605 
1606 } // namespace vigra
1607 
1608 #endif /* VIGRA_VOXELNEIGHBORHOOD_HXX */

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de)
Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany

html generated using doxygen and Python
vigra 1.7.1 (Thu Jun 14 2012)