Logo Search packages:      
Sourcecode: k3dsurf version File versions  Download package

******************************************************************************void Model3D::calcul_objet3 (  ) 

Calculate the grid

We will try to resove HP

In This code we attempt resolve some missing Points

============= First case : DL = Down-Left=====================

============= Second case : HL = Height-Left ============

============= Third case : HR = Height-Right ============

============= Fourth case : DR = Height-Right ============

==================================

=========================

=========================

============= Fourth case : DR = Height-Right ============

Definition at line 4225 of file Model3D.cpp.

                             {
    double vals[] = {0,0,0,0,0,0};
    double vals2[] = {0,0,0,0,0,0};
    double iprime, jprime, valeur_de_fct_implicite;
    double spherical_val, cylindrical_val, U_step, V_step;

// we initialise the hidden_points array so all points are ready to be drawn
   for(int j=0; j < nb_ligne   ; j++)
    for (int i=0; i < nb_colone  ; i++)
         hidden_points[j][i]    =  1;
         there_is_hidden_points = -1;
// this is for the morph effect...
if(morph_param >= 0.0) {
 vals[2] = vals2[2] = morph_param ;
}
else {
 vals[2] = vals2[2] = -morph_param ;
}
morph_param -= step ;
if( morph_param <= -1) morph_param = 1;

if ( supershape == 1){
double r1, r2;
  // Begin First case : n = 1, 3, 5.....
//  if(coefficent_fct_implicite_parity == 1)
    for(int j=0; j < nb_ligne   ; j++) {
    jprime = (double)j/(double)(nb_ligne -1 ) ;
    jprime = jprime * dif_u  + u_inf;
     for (int i=0; i < nb_colone   ; i++)
       {
   iprime = (double)i/(double)(nb_colone-1 ) ;
   iprime = iprime * dif_v + v_inf;
   r1 = pow(
        pow(fabs(cos(m1*jprime/4)/a_1), n2_1) +
        pow(fabs(sin(m1*jprime/4)/b_1), n3_1)
        , -1/n1_1);

   r2 = pow(
        pow(fabs(cos(m2*iprime/4)/a_2), n2_2) +
        pow(fabs(sin(m2*iprime/4)/b_2), n3_2)
        , -1/n1_2);

   Tre2[j*3    ][i]  = r1 * cos(jprime) * r2 * cos(iprime);
   Tre2[j*3 + 1][i]  = r1 * sin(jprime) * r2 * cos(iprime);
   Tre2[j*3 + 2][i]  = r2 * sin(iprime);
  }       }

  // End of first case : n = 1, 3, 5.....
}

 else if (cylindricaldef == 1){

  // Begin First case : n = 1, 3, 5.....
//  if(coefficent_fct_implicite_parity == 1)
    for(int j=0; j < nb_ligne   ; j++) {
    jprime = (double)j/(double)(nb_ligne -1 ) ;
    jprime = jprime * dif_u  + u_inf;
  for (int i=0; i < nb_colone   ; i++)
      {
   iprime = (double)i/(double)(nb_colone-1 ) ;
   iprime = iprime * dif_v + v_inf;

   vals[0]=jprime; vals[1]=iprime;   // u = jprime ; v = iprime;

   vals[3] = cos(jprime) ; // because  X = cos(u)
   vals[4] = sin(jprime);  // because  Y = sin(u)
   vals[5] = iprime  ;     // because  Z = v
   cylindrical_val = myParser_cylindrical.Eval(vals) ;

   (cylindrical_val  >= 0 ) ?
   cylindrical_val  =  pow(cylindrical_val, 1/coefficent_fct_implicite) :
   cylindrical_val  = -pow(-cylindrical_val, 1/coefficent_fct_implicite);

   Tre2[j*3    ][i]  = vals[3] * cylindrical_val;
   Tre2[j*3 + 1][i]  = vals[4] * cylindrical_val;
   Tre2[j*3 + 2][i]  = vals[5] ;

  }      }

  // End of first case : n = 1, 3, 5.....
}
else if (sphericaldef == 1){

  // Begin First case : n = 1, 3, 5.....
//  if(coefficent_fct_implicite_parity == 1)
    for(int j=0; j < nb_ligne   ; j++) {
    jprime = (double)j/(double)(nb_ligne -1 ) ;
    jprime = jprime * dif_u  + u_inf;
     for (int i=0; i < nb_colone   ; i++)
    {
   iprime = (double)i/(double)(nb_colone-1 ) ;
   iprime = iprime * dif_v + v_inf;

   vals[0]=jprime; vals[1]=iprime;   // u = jprime ; v = iprime;


//double supershape(double n1, double n2, double n3, int m, double a, double b, double teta)
   vals[3] = cos(iprime)*cos(jprime) ; // because  X = cos(v)*cos(u)
   vals[4] = sin(iprime)*cos(jprime);  // because  Y = sin(v)*cos(u)
   vals[5] = sin(jprime)  ;            // because  Z = sin(u)
   spherical_val = myParser_spherical.Eval(vals) ;

   (spherical_val  >= 0 ) ?
   spherical_val  =  pow(spherical_val, 1/coefficent_fct_implicite) :
   spherical_val  = -pow(-spherical_val, 1/coefficent_fct_implicite);

   Tre2[j*3    ][i]  = vals[3] * spherical_val;
   Tre2[j*3 + 1][i]  = vals[4] * spherical_val;
   Tre2[j*3 + 2][i]  = vals[5] * spherical_val;


  }   }

  // End of first case : n = 1, 3, 5.....
}
else

if(sixdimshapes == 1){

  for(int j=0; j < nb_ligne   ; j++) {
    jprime = (double)j/(double)(nb_ligne -1 ) ;
    jprime = jprime * dif_u  + u_inf;
 for (int i=0; i < nb_colone   ; i++)
      {
   iprime = (double)i/(double)(nb_colone-1 ) ;
   iprime = iprime * dif_v + v_inf;

   vals[0]=jprime; vals[1]=iprime;

   shape6D[j*6    ][i]  = vals[3] = myParserX.Eval(vals);
   shape6D[j*6 + 1][i]  = vals[4] = myParserY.Eval(vals);
   shape6D[j*6 + 2][i]            = myParserZ.Eval(vals);
   shape6D[j*6 + 3][i]            = myParserW.Eval(vals);
   shape6D[j*6 + 4][i]            = myParserT.Eval(vals);
   shape6D[j*6 + 5][i]            = myParserS.Eval(vals);
  }    }

   boite_englobante6D();
   project_6D_to_5D();
   project_5D_to_4D();
   project_4D_to_3D();

                  }
else

if(fivedimshapes == 1){

  for(int j=0; j < nb_ligne   ; j++) {
    jprime = (double)j/(double)(nb_ligne -1 ) ;
    jprime = jprime * dif_u  + u_inf;
  for (int i=0; i < nb_colone   ; i++)
   {
   iprime = (double)i/(double)(nb_colone-1 ) ;
   iprime = iprime * dif_v + v_inf;

   vals[0]=jprime; vals[1]=iprime;

   shape5D[j*5    ][i]  = vals[3] = myParserX.Eval(vals);
   shape5D[j*5 + 1][i]  = vals[4] = myParserY.Eval(vals);
   shape5D[j*5 + 2][i]            = myParserZ.Eval(vals);
   shape5D[j*5 + 3][i]            = myParserW.Eval(vals);
   shape5D[j*5 + 4][i]            = myParserT.Eval(vals);
  }     }

   boite_englobante5D();
   project_5D_to_4D();
   project_4D_to_3D();
                  }

else

if(fourdimshapes == 1){
  for(int j=0; j < nb_ligne   ; j++) {
    jprime = (double)j/(double)(nb_ligne -1 ) ;
    jprime = jprime * dif_u  + u_inf;
  for (int i=0; i < nb_colone   ; i++)
  {
   iprime = (double)i/(double)(nb_colone-1 ) ;
   iprime = iprime * dif_v + v_inf;

   vals[0]=jprime; vals[1]=iprime;

   vals[3] = shape4D[j*4    ][i]  = myParserX.Eval(vals);
   vals[4] = shape4D[j*4 + 1][i]  = myParserY.Eval(vals);
   shape4D[j*4 + 2][i]  = myParserZ.Eval(vals);
   shape4D[j*4 + 3][i]  = myParserW.Eval(vals);
  }     }

   boite_englobante4D();
   project_4D_to_3D();
                  }

else


if(two_system == -1)     // Just one system...cooooooooooool
 if(  implicitdef != 1 )    {
 // in this case we have a simple equation system...
  if(there_is_condition == -1) // No condition to verify
  for(int j=0; j < nb_ligne   ; j++) {
    jprime = (double)j/(double)(nb_ligne -1 ) ;
    jprime = jprime * dif_u  + u_inf;

  for (int i=0; i < nb_colone   ; i++)
  {
   iprime = (double)i/(double)(nb_colone-1 ) ;
   iprime = iprime * dif_v + v_inf;
   vals[0]=jprime; vals[1]=iprime;

   vals[3] = Tre2[j*3    ][i]  = myParserX.Eval(vals);
   vals[4] = Tre2[j*3 + 1][i]  = myParserY.Eval(vals);
   Tre2[j*3 + 2][i]  = myParserZ.Eval(vals);
  }
   } // End of if(there_is_condition == -1)

  // Here There is a condition to verify
  else {
       /// Calculate the grid
   for(int j=0; j < nb_ligne   ; j++) {
    jprime = (double)j/(double)(nb_ligne -1 ) ;
    jprime = jprime * dif_u  + u_inf;
 for (int i=0; i < nb_colone   ; i++) {
   iprime = (double)i/(double)(nb_colone-1 ) ;
   iprime = iprime * dif_v + v_inf;

   vals[0]=jprime; vals[1]=iprime;

   vals[3] = Tre2[j*3    ][i]  = myParserX.Eval(vals);
   vals[4] = Tre2[j*3 + 1][i]  = myParserY.Eval(vals);
   vals[5] = Tre2[j*3 + 2][i]  = myParserZ.Eval(vals);
       if( myParser_condition.Eval(vals) == 0) {
          hidden_points[j][i] = 0;
          there_is_hidden_points = 1; //
                                                }
                                            }
                                        }
        /// We will try to resove HP

  } // End  There is a condition to verify

} // End  if(  implicitdef != 1 )
// here we are going to work with implicit equation...

 else
   {
  // Begin First case : n = 1, 3, 5...
  if(coefficent_fct_implicite_parity == 1)
    for(int j=0; j < nb_ligne   ; j++) {
    jprime = (double)j/(double)(nb_ligne -1 ) ;
    jprime = jprime * dif_u  + u_inf;

  for (int i=0; i < nb_colone   ; i++)
   {
   iprime = (double)i/(double)(nb_colone-1 ) ;
   iprime = iprime * dif_v + v_inf;
   vals[0]=jprime; vals[1]=iprime;
   vals[3] = Tre2[j*3    ][i]  = jprime; // because  X = u
   vals[4] = Tre2[j*3 + 1][i]  = iprime; // because  Y = v
   //Tre2[j*3 + 2][i]  = pow(myParserZ.Eval(vals), 1/coefficent_fct_implicite);

   valeur_de_fct_implicite = myParserZ.Eval(vals) ;
   (valeur_de_fct_implicite  >= 0 ) ?
   Tre2[j*3 + 2][i]  = pow(valeur_de_fct_implicite, 1/coefficent_fct_implicite) :
   Tre2[j*3 + 2][i]  = -pow(-valeur_de_fct_implicite, 1/coefficent_fct_implicite);

  }    }

  // End of first case : n = 1, 3, 5...

  // Begin Second case : n = 2, 4, 6.....

 else {
// We begin with half of the grid...be careful...
  for(int j=0; j < nb_ligne ; j++) {
    jprime = (double)j/(double)(nb_ligne -1 ) ;
    jprime = jprime * dif_u  + u_inf;

  for (int i=0; i < nb_colone   ; i++)
{
   iprime = (double)i/(double)(nb_colone -1 ) ;
   iprime = iprime * dif_v + v_inf;
   vals[0]= vals[3] = jprime; vals[1] = vals[4] = iprime;

   Tre2[j*3    ][i]  =  jprime;
   Tre2[j*3 + 1][i]  =  iprime;
   valeur_de_fct_implicite = myParserZ.Eval(vals) ;

   if (valeur_de_fct_implicite  >= 0 )  Tre2[j*3 + 2][i] =  pow(valeur_de_fct_implicite, 1/coefficent_fct_implicite);


   else  {
   hidden_points[j][i]  = 0;
   there_is_hidden_points = 1; // we give the signal to take care of the fact that we have some HP
   }
 }
}


//we tray to fix some points of the grid

  for(int j=0; j < nb_ligne -1   ; j++)
    for (int i=0; i < nb_colone -1  ; i++)
         {
      if((hidden_points[j  ][i  ] +
          hidden_points[j+1][i  ] +
          hidden_points[j+1][i+1] +
          hidden_points[j  ][i+1]) >=3)
         {
   if(hidden_points[j][i] == 0)
       Tre2[j*3 + 2][i] = (Tre2[(j+1)*3 + 2][i] + Tre2[j*3 + 2][i+1])/2;

   else if(hidden_points[j+1][i] == 0)
       Tre2[(j+1)*3 + 2][i] = (Tre2[(j+1)*3 + 2][i+1] + Tre2[j*3 + 2][i])/2;

   else if(hidden_points[j+1][i+1] == 0)
       Tre2[(j+1)*3 + 2][i+1] = (Tre2[(j+1)*3 + 2][i] + Tre2[j*3 + 2][i+1])/2;

   else if(hidden_points[j][i+1] == 0)
       Tre2[j*3 + 2][i+1] = (Tre2[j*3 + 2][i] + Tre2[(j+1)*3 + 2][i+1])/2;
                  }
          }
/*
// The new way to calculate the new values to replace HP
if(there_is_hidden_points == 1){

 U_step = (double)dif_u/(double)( (nb_colone-1) * precision) ;
 V_step = (double)dif_v/(double)( (nb_colone-1) * precision) ;

  for(int j=0; j < nb_ligne -1   ; j++)
    for (int i=0; i < nb_colone -1  ; i++)
      if((hidden_points[j][i]     +
          hidden_points[j+1][i]   +
          hidden_points[j+1][i+1] +
          hidden_points[j][i+1])    >=3)
          {
   // DL = Down-Left
   if(hidden_points[j][i] == 0)
          for(int k=1; k < 11   ; k++)  {
   DL2[j*3    ][i] = vals[0] = vals[3] = (Tre2[j*3    ][i] + (double)k*(double)U_step);
   DL2[j*3 + 1][i] = vals[1] = vals[4] = (Tre2[j*3 + 1][i] + (double)k*(double)V_step);
   valeur_de_fct_implicite = myParserZ.Eval(vals) ;
   if(valeur_de_fct_implicite >=0) {
   DL2[j*3 + 2][i] =  pow(valeur_de_fct_implicite, 1/coefficent_fct_implicite);
   k = 10;
                                   }
                          }
   // HL = Height-Left
   else if(hidden_points[j+1][i] == 0)
          for(int k=1; k < 11   ; k++)   {
   HL2[(j+1)*3    ][i] = vals[0] = vals[3] = (Tre2[(j+1)*3    ][i] - (double)k*(double)U_step);
   HL2[(j+1)*3 + 1][i] = vals[1] = vals[4] = (Tre2[(j+1)*3 + 1][i] + (double)k*(double)V_step);
   valeur_de_fct_implicite = myParserZ.Eval(vals) ;
   if(valeur_de_fct_implicite >=0) {
   HL2[(j+1)*3 + 2][i] =  pow(valeur_de_fct_implicite, 1/coefficent_fct_implicite);
   k = 10;
                                   }
                               }
   // HR = Height-Right
   else if(hidden_points[j+1][i+1] == 0)
          for(int k=1; k < 11   ; k++)   {
   HR2[(j+1)*3    ][i+1] = vals[0] = vals[3] = (Tre2[(j+1)*3    ][i+1] - (double)k*(double)U_step);
   HR2[(j+1)*3 + 1][i+1] = vals[1] = vals[4] = (Tre2[(j+1)*3 + 1][i+1] - (double)k*(double)V_step);
   valeur_de_fct_implicite = myParserZ.Eval(vals) ;
   if(valeur_de_fct_implicite >=0) {
   HR2[(j+1)*3 + 2][i+1] =  pow(valeur_de_fct_implicite, 1/coefficent_fct_implicite);
   k = 10;
                                   }
                               }
   // DR = Down-Right
   else if(hidden_points[j][i+1] == 0)
          for(int k=1; k < 11   ; k++)   {
   DR2[j*3    ][i+1] = vals[0] = vals[3] = (Tre2[j*3    ][i+1] + (double)k*(double)U_step);
   DR2[j*3 + 1][i+1] = vals[1] = vals[4] = (Tre2[j*3 + 1][i+1] - (double)k*(double)V_step);
   valeur_de_fct_implicite = myParserZ.Eval(vals) ;
   if(valeur_de_fct_implicite >=0) {
   DR2[j*3 + 2][i+1] =  pow(valeur_de_fct_implicite, 1/coefficent_fct_implicite);
   k = 10;
                                   }
                                }

                  }   // End of   if((hidden_points[j][i]+...)
}; // End of if(there_is_hidden_points == 1)
*/


   }  // End of Second case : n = 2, 4, 6...

   } // end of implicit equation...

//================ Begin treatement of two systemes ============

 else {

moitie_colone = nb_colone/2;

// We begin with half of the grid...be careful...
  for(int j=0; j < nb_ligne   ; j++) {
    jprime = (double)j/(double)(nb_ligne -1 ) ;
    jprime = jprime * dif_u  + u_inf;

  for (int i=0; i < moitie_colone   ; i++)
{
   iprime = (double)i/(double)(moitie_colone -1 ) ;
   iprime = iprime * dif_v + v_inf;

   vals[0]=jprime; vals[1]=iprime;

   vals[3] = Tre2[j*3    ][i]  = myParserX.Eval(vals);
   vals[4] = Tre2[j*3 + 1][i]  = myParserY.Eval(vals);
   vals[5] = Tre2[j*3 + 2][i]  = myParserZ.Eval(vals);
   /*
          if( myParser_condition.Eval(vals) == 0) {
          hidden_points[j][i] = 0;
          there_is_hidden_points = 1; //
                                                }
   */
 }
                                       }

// we finish the remaining of the grid...
  for(int j=0; j < nb_ligne   ; j++) {
    jprime = (double)j/(double)(nb_ligne -1 ) ;
    jprime = jprime * dif_u_2  + u_inf_2;

  for (int i=moitie_colone-1; i < nb_colone   ; i++)
      {
   iprime = (double)(i - moitie_colone+1)/(double)(nb_colone - moitie_colone ) ;
   iprime = iprime * dif_v_2 + v_inf_2;

   vals2[0]=jprime; vals2[1]=iprime;

   vals2[3] = Tre2[j*3    ][i]  = myParserX_2.Eval(vals2);
   vals2[4] = Tre2[j*3 + 1][i]  = myParserY_2.Eval(vals2);
   vals2[5] = Tre2[j*3 + 2][i]  = myParserZ_2.Eval(vals2);
   /*
          if( myParser_condition.Eval(vals2) == 0) {
          hidden_points[j][i] = 0;
          there_is_hidden_points = 1; //
                                                }
   */
  }
                                       }

}

/// In This code we attempt resolve some missing Points
// DB=Defined Border, NDB=Non defined Border, MP = Middle Point

double DB_X, DB_Y,
       NDB_X, NDB_Y,
       MP_X, MP_Y;
int    precision_step, i, j;


if(there_is_condition == 1 && implicitdef != 1) {

 U_step =  dif_u/(double)(nb_ligne  -1);
 V_step =  dif_v/(double)(nb_colone -1);

// In this case, we have just one missing point

  for(j=0; j < nb_ligne -1   ; j++)
    for (i=0; i < nb_colone -1  ; i++)

      if((hidden_points[j  ][i  ]  +
          hidden_points[j+1][i  ]  +
          hidden_points[j+1][i+1]  +
          hidden_points[j  ][i+1]) >=3)
 {
///============= First case : DL = Down-Left=====================
   if(hidden_points[j][i] == 0) {
   // initialisation
   DB_X  =  ((double)(j+1)) * U_step + u_inf;
   DB_Y  =  ((double)(i+1)) * V_step + v_inf;
   //DB_X  =  ((double)(j+1)) * U_step + u_inf;
   //DB_Y  =  ((double)(i)) * V_step + v_inf;

   NDB_X =  ((double)(j)) * U_step + u_inf;
   NDB_Y =  ((double)(i)) * V_step + v_inf;

   DL2[j*3    ][i] = Tre2[(j+1)*3    ][i];
   DL2[j*3 + 1][i] = Tre2[(j+1)*3 + 1][i];
   DL2[j*3 + 2][i] = Tre2[(j+1)*3 + 2][i];

   precision_step = 0; // Approximation by 2^5
   while ( precision_step < 5){
         MP_X = (DB_X + NDB_X)/2;
         MP_Y = (DB_Y + NDB_Y)/2;
   // We compute this point and look if it fulfill the condition
   // If yes => DB = MP; else NDB = MP;

   vals[0] = MP_X;
   vals[1] = MP_Y;
   vals[3] = myParserX.Eval(vals);
   vals[4] = myParserY.Eval(vals);
   vals[5] = myParserZ.Eval(vals);

   if( myParser_condition.Eval(vals) == 0) {
   NDB_X = MP_X;
   NDB_Y = MP_Y;
       } // End of if( myParser_condition.Eval(vals) == 0)
   else {
   DB_X = MP_X;
   DB_Y = MP_Y;
   DL2[j*3    ][i] = vals[3];
   DL2[j*3 + 1][i] = vals[4];
   DL2[j*3 + 2][i] = vals[5];
        }
   precision_step++;
   }// End of while ( precision_step < 5)...

   } // End of if(hidden_points[j][i] == 0)


///============= Second case : HL = Height-Left ============

   else if(hidden_points[j+1][i] == 0) {
   // initialisation
   DB_X  =  ((double)(j))   * U_step + u_inf;
   DB_Y  =  ((double)(i+1)) * V_step + v_inf;

   //DB_X  =  ((double)(j+1))   * U_step + u_inf;
   //DB_Y  =  ((double)(i+1)) * V_step + v_inf;

   NDB_X =  ((double)(j+1)) * U_step + u_inf;
   NDB_Y =  ((double)(i))   * V_step + v_inf;

   HL2[(j+1)*3    ][i] = Tre2[(j+1)*3    ][i+1];
   HL2[(j+1)*3 + 1][i] = Tre2[(j+1)*3 + 1][i+1];
   HL2[(j+1)*3 + 2][i] = Tre2[(j+1)*3 + 2][i+1];

   precision_step = 0; // Approximation by 2^5

   while ( precision_step < 5){
         MP_X = (DB_X + NDB_X)/2;
         MP_Y = (DB_Y + NDB_Y)/2;
   // We compute this point and look if it fulfill the condition
   // If yes => DB = MP; else NDB = MP;

   vals[0] = MP_X;
   vals[1] = MP_Y;
   vals[3] = myParserX.Eval(vals);
   vals[4] = myParserY.Eval(vals);
   vals[5] = myParserZ.Eval(vals);

   if( myParser_condition.Eval(vals) == 0) {
   NDB_X = MP_X;
   NDB_Y = MP_Y;
       } // End of if( myParser_condition.Eval(vals) == 0)
   else {
   DB_X = MP_X;
   DB_Y = MP_Y;
   HL2[(j+1)*3    ][i] = vals[3];
   HL2[(j+1)*3 + 1][i] = vals[4];
   HL2[(j+1)*3 + 2][i] = vals[5];
        }
   precision_step++;
   }// End of while ( precision_step < 5)...
   } // End of if(hidden_points[j][i] == 0)


///============= Third case : HR = Height-Right ============

   else if(hidden_points[j+1][i+1] == 0) {
   // initialisation
   DB_X  =  ((double)(j))   * U_step + u_inf;
   DB_Y  =  ((double)(i))   * V_step + v_inf;
   //DB_X  =  ((double)(j))   * U_step + u_inf;
   //DB_Y  =  ((double)(i+1))   * V_step + v_inf;

   NDB_X =  ((double)(j+1)) * U_step + u_inf;
   NDB_Y =  ((double)(i+1)) * V_step + v_inf;

   HR2[(j+1)*3    ][i+1] = Tre2[j*3    ][i+1];
   HR2[(j+1)*3 + 1][i+1] = Tre2[j*3 + 1][i+1];
   HR2[(j+1)*3 + 2][i+1] = Tre2[j*3 + 2][i+1];

   precision_step = 0; // Approximation by 2^5

   while ( precision_step < 5){
         MP_X = (DB_X + NDB_X)/2;
         MP_Y = (DB_Y + NDB_Y)/2;
   // We compute this point and look if it fulfill the condition
   // If yes => DB = MP; else NDB = MP;

   vals[0] = MP_X;
   vals[1] = MP_Y;
   vals[3] = myParserX.Eval(vals);
   vals[4] = myParserY.Eval(vals);
   vals[5] = myParserZ.Eval(vals);

   if( myParser_condition.Eval(vals) == 0) {
   NDB_X = MP_X;
   NDB_Y = MP_Y;
       } // End of if( myParser_condition.Eval(vals) == 0)
   else {
   DB_X = MP_X;
   DB_Y = MP_Y;
   HR2[(j+1)*3    ][i+1] = vals[3];
   HR2[(j+1)*3 + 1][i+1] = vals[4];
   HR2[(j+1)*3 + 2][i+1] = vals[5];
        }
   precision_step++;
   }// End of while ( precision_step < 5)...
   } // End of if(hidden_points[j][i] == 0)



///============= Fourth case : DR = Height-Right ============

   else if(hidden_points[j][i+1] == 0) {
   // initialisation
   DB_X  =  ((double)(j+1))   * U_step + u_inf;
   DB_Y  =  ((double)(i))   * V_step + v_inf;
   //DB_X  =  ((double)(j))   * U_step + u_inf;
   //DB_Y  =  ((double)(i))   * V_step + v_inf;

   NDB_X =  ((double)(j)) * U_step + u_inf;
   NDB_Y =  ((double)(i+1))   * V_step + v_inf;

   DR2[j*3    ][i+1] = Tre2[j*3    ][i];
   DR2[j*3 + 1][i+1] = Tre2[j*3 + 1][i];
   DR2[j*3 + 2][i+1] = Tre2[j*3 + 2][i];

   precision_step = 0; // Approximation by 2^5

   while ( precision_step < 5){
         MP_X = (DB_X + NDB_X)/2;
         MP_Y = (DB_Y + NDB_Y)/2;
   // We compute this point and look if it fulfill the condition
   // If yes => DB = MP; else NDB = MP;

   vals[0] = MP_X;
   vals[1] = MP_Y;
   vals[3] = myParserX.Eval(vals);
   vals[4] = myParserY.Eval(vals);
   vals[5] = myParserZ.Eval(vals);

   if( myParser_condition.Eval(vals) == 0) {
   NDB_X = MP_X;
   NDB_Y = MP_Y;
       } // End of if( myParser_condition.Eval(vals) == 0)
   else {
   DB_X = MP_X;
   DB_Y = MP_Y;
   DR2[j*3    ][i+1] = vals[3];
   DR2[j*3 + 1][i+1] = vals[4];
   DR2[j*3 + 2][i+1] = vals[5];
        }

   precision_step++;
   }// End of while ( precision_step < 5)...

   } // End of if(hidden_points[j][i] == 0)

                  } // End of if((hidden_points[j][i] + ...)



double DB2_X, DB2_Y,
    NDB2_X, NDB2_Y,
    MP2_X, MP2_Y;

//==============================================================
//========== In this case, we have two missing point ===========
//==============================================================
  for(j=0; j < nb_ligne -1   ; j++)
    for (i=0; i < nb_colone -1  ; i++)

      if((hidden_points[j  ][i  ]  +
          hidden_points[j+1][i  ]  +
          hidden_points[j+1][i+1]  +
          hidden_points[j  ][i+1]) == 2)
              {
///==================================
   if(hidden_points[j][i] == 0 && hidden_points[j][i+1] == 0) {
   // initialisation
   DB_X  =  ((double)(j+1)) * U_step + u_inf;
   DB_Y  =  ((double)(i)) * V_step + v_inf;

   NDB_X =  ((double)(j)) * U_step + u_inf;
   NDB_Y =  ((double)(i)) * V_step + v_inf;

   DL2[j*3    ][i] = Tre2[(j+1)*3    ][i];
   DL2[j*3 + 1][i] = Tre2[(j+1)*3 + 1][i];
   DL2[j*3 + 2][i] = Tre2[(j+1)*3 + 2][i];

   DB2_X  =  ((double)(j+1))   * U_step + u_inf;
   DB2_Y  =  ((double)(i+1))   * V_step + v_inf;

   NDB2_X =  ((double)(j)) * U_step + u_inf;
   NDB2_Y =  ((double)(i+1))* V_step + v_inf;

   DR2[j*3    ][i+1] = Tre2[(j+1)*3    ][i+1];
   DR2[j*3 + 1][i+1] = Tre2[(j+1)*3 + 1][i+1];
   DR2[j*3 + 2][i+1] = Tre2[(j+1)*3 + 2][i+1];

   // First point solution
   precision_step = 0;
   while ( precision_step < 5){
         MP_X = (DB_X + NDB_X)/2;
         MP_Y = (DB_Y + NDB_Y)/2;

   vals[0] = MP_X;
   vals[1] = MP_Y;
   vals[3] = myParserX.Eval(vals);
   vals[4] = myParserY.Eval(vals);
   vals[5] = myParserZ.Eval(vals);

   if( myParser_condition.Eval(vals) == 0) {
   NDB_X = MP_X;
   NDB_Y = MP_Y;
       } // End of if( myParser_condition.Eval(vals) == 0)
   else {
   DB_X = MP_X;
   DB_Y = MP_Y;
   DL2[j*3    ][i] = vals[3];
   DL2[j*3 + 1][i] = vals[4];
   DL2[j*3 + 2][i] = vals[5];
        }

   precision_step++;
   }// End of while ( precision_step < 5)...

   // Second point solution
   precision_step = 0;
   while ( precision_step < 5){
         MP2_X = (DB2_X + NDB2_X)/2;
         MP2_Y = (DB2_Y + NDB2_Y)/2;

   vals[0] = MP2_X;
   vals[1] = MP2_Y;
   vals[3] = myParserX.Eval(vals);
   vals[4] = myParserY.Eval(vals);
   vals[5] = myParserZ.Eval(vals);

   if( myParser_condition.Eval(vals) == 0) {
   NDB2_X = MP2_X;
   NDB2_Y = MP2_Y;
       }
   else {
   DB2_X = MP2_X;
   DB2_Y = MP2_Y;
   DR2[j*3    ][i+1] = vals[3];
   DR2[j*3 + 1][i+1] = vals[4];
   DR2[j*3 + 2][i+1] = vals[5];
        }

   precision_step++;
   }// End of while ( precision_step < 5)...


   } // End of if(hidden_points[j][i] == 0 && hidden_points[j][i+1] == 0)


///=========================

   else if(hidden_points[j][i] == 0 && hidden_points[j+1][i] == 0) {
   // initialisation
   DB_X  =  ((double)(j)) * U_step + u_inf;
   DB_Y  =  ((double)(i+1))* V_step + v_inf;

   NDB_X =  ((double)(j)) * U_step + u_inf;
   NDB_Y =  ((double)(i)) * V_step + v_inf;

   DL2[j*3    ][i] = Tre2[j*3    ][i+1];
   DL2[j*3 + 1][i] = Tre2[j*3 + 1][i+1];
   DL2[j*3 + 2][i] = Tre2[j*3 + 2][i+1];


   DB2_X  =  ((double)(j+1))   * U_step + u_inf;
   DB2_Y  =  ((double)(i+1))   * V_step + v_inf;

   NDB2_X =  ((double)(j+1)) * U_step + u_inf;
   NDB2_Y =  ((double)(i))   * V_step + v_inf;

   HL2[(j+1)*3    ][i] = Tre2[(j+1)*3    ][i+1];
   HL2[(j+1)*3 + 1][i] = Tre2[(j+1)*3 + 1][i+1];
   HL2[(j+1)*3 + 2][i] = Tre2[(j+1)*3 + 2][i+1];

   // First point solution
   precision_step = 0;
   while ( precision_step < 5){
         MP_X = (DB_X + NDB_X)/2;
         MP_Y = (DB_Y + NDB_Y)/2;

   vals[0] = MP_X;
   vals[1] = MP_Y;
   vals[3] = myParserX.Eval(vals);
   vals[4] = myParserY.Eval(vals);
   vals[5] = myParserZ.Eval(vals);

   if( myParser_condition.Eval(vals) == 0) {
   NDB_X = MP_X;
   NDB_Y = MP_Y;
       } // End of if( myParser_condition.Eval(vals) == 0)
   else {
   DB_X = MP_X;
   DB_Y = MP_Y;
   DL2[j*3    ][i] = vals[3];
   DL2[j*3 + 1][i] = vals[4];
   DL2[j*3 + 2][i] = vals[5];
        }

   precision_step++;
   }// End of while ( precision_step < 5)...


   // Second point solution
   precision_step = 0;
   while ( precision_step < 5){
         MP2_X = (DB2_X + NDB2_X)/2;
         MP2_Y = (DB2_Y + NDB2_Y)/2;

   vals[0] = MP2_X;
   vals[1] = MP2_Y;
   vals[3] = myParserX.Eval(vals);
   vals[4] = myParserY.Eval(vals);
   vals[5] = myParserZ.Eval(vals);

   if( myParser_condition.Eval(vals) == 0) {
   NDB2_X = MP2_X;
   NDB2_Y = MP2_Y;
       }
   else {
   DB2_X = MP2_X;
   DB2_Y = MP2_Y;
   HL2[(j+1)*3    ][i] = vals[3];
   HL2[(j+1)*3 + 1][i] = vals[4];
   HL2[(j+1)*3 + 2][i] = vals[5];
        }

   precision_step++;
   }// End of while ( precision_step < 5)...


   } // End of if(hidden_points[j][i] == 0 && hidden_points[j+1][i] == 0)


///=========================

   else if(hidden_points[j+1][i] == 0 && hidden_points[j+1][i+1] == 0) {
   // initialisation
   DB_X  =  ((double)(j)) * U_step + u_inf;
   DB_Y  =  ((double)(i+1)) * V_step + v_inf;

   NDB_X =  ((double)(j+1)) * U_step + u_inf;
   NDB_Y =  ((double)(i+1)) * V_step + v_inf;

   HR2[(j+1)*3    ][i+1] = Tre2[j*3    ][i+1];
   HR2[(j+1)*3 + 1][i+1] = Tre2[j*3 + 1][i+1];
   HR2[(j+1)*3 + 2][i+1] = Tre2[j*3 + 2][i+1];



   DB2_X  =  ((double)(j))   * U_step + u_inf;
   DB2_Y  =  ((double)(i)) * V_step + v_inf;

   NDB2_X =  ((double)(j+1)) * U_step + u_inf;
   NDB2_Y =  ((double)(i))   * V_step + v_inf;

   HL2[(j+1)*3    ][i] = Tre2[j*3    ][i];
   HL2[(j+1)*3 + 1][i] = Tre2[j*3 + 1][i];
   HL2[(j+1)*3 + 2][i] = Tre2[j*3 + 2][i];

   // First point solution
   precision_step = 0;
   while ( precision_step < 5){
         MP_X = (DB_X + NDB_X)/2;
         MP_Y = (DB_Y + NDB_Y)/2;

   vals[0] = MP_X;
   vals[1] = MP_Y;
   vals[3] = myParserX.Eval(vals);
   vals[4] = myParserY.Eval(vals);
   vals[5] = myParserZ.Eval(vals);

   if( myParser_condition.Eval(vals) == 0) {
   NDB_X = MP_X;
   NDB_Y = MP_Y;
       } // End of if( myParser_condition.Eval(vals) == 0)
   else {
   DB_X = MP_X;
   DB_Y = MP_Y;
   HR2[(j+1)*3    ][i+1] = vals[3];
   HR2[(j+1)*3 + 1][i+1] = vals[4];
   HR2[(j+1)*3 + 2][i+1] = vals[5];
        }

   precision_step++;
   }// End of while ( precision_step < 5)...


   // Second point solution
   precision_step = 0;
   while ( precision_step < 5){
         MP2_X = (DB2_X + NDB2_X)/2;
         MP2_Y = (DB2_Y + NDB2_Y)/2;

   vals[0] = MP2_X;
   vals[1] = MP2_Y;
   vals[3] = myParserX.Eval(vals);
   vals[4] = myParserY.Eval(vals);
   vals[5] = myParserZ.Eval(vals);

   if( myParser_condition.Eval(vals) == 0) {
   NDB2_X = MP2_X;
   NDB2_Y = MP2_Y;
       }
   else {
   DB2_X = MP2_X;
   DB2_Y = MP2_Y;
   HL2[(j+1)*3    ][i] = vals[3];
   HL2[(j+1)*3 + 1][i] = vals[4];
   HL2[(j+1)*3 + 2][i] = vals[5];
        }

   precision_step++;
   }// End of while ( precision_step < 5)...

   } // End of if(hidden_points[j+1][i] == 0 && hidden_points[j+1][i+1] == 0)

///============= Fourth case : DR = Height-Right ============

   else if(hidden_points[j+1][i+1] == 0 && hidden_points[j][i+1] == 0) {
   // initialisation
   DB_X  =  ((double)(j+1)) * U_step + u_inf;
   DB_Y  =  ((double)(i)) * V_step + v_inf;

   NDB_X =  ((double)(j+1)) * U_step + u_inf;
   NDB_Y =  ((double)(i+1)) * V_step + v_inf;

   HR2[(j+1)*3    ][i+1] = Tre2[(j+1)*3    ][i];
   HR2[(j+1)*3 + 1][i+1] = Tre2[(j+1)*3 + 1][i];
   HR2[(j+1)*3 + 2][i+1] = Tre2[(j+1)*3 + 2][i];

   DB2_X  =  ((double)(j)) * U_step + u_inf;
   DB2_Y  =  ((double)(i)) * V_step + v_inf;

   NDB2_X =  ((double)(j)) * U_step + u_inf;
   NDB2_Y =  ((double)(i+1))* V_step + v_inf;

   DR2[j*3    ][i+1] = Tre2[j*3    ][i];
   DR2[j*3 + 1][i+1] = Tre2[j*3 + 1][i];
   DR2[j*3 + 2][i+1] = Tre2[j*3 + 2][i];

   // First point solution
   precision_step = 0;
   while ( precision_step < 5){
         MP_X = (DB_X + NDB_X)/2;
         MP_Y = (DB_Y + NDB_Y)/2;

   vals[0] = MP_X;
   vals[1] = MP_Y;
   vals[3] = myParserX.Eval(vals);
   vals[4] = myParserY.Eval(vals);
   vals[5] = myParserZ.Eval(vals);

   if( myParser_condition.Eval(vals) == 0) {
   NDB_X = MP_X;
   NDB_Y = MP_Y;
       } // End of if( myParser_condition.Eval(vals) == 0)
   else {
   DB_X = MP_X;
   DB_Y = MP_Y;
   HR2[(j+1)*3    ][i+1] = vals[3];
   HR2[(j+1)*3 + 1][i+1] = vals[4];
   HR2[(j+1)*3 + 2][i+1] = vals[5];
        }

   precision_step++;
   }// End of while ( precision_step < 5)...

   // Second point solution
   precision_step = 0;
   while ( precision_step < 5){
         MP2_X = (DB2_X + NDB2_X)/2;
         MP2_Y = (DB2_Y + NDB2_Y)/2;

   vals[0] = MP2_X;
   vals[1] = MP2_Y;
   vals[3] = myParserX.Eval(vals);
   vals[4] = myParserY.Eval(vals);
   vals[5] = myParserZ.Eval(vals);

   if( myParser_condition.Eval(vals) == 0) {
   NDB2_X = MP2_X;
   NDB2_Y = MP2_Y;
       }
   else {
   DB2_X = MP2_X;
   DB2_Y = MP2_Y;
   DR2[j*3    ][i+1] = vals[3];
   DR2[j*3 + 1][i+1] = vals[4];
   DR2[j*3 + 2][i+1] = vals[5];
        }
   precision_step++;
   }// End of while ( precision_step < 5)...


   } // End of if(hidden_points[j+1][i+1] == 0 && hidden_points[j][i+1] == 0)

} // End of if((hidden_points[j][i] + ...)

}; // End of if(there_is_hidden_points == 1)

// Computes Points axes if activated :
// This must be changed for better performances...
if(drawaxes_ok == 1) {

MINX =999999999;
MINY =999999999;
MINZ =999999999;;

MAXX =-999999999;
MAXY =-999999999;
MAXZ =-999999999;

 for (i=0; i < nb_ligne   ; i++)
    for (j=0; j < nb_colone   ; j++) {
     if(hidden_points[i][j] == 1 || implicitdef != 1) {
     if(MINX > Tre2[i*3    ][j] ) MINX = Tre2[i*3    ][j] ;

     if(MINY > Tre2[i*3 + 1][j] ) MINY = Tre2[i*3 + 1][j] ;

     if(MINZ > Tre2[i*3 + 2][j] ) MINZ = Tre2[i*3 + 2][j] ;

     if(MAXX < Tre2[i*3    ][j] ) MAXX = Tre2[i*3    ][j] ;

     if(MAXY < Tre2[i*3 + 1][j] ) MAXY = Tre2[i*3 + 1][j] ;

     if(MAXZ < Tre2[i*3 + 2][j] ) MAXZ = Tre2[i*3 + 2][j] ;
                                  }
    }

  DIFX = MAXX - MINX ;
  DIFY = MAXY - MINY ;
  DIFZ = MAXZ - MINZ ;

double StepX, StepY, StepZ, center_x, center_y, center_z;

StepX = fabs((2./3.)*DIFX*axe_size/(double)(nb_licol-1));
StepY = fabs((2./3.)*DIFY*axe_size/(double)(nb_licol-1));
StepZ = fabs((2./3.)*DIFZ*axe_size/(double)(nb_licol-1));

if(axe_center == -1) {
 center_x = (MAXX + MINX)/2.;
 center_y = (MAXY + MINY)/2.;
 center_z = (MAXZ + MINZ)/2.;

StepX = (2./3.)*DIFX*axe_size/(double)(nb_licol-1);
StepY = (2./3.)*DIFY*axe_size/(double)(nb_licol-1);
StepZ = (2./3.)*DIFZ*axe_size/(double)(nb_licol-1);

}
else center_x = center_y = center_z = 0;

for (i=0; i < nb_licol ; i++) {
        Axes_array2[0][i*3    ] = center_x + i*StepX;
        Axes_array2[0][i*3 + 1] = center_y;
        Axes_array2[0][i*3 + 2] = center_z;

        Axes_array2[1][i*3    ] = center_x;
        Axes_array2[1][i*3 + 1] = center_y + i*StepY;
        Axes_array2[1][i*3 + 2] = center_z;

        Axes_array2[2][i*3    ] = center_x;
        Axes_array2[2][i*3 + 1] = center_y;
        Axes_array2[2][i*3 + 2] = center_z + i*StepZ;
                          }

} // End of if(drawaxes_ok == 1);

} // End of the fct calcul_objet3()


Generated by  Doxygen 1.6.0   Back to index