1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 #include "[Polynomial.h]"19 #include "[MathFunc.h]"20 21 [MATH_BEGIN_NAMESPACE]22 23 int [Polynomial::SolveQuadratic](float a, float b, float c, float &root1, float &root2)24 {25 26 27 28 float radicand = b*b - 4.f * a * c;29 if (radicand < -1[e]-6f) 30 return 0;31 float denom = 1.f / (2.f * a);32 if (radicand < 1[e]-6f) 33 {34 root1 = -b * denom;35 return 1;36 }37 radicand = [Sqrt](radicand);38 root1 = (-b + radicand) * denom;39 root2 = (-b - radicand) * denom;40 return 2;41 }42 43 #if 044 int Polynomial::SolveCubic(float , float , float , float , float & , float & , float & )45 {46 #ifdef _MSC_VER47 #pragma warning(Polynomial::SolveCubic not implemented!)48 #else49 #warning Polynomial::SolveCubic not implemented!50 #endif51 [assume](false && "Polynomial::SolveCubic not implemented!"); 52 return 0;53 }54 55 int Polynomial::SolveQuartic(float , float , float , float , float & , float & , float & , float & )56 {57 #ifdef _MSC_VER58 #pragma warning(Polynomial::SolveQuartic not implemented!)59 #else60 #warning Polynomial::SolveQuartic not implemented!61 #endif62 [assume](false && "Polynomial::SolveQuartic not implemented!"); 63 return 0;64 }65 #endif66 67 [MATH_END_NAMESPACE] Go back to previous page