[342f33f] | 1 | #ifndef VECTOR_HPP_
|
---|
| 2 | #define VECTOR_HPP_
|
---|
| 3 |
|
---|
| 4 | /** Single vector.
|
---|
| 5 | * basically, just a x[3] but with helpful functions
|
---|
| 6 | */
|
---|
| 7 | class vector {
|
---|
| 8 | public:
|
---|
| 9 | double x[NDIM];
|
---|
| 10 |
|
---|
| 11 | vector();
|
---|
[498a9f] | 12 | vector(double x1, double x2, double x3);
|
---|
[342f33f] | 13 | ~vector();
|
---|
| 14 |
|
---|
| 15 | double Distance(const vector *y) const;
|
---|
| 16 | double PeriodicDistance(const vector *y, const double *cell_size) const;
|
---|
| 17 | double ScalarProduct(const vector *y) const;
|
---|
| 18 | double Projection(const vector *y) const;
|
---|
| 19 | double Norm() const ;
|
---|
| 20 | double Angle(vector *y) const;
|
---|
| 21 |
|
---|
| 22 | void AddVector(const vector *y);
|
---|
| 23 | void SubtractVector(const vector *y);
|
---|
| 24 | void CopyVector(const vector *y);
|
---|
| 25 | void RotateVector(const vector *y, const double alpha);
|
---|
[498a9f] | 26 | void ProjectOntoPlane(const vector *y);
|
---|
[3dfad8] | 27 | void Zero();
|
---|
[498a9f] | 28 | void One(double one);
|
---|
| 29 | void Init(double x1, double x2, double x3);
|
---|
[342f33f] | 30 | void Normalize();
|
---|
| 31 | void Translate(const vector *x);
|
---|
| 32 | void Mirror(const vector *x);
|
---|
| 33 | void Scale(double **factor);
|
---|
| 34 | void Scale(double *factor);
|
---|
| 35 | void Scale(double factor);
|
---|
| 36 | void MatrixMultiplication(double *M);
|
---|
| 37 | void InverseMatrixMultiplication(double *M);
|
---|
| 38 | void KeepPeriodic(ofstream *out, double *matrix);
|
---|
| 39 | void LinearCombinationOfVectors(const vector *x1, const vector *x2, const vector *x3, double *factors);
|
---|
| 40 |
|
---|
[110ceb] | 41 | double CutsPlaneAt(vector *A, vector *B, vector *C);
|
---|
[342f33f] | 42 | bool GetOneNormalVector(const vector *x1);
|
---|
| 43 | bool MakeNormalVector(const vector *y1);
|
---|
| 44 | bool MakeNormalVector(const vector *y1, const vector *y2);
|
---|
| 45 | bool MakeNormalVector(const vector *x1, const vector *x2, const vector *x3);
|
---|
| 46 | bool SolveSystem(vector *x1, vector *x2, vector *y, double alpha, double beta, double c);
|
---|
| 47 | bool LSQdistance(vector **vectors, int dim);
|
---|
| 48 |
|
---|
| 49 | void AskPosition(double *cell_size, bool check);
|
---|
| 50 | bool Output(ofstream *out) const;
|
---|
| 51 | };
|
---|
| 52 |
|
---|
| 53 | ofstream& operator<<(ofstream& ost, vector& m);
|
---|
| 54 | vector& operator+=(vector& a, const vector& b);
|
---|
| 55 | vector& operator*=(vector& a, const double m);
|
---|
| 56 | vector& operator*(const vector& a, const double m);
|
---|
| 57 | vector& operator+(const vector& a, const vector& b);
|
---|
| 58 |
|
---|
| 59 | #endif /*VECTOR_HPP_*/
|
---|