www.pudn.com > cad3d.zip > CubicEquation.h
// CubicEquation.h: interface for the CCubicEquation class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_CUBICEQUATION_H__9C8033D9_FE51_4AE8_84E3_C6B98668F893__INCLUDED_) #define AFX_CUBICEQUATION_H__9C8033D9_FE51_4AE8_84E3_C6B98668F893__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include#include "stdInclude.h" #include "Check.h" #include "3DMath/3DMath.h" class MATH3D_API CCubicEquation { public: math_complex m_solutions[3]; //solving the equation x^3 + px + q = 0 void Solve(double dP, double dQ); math_complex GetCubicRoot(const math_complex& x); public: CCubicEquation(double dA, double dB, double dC, double dD); CCubicEquation(double dP, double dQ);//Kardano form virtual ~CCubicEquation(); inline const math_complex& GetSolution(int i) const; }; inline const math_complex& CCubicEquation::GetSolution(int i) const { CHECK_INDEX_02(i); return m_solutions[i]; } #endif // !defined(AFX_CUBICEQUATION_H__9C8033D9_FE51_4AE8_84E3_C6B98668F893__INCLUDED_)