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 3389 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){
/*     dif_u = 6.28; u_inf = -3.14;
       dif_v = 3.14; v_inf = -1.57; 


     
m1 = 0; a_1 = 1.0; b_1 =1.0; n1_1 = 0.48; n2_1 =30.25; n3_1 =0.35;
m2 = 5; a_2 = 1.0; b_2 =1.0; n1_2 = 15.44; n2_2 =-0.45; n3_2 =87;

m1 = 0.2; a_1 = 1.0; b_1 =1.0; n1_1 = 0.1; n2_1 =1.7; n3_1 =1.7;
m2 = 0.2; a_2 = 1.0; b_2 =1.0; n1_2 = 0.5; n2_2 =0.2; n3_2 =0.2;

m1 = 2; a_1 = 1.0; b_1 =1.0; n1_1 = 1; n2_1 =1; n3_1 =1;
m2 = 4; a_2 = 1.0; b_2 =1.0; n1_2 = 1; n2_2 =1; n3_2 =1;

m1 = 5.7; a_1 = 1.0; b_1 =1.0; n1_1 = 0.5; n2_1 = 1; n3_1 =2.5;
m2 = 10; a_2 = 1.0; b_2 =1.0; n1_2 = 3; n2_2 =0.2; n3_2 = 1;

m1 = 6; a_1 = 1.0; b_1 =1.0; n1_1 = 60; n2_1 = 55; n3_1 =1000;
m2 = 6; a_2 = 1.0; b_2 =1.0; n1_2 =250; n2_2 =100; n3_2 = 100;
 
m1 = 2; a_1 = 1.0; b_1 =1.0; n1_1 = 0.99; n2_1 =97.67; n3_1 =-0.439;
m2 = 7; a_2 = 1.0; b_2 =1.0; n1_2 = -8.11; n2_2 =-0.0807; n3_2 =93;

m1 = 6; a_1 = 1.0; b_1 =1.0; n1_1 = 0.709889; n2_1 =46.82; n3_1 =-0.80;
m2 = 7; a_2 = 1.0; b_2 =1.0; n1_2 = -31.9083; n2_2 =-0.19; n3_2 = 97;
    
m1 = 6; a_1 = 1.0; b_1 =1.0; n1_1 = 3000; n2_1 =1000; n3_1 =1000;
m2 = 6; a_2 = 1.0; b_2 =1.0; n1_2 = 250; n2_2 =100; n3_2 =100;     
     
m1 = 3; a_1 = 1.0; b_1 =1.0; n1_1 = 1; n2_1 =1; n3_1 =1;
m2 = 6; a_2 = 2.0; b_2 =1.0; n1_2 = 2; n2_2 =1; n3_2 =1;
      
m1 = 7; a_1 = 1.0; b_1 =1.0; n1_1 = 0.2; n2_1 =1.7; n3_1 =1.7;
m2 = 7; a_2 = 1.0; b_2 =1.0; n1_2 = 0.2; n2_2 =1.7; n3_2 =1.7;
*/
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)



/*

  i = 0;  
  for(j=0; j < nb_ligne    ; j++) {
  DR2[j*3    ][i] = HR2[j*3    ][i] = HL2[j*3    ][i];
  DR2[j*3 + 1][i] = HR2[j*3 + 1][i] = HL2[j*3 + 1][i];
  DR2[j*3 + 2][i] = HR2[j*3 + 2][i] = HL2[j*3 + 2][i];
  }
  
  i = nb_colone -1;  
  for(j=0; j < nb_ligne    ; j++) { 
  DL2[j*3    ][i] = HL2[j*3    ][i] = HR2[j*3    ][i];
  DL2[j*3 + 1][i] = HL2[j*3 + 1][i] = HR2[j*3 + 1][i];
  DL2[j*3 + 2][i] = HL2[j*3 + 2][i] = HR2[j*3 + 2][i];
  }

  j = 0;  
  for(i=0; i < nb_colone    ; i++) {
  HR2[j*3    ][i] = HL2[j*3    ][i] = DL2[j*3    ][i];
  HR2[j*3 + 1][i] = HL2[j*3 + 1][i] = DL2[j*3 + 1][i];
  HL2[j*3 + 2][i] = HL2[j*3 + 2][i] = DL2[j*3 + 2][i];
  }

  j = nb_ligne -1;  
  for(i=0; i < nb_colone   ; i++) {
  DR2[j*3    ][i] = DL2[j*3    ][i] = HL2[j*3    ][i];
  DR2[j*3 + 1][i] = DL2[j*3 + 1][i] = HL2[j*3 + 1][i];
  DL2[j*3 + 2][i] = DL2[j*3 + 2][i] = HL2[j*3 + 2][i];
  }
*/




























} // End of the fct calcul_objet3()


Generated by  Doxygen 1.6.0   Back to index