]> Shamusworld >> Repos - architektonas/blob - src/base/vectorsolutions.h
Initial import
[architektonas] / src / base / vectorsolutions.h
1 #ifndef __VECTORSOLUTIONS_H__
2 #define __VECTORSOLUTIONS_H__
3
4 #include <iostream>                                                             // Needed for 'friend ostream' below
5 #include "vector.h"
6
7 /**
8  * Represents one to 4 vectors. Typically used to return multiple
9  * solutions from a function.
10  */
11 class VectorSolutions
12 {
13         public:
14                 VectorSolutions();
15                 VectorSolutions(const VectorSolutions & s);
16                 VectorSolutions(int num);
17                 VectorSolutions(const Vector & v1);
18                 VectorSolutions(const Vector & v1, const Vector & v2);
19                 VectorSolutions(const Vector & v1, const Vector & v2, const Vector & v3);
20                 VectorSolutions(const Vector & v1, const Vector & v2, const Vector & v3,
21                         const Vector & v4);
22                 VectorSolutions(const Vector & v1, const Vector & v2, const Vector & v3,
23                         const Vector & v4, const Vector & v5);
24
25                 ~VectorSolutions();
26
27                 void alloc(int num);
28                 void clean();
29                 Vector get(int i) const;
30                 int getNumber() const;
31                 bool hasValid() const;
32                 void set(int i, const Vector & v);
33                 void setTangent(bool t);
34                 bool isTangent() const;
35                 Vector getClosest(const Vector & coord, double * dist = NULL, int * index = NULL) const;
36                 void rotate(Vector center, double ang);
37                 void scale(Vector center, Vector factor);
38
39                 VectorSolutions operator=(const VectorSolutions & s);
40
41                 friend std::ostream & operator<<(std::ostream & os, const VectorSolutions & s);
42
43         private:
44                 Vector * vector;
45                 int num;
46                 bool tangent;
47 };
48
49 #endif  // __VECTORSOLUTIONS_H__