gap_and_valley.h
00001 /*
00002  *      gap_and_valley.cpp
00003  *
00004  *      Copyright 2007 Joey Durham <joey@engineering.ucsb.edu>
00005  *
00006  *      This program is free software; you can redistribute it and/or modify
00007  *      it under the terms of the GNU General Public License as published by
00008  *      the Free Software Foundation; either version 2 of the License, or
00009  *      (at your option) any later version.
00010  *
00011  *      This program is distributed in the hope that it will be useful,
00012  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *      GNU General Public License for more details.
00015  *
00016  *      You should have received a copy of the GNU General Public License
00017  *      along with this program; if not, write to the Free Software
00018  *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  */
00020 
00021 
00022 
00023 #ifndef GAP_AND_VALLEY_H
00024 #define GAP_AND_VALLEY_H
00025 
00026 #include <vector>
00027 
00028 extern int getIndex( int circularIdx, int max );
00029 extern int sign( double num );
00030 extern int getSectorsBetween( int iS1, int iS2, int iSMax );
00031 extern int getSectorsBetweenDirected( int iS1, int iS2, int iSMax, int iDirection );
00032  
00033 class Gap
00034 {
00035         public :
00036                 int m_iSector;
00037                 double m_dist;
00038                 int m_iDir;
00039                 bool m_bExplored;
00040                 bool m_bContaminated;
00041                 
00042                 Gap();
00043                 Gap( int iSector, double dist, int iDir );
00044                 Gap( Gap* copyFromGap );
00045                 ~Gap();
00046                 
00047                 void Update( int iNewSector, double newDist );
00048                 void Update( int iNewSector, double newDist, int iNewDir );
00049         
00050  };
00051 
00052 // ---------------------------------------------------------------------
00053 
00054 class Valley
00055 {
00056         public :
00057                 Gap* m_pRisingDisc;
00058                 Gap* m_pOtherDisc;
00059                 int m_iRisingToOther;
00060                 
00061                 Valley();
00062                 Valley( Gap* risingGap, Gap* otherGap, int risingToOther );
00063                 virtual ~Valley() {}
00064                 
00065                 void overwrite( Gap* risingGap, Gap* otherGap, int risingToOther );
00066                 
00067                 int getValleyWidth( std::vector<double> fullLP );
00068                 
00069                 bool isSectorInValley( int iSector, int iSMax );
00070 };
00071 
00072 // -------------------------------------------------------------------
00073 
00074 #endif

Last updated 12 September 2005 21:38:45