src/ringFinder.h

changeset 1217
314e12e23c3a
parent 968
4b93b7963456
child 1222
34def2630300
equal deleted inserted replaced
1216:12f9ea615cbc 1217:314e12e23c3a
37 37
38 // A solution whose components fill the desired ring space. 38 // A solution whose components fill the desired ring space.
39 class Solution 39 class Solution
40 { 40 {
41 public: 41 public:
42 inline void addComponent (const Component& a); 42 inline void addComponent(const Component& a);
43 inline const QVector<Component>& getComponents() const; 43 inline const QVector<Component>& getComponents() const;
44 void scaleComponents (double scale); 44 void scaleComponents(double scale);
45 bool isSuperiorTo (const Solution* other) const; 45 bool isSuperiorTo(const Solution* other) const;
46 46
47 private: 47 private:
48 QVector<Component> m_components; 48 QVector<Component> m_components;
49 }; 49 };
50 50
51 RingFinder(); 51 RingFinder();
52 52
53 inline const QVector<Solution>& allSolutions() const; 53 inline const QVector<Solution>& allSolutions() const;
54 inline const Solution* bestSolution() const; 54 inline const Solution* bestSolution() const;
55 bool findRings (double r0, double r1); 55 bool findRings(double r0, double r1);
56 56
57 private: 57 private:
58 QVector<Solution> m_solutions; 58 QVector<Solution> m_solutions;
59 const Solution* m_bestSolution; 59 const Solution* m_bestSolution;
60 int m_stack; 60 int m_stack;
61 61
62 bool findRingsRecursor (double r0, double r1, Solution& currentSolution); 62 bool findRingsRecursor(double r0, double r1, Solution& currentSolution);
63 }; 63 };
64 64
65 // 65 //
66 // Gets the components of a solution 66 // Gets the components of a solution
67 // 67 //
71 } 71 }
72 72
73 // 73 //
74 // Adds a component to a solution 74 // Adds a component to a solution
75 // 75 //
76 inline void RingFinder::Solution::addComponent (const Component& a) 76 inline void RingFinder::Solution::addComponent(const Component& a)
77 { 77 {
78 m_components.push_back (a); 78 m_components.push_back(a);
79 } 79 }
80 80
81 // 81 //
82 // Returns the solution that was considered best. Returns null 82 // Returns the solution that was considered best. Returns null
83 // if there isn't any suitable solution. 83 // if there isn't any suitable solution.

mercurial