-
Notifications
You must be signed in to change notification settings - Fork 0
/
Eq2degComp.hpp
64 lines (59 loc) · 1.62 KB
/
Eq2degComp.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef __EQ2DEGCOMP_HPP
#define __EQ2DEGCOMP_HPP
/**
* CS-17, Eq2degComp.hpp
* Derived class to manage quadratics equations with complex roots
* a*x^2+b*x+c=0
*
* with the following restrictions:
* The coefficients are real
*
* @author Christophe Gattardi
* @version 1.0 15/03/2020
*/
// //////////////////////////////////////////////////////////////////////
// Import section
// //////////////////////////////////////////////////////////////////////
// STL
#include<complex>
#include <Eq2deg.hpp>
class Eq2degComp: public Eq2deg{
protected:
bool m_complexRoots;
std::vector<std::complex<double>> m_rac;
public:
/**
* @brief Construct a new Eq2degComp object
*
* @param a double: coefficent of x^2
* @param b double: coefficient of x
* @param c double: constant
*/
Eq2degComp(const double& iA, const double& iB, const double& iC );
virtual ~Eq2degComp();
/**
* @brief compute the discriminant
*
*/
virtual void computeDelta();
/**
* @brief Compute the roots
*
*/
virtual void computeRoots();
/**
* @brief Get the root value by number
*
* @param rootNumber the number of the root to retrieve (1 or 2)
* @return double
*/
std::complex<double> getRoot(const int& iRootNumber) const;
private:
/**
* Display of the object.
*
* @return std::string Dump of the object.
*/
virtual std::string describe() const;
};
#endif //__EQ2DEGCOMP_HPP