Flow123d  release_2.2.0-41-g0958a8d
myvector.h
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file myvector.h
15  * @brief
16  */
17 
18 #ifndef vectorH
19 #define vectorH
20 
21 class TPoint;
22 
23 
24 class TVector {
25 protected:
26  static int numberInstance;
27  int id;
28 
29  double coors[ 3 ];
30  double length;
31 
32  int generateId();
33 
34  void Compute();
35  void CompLength();
36 
37 public:
38  TVector();
39  TVector(double, double, double);
41  TVector(const TVector &);
42  ~TVector();
43 
44  double Length() const;
45  void Get(double&, double&, double&) const;
46  void Get(double*) const;
47  double Get(int) const;
48  void SetVector(double, double, double);
49  bool IsZero();
50 
51  double X1() const;
52  double X2() const;
53  double X3() const;
54 
55  TVector & operator =(const TPoint&);
56  TVector operator +(const TVector&);
57  TVector operator +(const TPoint&);
58  TVector operator -(const TVector&);
59  friend TVector operator*(const TVector&, double);
60  friend TVector operator*(double, const TVector&);
61  bool operator ==(const TVector&);
62 
63  static int getNumInstances() {
65  }
66 };
67 
68 TVector Cross(const TVector&, const TVector&);
69 double Dot(const TVector&, const TVector&);
70 bool AreParallel(const TVector&, const TVector&);
71 bool ArePerpendicular(const TVector&, const TVector&);
72 
73 #endif
bool ArePerpendicular(const TVector &, const TVector &)
Definition: vector.cpp:242
double X2() const
Definition: vector.cpp:222
TVector & operator=(const TPoint &)
Definition: vector.cpp:84
~TVector()
Definition: vector.cpp:72
double X1() const
Definition: vector.cpp:218
static int getNumInstances()
Definition: myvector.h:63
bool operator==(const TVector &)
Definition: vector.cpp:209
bool AreParallel(const TVector &, const TVector &)
Definition: vector.cpp:230
double length
Definition: myvector.h:30
double X3() const
Definition: vector.cpp:226
TVector()
Definition: vector.cpp:31
int id
Definition: myvector.h:27
Definition: point.h:27
TVector Cross(const TVector &, const TVector &)
Definition: vector.cpp:180
TVector operator+(const TVector &)
Definition: vector.cpp:94
void CompLength()
Definition: vector.cpp:80
friend TVector operator*(const TVector &, double)
Definition: vector.cpp:137
double Length() const
Definition: vector.cpp:157
double coors[3]
Definition: myvector.h:29
bool IsZero()
Definition: vector.cpp:149
void SetVector(double, double, double)
Definition: vector.cpp:130
TVector operator-(const TVector &)
Definition: vector.cpp:118
void Get(double &, double &, double &) const
Definition: vector.cpp:161
double Dot(const TVector &, const TVector &)
Definition: vector.cpp:197
void Compute()
Definition: vector.cpp:76
int generateId()
Definition: vector.cpp:27
static int numberInstance
Definition: myvector.h:26