]> Creatis software - creaVtk.git/blobdiff - bbtk_creaVtk_PKG/src/bbcreaVtkMeshDeformation.cxx
Merge branch 'vtk9itk5wx3-macos' of ssh://git.creatis.insa-lyon.fr/creaVtk into vtk9i...
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkMeshDeformation.cxx
index 9223d520135f4ac9d37dee006a2617c2f8a69721..865a6fae82f8b9c352c2b34c0ef45908e14e2055 100644 (file)
@@ -28,15 +28,16 @@ void MeshDeformation::Process()
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
 
+
     std::vector<double> lstCenter = bbGetInputCenter();
 
-    double s = bbGetInputS();
-    bool ok=false;
+    double  s   = bbGetInputS();
+    bool    ok  = false;
     if (bbGetInputTypeIn()==0) // direction
     {
         if (bbGetInputDirection().size()==3)
         {
-                ok = !( (bbGetInputDirection()[0]==0) && (bbGetInputDirection()[1]==0) && (bbGetInputDirection()[2]==0) );
+            ok = !( (bbGetInputDirection()[0]==0) && (bbGetInputDirection()[1]==0) && (bbGetInputDirection()[2]==0) );
         }
     } // if TypeIn 0
     
@@ -47,6 +48,9 @@ void MeshDeformation::Process()
 
     if ( (bbGetInputIn()!=NULL) && (ok==true) && (bbGetInputEdgeId()>=0) && (bbGetInputActive()==true) )
     {
+
+        printf(" EED MeshDeformation::Process   %ld   %ld  -   %f %f %f \n", EdgeIdBack, bbGetInputEdgeId() , lstCenter[0],lstCenter[1],lstCenter[2] );
+
         vtkPoints* points=bbGetInputIn()->GetPoints();
         long    i,size=points->GetNumberOfPoints();
         double  p[3];  // point
@@ -67,37 +71,40 @@ void MeshDeformation::Process()
             displcement_y = bbGetInputDirection()[1];
             displcement_z = bbGetInputDirection()[2];
         } // if TypeIn 0 Direction
-        
+               
+               printf(" EED MeshDeformation::Process   %ld   %ld  -   %f %f %f \n", EdgeIdBack, bbGetInputEdgeId() , lstCenter[0],lstCenter[1],lstCenter[2] );
+               
         if (bbGetInputTypeIn()==1) // Center
         {
             if (EdgeIdBack==bbGetInputEdgeId() )
             {
-                displcement_x   = (lstCenter[0]-backLstCenter[0])/1.0;
-                displcement_y   = (lstCenter[1]-backLstCenter[1])/1.0;
-                displcement_z   = (lstCenter[2]-backLstCenter[2])/1.0;
+                displcement_x = (lstCenter[0]-backLstCenter[0])/1.0;
+                displcement_y = (lstCenter[1]-backLstCenter[1])/1.0;
+                displcement_z = (lstCenter[2]-backLstCenter[2])/1.0;
             } // if EdgeIdBack!=bbGetInputEdgeId()
-            backLstCenter[0]= lstCenter[0];
-            backLstCenter[1]= lstCenter[1];
-            backLstCenter[2]= lstCenter[2];
+            backLstCenter[0] = lstCenter[0];
+            backLstCenter[1] = lstCenter[1];
+            backLstCenter[2] = lstCenter[2];
         } // if TypeIn 1 Center
-
-        
-            points->GetPoint( bbGetInputEdgeId() , pb );
-            if (EdgeIdBack!=bbGetInputEdgeId() )
+        points->GetPoint( bbGetInputEdgeId() , pb );
+        if (EdgeIdBack!=bbGetInputEdgeId() )
+        {
+            EdgeIdBack = bbGetInputEdgeId();
+            voiIdPoints.clear();
+            for ( i=0 ; i<size ; i++)
             {
-                EdgeIdBack = bbGetInputEdgeId();
-                voiIdPoints.clear();
-                for ( i=0 ; i<size ; i++)
+                points->GetPoint(i,p);
+                if ( (p[0]>(pb[0]-sx)) && (p[0]<(pb[0]+sx)) &&
+                     (p[1]>(pb[1]-sy)) && (p[1]<(pb[1]+sy)) &&
+                     (p[2]>(pb[2]-sz)) && (p[2]<(pb[2]+sz)) )
                 {
-                    points->GetPoint(i,p);
-                    if ( (p[0]>(pb[0]-sx)) && (p[0]<(pb[0]+sx)) &&
-                         (p[1]>(pb[1]-sy)) && (p[1]<(pb[1]+sy)) &&
-                         (p[2]>(pb[2]-sz)) && (p[2]<(pb[2]+sz)) )
-                    {
-                        voiIdPoints.push_back( i );
-                    } // if
-                } // for i
-            } // back
+                    voiIdPoints.push_back( i );
+                } // if
+            } // for i
+                       backLstCenter[0] = lstCenter[0];
+                       backLstCenter[1] = lstCenter[1];
+                       backLstCenter[2] = lstCenter[2];
+        } // if EdgeIdBack
 
         if ( !((displcement_x==0) &&(displcement_y==0) && (displcement_z==0)) )
         {
@@ -125,7 +132,7 @@ void MeshDeformation::Process()
             points->Modified();
             bbGetInputIn()->Modified();
         } // if distance_x y z  != 0
-    } // In != NULL
+    } // In != NULL    ok    active
 }
 //===== 
 // 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)
@@ -151,6 +158,7 @@ void MeshDeformation::bbUserSetDefaultValues()
     backLstCenter.push_back(0);
     backLstCenter.push_back(0);
 }
+
 //===== 
 // 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)
 //===== 
@@ -164,19 +172,18 @@ void MeshDeformation::bbUserInitializeProcessing()
 
   
 }
+
 //===== 
 // 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)
 //===== 
 void MeshDeformation::bbUserFinalizeProcessing()
 {
-
 //  THE FINALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should desallocate the internal/output pointers 
 //    if any
-  
-}
 }
-// EO namespace bbcreaVtk
+
+}// EO namespace bbcreaVtk