]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx
e1717ca87466bbbabbf5bc22628d5cf99ba9d442
[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
91                                 dist2 = 0;
92                                 for (k=iGeneral+1; k<iGeneral+size;k++)
93                                 {
94                                         dx=(*lstOutX)[k]-(*lstOutX)[k-1];
95                                         dy=(*lstOutY)[k]-(*lstOutY)[k-1];
96                                         dz=(*lstOutZ)[k]-(*lstOutZ)[k-1];
97                                         distSeg = sqrt( dx*dx + dy*dy + dz*dz );
98                                         ii=i-iGeneral;
99                                         if ( dist2+distSeg>=ii*delta) 
100                                         {
101                                                 dd=(ii*delta-dist2)/distSeg;
102                                                 if (distSeg==0)
103                                                 {
104                                                         dd=0;
105                                                 } // if distSeg == 0
106                                                 lstRstX.push_back( (*lstOutX)[k-1] + dd*dx );
107                                                 lstRstY.push_back( (*lstOutY)[k-1] + dd*dy );
108                                                 lstRstZ.push_back( (*lstOutZ)[k-1] + dd*dz );
109                                                 k=iGeneral+size;
110                                         } else {
111                                                 if (k==iGeneral+size-1) 
112                                                 {
113                                                         dd=1;
114                                                         lstRstX.push_back( (*lstOutX)[k-1] + dd*dx );
115                                                         lstRstY.push_back( (*lstOutY)[k-1] + dd*dy );
116                                                         lstRstZ.push_back( (*lstOutZ)[k-1] + dd*dz );
117 //                                                      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);
118                                                 }
119                                         }// if dist2 
120                                         dist2=dist2+distSeg;
121                                 } // for k
122                         } //for i   
123                         if (lstRstX.size()!=size) 
124                         {
125                                 printf("EED Warnning!   ManualContourModel_Box::RedistributionPoints  >> This list is not coherent  iLstIndexOut=%d  lstRstX.size()=%d  size=%d\n",iLstIndexOut, lstRstX.size(), size);
126                         }
127                         for (i=iGeneral; i<iGeneral+size;i++)
128                         {
129                                 ii=i-iGeneral;
130                                 (*lstOutX)[i] = lstRstX[ii];
131                                 (*lstOutY)[i] = lstRstY[ii];
132                                 (*lstOutZ)[i] = lstRstZ[ii];
133                         } // for i
134                 } // if size>2
135                 iGeneral=iGeneral+size;
136         }// for iLstIndexOut
137 }
138
139
140 void ManualContourModel_Box::ClockwisePoints(   std::vector<double> *lstInX,
141                                                                                         std::vector<double> *lstInY, 
142                                                                                         std::vector<double> *lstInZ,
143                                                                                         std::vector<int> *lstIndexsIn )
144 {
145         int     iLstIndexIn,sizeLstIndexIn=lstIndexsIn->size();
146         int     i,iGeneral=0;
147         int     size,size2;
148         double  cx,cy,cz;
149         double  px,py,pz;
150         double  backpx,backpy,backpz;
151         double  ang;
152         char    dir=-1;
153         bool    dirx,diry,dirz;
154         int     flagAng=0;
155         float   backang;
156         double  tmp;
157
158         // For each contour
159         for (iLstIndexIn=0;  iLstIndexIn<sizeLstIndexIn; iLstIndexIn++)
160         {
161                 // Step 1. Find gravity center and direction
162                 size    = (*lstIndexsIn)[iLstIndexIn];
163                 if (size>2)  // for contour with more than 2 points
164                 {
165                         cx              = 0;
166                         cy              = 0;
167                         cz              = 0;
168                         dirx    = true;
169                         diry    = true;
170                         dirz    = true;
171                         for ( i=0 ; i<size ; i++ )
172                         {
173                                 px=(*lstInX)[iGeneral+i];
174                                 py=(*lstInY)[iGeneral+i];
175                                 pz=(*lstInZ)[iGeneral+i];
176                                 cx      = px + cx;
177                                 cy      = py + cy;
178                                 cz      = pz + cz;
179                                 if (i!=0) 
180                                 { 
181                                         if (backpx!=px) { dirx=false; } 
182                                         if (backpy!=py) { diry=false; } 
183                                         if (backpz!=pz) { dirz=false; } 
184                                         backpx=px;
185                                         backpy=py;
186                                         backpz=pz;
187                                 } // if i!=0
188                                 backpx=px; 
189                                 backpy=py; 
190                                 backpz=pz; 
191                         } // for i 
192                         cx=cx/size;
193                         cy=cy/size;
194                         cz=cz/size;
195                         if (dirx==true) { dir=1; }  // YZ 
196                         if (diry==true) { dir=2; }  // XZ 
197                         if (dirz==true) { dir=0; }  // XZ 
198                         // Step 2. Find angle diference find 
199                         flagAng=0;
200                         for ( i=0 ; i<size ; i++ )
201                         {
202                                 px = (*lstInX)[iGeneral+i]-cx;
203                                 py = (*lstInY)[iGeneral+i]-cy;
204                                 pz = (*lstInZ)[iGeneral+i]-cz;
205                                 if (dir==0) { ang=atan2( py , px ); } // XY
206                                 if (dir==1) { ang=atan2( pz , py ); } // YZ
207                                 if (dir==2) { ang=atan2( pz , px ); } // XZ
208                                 if (i>0) 
209                                 { 
210                                         if (backang<ang) 
211                                         {
212                                                 flagAng++;
213                                         } else {
214                                                 flagAng--;
215                                         }// if backang<ang
216                                 } // if i
217                                 backang=ang; 
218                         } // for i 
219
220 printf("EED ManualContourModel_Box::ClockwisePoints cx=%f cy=%f cz=%f    flagAng=%d   size=%d \n",cx,cy,cz,flagAng, size);
221 //if (cy<=490) { flagAng = flagAng*(-1); }
222
223                         // Step 3. Invert order of points
224                         if (flagAng<0)
225                         {
226                                 size2 = size/2;
227                                 for ( i=0 ; i<size2 ; i++ )
228                                 {
229                                         tmp                                                     = (*lstInX)[iGeneral+i];
230                                         (*lstInX)[iGeneral+i]                   = (*lstInX)[iGeneral+size-1-i];
231                                         (*lstInX)[iGeneral+size-1-i]    = tmp;
232                                         tmp                                                     = (*lstInY)[iGeneral+i];
233                                         (*lstInY)[iGeneral+i]                   = (*lstInY)[iGeneral+size-1-i];
234                                         (*lstInY)[iGeneral+size-1-i]    = tmp;
235                                         tmp                                                     = (*lstInZ)[iGeneral+i];
236                                         (*lstInZ)[iGeneral+i]                   = (*lstInZ)[iGeneral+size-1-i];
237                                         (*lstInZ)[iGeneral+size-1-i]    = tmp;
238                                 } // for i
239                         } // flagAng
240                 } // size>2
241                 iGeneral = iGeneral+size;
242         } // for iLstIndexIn
243 }
244
245
246 /*
247 void ManualContourModel_Box::ShiftValues(       std::vector<double> *lstInX,
248                                                                                         std::vector<double> *lstInY, 
249                                                                                         std::vector<double> *lstInZ,
250                                                                                         std::vector<int> *lstIndexsIn )
251 {
252         int iLstIndexIn,sizeLstIndexIn=lstIndexsIn->size();
253         int ii, iGeneral=0;
254         int size,size2;
255         double dist,distMin;
256         int i,iBack;
257         int ig;
258         double dx,dy,dz;
259         std::vector<double> LstTmpX;
260         std::vector<double> LstTmpY;
261         std::vector<double> LstTmpZ;
262         if (sizeLstIndexIn>=2)
263         {
264         
265                 for (iLstIndexIn=0;  iLstIndexIn<sizeLstIndexIn-1; iLstIndexIn++)
266                 {
267                         size  = (*lstIndexsIn)[iLstIndexIn];
268                         size2 = (*lstIndexsIn)[iLstIndexIn+1];
269                         //find min distance and  iBack
270                         distMin = 10000000;
271                         iBack   = 0;
272                         
273                         
274                         for (ig=0; ig<size; ig++)
275                         {
276                                 for ( i=0 ; i<size2 ; i++ )
277                                 {
278                                         dx      = (*lstInX)[iGeneral+ig]-(*lstInX)[iGeneral+size+i];
279                                         dy      = (*lstInY)[iGeneral+ig]-(*lstInY)[iGeneral+size+i];
280                                         dz      = (*lstInZ)[iGeneral+ig]-(*lstInZ)[iGeneral+size+i];
281                                         dist= sqrt( dx*dx + dy*dy + dz*dz );
282                                         if ( dist<distMin ) 
283                                         {
284                                                 iBack   = i-ig;
285                                                 distMin = dist;
286                                         }
287                                 } // for i size2
288                         } // for ig size
289
290 if (iBack<0) 
291 {
292         printf("- "); 
293         iBack = iBack + size2; 
294 }
295                         
296 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);
297                         
298                         if (iBack!=0)
299                         {
300                                 LstTmpX.clear();
301                                 LstTmpY.clear();
302                                 LstTmpZ.clear();
303                                 for (i=0 ; i<size2 ; i++) 
304                                 {
305                                         ii= (i+iBack)%size2;
306                                         LstTmpX.push_back( (*lstInX)[iGeneral+size+ii] );
307                                         LstTmpY.push_back( (*lstInY)[iGeneral+size+ii] );
308                                         LstTmpZ.push_back( (*lstInZ)[iGeneral+size+ii] );
309                                 } // for i                              
310                                 for (i=0 ; i<size2 ; i++) 
311                                 {
312                                         (*lstInX)[iGeneral+size+i] = LstTmpX[i];
313                                         (*lstInY)[iGeneral+size+i] = LstTmpY[i];
314                                         (*lstInZ)[iGeneral+size+i] = LstTmpZ[i];
315                                 } // for i                              
316                         }
317                         iGeneral=iGeneral+size;
318                 } // for iLstIndexIn
319                 
320 //------------          
321                 
322                 iGeneral=0;
323
324                 for (iLstIndexIn=0;  iLstIndexIn<sizeLstIndexIn-1; iLstIndexIn++)
325                 {
326                         size  = (*lstIndexsIn)[iLstIndexIn];
327                         size2 = (*lstIndexsIn)[iLstIndexIn+1];
328                         //find min distance and  iBack
329                         distMin = 10000000;
330                         iBack   = 0;
331                         
332                         
333 //                      for (ig=0; ig<size; ig++)
334 //                      {
335                                 for ( i=0 ; i<size2 ; i++ )
336                                 {
337                                         dx      = (*lstInX)[iGeneral]-(*lstInX)[iGeneral+size+i];
338                                         dy      = (*lstInY)[iGeneral]-(*lstInY)[iGeneral+size+i];
339                                         dz      = (*lstInZ)[iGeneral]-(*lstInZ)[iGeneral+size+i];
340                                         dist= sqrt( dx*dx + dy*dy + dz*dz );
341                                         if ( dist<distMin ) 
342                                         {
343                                                 iBack   = i;
344                                                 distMin = dist;
345                                         }
346                                 } // for i size2
347 //                      } // for ig size
348
349                         
350 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);
351                         
352                         if (iBack!=0)
353                         {
354                                 LstTmpX.clear();
355                                 LstTmpY.clear();
356                                 LstTmpZ.clear();
357                                 for (i=0 ; i<size2 ; i++) 
358                                 {
359                                         ii= (i+iBack)%size2;
360                                         LstTmpX.push_back( (*lstInX)[iGeneral+size+ii] );
361                                         LstTmpY.push_back( (*lstInY)[iGeneral+size+ii] );
362                                         LstTmpZ.push_back( (*lstInZ)[iGeneral+size+ii] );
363                                 } // for i                              
364                                 for (i=0 ; i<size2 ; i++) 
365                                 {
366                                         (*lstInX)[iGeneral+size+i] = LstTmpX[i];
367                                         (*lstInY)[iGeneral+size+i] = LstTmpY[i];
368                                         (*lstInZ)[iGeneral+size+i] = LstTmpZ[i];
369                                 } // for i                              
370                         }
371                         iGeneral=iGeneral+size;
372                 } // for iLstIndexIn
373                 
374         } // if sizeLstIndexIn
375         
376 }
377 */
378
379
380
381 void ManualContourModel_Box::ShiftValues(       std::vector<double> *lstInX,
382                                                                                         std::vector<double> *lstInY, 
383                                                                                         std::vector<double> *lstInZ,
384                                                                                         std::vector<int> *lstIndexsIn )
385 {
386         int iLstIndexIn,sizeLstIndexIn=lstIndexsIn->size();
387         int ii, iGeneral=0;
388         int size,size2;
389         double dist,distMin;
390         int i,iBack;
391         int ig;
392         double dx,dy,dz;
393         std::vector<double> LstTmpX;
394         std::vector<double> LstTmpY;
395         std::vector<double> LstTmpZ;
396         if (sizeLstIndexIn>=2)
397         {
398         
399                 for (iLstIndexIn=0;  iLstIndexIn<sizeLstIndexIn-1; iLstIndexIn++)
400                 {
401                         size  = (*lstIndexsIn)[iLstIndexIn];
402                         size2 = (*lstIndexsIn)[iLstIndexIn+1];
403                         //find min distance and  iBack
404                         distMin = 10000000;
405                         iBack   = 0;
406                         
407                         
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                                         LstTmpX.push_back( (*lstInX)[iGeneral+size+ii] );
439                                         LstTmpY.push_back( (*lstInY)[iGeneral+size+ii] );
440                                         LstTmpZ.push_back( (*lstInZ)[iGeneral+size+ii] );
441                                 } // for i                              
442                                 for (i=0 ; i<size2 ; i++) 
443                                 {
444                                         (*lstInX)[iGeneral+size+i] = LstTmpX[i];
445                                         (*lstInY)[iGeneral+size+i] = LstTmpY[i];
446                                         (*lstInZ)[iGeneral+size+i] = LstTmpZ[i];
447                                 } // for i                              
448                         }
449                         iGeneral=iGeneral+size;
450                 } // for iLstIndexIn
451                 
452                 
453         } // if sizeLstIndexIn
454         
455 }
456
457
458
459
460
461
462 void ManualContourModel_Box::Process()
463 {
464 // THE MAIN PROCESSING METHOD BODY
465 //   Here we simply set the input 'In' value to the output 'Out'
466 //   And print out the output value
467 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
468 //    void bbSet{Input|Output}NAME(const TYPE&)
469 //    const TYPE& bbGet{Input|Output}NAME() const 
470 //    Where :
471 //    * NAME is the name of the input/output
472 //      (the one provided in the attribute 'name' of the tag 'input')
473 //    * TYPE is the C++ type of the input/output
474 //      (the one provided in the attribute 'type' of the tag 'input')
475
476 //    bbSetOutputOut( bbGetInputIn() );
477 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
478
479         // First Step  Spline Interpolation
480         std::vector<double> lstInX=bbGetInputLstControlPointsX();
481         std::vector<double> lstInY=bbGetInputLstControlPointsY();
482         std::vector<double> lstInZ=bbGetInputLstControlPointsZ();
483         if ( (lstInX.size()!=lstInY.size()) || (lstInY.size()!=lstInZ.size()) ) 
484         { 
485                 printf("Warnning !!  .. ManualContourModel_Box: The list X Y Z, no have the same number of elements \n");
486                 return;
487         }
488         std::vector<int>        lstIndexsIn=bbGetInputLstIndexsIn();
489         std::vector<int>        lstIndexsOut;
490         std::vector<double> lstOutX;
491         std::vector<double> lstOutY;
492         std::vector<double> lstOutZ;
493         if (bbGetInputLstIndexsIn().size()==0)
494         {
495                 lstIndexsIn.push_back( lstInX.size() );
496         }
497         if (bbGetInputDoubleContour()==1)
498         {
499                 ClockwisePoints( &lstInX , &lstInY , &lstInZ , &lstIndexsIn );
500 //              ShiftValues( &lstInX , &lstInY , &lstInZ , &lstIndexsIn );
501         } // DoubleContour
502         int i,size=lstIndexsIn.size();
503         int iGeneral=0;
504         for (i=0;i<size;i++)
505         {
506                 ProcessBySegment(       bbGetInputType() , 
507                                                         iGeneral,  lstIndexsIn[i] ,
508                                                         &lstInX ,  &lstInY  , &lstInZ,
509                                                         &lstOutX , &lstOutY , &lstOutZ,
510                                                         &lstIndexsOut,bbGetInputOpenClose() );
511         } // for
512
513         if (bbGetInputDoubleContour()==0)
514         {
515                 //////////////////// Set Out   DoubleContour = 0
516                 bbSetOutputLstContourPointsX(lstOutX);  
517                 bbSetOutputLstContourPointsY(lstOutY);  
518                 bbSetOutputLstContourPointsZ(lstOutZ);
519                 bbSetOutputLstIndexsOut(lstIndexsOut);  
520         } else {
521                 RedistributionPoints(&lstOutX,&lstOutY,&lstOutZ,&lstIndexsOut);
522                 ShiftValues( &lstOutX, &lstOutY, &lstOutZ, &lstIndexsOut );
523                 ///////////// Second Step Transpose the vectors   
524                 lstInX.clear();
525                 lstInY.clear();
526                 lstInZ.clear();
527                 lstIndexsIn.clear();
528                 size  = bbGetInputNbPoints();
529                 int j,size2 = lstIndexsOut.size();
530                 for (i=0;i<size;i++)
531                 {
532                         for (j=0;j<size2;j++)
533                         {
534                                 lstInX.push_back( lstOutX[ j*lstIndexsOut[j] + i ] );
535                                 lstInY.push_back( lstOutY[ j*lstIndexsOut[j] + i ] );
536                                 lstInZ.push_back( lstOutZ[ j*lstIndexsOut[j] + i ] );
537                         } // for j
538                         lstIndexsIn.push_back( size2 );
539                 } // for i
540                 lstOutX.clear();
541                 lstOutY.clear();
542                 lstOutZ.clear();
543                 lstIndexsOut.clear();
544                 ///////////////////// Third step Interponation 2
545                 size=lstIndexsIn.size();
546                 iGeneral=0;
547                 for (i=0;i<size;i++)
548                 {
549                         ProcessBySegment(       bbGetInputType() , 
550                                                                 iGeneral, lstIndexsIn[i] ,
551                                                                 &lstInX,&lstInY,&lstInZ,
552                                                                 &lstOutX,&lstOutY,&lstOutZ,
553                                                                 &lstIndexsOut,bbGetInputOpenClose2());
554                 } // for
555                 RedistributionPoints(&lstOutX,&lstOutY,&lstOutZ,&lstIndexsOut);
556                 //////////////////// Forth step Transpose the vectors   
557                 lstInX.clear();
558                 lstInY.clear();
559                 lstInZ.clear();
560                 lstIndexsIn.clear();
561                 size  = bbGetInputNbPoints();
562                 size2 = lstIndexsOut.size();
563                 for (i=0;i<size;i++)
564                 {
565                         for (j=0;j<size2;j++)
566                         {
567                                 lstInX.push_back( lstOutX[ j*lstIndexsOut[j] + i ] );
568                                 lstInY.push_back( lstOutY[ j*lstIndexsOut[j] + i ] );
569                                 lstInZ.push_back( lstOutZ[ j*lstIndexsOut[j] + i ] );
570                         } // for j
571                         lstIndexsIn.push_back( size2 );
572                 } // for i
573                 lstOutX.clear();
574                 lstOutY.clear();
575                 lstOutZ.clear();
576                 lstIndexsOut.clear();
577                 //////////////////// Set Out   DoubleContour = 1
578                 bbSetOutputLstContourPointsX(lstInX);   
579                 bbSetOutputLstContourPointsY(lstInY);   
580                 bbSetOutputLstContourPointsZ(lstInZ);
581                 bbSetOutputLstIndexsOut(lstIndexsIn);   
582
583         } // if DoubleContour 
584
585 }
586 //===== 
587 // 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)
588 //===== 
589 void ManualContourModel_Box::bbUserSetDefaultValues()
590 {
591
592 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
593 //    Here we initialize the input 'In' to 0
594    bbSetInputType(1);
595    bbSetInputDoubleContour(0);
596    bbSetInputOpenClose(false);
597    bbSetInputOpenClose2(false);
598    bbSetInputNbPoints(100);
599   
600 }
601 //===== 
602 // 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)
603 //===== 
604 void ManualContourModel_Box::bbUserInitializeProcessing()
605 {
606
607 //  THE INITIALIZATION METHOD BODY :
608 //    Here does nothing 
609 //    but this is where you should allocate the internal/output pointers 
610 //    if any 
611
612   
613 }
614 //===== 
615 // 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)
616 //===== 
617 void ManualContourModel_Box::bbUserFinalizeProcessing()
618 {
619
620 //  THE FINALIZATION METHOD BODY :
621 //    Here does nothing 
622 //    but this is where you should desallocate the internal/output pointers 
623 //    if any
624   
625 }
626 }
627 // EO namespace bbcreaMaracasVisu
628
629