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 "bbcreaVtkApplyTransformToPoint3D.h"
5 #include "bbcreaVtkPackage.h"
6 #include "vtkTransform.h"
11 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ApplyTransformToPoint3D)
12 BBTK_BLACK_BOX_IMPLEMENTATION(ApplyTransformToPoint3D,bbtk::AtomicBlackBox);
14 // 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)
16 void ApplyTransformToPoint3D::Process()
19 // THE MAIN PROCESSING METHOD BODY
20 // Here we simply set the input 'In' value to the output 'Out'
21 // And print out the output value
22 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
23 // void bbSet{Input|Output}NAME(const TYPE&)
24 // const TYPE& bbGet{Input|Output}NAME() const
26 // * NAME is the name of the input/output
27 // (the one provided in the attribute 'name' of the tag 'input')
28 // * TYPE is the C++ type of the input/output
29 // (the one provided in the attribute 'type' of the tag 'input')
30 // bbSetOutputOut( bbGetInputIn() );
31 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
34 if ((bbGetInputPoint().size()==3) && (bbGetInputDirectionInPoint().size()==3) )
36 double point[3] , newPoint[3];
37 point[0] = bbGetInputPoint()[0];
38 point[1] = bbGetInputPoint()[1];
39 point[2] = bbGetInputPoint()[2];
40 bbGetInputTransform()->TransformPoint( point,newPoint );
41 std::vector<double> out;
42 out.push_back( newPoint[0] );
43 out.push_back( newPoint[1] );
44 out.push_back( newPoint[2] );
45 bbSetOutputOut( out );
47 double pointDir[3] , newPointDir[3];
48 pointDir[0] = bbGetInputPoint()[0]+bbGetInputDirectionInPoint()[0];
49 pointDir[1] = bbGetInputPoint()[1]+bbGetInputDirectionInPoint()[1];
50 pointDir[2] = bbGetInputPoint()[2]+bbGetInputDirectionInPoint()[2];
51 bbGetInputTransform()->TransformPoint( pointDir,newPointDir );
52 std::vector<double> outDir;
53 outDir.push_back( newPointDir[0]-newPoint[0] );
54 outDir.push_back( newPointDir[1]-newPoint[1] );
55 outDir.push_back( newPointDir[2]-newPoint[2] );
56 bbSetOutputOutDirection( outDir );
58 printf("EED Warning! ApplyTransformToPoint3D::Process Incoherent sizes Point(3)=%d DirectionInPoint(3)=%d\n", bbGetInputPoint().size(),bbGetInputDirectionInPoint().size() );
63 // 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)
65 void ApplyTransformToPoint3D::bbUserSetDefaultValues()
67 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
68 // Here we initialize the input 'In' to 0
70 std::vector<double> point;
74 bbSetInputPoint( point );
75 std::vector<double> dir;
79 bbSetInputDirectionInPoint( dir );
80 bbSetInputTransform(NULL);
84 // 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)
86 void ApplyTransformToPoint3D::bbUserInitializeProcessing()
88 // THE INITIALIZATION METHOD BODY :
90 // but this is where you should allocate the internal/output pointers
95 // 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)
97 void ApplyTransformToPoint3D::bbUserFinalizeProcessing()
99 // THE FINALIZATION METHOD BODY :
101 // but this is where you should desallocate the internal/output pointers
105 } // EO namespace bbcreaVtk