#include <obstacle_grid.h>
Inherited by _classes_ [private].
Inheritance diagram for VectorHash:

| Public Methods | |
| operator unsigned int () const | |
| The constructor of this class only takes a Vector for an argument and converts that to hashval . More... | |
| VectorHash () | |
| void | operator= (const VectorHash &oth) | 
| VectorHash (const VectorHash &oth) | |
| VectorHash (const Vector &coord) | |
| bool | operator== (const VectorHash &oth) const | 
| An equal comparism function between two VectorHash es. Since hashval is pre-calculated, all this function needs to do is check for equality. More... | |
| bool | operator< (const VectorHash &oth) const | 
| A less than comparism function between two VectorHash es that allows for sorting. Since hashval is pre-calculated, all this function needs to do is check if our hashval is less than the other. More... | |
| Static Public Methods | |
| const float | shortWidth () | 
| A constant unexact default for the width of a Surface . More... | |
| Public Attributes | |
| unsigned int | hashval | 
| hashval is the stored hash value used for hasty comparisms. More... | |
| Static Public Attributes | |
| const float | ScaleAmt = (float)(2.) | 
| this constant is one divided by the width/height of each 'square' used for collisions with Obstacle s. More... | |
| Static Private Methods | |
| float | frem (float a, float b) | 
| An internal remainder function that only returns a positive remainder between two floats. More... | |
VectorHash is a hash value used for fast sorting between (2-dimensional) Vector s. This class goes in a board x spaces forward and then y times a fake width for the Surface. This is allowed to be slightly in-accurate because of unlikeliness of getting the same number twice between the range of a short int.
| 
 | 
| 
 
 00031                   {
00032         hashval=0;
00033     }
 | 
| 
 | 
| 
 
 | 
| 
 | 
| 
 
 00038                                      {
00039         Vector crd (coord.Scale(ScaleAmt));
00040         hashval =((unsigned int)((frem(floor(crd.i),shortWidth()))+(shortWidth()*floor(crd.j))));
00041     }
 | 
| 
 | ||||||||||||
| An internal remainder function that only returns a positive remainder between two floats. 
 
 00013                                          {
00014         float ne=fmod(a,b);
00015         if (ne<0) {
00016             return b+ne;
00017         } else {
00018             return ne;
00019         }
00020     }
 | 
| 
 | 
| The constructor of this class only takes a Vector for an argument and converts that to hashval . 
 
 00028                                           {
00029         return hashval;
00030     }
 | 
| 
 | 
| A less than comparism function between two VectorHash es that allows for sorting. Since hashval is pre-calculated, all this function needs to do is check if our hashval is less than the other. 
 
 | 
| 
 | 
| 
 
 | 
| 
 | 
| An equal comparism function between two VectorHash es. Since hashval is pre-calculated, all this function needs to do is check for equality. 
 
 | 
| 
 | 
| A constant unexact default for the width of a Surface . 
 
 00025 {return 65536-129;} 
 | 
| 
 | 
| hashval is the stored hash value used for hasty comparisms. 
 | 
| 
 | 
| this constant is one divided by the width/height of each 'square' used for collisions with Obstacle s. 
 | 
 1.2.15
1.2.15