gap_and_valley.h
1 /*
2  * gap_and_valley.cpp
3  *
4  * Copyright 2007 Joey Durham <joey@engineering.ucsb.edu>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 
22 
23 #ifndef GAP_AND_VALLEY_H
24 #define GAP_AND_VALLEY_H
25 
26 #include <vector>
27 
28 extern int getIndex( int circularIdx, int max );
29 extern int sign( double num );
30 extern int getSectorsBetween( int iS1, int iS2, int iSMax );
31 extern int getSectorsBetweenDirected( int iS1, int iS2, int iSMax, int iDirection );
32 
33 class Gap
34 {
35  public :
36  int m_iSector;
37  double m_dist;
38  int m_iDir;
39  bool m_bExplored;
40  bool m_bContaminated;
41 
42  Gap();
43  Gap( int iSector, double dist, int iDir );
44  Gap( Gap* copyFromGap );
45  ~Gap();
46 
47  void Update( int iNewSector, double newDist );
48  void Update( int iNewSector, double newDist, int iNewDir );
49 
50  };
51 
52 // ---------------------------------------------------------------------
53 
54 class Valley
55 {
56  public :
57  Gap* m_pRisingDisc;
58  Gap* m_pOtherDisc;
59  int m_iRisingToOther;
60 
61  Valley();
62  Valley( Gap* risingGap, Gap* otherGap, int risingToOther );
63  virtual ~Valley() {}
64 
65  void overwrite( Gap* risingGap, Gap* otherGap, int risingToOther );
66 
67  int getValleyWidth( std::vector<double> fullLP );
68 
69  bool isSectorInValley( int iSector, int iSMax );
70 };
71 
72 // -------------------------------------------------------------------
73 
74 #endif
Definition: gap_and_valley.h:54
Definition: gap_and_valley.h:33
T max(T a, T b)
Return the maximum of a, b.
Definition: utility.h:122