]> Creatis software - creaVtk.git/blobdiff - bbtk_creaVtk_PKG/src/bbcreaVtkPointPickerNearest.cxx
#3478 PointPickerNearest
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkPointPickerNearest.cxx
index e7534a069ab55cb9b223f1a665fa9e9c9556a7f5..fc2442a9977d9e9066fa24d9500a06ab067498d8 100644 (file)
@@ -31,10 +31,13 @@ void PointPickerNearest::Process()
 //    * TYPE is the C++ type of the input/output
 //      (the one provided in the attribute 'type' of the tag 'input')
 
+    printf ("EED PointPickerNearest::Process Start\n");
 
     std::vector<double> lstNormal;
     std::vector<double> refPoint = bbGetInputPoint();
 
+    printf ("EED PointPickerNearest::Process 1\n");
+
     if ((bbGetInputActive()==true) && ( bbGetInputMesh()!=NULL) && (refPoint.size()==3) )
     {
         double      p[3];
@@ -45,6 +48,7 @@ void PointPickerNearest::Process()
         vtkPoints   *points = bbGetInputMesh()->GetPoints();
         long        size    = points->GetNumberOfPoints();
         double      border = bbGetInputBorder() * bbGetInputBorder();
+        printf ("EED PointPickerNearest::Process 2\n");
         for ( i=0 ; i<size ; i++)
         {
             points->GetPoint(i,p);
@@ -61,6 +65,7 @@ void PointPickerNearest::Process()
             } // if distMax
         } // for i
 
+        printf ("EED PointPickerNearest::Process 3\n");
         if (iBack>=0)
         {
             vtkPointData    *pointdata  = bbGetInputMesh()->GetPointData();
@@ -74,10 +79,12 @@ void PointPickerNearest::Process()
                 printf("EED creaVtkCallbackPointPicker::Execute dataarray=%s  n=%ld p=%ld\n", dataarray->GetName(),dataarray->GetNumberOfValues() ,polydata->GetNumberOfPoints() );
             } // for i
             */
+            printf ("EED PointPickerNearest::Process 4\n");
             dataarray   = pointdata->GetNormals();
             if (dataarray!=NULL)
             {
                 pValue      = dataarray->GetTuple3( iBack );
+                printf ("EED PointPickerNearest::Process 5\n");
                 lstNormal.push_back(pValue[0]);
                 lstNormal.push_back(pValue[1]);
                 lstNormal.push_back(pValue[2]);
@@ -85,10 +92,27 @@ void PointPickerNearest::Process()
         } // if iBack
         bbSetOutputPointId( iBack );
         bbSetOutputNormal( lstNormal );
+        printf ("EED PointPickerNearest::Process 6 %ld\n", iBack);
+        std::vector<double> lstPointOut;
+        if (iBack>=0){
+            points->GetPoint(iBack,p);
+            lstPointOut.push_back(p[0]);
+            lstPointOut.push_back(p[1]);
+            lstPointOut.push_back(p[2]);
+            printf ("EED PointPickerNearest::Process 7 pointOut=%f %f %f\n", lstPointOut[0],lstPointOut[1],lstPointOut[2]);
+        }// if iBack
+        bbSetOutputPointOut( lstPointOut );
     } else {
         bbSetOutputPointId( -1 );
+        lstNormal.push_back(0);
+        lstNormal.push_back(1);
+        lstNormal.push_back(2);
         bbSetOutputNormal( lstNormal );
+        bbSetOutputPointOut( bbGetInputPoint() );
     }
+    
+    printf ("EED PointPickerNearest::Process END\n");
+
 }
 //===== 
 // 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)
@@ -100,7 +124,7 @@ void PointPickerNearest::bbUserSetDefaultValues()
 //    Here we initialize the input 'In' to 0
     bbSetInputActive(false);
     bbSetInputMesh(NULL);
-    bbSetInputBorder(10);
+    bbSetInputBorder(5);
 }
 //===== 
 // 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)