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