]> Creatis software - creaVtk.git/blobdiff - bbtk_creaVtk_PKG/src/bbcreaVtkCutter.cxx
#3513 CleanMeshWithPatch
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkCutter.cxx
index 2b7c9aed7ef57599f5e19a0f21e8c8797862dd7a..0e4f85af50e1e4d59188d59209919b8b8d7c78b2 100644 (file)
@@ -4,9 +4,7 @@
 #include "bbcreaVtkCutter.h"
 #include "bbcreaVtkPackage.h"
 #include "vtkCutter.h"
-#include "vtkStripper.h"
-#include "vtkPlane.h"
-#
+
 namespace bbcreaVtk
 {
 
@@ -32,49 +30,32 @@ void Cutter::Process()
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
   
-  
-  
-  
-  
   //  See example in:
   //  https://kitware.github.io/vtk-examples/site/Cxx/VisualizationAlgorithms/Cutter/
   
-       vtkCutter       *cutter;
-    vtkPolyData        *poly;
-       vtkStripper     *strips;
-
-       vtkPlane        *plane;
-       plane  = vtkPlane::New();
-       plane->SetOrigin(0,0,30);
-       plane->SetNormal(0,0,1);
-       
-       cutter = vtkCutter::New();
-       cutter->SetInputData( bbGetInputIn() );
-    cutter->SetCutFunction( plane );
-    cutter->Update();
-       
-       strips = vtkStripper::New();
-    strips->SetInputData( cutter->GetOutput() );
-    strips->Update();
-    poly = vtkPolyData::New();
-    poly->SetPoints( strips->GetOutput()->GetPoints() );
-    poly->SetPolys( strips->GetOutput()->GetLines() );
-       
-       bbSetOutputOut( poly );
-//     bbSetOutputOut( cutter->GetOutput() );
-       
-       
+    if ( (bbGetInputActive()==true) && (bbGetInputIn()!=NULL) )
+    {
+        vtkCutter *cutter;
+        cutter = vtkCutter::New();
+        cutter->SetInputData( bbGetInputIn() );
+        cutter->SetCutFunction( bbGetInputImplicitFunction() );
+        cutter->Update();
+        bbSetOutputOut( cutter->GetOutput() );
+    } else {
+        bbSetOutputOut( NULL );
+    }
 }
+
 //===== 
 // 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 Cutter::bbUserSetDefaultValues()
 {
-
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
 //   bbSetInputIn(NULL);
-  
+    bbSetInputActive( true );
+    bbSetOutputOut( NULL );
 }
 //===== 
 // 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)
@@ -101,7 +82,7 @@ void Cutter::bbUserFinalizeProcessing()
 //    if any
   
 }
-}
-// EO namespace bbcreaVtk
+
+}// EO namespace bbcreaVtk