| 141 | |
| 142 | |
| 143 | float DistanceTable::maximum(uint8_t &x, uint8_t &y) |
| 144 | { |
| 145 | float ma = _distanceTable[0]; |
| 146 | x = 0; |
| 147 | y = 0; |
| 148 | for (uint8_t xx = 1; xx < _dimension; xx++) |
| 149 | { |
| 150 | uint16_t index = (xx * (xx - 1))/2; |
| 151 | for (uint8_t yy = 0; yy < xx; yy++) |
| 152 | { |
| 153 | float value = _distanceTable[index + yy]; |
| 154 | if (value > ma) |
| 155 | { |
| 156 | ma = value; |
| 157 | x = xx; |
| 158 | y = yy; |
| 159 | } |
| 160 | else if (_invert) |
| 161 | { |
| 162 | value = -value; |
| 163 | if (value > ma) |
| 164 | { |
| 165 | ma = value; |
| 166 | x = yy; |
| 167 | y = xx; |
| 168 | } |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | return ma; |
| 173 | } |
| 174 | |
| 175 | |
| 176 | float DistanceTable::sum() |