[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
00001 /************************************************************************/ 00002 /* */ 00003 /* Copyright 2006-2007 by F. Heinrich, B. Seppke, Ullrich Koethe */ 00004 /* */ 00005 /* This file is part of the VIGRA computer vision library. */ 00006 /* The VIGRA Website is */ 00007 /* http://hci.iwr.uni-heidelberg.de/vigra/ */ 00008 /* Please direct questions, bug reports, and contributions to */ 00009 /* ullrich.koethe@iwr.uni-heidelberg.de or */ 00010 /* vigra@informatik.uni-hamburg.de */ 00011 /* */ 00012 /* Permission is hereby granted, free of charge, to any person */ 00013 /* obtaining a copy of this software and associated documentation */ 00014 /* files (the "Software"), to deal in the Software without */ 00015 /* restriction, including without limitation the rights to use, */ 00016 /* copy, modify, merge, publish, distribute, sublicense, and/or */ 00017 /* sell copies of the Software, and to permit persons to whom the */ 00018 /* Software is furnished to do so, subject to the following */ 00019 /* conditions: */ 00020 /* */ 00021 /* The above copyright notice and this permission notice shall be */ 00022 /* included in all copies or substantial portions of the */ 00023 /* Software. */ 00024 /* */ 00025 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND */ 00026 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */ 00027 /* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */ 00028 /* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */ 00029 /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ 00030 /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ 00031 /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ 00032 /* OTHER DEALINGS IN THE SOFTWARE. */ 00033 /* */ 00034 /************************************************************************/ 00035 00036 #ifndef VIGRA_VOXELNEIGHBORHOOD_HXX 00037 #define VIGRA_VOXELNEIGHBORHOOD_HXX 00038 00039 #include "tinyvector.hxx" 00040 #include "pixelneighborhood.hxx" 00041 00042 namespace vigra { 00043 00044 /** \addtogroup VoxelNeighborhood Utilities to manage voxel neighborhoods 00045 00046 6- and 26-neighborhood definitions and circulators. 00047 00048 <b>\#include</b> <<a href="voxelneighborhood_8hxx-source.html">vigra/voxelneighborhood.hxx</a>><br> 00049 00050 <b>See also:</b> \ref vigra::NeighborhoodCirculator 00051 */ 00052 //@{ 00053 00054 /// 3-dimensional difference vector 00055 typedef vigra::TinyVector<int, 3> Diff3D; 00056 00057 /********************************************************/ 00058 /* */ 00059 /* AtVolumeBorder */ 00060 /* */ 00061 /********************************************************/ 00062 00063 /** \brief Encode whether a voxel is near the volume border. 00064 00065 // This enum is used with \ref isAtVolumeBorder() and 00066 // \ref vigra::RestrictedNeighborhoodCirculator. 00067 00068 //<b>\#include</b> <<a href="voxelneighborhood_8hxx-source.html">vigra/voxelneighborhood.hxx</a>><br> 00069 //Namespace: vigra 00070 */ 00071 00072 typedef AtImageBorder AtVolumeBorder; 00073 00074 00075 /** \brief Find out whether a voxel is at the volume border. 00076 00077 This function checks if \a x == 0 or \a x == \a width - 1 and 00078 \a y == 0 or \a y == \a height - 1 and so on and returns the appropriate value 00079 of \ref vigra::AtVolumeBorder, or zero when the voxel is not at te volume border. 00080 The behavior of the function is undefined if (x,y,z) is not inside the volume. 00081 */ 00082 inline AtVolumeBorder isAtVolumeBorder(int x, int y, int z, int width, int height, int depth) 00083 { 00084 return static_cast<AtVolumeBorder>((x == 0 00085 ? LeftBorder 00086 : x == width-1 00087 ? RightBorder 00088 : NotAtBorder) | 00089 (y == 0 00090 ? TopBorder 00091 : y == height-1 00092 ? BottomBorder 00093 : NotAtBorder) | 00094 (z == 0 00095 ? FrontBorder 00096 : z == depth-1 00097 ? RearBorder 00098 : NotAtBorder)); 00099 } 00100 00101 inline AtVolumeBorder isAtVolumeBorder(Diff3D const & p, Diff3D const & shape) 00102 { 00103 return isAtVolumeBorder(p[0], p[1], p[2], shape[0], shape[1], shape[2]); 00104 } 00105 00106 /** \brief Find out whether a voxel is at a scan-order relevant volume border. 00107 This function checks if \a x == 0 or \a y == 0 or \a z == \a 0 and returns the 00108 appropriate value of \ref vigra::AtVolumeBorder, or zero when the voxel is 00109 not at te volume border. 00110 The behavior of the function is undefined if (x,y,z) is not inside the volume. 00111 */ 00112 inline AtVolumeBorder isAtVolumeBorderCausal(int x, int y, int z, int /* width */, int /* height */, int /* depth */) 00113 { 00114 return static_cast<AtVolumeBorder>((x == 0 00115 ? LeftBorder 00116 : NotAtBorder) | 00117 (y == 0 00118 ? TopBorder 00119 : NotAtBorder) | 00120 (z == 0 00121 ? FrontBorder 00122 : NotAtBorder)); 00123 } 00124 /** TODO: Write new comment \brief Find out whether a voxel is at a scan-order relevant volume border. 00125 This function checks if \a x == 0 or \a y == 0 or \a z == \a 0 and returns the 00126 appropriate value of \ref vigra::AtVolumeBorder, or zero when the voxel is 00127 not at te volume border. 00128 The behavior of the function is undefined if (x,y,z) is not inside the volume. 00129 */ 00130 inline AtVolumeBorder isAtVolumeBorderAntiCausal(int x, int y, int z, int width, int height, int depth) 00131 { 00132 return static_cast<AtVolumeBorder>((x == width-1 00133 ? RightBorder 00134 : NotAtBorder) | 00135 (y == height-1 00136 ? BottomBorder 00137 : NotAtBorder) | 00138 (z == depth-1 00139 ? RearBorder 00140 : NotAtBorder)); 00141 } 00142 00143 /********************************************************/ 00144 /* */ 00145 /* Neighborhood3DSix */ 00146 /* */ 00147 /********************************************************/ 00148 00149 /** 3D 6-Neighborhood. */ 00150 namespace Neighborhood3DSix 00151 { 00152 00153 /** \brief Encapsulation of direction management of neighbors for a 3D 6-neighborhood. 00154 */ 00155 class NeighborCode3D 00156 { 00157 public: 00158 00159 typedef Diff3D difference_type; 00160 00161 /** provides enumeration of all directions. 00162 DirectionCount may be used for portable loop termination conditions. 00163 */ 00164 enum Direction { 00165 Error = -1, 00166 InFront= 0, 00167 North, 00168 West , 00169 Behind, 00170 South, 00171 East, 00172 DirectionCount, 00173 CausalFirst = InFront, 00174 CausalLast = West, 00175 AntiCausalFirst = Behind, 00176 AntiCausalLast = East, 00177 00178 InitialDirection = InFront, 00179 OppositeDirPrefix = 1, 00180 OppositeOffset = 3 00181 }; 00182 00183 static unsigned int directionBit(Direction d) 00184 { 00185 static unsigned int b[] = { 1 << InFront, 00186 1 << North, 00187 1 << West, 00188 1 << Behind, 00189 1 << South, 00190 1 << East 00191 }; 00192 return b[d]; 00193 }; 00194 00195 00196 /** The number of valid neighbors if the current center is at the volume border. 00197 */ 00198 static unsigned int nearBorderDirectionCount(AtVolumeBorder b) 00199 { 00200 static unsigned int c[] = { 6, 5, 5, 0, 5, 4, 4, 0, 5, 4, 00201 4, 0, 0, 0, 0, 0, 5, 4, 4, 0, 00202 4, 3, 3, 0, 4, 3, 3, 0, 0, 0, 00203 0, 0, 5, 4, 4, 0, 4, 3, 3, 0, 00204 4, 3, 3}; 00205 return c[b]; 00206 } 00207 00208 /** The valid direction codes when the center is at the volume border. 00209 \a index must be in the range <tt>0...nearBorderDirectionCount(b)-1</tt>. 00210 */ 00211 static Direction nearBorderDirections(AtVolumeBorder b, int index) 00212 { 00213 static Direction c[43][6] = { 00214 { InFront, North, West, Behind, South, East}, // 0 - NotAtBorder 00215 { InFront, North, West, Behind, South, Error}, // 1 - AtRightBorder 00216 { InFront, North, Behind, South, East, Error}, // 2 - AtLeftBorder 00217 { Error, Error, Error, Error, Error, Error}, 00218 { InFront, West, Behind, South, East, Error}, // 4 - AtTopBorder 00219 { InFront, West, Behind, South, Error, Error}, // 5 - AtTopRightBorder 00220 { InFront, Behind, South, East, Error, Error}, // 6 - AtTopLeftBorder 00221 { Error, Error, Error, Error, Error, Error}, 00222 { InFront, North, West, Behind, East, Error}, // 8 - AtBottomBorder 00223 { InFront, North, West, Behind, Error, Error}, // 9 - AtBottomRightBorder 00224 { InFront, North, Behind, East, Error, Error}, //10- AtBottomLeftBorder 00225 { Error, Error, Error, Error, Error, Error}, 00226 { Error, Error, Error, Error, Error, Error}, 00227 { Error, Error, Error, Error, Error, Error}, 00228 { Error, Error, Error, Error, Error, Error}, 00229 { Error, Error, Error, Error, Error, Error}, 00230 { North, West, Behind, South, East, Error}, //16 - AtFrontBorder 00231 { North, West, Behind, South, Error, Error}, //17 - AtFrontRightBorder 00232 { North, Behind, South, East, Error, Error}, //18 - AtFrontLeftBorder 00233 { Error, Error, Error, Error, Error, Error}, 00234 { West, Behind, South, East, Error, Error}, //20 - AtTopFrontBorder 00235 { West, Behind, South, Error, Error, Error}, //21 - AtTopRightFrontBorder 00236 { Behind, South, East, Error, Error, Error}, //22 - AtTopLeftFrontBorder 00237 { Error, Error, Error, Error, Error, Error}, 00238 { North, West, Behind, East, Error, Error}, //24 - AtBottomFrontBorder 00239 { North, West, Behind, Error, Error, Error}, //25 - AtBottomRightFrontBorder 00240 { North, Behind, East, Error, Error, Error}, //26 - AtBottomLeftFrontBorder 00241 { Error, Error, Error, Error, Error, Error}, 00242 { Error, Error, Error, Error, Error, Error}, 00243 { Error, Error, Error, Error, Error, Error}, 00244 { Error, Error, Error, Error, Error, Error}, 00245 { Error, Error, Error, Error, Error, Error}, 00246 { InFront, North, West, South, East,Error}, //32 - AtRearBorder 00247 { InFront, North, West, South, Error, Error}, //33 - AtRearRightBorder 00248 { InFront, North, South, East, Error, Error}, //34 - AtRearLeftBorder 00249 { Error, Error, Error, Error, Error, Error}, 00250 { InFront, West, South, East, Error, Error}, //36 - AtTopRearBorder 00251 { InFront, West, South, Error, Error, Error}, //37 - AtTopRightRearBorder 00252 { InFront, South, East, Error, Error, Error}, //38 - AtTopLeftRearBorder 00253 { Error, Error, Error, Error, Error, Error}, 00254 { InFront, North, West, East, Error, Error}, //40 - AtBottomRearBorder 00255 { InFront, North, West, Error, Error, Error}, //41 - AtBottomRightRearBorder 00256 { InFront, North, East, Error, Error, Error} //42 - AtBottomLeftRearBorder 00257 }; 00258 return c[b][index]; 00259 } 00260 00261 /** The valid direction three codes in anti causal direction (means: look back in scanline 00262 direction)when the center is at the volume border. 00263 Should be used with isAtVolumeBorderCausal to determine the Directions, as this 00264 avoids using of the nonesense border ids (e.g. 0,1,8,9...) of this table. 00265 \a index must be in the range <tt>0...nearBorderDirectionCount(b)-1</tt>. 00266 */ 00267 static Direction nearBorderDirectionsCausal(AtVolumeBorder b, int index) 00268 { 00269 static Direction c[43][3] = { 00270 { InFront, North, West}, // 0 - NotAtBorder -----> should never be used 00271 { InFront, North, West}, // 1 - AtRightBorder -----> should never be used 00272 { InFront, North, Error}, // 2 - AtLeftBorder 00273 { Error, Error, Error}, 00274 { InFront, West, Error}, // 4 - AtTopBorder 00275 { InFront, West, Error}, // 5 - AtTopRightBorder 00276 { InFront, Error,Error}, // 6 - AtTopLeftBorder 00277 { Error, Error, Error}, 00278 { InFront, North, West}, // 8 - AtBottomBorder -----> should never be used 00279 { InFront, North, West}, // 9 - AtBottomRightBorder -----> should never be used 00280 { InFront, North, Error}, //10- AtBottomLeftBorder 00281 { Error, Error, Error}, 00282 { Error, Error, Error}, 00283 { Error, Error, Error}, 00284 { Error, Error, Error}, 00285 { Error, Error, Error}, 00286 { North, West, Error}, //16 - AtFrontBorder 00287 { North, West, Error}, //17 - AtFrontRightBorder 00288 { North, Error, Error}, //18 - AtFrontLeftBorder 00289 { Error, Error, Error}, 00290 { West, Error, Error}, //20 - AtTopFrontBorder 00291 { West, Error, Error}, //21 - AtTopRightFrontBorder 00292 { Error, Error, Error}, //22 - AtTopLeftFrontBorder 00293 { Error, Error, Error}, 00294 { North, West, Error}, //24 - AtBottomFrontBorder 00295 { North, West, Error}, //25 - AtBottomRightFrontBorder 00296 { North, Error, Error}, //26 - AtBottomLeftFrontBorder 00297 { Error, Error, Error}, 00298 { Error, Error, Error}, 00299 { Error, Error, Error}, 00300 { Error, Error, Error}, 00301 { Error, Error, Error}, 00302 { InFront, North, West}, //32 - AtRearBorder -----> should never be used 00303 { InFront, North, West}, //33 - AtRearRightBorder -----> should never be used 00304 { InFront, North, Error}, //34 - AtRearLeftBorder 00305 { Error, Error, Error}, 00306 { InFront, West, Error}, //36 - AtTopRearBorder 00307 { InFront, West, Error}, //37 - AtTopRightRearBorder 00308 { InFront, Error, Error}, //38 - AtTopLeftRearBorder 00309 { Error, Error, Error}, 00310 { InFront, North, West}, //40 - AtBottomRearBorder -----> should never be used 00311 { InFront, North, West}, //41 - AtBottomRightRearBorder -----> should never be used 00312 { InFront, North, Error} //42 - AtBottomLeftRearBorder 00313 }; 00314 return c[b][index]; 00315 } 00316 00317 /** transform direction code into corresponding Diff3D offset. 00318 (note: there is no bounds checking on the code you pass.) 00319 */ 00320 static Diff3D const & diff(Direction code) 00321 { 00322 static Diff3D d[] = { 00323 Diff3D( 0, 0, -1), //InFront 00324 Diff3D( 0, -1, 0), //North 00325 Diff3D( -1, 0, 0), //West 00326 Diff3D( 0, 0, 1), //Behind 00327 Diff3D( 0, 1, 0), //South 00328 Diff3D( 1, 0, 0) //East 00329 }; 00330 return d[code]; 00331 } 00332 00333 /** Equivalent to <tt>diff(static_cast<Direction>(code))</tt>. 00334 (note: there is no bounds checking on the code you pass.) 00335 */ 00336 static Diff3D const & diff(int code) { return diff(static_cast<Direction>(code)); } 00337 00338 /** Equivalent to <tt>diff(code)[dim]</tt> */ 00339 static int diff(Direction code, int dim) { return diff(code)[dim]; } 00340 00341 /** Get the relative offset from one neighbor to the other. 00342 For example, <tt>relativeDiff(East, West) == multi_differencetype(-2,0,0)</tt>. 00343 (note: there is no bounds checking on the code you pass.) 00344 */ 00345 static Diff3D const & relativeDiff(Direction fromCode, Direction toCode) 00346 { 00347 static Diff3D d[6][6] = 00348 { 00349 // InFront - North - West - Behind - South - East 00350 { 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 00351 { 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 00352 { 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 00353 { 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 00354 { 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 00355 { 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 00356 }; 00357 00358 return d[fromCode][toCode]; 00359 } 00360 00361 /** Equivalent to relativeDiff(static_cast<Direction>(fromCode), static_cast<Direction>(toCode)). 00362 (note: there is no bounds checking on the code you pass.) 00363 */ 00364 static Diff3D const & relativeDiff(int fromCode, int toCode) 00365 { 00366 return relativeDiff(static_cast<Direction>(fromCode), static_cast<Direction>(toCode)); 00367 } 00368 00369 /** X-component of diff() */ 00370 static int dX(Direction code) { return diff(code)[0]; } 00371 /** Y-component of diff() */ 00372 static int dY(Direction code) { return diff(code)[1]; } 00373 /** Z-component of diff() */ 00374 static int dZ(Direction code) { return diff(code)[2]; } 00375 00376 /** X-component of diff() */ 00377 static int dX(int code) { return diff(code)[0]; } 00378 /** Y-component of diff() */ 00379 static int dY(int code) { return diff(code)[1]; } 00380 /** Z-component of diff() */ 00381 static int dZ(int code) { return diff(code)[2]; } 00382 00383 00384 /** transform Diff3D offset into corresponding direction code. 00385 The code <tt>Direction::Error</tt> will be returned if <tt>diff</tt> 00386 is not in the 3DSix-Neighborhood. 00387 */ 00388 static Direction code(Diff3D const & diff) 00389 { 00390 switch(diff[0]) { 00391 case 0: 00392 { 00393 switch(diff[1]) { 00394 case 0: 00395 switch(diff[2]) { 00396 case 1: 00397 return Behind; 00398 case -1: 00399 return InFront; 00400 default: 00401 return Error; 00402 } 00403 00404 case 1: 00405 return (diff[2] == 0) ? South : Error; 00406 case -1: 00407 return (diff[2] == 0) ? North : Error; 00408 default: 00409 return Error; 00410 } 00411 } 00412 case -1: 00413 return ((diff[1] == 0) && (diff[2] == 0)) ? West : Error; 00414 case 1: 00415 return ((diff[1] == 0) && (diff[2] == 0)) ? East : Error; 00416 } 00417 return Error; 00418 } 00419 00420 /** Check whether a code refers to a diagonal direction. 00421 Useful if you want to abstract the differences between 6- and 26-neighborhood. 00422 Always <tt>false</tt> for 6-neighborhood. 00423 */ 00424 static bool isDiagonal(Direction) { return false; } 00425 00426 static Diff3D const & right() { return diff(East); } /**< Offset to the right neighbor */ 00427 static Diff3D const & top() { return diff(North); } /**< Offset to the top neighbor */ 00428 static Diff3D const & left() { return diff(West); } /**< Offset to the left neighbor */ 00429 static Diff3D const & bottom() { return diff(South); } /**< Offset to the bottom neighbor */ 00430 static Diff3D const & rear() { return diff(Behind); } /**< Offset to the rear neighbor */ 00431 static Diff3D const & front() { return diff(InFront); } /**< Offset to the neighbor in front */ 00432 00433 static Diff3D const & east() { return diff(East); } /**< Offset to the east neighbor */ 00434 static Diff3D const & north() { return diff(North); } /**< Offset to the north neighbor */ 00435 static Diff3D const & west() { return diff(West); } /**< Offset to the west neighbor */ 00436 static Diff3D const & south() { return diff(South); } /**< Offset to the south neighbor */ 00437 static Diff3D const & behind() { return diff(Behind); } /**< Offset to the rear neighbor */ 00438 static Diff3D const & infront() { return diff(InFront); } /**< Offset to the neighbor in front */ 00439 00440 }; // class Neighborhood3DSix 00441 00442 00443 /** Export NeighborCode3D::Direction into the scope of namespace Neighborhood3DSix. 00444 */ 00445 typedef NeighborCode3D::Direction Direction; 00446 00447 static const Direction East = NeighborCode3D::East; /**< Export NeighborCode3D::East to namespace Neighborhood3DSix */ 00448 static const Direction North = NeighborCode3D::North; /**< Export NeighborCode3D::North to namespace Neighborhood3DSix */ 00449 static const Direction West = NeighborCode3D::West; /**< Export NeighborCode3D::West to namespace Neighborhood3DSix */ 00450 static const Direction South = NeighborCode3D::South; /**< Export NeighborCode3D::South to namespace Neighborhood3DSix */ 00451 static const Direction Behind = NeighborCode3D::Behind; /**< Export NeighborCode3D::Behind to namespace Neighborhood3DSix */ 00452 static const Direction InFront = NeighborCode3D::InFront; /**< Export NeighborCode3D::InFront to namespace Neighborhood3DSix */ 00453 static const Direction DirectionCount = NeighborCode3D::DirectionCount; /**< Export NeighborCode3D::DirectionCount to namespace Neighborhood3DSix */ 00454 00455 00456 }//namespace Neighborhood3DSix 00457 00458 /** Export \ref vigra::Neighborhood3DSix::NeighborCode3D into the scope of namespace vigra. 00459 */ 00460 typedef Neighborhood3DSix::NeighborCode3D NeighborCode3DSix; 00461 00462 /********************************************************/ 00463 /* */ 00464 /* Neighborhood3DTwentySix */ 00465 /* */ 00466 /********************************************************/ 00467 /** 3D 26-Neighborhood. */ 00468 namespace Neighborhood3DTwentySix 00469 { 00470 00471 /** \brief Encapsulation of direction management of neighbors for a 3D 26-neighborhood. 00472 */ 00473 class NeighborCode3D 00474 { 00475 public: 00476 00477 typedef Diff3D difference_type; 00478 00479 /** provides enumeration of all directions. 00480 DirectionCount may be used for portable loop termination conditions. 00481 */ 00482 enum Direction { 00483 Error = -1, 00484 InFrontNorthWest = 0, 00485 InFrontNorth, 00486 InFrontNorthEast, 00487 InFrontWest, 00488 InFront, 00489 InFrontEast, 00490 InFrontSouthWest, 00491 InFrontSouth, 00492 InFrontSouthEast, 00493 00494 NorthWest, 00495 North, 00496 NorthEast, 00497 West, 00498 East, 00499 SouthWest, 00500 South, 00501 SouthEast, 00502 00503 BehindNorthWest, 00504 BehindNorth, 00505 BehindNorthEast, 00506 BehindWest, 00507 Behind, 00508 BehindEast, 00509 BehindSouthWest, 00510 BehindSouth, 00511 BehindSouthEast, 00512 00513 DirectionCount, 00514 CausalFirst = InFrontNorthWest, 00515 CausalLast = West, 00516 AntiCausalFirst = BehindSouthEast, 00517 AntiCausalLast = East, 00518 00519 InitialDirection = InFrontNorthWest, 00520 OppositeDirPrefix = -1, 00521 OppositeOffset = 25 00522 }; 00523 00524 static unsigned int directionBit(Direction d) 00525 { 00526 static unsigned int b[] = { 00527 1 << InFrontNorthWest, 00528 1 << InFrontNorth, 00529 1 << InFrontNorthEast, 00530 1 << InFrontWest, 00531 1 << InFront, 00532 1 << InFrontEast, 00533 1 << InFrontSouthWest, 00534 1 << InFrontSouth, 00535 1 << InFrontSouthEast, 00536 00537 1 << NorthWest, 00538 1 << North, 00539 1 << NorthEast, 00540 1 << West, 00541 1 << East, 00542 1 << SouthWest, 00543 1 << South, 00544 1 << SouthEast, 00545 00546 1 << BehindNorthWest, 00547 1 << BehindNorth, 00548 1 << BehindNorthEast, 00549 1 << BehindWest, 00550 1 << Behind, 00551 1 << BehindEast, 00552 1 << BehindSouthWest, 00553 1 << BehindSouth, 00554 1 << BehindSouthEast 00555 }; 00556 return b[d]; 00557 }; 00558 00559 00560 00561 /** The number of valid neighbors if the current center is at the volume border. 00562 */ 00563 static unsigned int nearBorderDirectionCount(AtVolumeBorder b) 00564 { 00565 static unsigned int c[] = { 26, 17, 17, 0, 17, 11, 11, 0, 17, 11, 00566 11, 0, 0, 0, 0, 0, 17, 11, 11, 0, 00567 11, 7, 7, 0, 11, 7, 7, 0, 0, 0, 00568 0, 0, 17, 11, 11, 0, 11, 7, 7, 0, 00569 11, 7, 7}; 00570 return c[b]; 00571 } 00572 00573 /** The valid direction codes when the center is at the volume border. 00574 \a index must be in the range <tt>0...nearBorderDirectionCount(b)-1</tt>. 00575 */ 00576 static Direction nearBorderDirections(AtVolumeBorder b, int index) 00577 { 00578 static Direction c[43][26] = { 00579 //0 - NotAtBorder 00580 { InFrontNorthWest, InFrontNorth, InFrontNorthEast, 00581 InFrontWest, InFront, InFrontEast, 00582 InFrontSouthWest, InFrontSouth, InFrontSouthEast, 00583 00584 NorthWest, North, NorthEast, 00585 West, East, 00586 SouthWest, South, SouthEast, 00587 00588 BehindNorthWest, BehindNorth, BehindNorthEast, 00589 BehindWest, Behind, BehindEast, 00590 BehindSouthWest, BehindSouth, BehindSouthEast}, 00591 //1 - AtRightBorder 00592 { InFrontNorthWest, InFrontNorth, /*InFrontNorthEast,*/ 00593 InFrontWest, InFront, /*InFrontEast,*/ 00594 InFrontSouthWest, InFrontSouth, /*InFrontSouthEast,*/ 00595 00596 NorthWest, North, /*NorthEast,*/ 00597 West, /*East,*/ 00598 SouthWest, South, /*SouthEast,*/ 00599 00600 BehindNorthWest, BehindNorth, /*BehindNorthEast,*/ 00601 BehindWest, Behind, /*BehindEast,*/ 00602 BehindSouthWest, BehindSouth, /*BehindSouthEast,*/ 00603 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00604 //2 - AtLeftBorder 00605 { /*InFrontNorthWest,*/ InFrontNorth, InFrontNorthEast, 00606 /*InFrontWest,*/ InFront, InFrontEast, 00607 /*InFrontSouthWest,*/ InFrontSouth, InFrontSouthEast, 00608 00609 /*NorthWest,*/ North, NorthEast, 00610 /*West,*/ East, 00611 /*SouthWest,*/ South, SouthEast, 00612 00613 /*BehindNorthWest,*/ BehindNorth, BehindNorthEast, 00614 /*BehindWest,*/ Behind, BehindEast, 00615 /*BehindSouthWest,*/ BehindSouth, BehindSouthEast, 00616 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00617 //3 - Nothin' 00618 { Error, Error, Error, Error, Error, Error, Error, Error, Error, 00619 Error, Error, Error, Error, Error, Error, Error, Error, 00620 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00621 //4 - AtTopBorder 00622 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/ 00623 InFrontWest, InFront, InFrontEast, 00624 InFrontSouthWest, InFrontSouth, InFrontSouthEast, 00625 00626 /*NorthWest, North, NorthEast,*/ 00627 West, East, 00628 SouthWest, South, SouthEast, 00629 00630 /*BehindNorthWest, BehindNorth, BehindNorthEast,*/ 00631 BehindWest, Behind, BehindEast, 00632 BehindSouthWest, BehindSouth, BehindSouthEast, 00633 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00634 //5 - AtTopRightBorder 00635 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/ 00636 InFrontWest, InFront, /*InFrontEast,*/ 00637 InFrontSouthWest, InFrontSouth, /*InFrontSouthEast,*/ 00638 00639 /*NorthWest, North, NorthEast,*/ 00640 West, /*East,*/ 00641 SouthWest, South, /*SouthEast,*/ 00642 00643 /*BehindNorthWest, BehindNorth, BehindNorthEast,*/ 00644 BehindWest, Behind, /*BehindEast,*/ 00645 BehindSouthWest, BehindSouth, /*BehindSouthEast,*/ 00646 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00647 Error, Error, Error, Error, Error, Error}, 00648 //6 - AtTopLeftBorder 00649 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/ 00650 /*InFrontWest,*/ InFront, InFrontEast, 00651 /*InFrontSouthWest,*/ InFrontSouth, InFrontSouthEast, 00652 00653 /*NorthWest, North, NorthEast,*/ 00654 /*West,*/ East, 00655 /*SouthWest,*/ South, SouthEast, 00656 00657 /*BehindNorthWest, BehindNorth, BehindNorthEast,*/ 00658 /*BehindWest, */ Behind, BehindEast, 00659 /*BehindSouthWest,*/ BehindSouth, BehindSouthEast, 00660 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00661 Error, Error, Error, Error, Error, Error}, 00662 //7 - Nothin' 00663 { Error, Error, Error, Error, Error, Error, Error, Error, Error, 00664 Error, Error, Error, Error, Error, Error, Error, Error, 00665 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00666 //8 - AtBottomBorder 00667 { InFrontNorthWest, InFrontNorth, InFrontNorthEast, 00668 InFrontWest, InFront, InFrontEast, 00669 /*InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 00670 00671 NorthWest, North, NorthEast, 00672 West, East, 00673 /*SouthWest, South, SouthEast,*/ 00674 00675 BehindNorthWest, BehindNorth, BehindNorthEast, 00676 BehindWest, Behind, BehindEast, 00677 /*BehindSouthWest, BehindSouth, BehindSouthEast*/ 00678 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00679 //9 - AtBottomRightBorder 00680 { InFrontNorthWest, InFrontNorth, /*InFrontNorthEast,*/ 00681 InFrontWest, InFront, /*InFrontEast,*/ 00682 /*InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 00683 00684 NorthWest, North, /*NorthEast,*/ 00685 West, /*East,*/ 00686 /*SouthWest, South, SouthEast,*/ 00687 00688 BehindNorthWest, BehindNorth, /*BehindNorthEast,*/ 00689 BehindWest, Behind, /*BehindEast,*/ 00690 /*BehindSouthWest, BehindSouth, BehindSouthEast*/ 00691 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00692 Error, Error, Error, Error, Error, Error}, 00693 //10 - AtBottomLeftBorder 00694 { /*InFrontNorthWest,*/ InFrontNorth, InFrontNorthEast, 00695 /*InFrontWest,*/ InFront, InFrontEast, 00696 /*InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 00697 00698 /*NorthWest,*/ North, NorthEast, 00699 /*West,*/ East, 00700 /*SouthWest, South, SouthEast,*/ 00701 00702 /*BehindNorthWest,*/ BehindNorth, BehindNorthEast, 00703 /*BehindWest,*/ Behind, BehindEast, 00704 /*BehindSouthWest, BehindSouth, BehindSouthEast*/ 00705 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00706 Error, Error, Error, Error, Error, Error}, 00707 //11 - Nothin' 00708 { Error, Error, Error, Error, Error, Error, Error, Error, Error, 00709 Error, Error, Error, Error, Error, Error, Error, Error, 00710 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00711 //12 - Nothin' 00712 { Error, Error, Error, Error, Error, Error, Error, Error, Error, 00713 Error, Error, Error, Error, Error, Error, Error, Error, 00714 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00715 //13 - Nothin' 00716 { Error, Error, Error, Error, Error, Error, Error, Error, Error, 00717 Error, Error, Error, Error, Error, Error, Error, Error, 00718 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00719 //14 - Nothin' 00720 { Error, Error, Error, Error, Error, Error, Error, Error, Error, 00721 Error, Error, Error, Error, Error, Error, Error, Error, 00722 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00723 //15 - Nothin' 00724 { Error, Error, Error, Error, Error, Error, Error, Error, Error, 00725 Error, Error, Error, Error, Error, Error, Error, Error, 00726 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00727 //16 - AtFrontBorder 00728 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast, 00729 InFrontWest, InFront, InFrontEast, 00730 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 00731 00732 NorthWest, North, NorthEast, 00733 West, East, 00734 SouthWest, South, SouthEast, 00735 00736 BehindNorthWest, BehindNorth, BehindNorthEast, 00737 BehindWest, Behind, BehindEast, 00738 BehindSouthWest, BehindSouth, BehindSouthEast, 00739 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00740 //17 - AtFrontRightBorder 00741 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast, 00742 InFrontWest, InFront, InFrontEast, 00743 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 00744 00745 NorthWest, North, /*NorthEast,*/ 00746 West, /*East,*/ 00747 SouthWest, South, /*SouthEast,*/ 00748 00749 BehindNorthWest, BehindNorth, /*BehindNorthEast,*/ 00750 BehindWest, Behind, /*BehindEast,*/ 00751 BehindSouthWest, BehindSouth, /*BehindSouthEast,*/ 00752 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00753 Error, Error, Error, Error, Error, Error}, 00754 //18 - AtFrontLeftBorder 00755 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast, 00756 InFrontWest, InFront, InFrontEast, 00757 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 00758 00759 /*NorthWest,*/ North, NorthEast, 00760 /*West,*/ East, 00761 /*SouthWest,*/ South, SouthEast, 00762 00763 /*BehindNorthWest,*/ BehindNorth, BehindNorthEast, 00764 /*BehindWest,*/ Behind, BehindEast, 00765 /*BehindSouthWest,*/ BehindSouth, BehindSouthEast, 00766 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00767 Error, Error, Error, Error, Error, Error}, 00768 //19 - Nothin' 00769 { Error, Error, Error, Error, Error, Error, Error, Error, Error, 00770 Error, Error, Error, Error, Error, Error, Error, Error, 00771 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00772 //20 - AtTopFrontBorder 00773 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast, 00774 InFrontWest, InFront, InFrontEast, 00775 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 00776 00777 /*NorthWest, North, NorthEast,*/ 00778 West, East, 00779 SouthWest, South, SouthEast, 00780 00781 /*BehindNorthWest, BehindNorth, BehindNorthEast,*/ 00782 BehindWest, Behind, BehindEast, 00783 BehindSouthWest, BehindSouth, BehindSouthEast, 00784 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00785 Error, Error, Error, Error, Error, Error}, 00786 //21 - AtTopRightFrontBorder 00787 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast, 00788 InFrontWest, InFront, InFrontEast, 00789 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 00790 00791 /*NorthWest, North, NorthEast,*/ 00792 West, /*East,*/ 00793 SouthWest, South, /*SouthEast,*/ 00794 00795 /*BehindNorthWest, BehindNorth, BehindNorthEast,*/ 00796 BehindWest, Behind, /*BehindEast,*/ 00797 BehindSouthWest, BehindSouth, /*BehindSouthEast,*/ 00798 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00799 Error, Error, Error, Error, Error, Error, 00800 Error, Error, Error, Error}, 00801 //22 - AtTopLeftFrontBorder 00802 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast, 00803 InFrontWest, InFront, InFrontEast, 00804 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 00805 00806 /*NorthWest, North, NorthEast,*/ 00807 /*West,*/ East, 00808 /*SouthWest,*/ South, SouthEast, 00809 00810 /*BehindNorthWest, BehindNorth, BehindNorthEast,*/ 00811 /*BehindWest,*/ Behind, BehindEast, 00812 /*BehindSouthWest,*/ BehindSouth, BehindSouthEast, 00813 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00814 Error, Error, Error, Error, Error, Error, 00815 Error, Error, Error, Error}, 00816 //23 - Nothin' 00817 { Error, Error, Error, Error, Error, Error, Error, Error, Error, 00818 Error, Error, Error, Error, Error, Error, Error, Error, 00819 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00820 //24 - AtBottomFrontBorder 00821 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast, 00822 InFrontWest, InFront, InFrontEast, 00823 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 00824 00825 NorthWest, North, NorthEast, 00826 West, East, 00827 /*SouthWest, South, SouthEast,*/ 00828 00829 BehindNorthWest, BehindNorth, BehindNorthEast, 00830 BehindWest, Behind, BehindEast, 00831 /*BehindSouthWest, BehindSouth, BehindSouthEast*/ 00832 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00833 Error, Error, Error, Error, Error, Error}, 00834 //25 - AtBottomRightFrontBorder 00835 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast, 00836 InFrontWest, InFront, InFrontEast, 00837 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 00838 00839 NorthWest, North, /*NorthEast,*/ 00840 West, /* East,*/ 00841 /*SouthWest, South, SouthEast,*/ 00842 00843 BehindNorthWest, BehindNorth, /*BehindNorthEast,*/ 00844 BehindWest, Behind, /*BehindEast,*/ 00845 /*BehindSouthWest, BehindSouth, BehindSouthEast*/ 00846 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00847 Error, Error, Error, Error, Error, Error, 00848 Error, Error, Error, Error}, 00849 //26 - AtBottomLeftFrontBorder 00850 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast, 00851 InFrontWest, InFront, InFrontEast, 00852 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 00853 00854 /*NorthWest,*/ North, NorthEast, 00855 /*West,*/ East, 00856 /*SouthWest, South, SouthEast,*/ 00857 00858 /*BehindNorthWest,*/ BehindNorth, BehindNorthEast, 00859 /*BehindWest,*/ Behind, BehindEast, 00860 /*BehindSouthWest, BehindSouth, BehindSouthEast*/ 00861 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00862 Error, Error, Error, Error, Error, Error, 00863 Error, Error, Error, Error}, 00864 //27 - Nothin' 00865 { Error, Error, Error, Error, Error, Error, Error, Error, Error, 00866 Error, Error, Error, Error, Error, Error, Error, Error, 00867 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00868 //28 - Nothin' 00869 { Error, Error, Error, Error, Error, Error, Error, Error, Error, 00870 Error, Error, Error, Error, Error, Error, Error, Error, 00871 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00872 //29 - Nothin' 00873 { Error, Error, Error, Error, Error, Error, Error, Error, Error, 00874 Error, Error, Error, Error, Error, Error, Error, Error, 00875 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00876 //30 - Nothin' 00877 { Error, Error, Error, Error, Error, Error, Error, Error, Error, 00878 Error, Error, Error, Error, Error, Error, Error, Error, 00879 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00880 //31 - Nothin' 00881 { Error, Error, Error, Error, Error, Error, Error, Error, Error, 00882 Error, Error, Error, Error, Error, Error, Error, Error, 00883 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00884 //32 - AtRearBorder 00885 { InFrontNorthWest, InFrontNorth, InFrontNorthEast, 00886 InFrontWest, InFront, InFrontEast, 00887 InFrontSouthWest, InFrontSouth, InFrontSouthEast, 00888 00889 NorthWest, North, NorthEast, 00890 West, East, 00891 SouthWest, South, SouthEast, 00892 00893 /*BehindNorthWest, BehindNorth, BehindNorthEast, 00894 BehindWest, Behind, BehindEast, 00895 BehindSouthWest, BehindSouth, BehindSouthEast,*/ 00896 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00897 //33 - AtRearRightBorder 00898 { InFrontNorthWest, InFrontNorth, /*InFrontNorthEast,*/ 00899 InFrontWest, InFront, /*InFrontEast,*/ 00900 InFrontSouthWest, InFrontSouth, /*InFrontSouthEast,*/ 00901 00902 NorthWest, North, /*NorthEast,*/ 00903 West, /*East,*/ 00904 SouthWest, South, /*SouthEast,*/ 00905 00906 /*BehindNorthWest, BehindNorth, BehindNorthEast, 00907 BehindWest, Behind, BehindEast, 00908 BehindSouthWest, BehindSouth, BehindSouthEast,*/ 00909 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00910 Error, Error, Error, Error, Error, Error}, 00911 //34 - AtRearLeftBorder 00912 { /*InFrontNorthWest,*/ InFrontNorth, InFrontNorthEast, 00913 /*InFrontWest,*/ InFront, InFrontEast, 00914 /*InFrontSouthWest,*/ InFrontSouth, InFrontSouthEast, 00915 00916 /*NorthWest,*/ North, NorthEast, 00917 /*West,*/ East, 00918 /*SouthWest,*/ South, SouthEast, 00919 00920 /*BehindNorthWest, BehindNorth, BehindNorthEast, 00921 BehindWest, Behind, BehindEast, 00922 BehindSouthWest, BehindSouth, BehindSouthEast,*/ 00923 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00924 Error, Error, Error, Error, Error, Error}, 00925 //35 - Nothin' 00926 { Error, Error, Error, Error, Error, Error, Error, Error, Error, 00927 Error, Error, Error, Error, Error, Error, Error, Error, 00928 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00929 //36 - AtTopRearBorder 00930 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/ 00931 InFrontWest, InFront, InFrontEast, 00932 InFrontSouthWest, InFrontSouth, InFrontSouthEast, 00933 00934 /*NorthWest, North, NorthEast,*/ 00935 West, East, 00936 SouthWest, South, SouthEast, 00937 00938 /*BehindNorthWest, BehindNorth, BehindNorthEast, 00939 BehindWest, Behind, BehindEast, 00940 BehindSouthWest, BehindSouth, BehindSouthEast,*/ 00941 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00942 Error, Error, Error, Error, Error, Error}, 00943 //37 - AtTopRightRearBorder 00944 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/ 00945 InFrontWest, InFront, /*InFrontEast,*/ 00946 InFrontSouthWest, InFrontSouth, /*InFrontSouthEast,*/ 00947 00948 /*NorthWest, North, NorthEast,*/ 00949 West, /*East,*/ 00950 SouthWest, South, /*SouthEast,*/ 00951 00952 /*BehindNorthWest, BehindNorth, BehindNorthEast, 00953 BehindWest, Behind, BehindEast, 00954 BehindSouthWest, BehindSouth, BehindSouthEast,*/ 00955 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00956 Error, Error, Error, Error, Error, Error, 00957 Error, Error, Error, Error}, 00958 //38 - AtTopLeftRearBorder 00959 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/ 00960 /*InFrontWest,*/ InFront, InFrontEast, 00961 /*InFrontSouthWest,*/ InFrontSouth, InFrontSouthEast, 00962 00963 /*NorthWest, North, NorthEast,*/ 00964 /*West,*/ East, 00965 /*SouthWest,*/ South, SouthEast, 00966 00967 /*BehindNorthWest, BehindNorth, BehindNorthEast, 00968 BehindWest, Behind, BehindEast, 00969 BehindSouthWest, BehindSouth, BehindSouthEast,*/ 00970 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00971 Error, Error, Error, Error, Error, Error, 00972 Error, Error, Error, Error}, 00973 //39 - Nothin' 00974 { Error, Error, Error, Error, Error, Error, Error, Error, Error, 00975 Error, Error, Error, Error, Error, Error, Error, Error, 00976 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 00977 //40 - AtBottomRearBorder 00978 { InFrontNorthWest, InFrontNorth, InFrontNorthEast, 00979 InFrontWest, InFront, InFrontEast, 00980 /*InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 00981 00982 NorthWest, North, NorthEast, 00983 West, East, 00984 /*SouthWest, South, SouthEast,*/ 00985 00986 /*BehindNorthWest, BehindNorth, BehindNorthEast, 00987 BehindWest, Behind, BehindEast, 00988 BehindSouthWest, BehindSouth, BehindSouthEast,*/ 00989 Error, Error, Error, Error, Error, Error, Error, Error, Error, 00990 Error, Error, Error, Error, Error, Error}, 00991 //41 - AtBottomRightRearBorder 00992 { InFrontNorthWest, InFrontNorth, /*InFrontNorthEast,*/ 00993 InFrontWest, InFront, /*InFrontEast,*/ 00994 /*InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 00995 00996 NorthWest, North, /*NorthEast,*/ 00997 West, /*East,*/ 00998 /*SouthWest, South, SouthEast,*/ 00999 01000 /*BehindNorthWest, BehindNorth, BehindNorthEast, 01001 BehindWest, Behind, BehindEast, 01002 BehindSouthWest, BehindSouth, BehindSouthEast,*/ 01003 Error, Error, Error, Error, Error, Error, Error, Error, Error, 01004 Error, Error, Error, Error, Error, Error, 01005 Error, Error, Error, Error}, 01006 //42 - AtBottomLeftRearBorder 01007 { /*InFrontNorthWest,*/ InFrontNorth, InFrontNorthEast, 01008 /*InFrontWest,*/ InFront, InFrontEast, 01009 /*InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 01010 01011 /*NorthWest,*/ North, NorthEast, 01012 /*West,*/ East, 01013 /*SouthWest, South, SouthEast,*/ 01014 01015 /*BehindNorthWest, BehindNorth, BehindNorthEast, 01016 BehindWest, Behind, BehindEast, 01017 BehindSouthWest, BehindSouth, BehindSouthEast,*/ 01018 Error, Error, Error, Error, Error, Error, Error, Error, Error, 01019 Error, Error, Error, Error, Error, Error, 01020 Error, Error, Error, Error} 01021 }; 01022 return c[b][index]; 01023 } 01024 01025 /** The valid direction three codes in anti causal direction (means: look back in scanline 01026 direction)when the center is at the volume border. 01027 Should be used with isAtVolumeBorderCausal to determine the Directions, as this 01028 avoids using of the nonesense border ids (e.g. 0,1,8,9...) of this table. 01029 \a index must be in the range <tt>0...nearBorderDirectionCount(b)-1</tt>. 01030 */ 01031 static Direction nearBorderDirectionsCausal(AtVolumeBorder b, int index) 01032 { 01033 static Direction c[43][13] = { 01034 //0 - NotAtBorder -----> should never be used 01035 { InFrontNorthWest, InFrontNorth, InFrontNorthEast, 01036 InFrontWest, InFront, InFrontEast, 01037 InFrontSouthWest, InFrontSouth, InFrontSouthEast, 01038 01039 NorthWest, North, NorthEast, 01040 West}, 01041 //1 - AtRightBorder -----> should never be used 01042 { InFrontNorthWest, InFrontNorth, InFrontNorthEast, 01043 InFrontWest, InFront, InFrontEast, 01044 InFrontSouthWest, InFrontSouth, InFrontSouthEast, 01045 01046 NorthWest, North, NorthEast, 01047 West}, 01048 //2 - AtLeftBorder 01049 { /*InFrontNorthWest,*/ InFrontNorth,InFrontNorthEast, 01050 /*InFrontWest,*/ InFront, InFrontEast, 01051 /*InFrontSouthWest,*/InFrontSouth, InFrontSouthEast, 01052 01053 /*NorthWest,*/ North, NorthEast, 01054 /*West*/ 01055 Error, Error, Error, Error, Error}, 01056 //3 - Nothin' 01057 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01058 //4 - AtTopBorder 01059 { /*InFrontNorthWest,InFrontNorth, InFrontNorthEast,*/ 01060 InFrontWest, InFront, InFrontEast, 01061 InFrontSouthWest, InFrontSouth, InFrontSouthEast, 01062 01063 /*NorthWest, North, NorthEast,*/ 01064 West, 01065 Error, Error, Error, Error, Error, Error}, 01066 //5 - AtTopRightBorder 01067 { /*InFrontNorthWest,InFrontNorth, InFrontNorthEast,*/ 01068 InFrontWest, InFront, /*InFrontEast,*/ 01069 InFrontSouthWest, InFrontSouth, /*InFrontSouthEast,*/ 01070 01071 /*NorthWest, North, NorthEast,*/ 01072 West, 01073 Error, Error, Error, Error, Error, Error, Error, Error}, 01074 //6 - AtTopLeftBorder 01075 { /*InFrontNorthWest,InFrontNorth, InFrontNorthEast,*/ 01076 /*InFrontWest,*/ InFront, InFrontEast, 01077 /*InFrontSouthWest,*/InFrontSouth, InFrontSouthEast, 01078 01079 /*NorthWest, North, NorthEast,*/ 01080 /*West,*/ 01081 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01082 //7 - Nothin' 01083 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01084 //8 - AtBottomBorder -----> should never be used 01085 { InFrontNorthWest, InFrontNorth, InFrontNorthEast, 01086 InFrontWest, InFront, InFrontEast, 01087 InFrontSouthWest, InFrontSouth, InFrontSouthEast, 01088 01089 NorthWest, North, NorthEast, 01090 West}, 01091 //9 - AtBottomRightBorder -----> should never be used 01092 { InFrontNorthWest, InFrontNorth, InFrontNorthEast, 01093 InFrontWest, InFront, InFrontEast, 01094 InFrontSouthWest, InFrontSouth, InFrontSouthEast, 01095 01096 NorthWest, North, NorthEast, 01097 West}, 01098 //10 - AtBottomLeftBorder 01099 { /*InFrontNorthWest,*/InFrontNorth, InFrontNorthEast, 01100 /*InFrontWest,*/ InFront, InFrontEast, 01101 /*InFrontSouthWest,*/InFrontSouth, InFrontSouthEast, 01102 01103 /*NorthWest,*/ North, NorthEast, 01104 /*West*/ 01105 Error, Error, Error, Error, Error}, 01106 //11 - Nothin' 01107 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01108 //12 - Nothin' 01109 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01110 //13 - Nothin' 01111 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01112 //14 - Nothin' 01113 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01114 //15 - Nothin' 01115 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01116 //16 - AtFrontBorder 01117 { /*InFrontNorthWest,InFrontNorth, InFrontNorthEast, 01118 InFrontWest, InFront, InFrontEast, 01119 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 01120 01121 NorthWest, North, NorthEast, 01122 West, 01123 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01124 //17 - AtFrontRightBorder 01125 { /*InFrontNorthWest,InFrontNorth, InFrontNorthEast, 01126 InFrontWest, InFront, InFrontEast, 01127 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 01128 01129 NorthWest, North, /*NorthEast,*/ 01130 West, 01131 Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01132 //18 - AtFrontLeftBorder 01133 { /*InFrontNorthWest,InFrontNorth, InFrontNorthEast, 01134 InFrontWest, InFront, InFrontEast, 01135 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 01136 01137 /*NorthWest,*/ North, NorthEast, 01138 /*West,*/ 01139 Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01140 //19 - Nothin' 01141 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01142 //20 - AtTopFrontBorder 01143 { /*InFrontNorthWest,InFrontNorth, InFrontNorthEast, 01144 InFrontWest, InFront, InFrontEast, 01145 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 01146 01147 /*NorthWest, North, NorthEast,*/ 01148 West, 01149 Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01150 //21 - AtTopRightFrontBorder 01151 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast, 01152 InFrontWest, InFront, InFrontEast, 01153 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 01154 01155 /*NorthWest, North, NorthEast,*/ 01156 West, 01157 Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01158 //22 - AtTopLeftFrontBorder 01159 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01160 //23 - Nothin 01161 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01162 //24 - AtBottomFrontBorder 01163 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast, 01164 InFrontWest, InFront, InFrontEast, 01165 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 01166 01167 NorthWest, North, NorthEast, 01168 West, 01169 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01170 //25 - AtBottomRightFrontBorder 01171 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast, 01172 InFrontWest, InFront, InFrontEast, 01173 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 01174 01175 NorthWest, North, /*NorthEast,*/ 01176 West, 01177 Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01178 //26 - AtBottomLeftFrontBorder 01179 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast, 01180 InFrontWest, InFront, InFrontEast, 01181 InFrontSouthWest, InFrontSouth, InFrontSouthEast,*/ 01182 01183 /*NorthWest,*/ North, NorthEast, 01184 West, 01185 Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01186 //27 - Nothin 01187 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01188 //28 - Nothin 01189 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01190 //29 - Nothin 01191 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01192 //30 - Nothin 01193 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01194 //31 - Nothin 01195 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01196 //32 - AtRearBorder -----> should never be used 01197 { InFrontNorthWest, InFrontNorth, InFrontNorthEast, 01198 InFrontWest, InFront, InFrontEast, 01199 InFrontSouthWest, InFrontSouth, InFrontSouthEast, 01200 01201 NorthWest, North, NorthEast, 01202 West}, 01203 //33 - AtRearRightBorder -----> should never be used 01204 { InFrontNorthWest, InFrontNorth, InFrontNorthEast, 01205 InFrontWest, InFront, InFrontEast, 01206 InFrontSouthWest, InFrontSouth, InFrontSouthEast, 01207 01208 NorthWest, North, NorthEast, 01209 West}, 01210 //34 - AtRearLeftBorder 01211 { /*InFrontNorthWest,*/InFrontNorth, InFrontNorthEast, 01212 /*InFrontWest,*/ InFront, InFrontEast, 01213 /*InFrontSouthWest,*/InFrontSouth, InFrontSouthEast, 01214 01215 /*NorthWest,*/ North, NorthEast, 01216 /*West*/ 01217 Error, Error, Error, Error, Error}, 01218 //35 - Nothin 01219 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01220 //36 - AtTopRearBorder 01221 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/ 01222 InFrontWest, InFront, InFrontEast, 01223 InFrontSouthWest, InFrontSouth, InFrontSouthEast, 01224 01225 /*NorthWest, North, NorthEast,*/ 01226 West, 01227 Error, Error, Error, Error, Error, Error}, 01228 //37 - AtTopRightRearBorder 01229 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/ 01230 InFrontWest, InFront, /*InFrontEast,*/ 01231 InFrontSouthWest, InFrontSouth, /*InFrontSouthEast,*/ 01232 01233 /*NorthWest, North, NorthEast,*/ 01234 West, 01235 Error, Error, Error, Error, Error, Error, Error, Error}, 01236 //38 - AtTopLeftRearBorder 01237 { /*InFrontNorthWest, InFrontNorth, InFrontNorthEast,*/ 01238 /*InFrontWest,*/ InFront, InFrontEast, 01239 /*InFrontSouthWest,*/InFrontSouth, InFrontSouthEast, 01240 01241 /*NorthWest, North, NorthEast,*/ 01242 /*West,*/ 01243 Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01244 //39 - Nothin 01245 { Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error, Error}, 01246 //40 - AtBottomRearBorder -----> should never be used 01247 { InFrontNorthWest, InFrontNorth, InFrontNorthEast, 01248 InFrontWest, InFront, InFrontEast, 01249 InFrontSouthWest, InFrontSouth, InFrontSouthEast, 01250 01251 NorthWest, North, NorthEast, 01252 West}, 01253 //41 - AtBottomRightRearBorder -----> should never be used 01254 { InFrontNorthWest, InFrontNorth, InFrontNorthEast, 01255 InFrontWest, InFront, InFrontEast, 01256 InFrontSouthWest, InFrontSouth, InFrontSouthEast, 01257 01258 NorthWest, North, NorthEast, 01259 West}, 01260 //42 - AtBottomLeftRearBorder 01261 { /*InFrontNorthWest,*/InFrontNorth, InFrontNorthEast, 01262 /*InFrontWest,*/ InFront, InFrontEast, 01263 /*InFrontSouthWest,InFrontSouth, InFrontSouthEast,*/ 01264 01265 /*NorthWest,*/ North, NorthEast, 01266 /*West*/ 01267 Error, Error, Error, Error, Error, Error, Error} 01268 }; 01269 return c[b][index]; 01270 } 01271 01272 /** transform direction code into corresponding Diff3D offset. 01273 (note: there is no bounds checking on the code you pass.) 01274 */ 01275 static Diff3D const & diff(Direction code) 01276 { 01277 static Diff3D d[] = { Diff3D( -1, -1, -1), //InFrontNorthWest 01278 Diff3D( 0, -1, -1), //InFrontNorth 01279 Diff3D( 1, -1, -1), //InFrontNorthEast 01280 Diff3D( -1, 0, -1), //InFrontWest 01281 Diff3D( 0, 0, -1), //InFront 01282 Diff3D( 1, 0, -1), //InFrontEast 01283 Diff3D( -1, 1, -1), //InFrontSouthWest 01284 Diff3D( 0, 1, -1), //InFrontSouth 01285 Diff3D( 1, 1, -1), //InFrontSouthEast 01286 01287 Diff3D( -1, -1, 0), //NorthWest 01288 Diff3D( 0, -1, 0), //North 01289 Diff3D( 1, -1, 0), //NorthEast 01290 Diff3D( -1, 0, 0), //West 01291 Diff3D( 1, 0, 0), //East 01292 Diff3D( -1, 1, 0), //SouthWest 01293 Diff3D( 0, 1, 0), //South 01294 Diff3D( 1, 1, 0), //SouthEast 01295 01296 Diff3D( -1, -1, 1), //BehindNorthWest 01297 Diff3D( 0, -1, 1), //BehindNorth 01298 Diff3D( 1, -1, 1), //BehindNorthEast 01299 Diff3D( -1, 0, 1), //BehindWest 01300 Diff3D( 0, 0, 1), //Behind 01301 Diff3D( 1, 0, 1), //BehindEast 01302 Diff3D( -1, 1, 1), //BehindSouthWest 01303 Diff3D( 0, 1, 1), //BehindSouth 01304 Diff3D( 1, 1, 1), //BehindSouthEast 01305 }; 01306 return d[code]; 01307 } 01308 01309 /** Equivalent to <tt>diff(static_cast<Direction>(code))</tt>. 01310 (note: there is no bounds checking on the code you pass.) 01311 */ 01312 static Diff3D const & diff(int code) { return diff(static_cast<Direction>(code)); } 01313 01314 /** Equivalent to <tt>diff(code)[dim]</tt> */ 01315 static int diff(Direction code, int dim) { return diff(code)[dim]; } 01316 01317 /** Get the relative offset from one neighbor to the other. 01318 For example, <tt>relativeDiff(East, West) == multi_differencetype(-2,0,0)</tt>. 01319 (note: there is no bounds checking on the code you pass.) 01320 */ 01321 static Diff3D const relativeDiff(Direction fromCode, Direction toCode) 01322 { 01323 //Uncomment the following lines may cause the program to crash because of insufficient 01324 //static allocatable memory on the stack 01325 /* 01326 static Diff3D d[][] = { 01327 // 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 01328 { 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 01329 { 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 01330 { 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 01331 { 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 01332 { 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 01333 { 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 01334 { 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 01335 { 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 01336 { 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 01337 { 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 01338 { 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 01339 { 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 01340 { 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 01341 { 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 01342 { 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 01343 { 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 01344 { 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 01345 { 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 01346 { 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 01347 { 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 01348 { 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 01349 { 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 01350 { 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 01351 { 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 01352 { 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 01353 { 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 01354 }; 01355 return d[fromCode][toCode]; 01356 */ 01357 return diff(toCode)-diff(fromCode); 01358 } 01359 01360 /** Equivalent to relativeDiff(static_cast<Direction>(fromCode), static_cast<Direction>(toCode)). 01361 (note: there is no bounds checking on the code you pass.) 01362 */ 01363 static Diff3D const relativeDiff(int fromCode, int toCode) 01364 { 01365 return relativeDiff(static_cast<Direction>(fromCode), static_cast<Direction>(toCode)); 01366 } 01367 01368 /** X-component of diff() */ 01369 static int dX(Direction code) { return diff(code)[0]; } 01370 /** Y-component of diff() */ 01371 static int dY(Direction code) { return diff(code)[1]; } 01372 /** Z-component of diff() */ 01373 static int dZ(Direction code) { return diff(code)[2]; } 01374 01375 /** X-component of diff() */ 01376 static int dX(int code) { return diff(code)[0]; } 01377 /** Y-component of diff() */ 01378 static int dY(int code) { return diff(code)[1]; } 01379 /** Z-component of diff() */ 01380 static int dZ(int code) { return diff(code)[2]; } 01381 01382 /** transform 6-neighborhood code into 26-neighborhood code. 01383 */ 01384 static Direction code(Neighborhood3DSix::Direction d) 01385 { 01386 switch (d){ 01387 case Neighborhood3DSix::InFront : 01388 return InFront; 01389 case Neighborhood3DSix::North : 01390 return North; 01391 case Neighborhood3DSix::West : 01392 return West; 01393 case Neighborhood3DSix::East : 01394 return East; 01395 case Neighborhood3DSix::South : 01396 return South; 01397 case Neighborhood3DSix::Behind : 01398 return Behind; 01399 default: 01400 vigra_fail("NeighborCode3D::code(): Internal error -- invalid direction code."); 01401 } 01402 return Error; 01403 } 01404 01405 /** transform Diff3D offset into corresponding direction code. 01406 The code <tt>Direction::Error</tt> will be returned if <tt>diff</tt> 01407 is not in the 3DTwentySix-Neighborhood. 01408 */ 01409 static Direction code(Diff3D const & diff) 01410 { 01411 switch(diff[0]){ 01412 case -1: 01413 switch(diff[1]){ 01414 case -1: 01415 switch(diff[2]){ 01416 case -1: return InFrontNorthWest; // ( -1, -1, -1) 01417 case 0: return NorthWest; // ( -1, -1, 0) 01418 case 1: return BehindNorthWest; // ( -1, -1, 1) 01419 } 01420 case 0: 01421 switch(diff[2]){ 01422 case -1: return InFrontWest; // ( -1, 0, -1) 01423 case 0: return West; // ( -1, 0, 0) 01424 case 1: return BehindWest; // ( -1, 0, 1) 01425 } 01426 case 1: 01427 switch(diff[2]){ 01428 case -1: return InFrontSouthWest; // ( -1, 1, -1) 01429 case 0: return SouthWest; // ( -1, 1, 0) 01430 case 1: return BehindSouthWest; // ( -1, 1, 1) 01431 } 01432 } 01433 case 0: 01434 switch(diff[1]){ 01435 case -1: 01436 switch(diff[2]){ 01437 case -1: return InFrontNorth; // ( 0, 0, -1) 01438 case 0: return North; // ( 0, -1, 0) 01439 case 1: return BehindNorth; // ( 0, -1, 1) 01440 } 01441 case 0: 01442 switch(diff[2]){ 01443 case -1: return InFront; // ( 0, 0, -1) 01444 case 1: return Behind; // ( 0, 0, 1) 01445 } 01446 case 1: 01447 switch(diff[2]){ 01448 case -1: return InFrontSouth; // ( 0, 1, -1) 01449 case 0: return South; // ( 0, 1, 0) 01450 case 1: return BehindSouth; // ( 0, 1, 1) 01451 } 01452 } 01453 case 1: 01454 switch(diff[1]){ 01455 case -1: 01456 switch(diff[2]){ 01457 case -1: return InFrontNorthEast; // ( 1, -1, -1) 01458 case 0: return NorthEast; // ( 1, -1, 0) 01459 case 1: return BehindNorthEast; // ( 1, -1, 1) 01460 } 01461 case 0: 01462 switch(diff[2]){ 01463 case -1: return InFrontEast; // ( 1, 0, -1) 01464 case 0: return East; // ( 1, 0, 0) 01465 case 1: return BehindEast; // ( 1, 0, 1) 01466 } 01467 case 1: 01468 switch(diff[2]){ 01469 case -1: return InFrontSouthEast; // ( 1, 1, -1) 01470 case 0: return SouthEast; // ( 1, 1, 0) 01471 case 1: return BehindSouthEast; // ( 1, 1, 1) 01472 } 01473 } 01474 } 01475 return Error; // better safe than sorry 01476 } 01477 01478 /** Check whether a code refers to a diagonal direction. 01479 Useful if you want to abstract the differences between 6- and 26-neighborhood. 01480 Always <tt>false</tt> for 6-neighborhood. 01481 */ 01482 static bool isDiagonal(Direction dir) { 01483 Diff3D d = diff(dir); 01484 if (abs(d[0])+abs(d[1])+abs(d[2])==1) 01485 return false; 01486 else 01487 return true; 01488 } 01489 01490 static Diff3D const & frontTopLeft() { return diff(InFrontNorthWest); } /**< Offset to the front-top-left neighbor */ 01491 static Diff3D const & frontTop() { return diff(InFrontNorth); } /**< Offset to the front-top neighbor */ 01492 static Diff3D const & frontTopRight() { return diff(InFrontNorthEast); } /**< Offset to the front-top-right neighbor */ 01493 static Diff3D const & frontLeft() { return diff(InFrontWest); } /**< Offset to the front-left neighbor */ 01494 static Diff3D const & front() { return diff(InFront); } /**< Offset to the front neighbor */ 01495 static Diff3D const & frontRight() { return diff(InFrontEast); } /**< Offset to the front-right neighbor */ 01496 static Diff3D const & frontBottomLeft() { return diff(InFrontSouthWest); } /**< Offset to the front-bottom-left neighbor */ 01497 static Diff3D const & frontBottom() { return diff(InFrontSouth); } /**< Offset to the front-bottom neighbor */ 01498 static Diff3D const & frontBottomRight() { return diff(InFrontSouthEast); } /**< Offset to the front-bottom-right neighbor */ 01499 01500 static Diff3D const & topLeft() { return diff(NorthWest); } /**< Offset to the top-left neighbor */ 01501 static Diff3D const & top() { return diff(North); } /**< Offset to the top neighbor */ 01502 static Diff3D const & topRight() { return diff(NorthEast); } /**< Offset to the top-right neighbor */ 01503 static Diff3D const & left() { return diff(West); } /**< Offset to the left neighbor */ 01504 static Diff3D const & right() { return diff(East); } /**< Offset to the right neighbor */ 01505 static Diff3D const & bottomLeft() { return diff(SouthWest); } /**< Offset to the bottom-left neighbor */ 01506 static Diff3D const & bottom() { return diff(South); } /**< Offset to the bottom neighbor */ 01507 static Diff3D const & bottomRight() { return diff(SouthEast); } /**< Offset to the bottom-right neighbor */ 01508 01509 static Diff3D const & rearTopLeft() { return diff(BehindNorthWest); } /**< Offset to the rear-top-left neighbor */ 01510 static Diff3D const & rearTop() { return diff(BehindNorth); } /**< Offset to the rear-top neighbor */ 01511 static Diff3D const & rearTopRight() { return diff(BehindNorthEast); } /**< Offset to the rear-top-right neighbor */ 01512 static Diff3D const & rearLeft() { return diff(BehindWest); } /**< Offset to the rear-left neighbor */ 01513 static Diff3D const & rear() { return diff(Behind); } /**< Offset to the rear neighbor */ 01514 static Diff3D const & rearRight() { return diff(BehindEast); } /**< Offset to the rear-right neighbor */ 01515 static Diff3D const & rearBottomLeft() { return diff(BehindSouthWest); } /**< Offset to the rear-bottom-left neighbor */ 01516 static Diff3D const & rearBottom() { return diff(BehindSouth); } /**< Offset to the rear-bottom neighbor */ 01517 static Diff3D const & rearBottomRight() { return diff(BehindSouthEast); } /**< Offset to the rear-bottom-right neighbor */ 01518 01519 //----- other namings 01520 01521 static Diff3D const & infrontNorthWest() { return diff(InFrontNorthWest); } /**< Offset to the infront-north-west neighbor */ 01522 static Diff3D const & infrontNorth() { return diff(InFrontNorth); } /**< Offset to the infront-north neighbor */ 01523 static Diff3D const & infrontNorthEast() { return diff(InFrontNorthEast); } /**< Offset to the infront-north-east neighbor */ 01524 static Diff3D const & infrontWest() { return diff(InFrontWest); } /**< Offset to the infront-west neighbor */ 01525 static Diff3D const & infront() { return diff(InFront); } /**< Offset to the infront neighbor */ 01526 static Diff3D const & infrontEast() { return diff(InFrontEast); } /**< Offset to the infront-east neighbor */ 01527 static Diff3D const & infrontSouthWest() { return diff(InFrontSouthWest); } /**< Offset to the infront-south-west neighbor */ 01528 static Diff3D const & infrontSouth() { return diff(InFrontSouth); } /**< Offset to the infront-south neighbor */ 01529 static Diff3D const & infrontSouthEast() { return diff(InFrontSouthEast); } /**< Offset to the infront-south-east neighbor */ 01530 01531 static Diff3D const & northWest() { return diff(NorthWest); } /**< Offset to the north-west neighbor */ 01532 static Diff3D const & north() { return diff(North); } /**< Offset to the north neighbor */ 01533 static Diff3D const & northEast() { return diff(NorthEast); } /**< Offset to the north-east neighbor */ 01534 static Diff3D const & west() { return diff(West); } /**< Offset to the west neighbor */ 01535 static Diff3D const & east() { return diff(East); } /**< Offset to the right neighbor */ 01536 static Diff3D const & southWest() { return diff(SouthWest); } /**< Offset to the south-west neighbor */ 01537 static Diff3D const & south() { return diff(South); } /**< Offset to the south neighbor */ 01538 static Diff3D const & southEast() { return diff(SouthEast); } /**< Offset to the south-east neighbor */ 01539 01540 static Diff3D const & behindNorthWest() { return diff(BehindNorthWest); } /**< Offset to the behind-north-west neighbor */ 01541 static Diff3D const & behindNorth() { return diff(BehindNorth); } /**< Offset to the behind-north neighbor */ 01542 static Diff3D const & behindNorthEast() { return diff(BehindNorthEast); } /**< Offset to the behind-north-east neighbor */ 01543 static Diff3D const & behindEast() { return diff(BehindWest); } /**< Offset to the behind-west neighbor */ 01544 static Diff3D const & behind() { return diff(Behind); } /**< Offset to the behind neighbor */ 01545 static Diff3D const & behindWest() { return diff(BehindEast); } /**< Offset to the behind-right neighbor */ 01546 static Diff3D const & behindSouthWest() { return diff(BehindSouthWest); } /**< Offset to the behind-south-west neighbor */ 01547 static Diff3D const & behindSouth() { return diff(BehindSouth); } /**< Offset to the behind-south neighbor */ 01548 static Diff3D const & behindSouthEast() { return diff(BehindSouthEast); } /**< Offset to the behind-south-east neighbor */ 01549 }; // class Neighborhood3D 01550 01551 01552 /** Export NeighborCode3D::Direction into the scope of namespace Neighborhood3DSix. 01553 */ 01554 typedef NeighborCode3D::Direction Direction; 01555 01556 static const Direction InFrontNorthWest = NeighborCode3D::InFrontNorthWest; /**< Export NeighborCode3D::InFrontNorthWest to namespace Neighborhood3DTwentySix */ 01557 static const Direction InFrontNorth = NeighborCode3D::InFrontNorth; /**< Export NeighborCode3D::InFrontNorth to namespace Neighborhood3DTwentySix */ 01558 static const Direction InFrontNorthEast = NeighborCode3D::InFrontNorthEast; /**< Export NeighborCode3D::InFrontNorthEast to namespace Neighborhood3DTwentySix */ 01559 static const Direction InFrontWest = NeighborCode3D::InFrontWest; /**< Export NeighborCode3D::InFrontWest to namespace Neighborhood3DTwentySix */ 01560 static const Direction InFront = NeighborCode3D::InFront; /**< Export NeighborCode3D::InFront to namespace Neighborhood3DTwentySix */ 01561 static const Direction InFrontEast = NeighborCode3D::InFrontEast; /**< Export NeighborCode3D::InFrontEast to namespace Neighborhood3DTwentySix */ 01562 static const Direction InFrontSouthWest = NeighborCode3D::InFrontSouthWest; /**< Export NeighborCode3D::InFrontSouthWest to namespace Neighborhood3DTwentySix */ 01563 static const Direction InFrontSouth = NeighborCode3D::InFrontSouth; /**< Export NeighborCode3D::InFrontSouth to namespace Neighborhood3DTwentySix */ 01564 static const Direction InFrontSouthEast = NeighborCode3D::InFrontSouthEast; /**< Export NeighborCode3D::InFrontSouthEast to namespace Neighborhood3DTwentySix */ 01565 01566 static const Direction NorthWest = NeighborCode3D::NorthWest; /**< Export NeighborCode3D::NorthWest to namespace Neighborhood3DTwentySix */ 01567 static const Direction North = NeighborCode3D::North; /**< Export NeighborCode3D::North to namespace Neighborhood3DTwentySix */ 01568 static const Direction NorthEast = NeighborCode3D::NorthEast; /**< Export NeighborCode3D::NorthEast to namespace Neighborhood3DTwentySix */ 01569 static const Direction West = NeighborCode3D::West; /**< Export NeighborCode3D::West to namespace Neighborhood3DTwentySix */ 01570 static const Direction East = NeighborCode3D::East; /**< Export NeighborCode3D::East to namespace Neighborhood3DTwentySix */ 01571 static const Direction SouthWest = NeighborCode3D::SouthWest; /**< Export NeighborCode3D::SouthWest to namespace Neighborhood3DTwentySix */ 01572 static const Direction South = NeighborCode3D::South; /**< Export NeighborCode3D::South to namespace Neighborhood3DTwentySix */ 01573 static const Direction SouthEast = NeighborCode3D::SouthEast; /**< Export NeighborCode3D::SouthEast to namespace Neighborhood3DTwentySix */ 01574 01575 static const Direction BehindNorthWest = NeighborCode3D::BehindNorthWest; /**< Export NeighborCode3D::BehindNorthWest to namespace Neighborhood3DTwentySix */ 01576 static const Direction BehindNorth = NeighborCode3D::BehindNorth; /**< Export NeighborCode3D::BehindNorth to namespace Neighborhood3DTwentySix */ 01577 static const Direction BehindNorthEast = NeighborCode3D::BehindNorthEast; /**< Export NeighborCode3D::BehindNorthEast to namespace Neighborhood3DTwentySix */ 01578 static const Direction BehindWest = NeighborCode3D::BehindWest; /**< Export NeighborCode3D::BehindWest to namespace Neighborhood3DTwentySix */ 01579 static const Direction Behind = NeighborCode3D::Behind; /**< Export NeighborCode3D::Behind to namespace Neighborhood3DTwentySix */ 01580 static const Direction BehindEast = NeighborCode3D::BehindEast; /**< Export NeighborCode3D::BehindEast to namespace Neighborhood3DTwentySix */ 01581 static const Direction BehindSouthWest = NeighborCode3D::BehindSouthWest; /**< Export NeighborCode3D::BehindSouthWest to namespace Neighborhood3DTwentySix */ 01582 static const Direction BehindSouth = NeighborCode3D::BehindSouth; /**< Export NeighborCode3D::BehindSouth to namespace Neighborhood3DTwentySix */ 01583 static const Direction BehindSouthEast = NeighborCode3D::BehindSouthEast; /**< Export NeighborCode3D::BehindSouthEast to namespace Neighborhood3DTwentySix */ 01584 01585 static const Direction DirectionCount = NeighborCode3D::DirectionCount; /**< Export NeighborCode3D::DirectionCount to namespace Neighborhood3DTwentySix */ 01586 01587 }//namespace Neighborhood3DTwentySix 01588 01589 /** Export \ref vigra::Neighborhood3DTwentySix::NeighborCode3D into the scope of namespace vigra. 01590 */ 01591 typedef Neighborhood3DTwentySix::NeighborCode3D NeighborCode3DTwentySix; 01592 01593 //@} 01594 01595 } // namespace vigra 01596 01597 #endif /* VIGRA_VOXELNEIGHBORHOOD_HXX */
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|