]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx
2afadd58691e04c0f04db481d40bbb8d58ee3541
[cpPlugins.git] / lib / cpPlugins / Plugins / BasicFilters / Cutter.cxx
1 #include "Cutter.h"
2 #include <cpPlugins/Interface/ImplicitFunction.h>
3 #include <cpPlugins/Interface/Mesh.h>
4
5 #include <vtkCutter.h>
6 #include <vtkProperty.h>
7
8
9 #include <vtkPlane.h>
10
11 // -------------------------------------------------------------------------
12 cpPlugins::BasicFilters::Cutter::
13 Cutter( )
14   : Superclass( )
15 {
16   this->_AddInput( "InputMesh" );
17   this->_AddInput( "InputFunction" );
18   this->_AddOutput< cpPlugins::Interface::Mesh >( "Output" );
19 }
20
21 // -------------------------------------------------------------------------
22 cpPlugins::BasicFilters::Cutter::
23 ~Cutter( )
24 {
25 }
26
27 // -------------------------------------------------------------------------
28 std::string cpPlugins::BasicFilters::Cutter::
29 _GenerateData( )
30 {
31   // Get inputs
32   auto mesh = this->GetInputData( "InputMesh" );
33   auto function = this->GetInputData( "InputFunction" );
34   vtkCutter* cutter = this->_CreateVTK< vtkCutter >( );
35   cutter->DebugOn( );
36   cutter->SetInputData( mesh->GetVTK< vtkPolyData >( ) );
37   cutter->SetCutFunction( function->GetVTK< vtkImplicitFunction >( ) );
38   cutter->SetValue( 0, 1 );
39   cutter->GenerateTrianglesOff( );
40   cutter->Update( );
41
42   // Execute filter
43   auto out = this->GetOutputData( "Output" );
44   out->SetVTK( cutter->GetOutput( ) );
45
46   return( "" );
47 }
48
49 // eof - $RCSfile$