X-Git-Url: http://git.euphorik.ch/?p=GPU.git;a=blobdiff_plain;f=WCudaMSE%2FStudent_Cuda_Image%2Fsrc%2Fcpp%2Fcore%2F03_Newton%2Fmoo%2Fdevice%2Fmath%2FNewtonMath.h;fp=WCudaMSE%2FStudent_Cuda_Image%2Fsrc%2Fcpp%2Fcore%2F03_Newton%2Fmoo%2Fdevice%2Fmath%2FNewtonMath.h;h=d1dffc72078f7f5f99a72f5b16dedb3e1c163e66;hp=e9b0dd8127348e33236dcdfaa13580ac536010f3;hb=f2c6a4fc79746e2d5c6678699bd2ca93ffc49bcc;hpb=ebdad7dc732d4742d09fd72d312175cb07d27a59 diff --git a/WCudaMSE/Student_Cuda_Image/src/cpp/core/03_Newton/moo/device/math/NewtonMath.h b/WCudaMSE/Student_Cuda_Image/src/cpp/core/03_Newton/moo/device/math/NewtonMath.h index e9b0dd8..d1dffc7 100755 --- a/WCudaMSE/Student_Cuda_Image/src/cpp/core/03_Newton/moo/device/math/NewtonMath.h +++ b/WCudaMSE/Student_Cuda_Image/src/cpp/core/03_Newton/moo/device/math/NewtonMath.h @@ -14,6 +14,14 @@ class NewtonMath C // (-1/2 -sqrt(3)/2) }; + // Les trois solutions du système d'équation : A, B et C (vecteur 2D). + static const float A1 = 1.0; + static const float A2 = 0.0; + static const float B1 = -0.5; // -1.0 / 2.0 + static const float B2 = 0.866025403785; // sqrt(3.0) / 2.0 + static const float C1 = -0.5; // -1.0 / 2.0 + static const float C2 = -0.866025403785; // -sqrt(3.0) / 2.0 + public: /* * n est le nombre d'iteration. @@ -30,15 +38,6 @@ class NewtonMath __device__ void colorXY(uchar4* ptrColor, float x1, float x2) const { - const float A1 = 1.0; - const float A2 = 0.0; - const float B1 = -1.0 / 2.0; - const float B2 = sqrt(3.0) / 2.0; - const float C1 = -1.0 / 2.0; - const float C2 = -sqrt(3.0) / 2.0; - - //const float epsilon = 0.1; - float nearest_current_solution_distance = FLT_MAX; Solution nearest_current_solution = A; @@ -64,7 +63,8 @@ class NewtonMath nearest_current_solution_distance = distance_to_C; } - /*if (Indice2D::tid() == 0) + /* For DEBUG. + * if (Indice2D::tid() == 0) { printf("nearest_current_solution_distance: %f\n", nearest_current_solution_distance); }*/ @@ -73,7 +73,8 @@ class NewtonMath printf("d to a: %f\n", distance_to_A); printf("d to a: %f\n", distance_to_B); printf("d to a: %f\n", distance_to_C); - }*/ + } + */ if (nearest_current_solution_distance < this->epsilon) break; @@ -112,7 +113,7 @@ class NewtonMath __device__ static void nextX(float x1, float x2, float& x1_next, float& x2_next) { - float f_x1 = x1 * x1 * x2 - 3.0 * x1 * x2 * x2 - 1.0; + float f_x1 = x1 * x1 * x1 - 3.0 * x1 * x2 * x2 - 1.0; float f_x2 = x2 * x2 * x2 - 3.0 * x1 * x1 * x2; // La matrice est représentée comme cela :