Fréchet View  1.6.0
A Tool for Exploring Fréchet Distance Algorithms
spirolator.h
Go to the documentation of this file.
1 
2 #ifndef FRECHET_VIEW_SPIROLATOR_H
3 #define FRECHET_VIEW_SPIROLATOR_H
4 
5 namespace frechet { namespace data {
6 
16 class Spirolator {
17 private:
18  int min;
19  int max;
20  int current;
21  int increment;
22 public:
28  Spirolator(int amin, int amax)
29  : min(amin),max(amax),current((amin+amax-1)/2),increment(0)
30  { }
34  operator bool() { return current >= min && current < max; }
38  operator int() { return current; }
44  ++increment;
45  if (increment&1)
46  current += increment; // add odd numbers
47  else
48  current -= increment; // subtract even numbers
49  return *this;
50  }
51 };
52 
53 } } // namespace
54 
55 #endif //FRECHET_VIEW_SPIROLATOR_H
int increment
increment for next step
Definition: spirolator.h:21
Spirolator & operator++()
advance the iterator
Definition: spirolator.h:43
global definitions for all algorithms.
int current
current value
Definition: spirolator.h:20
Spirolator(int amin, int amax)
constructor with number range
Definition: spirolator.h:28
int max
maximaum value
Definition: spirolator.h:19
an integer iterator that goes in "spirals", like this:
Definition: spirolator.h:16
int min
minimum value
Definition: spirolator.h:18