2 // 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)
4 #include "bbcreaVtkExtrusion.h"
5 #include "bbcreaVtkPackage.h"
7 #include <vtkTrimmedExtrusionFilter.h>
8 #include <vtkLinearExtrusionFilter.h>
9 #include <vtkTriangleFilter.h>
14 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,Extrusion)
15 BBTK_BLACK_BOX_IMPLEMENTATION(Extrusion,bbtk::AtomicBlackBox);
17 // 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)
19 void Extrusion::Process()
22 // THE MAIN PROCESSING METHOD BODY
23 // Here we simply set the input 'In' value to the output 'Out'
24 // And print out the output value
25 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
26 // void bbSet{Input|Output}NAME(const TYPE&)
27 // const TYPE& bbGet{Input|Output}NAME() const
29 // * NAME is the name of the input/output
30 // (the one provided in the attribute 'name' of the tag 'input')
31 // * TYPE is the C++ type of the input/output
32 // (the one provided in the attribute 'type' of the tag 'input')
33 // bbSetOutputOut( bbGetInputIn() );
34 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
36 if (bbGetInputIn()!=NULL)
38 if ((bbGetInputType()>=0) && (bbGetInputType()<=1))
40 vtkTrimmedExtrusionFilter *extrusion = vtkTrimmedExtrusionFilter::New();
41 extrusion->SetExtrusionDirection(1,1,1);
42 extrusion->SetInputData( bbGetInputIn() );
43 extrusion->SetTrimSurfaceData( bbGetInputIn2() );
44 if (bbGetInputType()==0)
46 extrusion->SetExtrusionStrategy(vtkTrimmedExtrusionFilter::BOUNDARY_EDGES);
48 extrusion->SetExtrusionStrategy(vtkTrimmedExtrusionFilter::ALL_EDGES);
51 bbSetOutputOut( extrusion->GetTrimSurface() );
54 if (bbGetInputType()==2)
56 // Apply linear extrusion
57 vtkLinearExtrusionFilter *extrude=vtkLinearExtrusionFilter::New();
58 extrude->SetInputData( bbGetInputIn() );
59 extrude->SetExtrusionTypeToNormalExtrusion();
60 extrude->SetVector(0, -1, 0);
61 extrude->SetScaleFactor(-7);
63 vtkTriangleFilter *triangleFilter = vtkTriangleFilter::New();
64 triangleFilter->SetInputData( extrude->GetOutput() );
65 triangleFilter->Update( );
66 bbSetOutputOut( triangleFilter->GetOutput() );
73 // 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)
75 void Extrusion::bbUserSetDefaultValues()
78 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
79 // Here we initialize the input 'In' to 0
85 // 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)
87 void Extrusion::bbUserInitializeProcessing()
90 // THE INITIALIZATION METHOD BODY :
92 // but this is where you should allocate the internal/output pointers
98 // 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 void Extrusion::bbUserFinalizeProcessing()
103 // THE FINALIZATION METHOD BODY :
105 // but this is where you should desallocate the internal/output pointers
110 // EO namespace bbcreaVtk