]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx
b3e434fbb473e7cfa7c6127ccc2cbaea2856a4e0
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuManualContourModel_Box.cxx
1 //===== 
2 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
3 //===== 
4 #include "bbcreaMaracasVisuManualContourModel_Box.h"
5 #include "bbcreaMaracasVisuPackage.h"
6
7 #include <creaContoursFactory.h>
8
9
10 namespace bbcreaMaracasVisu
11 {
12
13 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ManualContourModel_Box)
14 BBTK_BLACK_BOX_IMPLEMENTATION(ManualContourModel_Box,bbtk::AtomicBlackBox);
15 //===== 
16 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
17 //===== 
18
19
20 void ManualContourModel_Box::ProcessBySegment(  
21                         int Type, 
22                         int &iGeneral, int sizeSegment,
23                         std::vector<double> *lstInX,std::vector<double> *lstInY, std::vector<double> *lstInZ,
24                         std::vector<double> *lstOutX,std::vector<double> *lstOutY, std::vector<double> *lstOutZ,
25                         std::vector<int>        *lstIndexsOut, bool open )
26 {
27         creaContoursFactory f;
28         manualContourModel      *m;
29         int i,size=iGeneral+sizeSegment;
30         double x,y,z;
31         m = (manualContourModel*)f.getContourModel( bbGetInputType() );
32         m->SetNumberOfPointsSpline( bbGetInputNbPoints() );
33         m->SetCloseContour( open );
34         for (i=iGeneral;i<size;i++)
35         {
36                 m->AddPoint( (*lstInX)[i] , (*lstInY)[i] , (*lstInZ)[i] );
37         } // for
38         m->UpdateSpline();
39         int sizeContour = bbGetInputNbPoints();
40         for (i=0;i<sizeContour;i++)
41         {
42                 m->GetSpline_i_Point(i,&x,&y,&z);
43                 lstOutX->push_back(x);
44                 lstOutY->push_back(y);
45                 lstOutZ->push_back(z);
46         } // for
47         iGeneral=iGeneral+sizeSegment;
48         lstIndexsOut->push_back( sizeContour );
49         delete m;
50 }
51
52
53 void ManualContourModel_Box::RedistributionPoints(      std::vector<double> *lstOutX,
54                                                                                                         std::vector<double> *lstOutY, 
55                                                                                                         std::vector<double> *lstOutZ,
56                                                                                                         std::vector<int> *lstIndexsOut )
57 {
58         std::vector<double> lstRstX;
59         std::vector<double> lstRstY;
60         std::vector<double> lstRstZ;
61         int iLstIndexOut,sizeLstIndexOut = lstIndexsOut->size();
62         int ii, iGeneral=0;
63         int size;
64         for (iLstIndexOut=0;  iLstIndexOut<sizeLstIndexOut; iLstIndexOut++)
65         {
66 //printf("EED ManualContourModel_Box::RedistributionPoints iLstIndexOut=%d   \n", iLstIndexOut);
67                 lstRstX.clear();
68                 lstRstY.clear();
69                 lstRstZ.clear();
70                 size=(*lstIndexsOut)[iLstIndexOut];
71                 if (size>2)
72                 {
73                         double dist=0,dist2,distSeg,delta;
74                         double dd,dx,dy,dz;
75                         int i,k;
76                         for ( i=iGeneral+1 ; i<iGeneral+size ; i++ )
77                         {
78                                 dx      = (*lstOutX)[i]-(*lstOutX)[i-1];
79                                 dy      = (*lstOutY)[i]-(*lstOutY)[i-1];
80                                 dz      = (*lstOutZ)[i]-(*lstOutZ)[i-1];
81                                 dist= dist+sqrt( dx*dx + dy*dy + dz*dz );
82                         } //for
83                         delta = dist/(size-1);
84                         lstRstX.push_back( (*lstOutX)[iGeneral] );
85                         lstRstY.push_back( (*lstOutY)[iGeneral] );
86                         lstRstZ.push_back( (*lstOutZ)[iGeneral] );
87                         for (i=iGeneral+1; i<iGeneral+size;i++)
88                         {
89 //printf("EED ManualContourModel_Box::RedistributionPointsi=%d \n", i-iGeneral );
90                                 dist2 = 0;
91                                 for (k=iGeneral+1; k<iGeneral+size;k++)
92                                 {
93                                         dx = (*lstOutX)[k]-(*lstOutX)[k-1];
94                                         dy = (*lstOutY)[k]-(*lstOutY)[k-1];
95                                         dz = (*lstOutZ)[k]-(*lstOutZ)[k-1];
96                                         distSeg = sqrt( dx*dx + dy*dy + dz*dz );
97                                         ii = i-iGeneral;
98                                         if ( dist2+distSeg >= ii*delta )
99                                         {
100                                                 dd=(ii*delta-dist2)/distSeg;
101                                                 if (distSeg==0)
102                                                 {
103                                                         dd = 0;
104                                                 } // if distSeg == 0
105                                                 lstRstX.push_back( (*lstOutX)[k-1] + dd*dx );
106                                                 lstRstY.push_back( (*lstOutY)[k-1] + dd*dy );
107                                                 lstRstZ.push_back( (*lstOutZ)[k-1] + dd*dz );
108                                                 k=iGeneral+size;
109                                         } else {
110                                                 if ( k==iGeneral+size-1 )
111                                                 {
112                                                         dd = 1;
113                                                         lstRstX.push_back( (*lstOutX)[k-1] + dd*dx );
114                                                         lstRstY.push_back( (*lstOutY)[k-1] + dd*dy );
115                                                         lstRstZ.push_back( (*lstOutZ)[k-1] + dd*dz );
116 //                                                      printf("EED ManualContourModel_Box::RedistributionPoints iLstIndexOut=%d    i=%d k=%d  dist2+distSeg=%f    ii*delta=%f   dif=%f \n", iLstIndexOut,i-iGeneral, k-iGeneral, dist2+distSeg , ii*delta ,  (dist2+distSeg) - ii*delta);
117                                                 }
118                                         }// if dist2 
119                                         dist2 = dist2+distSeg;
120                                 } // for k
121                         } //for i   
122                         if (lstRstX.size()!=size) 
123                         {
124                                 printf("EED Warnning!   ManualContourModel_Box::RedistributionPoints  >> This list is not coherent  iLstIndexOut=%d  lstRstX.size()=%d  size=%d\n",iLstIndexOut, lstRstX.size(), size);
125                         }
126                         for (i=iGeneral; i<iGeneral+size;i++)
127                         {
128                                 ii=i-iGeneral;
129                                 (*lstOutX)[i] = lstRstX[ii];
130                                 (*lstOutY)[i] = lstRstY[ii];
131                                 (*lstOutZ)[i] = lstRstZ[ii];
132                         } // for i
133                 } // if size>2
134                 iGeneral=iGeneral+size;
135         }// for iLstIndexOut
136 }
137
138
139 void ManualContourModel_Box::ClockwisePoints(   std::vector<double> *lstInX,
140                                                                                         std::vector<double> *lstInY, 
141                                                                                         std::vector<double> *lstInZ,
142                                                                                         std::vector<int> *lstIndexsIn )
143 {
144         int     iLstIndexIn,sizeLstIndexIn=lstIndexsIn->size();
145         int     i,iGeneral=0;
146         int     size,size2;
147         double  cx,cy,cz;
148         double  px,py,pz;
149         double  backpx,backpy,backpz;
150         double  ang;
151         char    dir=-1;
152         bool    dirx,diry,dirz;
153         int     flagAng=0;
154         float   backang;
155         double  tmp;
156
157         // For each contour
158         for (iLstIndexIn=0;  iLstIndexIn<sizeLstIndexIn; iLstIndexIn++)
159         {
160                 // Step 1. Find gravity center and direction
161                 size    = (*lstIndexsIn)[iLstIndexIn];
162                 if (size>2)  // for contour with more than 2 points
163                 {
164                         cx              = 0;
165                         cy              = 0;
166                         cz              = 0;
167                         dirx    = true;
168                         diry    = true;
169                         dirz    = true;
170                         for ( i=0 ; i<size ; i++ )
171                         {
172                                 px=(*lstInX)[iGeneral+i];
173                                 py=(*lstInY)[iGeneral+i];
174                                 pz=(*lstInZ)[iGeneral+i];
175                                 cx      = px + cx;
176                                 cy      = py + cy;
177                                 cz      = pz + cz;
178                                 if (i!=0) 
179                                 { 
180                                         if (backpx!=px) { dirx=false; } 
181                                         if (backpy!=py) { diry=false; } 
182                                         if (backpz!=pz) { dirz=false; } 
183                                         backpx=px;
184                                         backpy=py;
185                                         backpz=pz;
186                                 } // if i!=0
187                                 backpx=px; 
188                                 backpy=py; 
189                                 backpz=pz; 
190                         } // for i 
191                         cx=cx/size;
192                         cy=cy/size;
193                         cz=cz/size;
194                         if (dirx==true) { dir=1; }  // YZ 
195                         if (diry==true) { dir=2; }  // XZ 
196                         if (dirz==true) { dir=0; }  // XZ 
197                         // Step 2. Find angle diference find 
198                         flagAng=0;
199                         for ( i=0 ; i<size ; i++ )
200                         {
201                                 px = (*lstInX)[iGeneral+i]-cx;
202                                 py = (*lstInY)[iGeneral+i]-cy;
203                                 pz = (*lstInZ)[iGeneral+i]-cz;
204                                 if (dir==0) { ang=atan2( py , px ); } // XY
205                                 if (dir==1) { ang=atan2( pz , py ); } // YZ
206                                 if (dir==2) { ang=atan2( pz , px ); } // XZ
207                                 if (i>0) 
208                                 { 
209                                         if (backang<ang) 
210                                         {
211                                                 flagAng++;
212                                         } else {
213                                                 flagAng--;
214                                         }// if backang<ang
215                                 } // if i
216                                 backang=ang; 
217                         } // for i 
218
219
220                         // Step 3. Invert order of points
221                         if (flagAng<0)
222                         {
223                                 size2 = size/2;
224                                 for ( i=0 ; i<size2 ; i++ )
225                                 {
226                                         tmp                                                     = (*lstInX)[iGeneral+i];
227                                         (*lstInX)[iGeneral+i]                   = (*lstInX)[iGeneral+size-1-i];
228                                         (*lstInX)[iGeneral+size-1-i]    = tmp;
229                                         tmp                                                     = (*lstInY)[iGeneral+i];
230                                         (*lstInY)[iGeneral+i]                   = (*lstInY)[iGeneral+size-1-i];
231                                         (*lstInY)[iGeneral+size-1-i]    = tmp;
232                                         tmp                                                     = (*lstInZ)[iGeneral+i];
233                                         (*lstInZ)[iGeneral+i]                   = (*lstInZ)[iGeneral+size-1-i];
234                                         (*lstInZ)[iGeneral+size-1-i]    = tmp;
235                                 } // for i
236                         } // flagAng
237                 } // size>2
238                 iGeneral = iGeneral+size;
239         } // for iLstIndexIn
240 }
241
242
243 /*
244 void ManualContourModel_Box::ShiftValues(       std::vector<double> *lstInX,
245                                                                                         std::vector<double> *lstInY, 
246                                                                                         std::vector<double> *lstInZ,
247                                                                                         std::vector<int> *lstIndexsIn )
248 {
249         int iLstIndexIn,sizeLstIndexIn=lstIndexsIn->size();
250         int ii, iGeneral=0;
251         int size,size2;
252         double dist,distMin;
253         int i,iBack;
254         int ig;
255         double dx,dy,dz;
256         std::vector<double> LstTmpX;
257         std::vector<double> LstTmpY;
258         std::vector<double> LstTmpZ;
259         if (sizeLstIndexIn>=2)
260         {
261         
262                 for (iLstIndexIn=0;  iLstIndexIn<sizeLstIndexIn-1; iLstIndexIn++)
263                 {
264                         size  = (*lstIndexsIn)[iLstIndexIn];
265                         size2 = (*lstIndexsIn)[iLstIndexIn+1];
266                         //find min distance and  iBack
267                         distMin = 10000000;
268                         iBack   = 0;
269                         
270                         
271                         for (ig=0; ig<size; ig++)
272                         {
273                                 for ( i=0 ; i<size2 ; i++ )
274                                 {
275                                         dx      = (*lstInX)[iGeneral+ig]-(*lstInX)[iGeneral+size+i];
276                                         dy      = (*lstInY)[iGeneral+ig]-(*lstInY)[iGeneral+size+i];
277                                         dz      = (*lstInZ)[iGeneral+ig]-(*lstInZ)[iGeneral+size+i];
278                                         dist= sqrt( dx*dx + dy*dy + dz*dz );
279                                         if ( dist<distMin ) 
280                                         {
281                                                 iBack   = i-ig;
282                                                 distMin = dist;
283                                         }
284                                 } // for i size2
285                         } // for ig size
286
287 if (iBack<0) 
288 {
289         printf("- "); 
290         iBack = iBack + size2; 
291 }
292                         
293 printf("EED ManualContourModel_Box::ShiftValues px=%f py=%f pz=%f  iBack=%d/%d  size=%d  distMin=%f \n", (*lstInX)[iGeneral]  , (*lstInY)[iGeneral] , (*lstInZ)[iGeneral], iBack, size2,size, distMin);
294                         
295                         if (iBack!=0)
296                         {
297                                 LstTmpX.clear();
298                                 LstTmpY.clear();
299                                 LstTmpZ.clear();
300                                 for (i=0 ; i<size2 ; i++) 
301                                 {
302                                         ii= (i+iBack)%size2;
303                                         LstTmpX.push_back( (*lstInX)[iGeneral+size+ii] );
304                                         LstTmpY.push_back( (*lstInY)[iGeneral+size+ii] );
305                                         LstTmpZ.push_back( (*lstInZ)[iGeneral+size+ii] );
306                                 } // for i                              
307                                 for (i=0 ; i<size2 ; i++) 
308                                 {
309                                         (*lstInX)[iGeneral+size+i] = LstTmpX[i];
310                                         (*lstInY)[iGeneral+size+i] = LstTmpY[i];
311                                         (*lstInZ)[iGeneral+size+i] = LstTmpZ[i];
312                                 } // for i                              
313                         }
314                         iGeneral=iGeneral+size;
315                 } // for iLstIndexIn
316                 
317 //------------          
318                 
319                 iGeneral=0;
320
321                 for (iLstIndexIn=0;  iLstIndexIn<sizeLstIndexIn-1; iLstIndexIn++)
322                 {
323                         size  = (*lstIndexsIn)[iLstIndexIn];
324                         size2 = (*lstIndexsIn)[iLstIndexIn+1];
325                         //find min distance and  iBack
326                         distMin = 10000000;
327                         iBack   = 0;
328                         
329                         
330 //                      for (ig=0; ig<size; ig++)
331 //                      {
332                                 for ( i=0 ; i<size2 ; i++ )
333                                 {
334                                         dx      = (*lstInX)[iGeneral]-(*lstInX)[iGeneral+size+i];
335                                         dy      = (*lstInY)[iGeneral]-(*lstInY)[iGeneral+size+i];
336                                         dz      = (*lstInZ)[iGeneral]-(*lstInZ)[iGeneral+size+i];
337                                         dist= sqrt( dx*dx + dy*dy + dz*dz );
338                                         if ( dist<distMin ) 
339                                         {
340                                                 iBack   = i;
341                                                 distMin = dist;
342                                         }
343                                 } // for i size2
344 //                      } // for ig size
345
346                         
347 printf("EED ManualContourModel_Box::ShiftValues px=%f py=%f pz=%f  iBack=%d/%d  size=%d  distMin=%f \n", (*lstInX)[iGeneral]  , (*lstInY)[iGeneral] , (*lstInZ)[iGeneral], iBack, size2,size, distMin);
348                         
349                         if (iBack!=0)
350                         {
351                                 LstTmpX.clear();
352                                 LstTmpY.clear();
353                                 LstTmpZ.clear();
354                                 for (i=0 ; i<size2 ; i++) 
355                                 {
356                                         ii= (i+iBack)%size2;
357                                         LstTmpX.push_back( (*lstInX)[iGeneral+size+ii] );
358                                         LstTmpY.push_back( (*lstInY)[iGeneral+size+ii] );
359                                         LstTmpZ.push_back( (*lstInZ)[iGeneral+size+ii] );
360                                 } // for i                              
361                                 for (i=0 ; i<size2 ; i++) 
362                                 {
363                                         (*lstInX)[iGeneral+size+i] = LstTmpX[i];
364                                         (*lstInY)[iGeneral+size+i] = LstTmpY[i];
365                                         (*lstInZ)[iGeneral+size+i] = LstTmpZ[i];
366                                 } // for i                              
367                         }
368                         iGeneral=iGeneral+size;
369                 } // for iLstIndexIn
370                 
371         } // if sizeLstIndexIn
372         
373 }
374 */
375
376
377
378 void ManualContourModel_Box::ShiftValues(       std::vector<double> *lstInX,
379                                                                                         std::vector<double> *lstInY, 
380                                                                                         std::vector<double> *lstInZ,
381                                                                                         std::vector<int> *lstIndexsIn )
382 {
383         int iLstIndexIn,sizeLstIndexIn=lstIndexsIn->size();
384         int ii, iGeneral=0;
385         int size,size2;
386         double dist,distMin;
387         int i,iBack;
388         int ig;
389         double dx,dy,dz;
390         std::vector<double> LstTmpX;
391         std::vector<double> LstTmpY;
392         std::vector<double> LstTmpZ;
393         if (sizeLstIndexIn>=2)
394         {
395         
396           
397          
398                 for (iLstIndexIn=0;  iLstIndexIn<sizeLstIndexIn-1; iLstIndexIn++)
399                 {
400                         size  = (*lstIndexsIn)[iLstIndexIn];
401                         size2 = (*lstIndexsIn)[iLstIndexIn+1];
402                         //find min distance and  iBack
403                         distMin = 10000000;
404                         iBack   = 0;
405                         
406                     // Comparing distance between two contours  
407                     // Both contours need the same size 
408                         for (ig=0; ig<size; ig++)
409                         {
410                                 dist=0;
411                                 for ( i=0 ; i<size2 ; i++ )
412                                 {
413                                         dx      = (*lstInX)[iGeneral+i]-(*lstInX)[iGeneral+size+(i+ig)%size];
414                                         dy      = (*lstInY)[iGeneral+i]-(*lstInY)[iGeneral+size+(i+ig)%size];
415                                         dz      = (*lstInZ)[iGeneral+i]-(*lstInZ)[iGeneral+size+(i+ig)%size];
416                                         dist= dist + sqrt( dx*dx + dy*dy + dz*dz );
417                                 } // for i size2
418
419                                 if ( dist<distMin ) 
420                                 {
421                                         iBack   = ig+size;
422                                         distMin = dist;
423                                 }
424                                 
425                         } // for ig size
426
427                         
428 //printf("EED ManualContourModel_Box::ShiftValues px=%f py=%f pz=%f  iBack=%d/%d  size=%d  distMin=%f \n", (*lstInX)[iGeneral]  , (*lstInY)[iGeneral] , (*lstInZ)[iGeneral], iBack, size2,size, distMin);
429                         
430                         if (iBack!=0)
431                         {
432                                 LstTmpX.clear();
433                                 LstTmpY.clear();
434                                 LstTmpZ.clear();
435                                 for (i=0 ; i<size2 ; i++) 
436                                 {
437                                         ii = (i+iBack)%size2;
438                                         if (ii<(size2-1)) // Skip the last item
439                                         {
440                                                 LstTmpX.push_back( (*lstInX)[iGeneral+size+ii] );
441                                                 LstTmpY.push_back( (*lstInY)[iGeneral+size+ii] );
442                                                 LstTmpZ.push_back( (*lstInZ)[iGeneral+size+ii] );
443                                         }
444                                 } // for i
445                                 
446                                 //Repeat the first item at the end to close the contour
447                                 LstTmpX.push_back( LstTmpX[0] );
448                                 LstTmpY.push_back( LstTmpY[0] );
449                                 LstTmpZ.push_back( LstTmpZ[0] );
450
451                                 for (i=0 ; i<size2 ; i++) 
452                                 {
453                                         (*lstInX)[iGeneral+size+i] = LstTmpX[i];
454                                         (*lstInY)[iGeneral+size+i] = LstTmpY[i];
455                                         (*lstInZ)[iGeneral+size+i] = LstTmpZ[i];
456                                 } // for i                              
457                         }
458                         iGeneral=iGeneral+size;
459                 } // for iLstIndexIn
460                 
461                 
462         } // if sizeLstIndexIn
463         
464 }
465
466
467
468
469
470
471 void ManualContourModel_Box::Process()
472 {
473 // THE MAIN PROCESSING METHOD BODY
474 //   Here we simply set the input 'In' value to the output 'Out'
475 //   And print out the output value
476 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
477 //    void bbSet{Input|Output}NAME(const TYPE&)
478 //    const TYPE& bbGet{Input|Output}NAME() const 
479 //    Where :
480 //    * NAME is the name of the input/output
481 //      (the one provided in the attribute 'name' of the tag 'input')
482 //    * TYPE is the C++ type of the input/output
483 //      (the one provided in the attribute 'type' of the tag 'input')
484
485 //    bbSetOutputOut( bbGetInputIn() );
486 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
487
488         // First Step  Spline Interpolation
489         std::vector<double> lstInX=bbGetInputLstControlPointsX();
490         std::vector<double> lstInY=bbGetInputLstControlPointsY();
491         std::vector<double> lstInZ=bbGetInputLstControlPointsZ();
492         if ( (lstInX.size()!=lstInY.size()) || (lstInY.size()!=lstInZ.size()) ) 
493         { 
494                 printf("Warnning !!  .. ManualContourModel_Box: The list X Y Z, no have the same number of elements \n");
495                 return;
496         }
497         std::vector<int>        lstIndexsIn=bbGetInputLstIndexsIn();
498         std::vector<int>        lstIndexsOut;
499         std::vector<double> lstOutX;
500         std::vector<double> lstOutY;
501         std::vector<double> lstOutZ;
502         if (bbGetInputLstIndexsIn().size()==0)
503         {
504                 lstIndexsIn.push_back( lstInX.size() );
505         }
506         if (bbGetInputDoubleContour()==1)
507         {
508                 ClockwisePoints( &lstInX , &lstInY , &lstInZ , &lstIndexsIn );
509 //              ShiftValues( &lstInX , &lstInY , &lstInZ , &lstIndexsIn );
510         } // DoubleContour
511         int i,size=lstIndexsIn.size();
512         int iGeneral=0;
513         for (i=0;i<size;i++)
514         {
515                 ProcessBySegment(       bbGetInputType() , 
516                                                         iGeneral,  lstIndexsIn[i] ,
517                                                         &lstInX ,  &lstInY  , &lstInZ,
518                                                         &lstOutX , &lstOutY , &lstOutZ,
519                                                         &lstIndexsOut,bbGetInputOpenClose() );
520         } // for
521
522         if (bbGetInputDoubleContour()==0)
523         {
524                 //////////////////// Set Out   DoubleContour = 0
525                 bbSetOutputLstContourPointsX(lstOutX);  
526                 bbSetOutputLstContourPointsY(lstOutY);  
527                 bbSetOutputLstContourPointsZ(lstOutZ);
528                 bbSetOutputLstIndexsOut(lstIndexsOut);  
529         } else {
530                 RedistributionPoints(&lstOutX,&lstOutY,&lstOutZ,&lstIndexsOut);
531 //EED 01/2021           
532                 ShiftValues( &lstOutX, &lstOutY, &lstOutZ, &lstIndexsOut );
533                 ///////////// Second Step Transpose the vectors   
534                 lstInX.clear();
535                 lstInY.clear();
536                 lstInZ.clear();
537                 lstIndexsIn.clear();
538                 size  = bbGetInputNbPoints();
539                 int j,size2 = lstIndexsOut.size();
540                 for (i=0;i<size;i++)
541                 {
542                         for (j=0;j<size2;j++)
543                         {
544                                 lstInX.push_back( lstOutX[ j*lstIndexsOut[j] + i ] );
545                                 lstInY.push_back( lstOutY[ j*lstIndexsOut[j] + i ] );
546                                 lstInZ.push_back( lstOutZ[ j*lstIndexsOut[j] + i ] );
547                         } // for j
548                         lstIndexsIn.push_back( size2 );
549                 } // for i
550                 lstOutX.clear();
551                 lstOutY.clear();
552                 lstOutZ.clear();
553                 lstIndexsOut.clear();
554                 ///////////////////// Third step Interponation 2
555                 size=lstIndexsIn.size();
556                 iGeneral=0;
557                 for (i=0;i<size;i++)
558                 {
559                         ProcessBySegment(       bbGetInputType() , 
560                                                                 iGeneral, lstIndexsIn[i] ,
561                                                                 &lstInX,&lstInY,&lstInZ,
562                                                                 &lstOutX,&lstOutY,&lstOutZ,
563                                                                 &lstIndexsOut,bbGetInputOpenClose2());
564                 } // for
565                 RedistributionPoints(&lstOutX,&lstOutY,&lstOutZ,&lstIndexsOut);
566                 //////////////////// Forth step Transpose the vectors   
567                 lstInX.clear();
568                 lstInY.clear();
569                 lstInZ.clear();
570                 lstIndexsIn.clear();
571                 size  = bbGetInputNbPoints();
572                 size2 = lstIndexsOut.size();
573                 for (i=0;i<size;i++)
574                 {
575                         for (j=0;j<size2;j++)
576                         {
577                                 lstInX.push_back( lstOutX[ j*lstIndexsOut[j] + i ] );
578                                 lstInY.push_back( lstOutY[ j*lstIndexsOut[j] + i ] );
579                                 lstInZ.push_back( lstOutZ[ j*lstIndexsOut[j] + i ] );
580                         } // for j
581                         lstIndexsIn.push_back( size2 );
582                 } // for i
583                 lstOutX.clear();
584                 lstOutY.clear();
585                 lstOutZ.clear();
586                 lstIndexsOut.clear();
587                 //////////////////// Set Out   DoubleContour = 1
588                 bbSetOutputLstContourPointsX(lstInX);   
589                 bbSetOutputLstContourPointsY(lstInY);   
590                 bbSetOutputLstContourPointsZ(lstInZ);
591                 bbSetOutputLstIndexsOut(lstIndexsIn);   
592
593         } // if DoubleContour 
594
595 }
596 //===== 
597 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
598 //===== 
599 void ManualContourModel_Box::bbUserSetDefaultValues()
600 {
601
602 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
603 //    Here we initialize the input 'In' to 0
604    bbSetInputType(1);
605    bbSetInputDoubleContour(0);
606    bbSetInputOpenClose(false);
607    bbSetInputOpenClose2(false);
608    bbSetInputNbPoints(100);
609   
610 }
611 //===== 
612 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
613 //===== 
614 void ManualContourModel_Box::bbUserInitializeProcessing()
615 {
616
617 //  THE INITIALIZATION METHOD BODY :
618 //    Here does nothing 
619 //    but this is where you should allocate the internal/output pointers 
620 //    if any 
621
622   
623 }
624 //===== 
625 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
626 //===== 
627 void ManualContourModel_Box::bbUserFinalizeProcessing()
628 {
629
630 //  THE FINALIZATION METHOD BODY :
631 //    Here does nothing 
632 //    but this is where you should desallocate the internal/output pointers 
633 //    if any
634   
635 }
636 }
637 // EO namespace bbcreaMaracasVisu
638
639