2 #include <cpPlugins/Interface/ImplicitFunction.h>
3 #include <cpPlugins/Interface/Mesh.h>
6 #include <vtkProperty.h>
8 // -------------------------------------------------------------------------
9 vtkAlgorithm* cpPlugins::BasicFilters::Cutter::
12 return( this->m_Algorithm );
15 // -------------------------------------------------------------------------
16 const vtkAlgorithm* cpPlugins::BasicFilters::Cutter::
17 GetVTKAlgorithm( ) const
19 return( this->m_Algorithm );
22 // -------------------------------------------------------------------------
23 cpPlugins::BasicFilters::Cutter::
28 this->m_ClassName = "cpPlugins::BasicFilters::Cutter";
29 this->m_ClassCategory = "MeshToMeshFilter";
31 this->SetNumberOfInputs( 2 );
32 this->SetNumberOfOutputs( 1 );
33 this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
35 this->m_Parameters = this->m_DefaultParameters;
38 // -------------------------------------------------------------------------
39 cpPlugins::BasicFilters::Cutter::
42 if( this->m_Algorithm != NULL )
43 this->m_Algorithm->Delete( );
46 // -------------------------------------------------------------------------
47 std::string cpPlugins::BasicFilters::Cutter::
51 cpPlugins::Interface::Mesh* mesh =
52 this->GetInput< cpPlugins::Interface::Mesh >( 0 );
53 cpPlugins::Interface::ImplicitFunction* function =
54 this->GetInput< cpPlugins::Interface::ImplicitFunction >( 1 );
55 if( function == NULL )
56 return( "Cutter: Input data 1 is not a valid implicit function." );
58 if( this->m_Algorithm != NULL )
59 this->m_Algorithm->Delete( );
61 vtkCutter* cutter = vtkCutter::New( );
62 cutter->SetInputData( mesh->GetVTKMesh( ) );
63 cutter->SetCutFunction( function->GetVTKImplicitFunction( ) );
64 cutter->GenerateTrianglesOff( );
65 this->m_Algorithm = cutter;
68 this->m_Algorithm->Update( );
69 cpPlugins::Interface::Mesh* out =
70 this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
71 out->SetVTKMesh( this->m_Algorithm->GetOutput( ) );