00001 //---------------------------------------------------------------------------- 00002 /** @file SgNbIterator.cpp 00003 */ 00004 //---------------------------------------------------------------------------- 00005 00006 #include "SgSystem.h" 00007 #include "SgNbIterator.h" 00008 00009 using namespace std; 00010 00011 //---------------------------------------------------------------------------- 00012 00013 SgNb4Iterator::Precomp::Precomp() 00014 { 00015 for (SgGrid row = 1; row <= SG_MAX_SIZE; ++row) 00016 for (SgGrid col = 1; col <= SG_MAX_SIZE; ++col) 00017 { 00018 SgPoint p = SgPointUtil::Pt(col, row); 00019 m_nb[p][0] = p - SG_NS; 00020 m_nb[p][1] = p - SG_WE; 00021 m_nb[p][2] = p + SG_WE; 00022 m_nb[p][3] = p + SG_NS; 00023 } 00024 } 00025 00026 const SgNb4Iterator::Precomp SgNb4Iterator::s_precomp; 00027 00028 //---------------------------------------------------------------------------- 00029 00030 const int SgNb4DiagIterator::s_diag[4] = { 00031 -SG_NS - SG_WE, 00032 -SG_NS + SG_WE, 00033 +SG_NS - SG_WE, 00034 +SG_NS + SG_WE 00035 }; 00036 00037 //---------------------------------------------------------------------------- 00038 00039 const int SgNb8Iterator::s_nb8[8] = { 00040 -SG_NS - SG_WE, 00041 -SG_NS, 00042 -SG_NS + SG_WE, 00043 -SG_WE, 00044 +SG_WE, 00045 +SG_NS - SG_WE, 00046 +SG_NS, 00047 +SG_NS + SG_WE 00048 }; 00049 00050 //---------------------------------------------------------------------------- 00051