]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkPlaneSource.cxx
3182 creaVtk Feature New Normal - Clean PlaneVecterVisu_Widget
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkPlaneSource.cxx
1 //===== 
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)
3 //===== 
4 #include "bbcreaVtkPlaneSource.h"
5 #include "bbcreaVtkPackage.h"
6 #include "vtkPlaneSource.h"
7 #include "vtkDataSet.h"
8 #include "iostream" 
9 namespace bbcreaVtk
10 {
11
12 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,PlaneSource)
13 BBTK_BLACK_BOX_IMPLEMENTATION(PlaneSource,bbtk::AtomicBlackBox);
14 //===== 
15 // 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 //===== 
17 void PlaneSource::Process()
18 {
19         double c[3];
20         double p0[3];
21     double p1[3];
22         double p2[3];
23         vtkPlaneSource *plane;
24         plane   =       vtkPlaneSource::New();
25         c[0]    =       bbGetInputCenter()[0];
26         c[1]    =       bbGetInputCenter()[1];
27         c[2]    =       bbGetInputCenter()[2];
28         p0[0]   =       0;      
29         p0[1]   =       0;
30         p0[2]   =       0;
31
32
33         // xy
34         if ((bbGetInputNormal()[0]==0) && (bbGetInputNormal()[1]==0) && (bbGetInputNormal()[2]==1)  ) 
35         {
36                 p1[0]   =       200;    
37                 p1[1]   =       0;
38                 p1[2]   =       0;    
39                 p2[0]   =       0;
40                 p2[1]   =       200;
41                 p2[2]   =       0;
42         }
43         
44         // xz
45         if ((bbGetInputNormal()[0]==0) && (bbGetInputNormal()[1]==1) && (bbGetInputNormal()[2]==0)  ) 
46         {
47                 p1[0]   =       200;    
48                 p1[1]   =       0;
49                 p1[2]   =       0;    
50                 p2[0]   =       0;
51                 p2[1]   =       0;
52                 p2[2]   =       200;
53         }
54
55         // yz
56         if ((bbGetInputNormal()[0]==1) && (bbGetInputNormal()[1]==0) && (bbGetInputNormal()[2]==0)  ) 
57         {
58                 p1[0]   =       0;      
59                 p1[1]   =       200;
60                 p1[2]   =       0;    
61                 p2[0]   =       0;
62                 p2[1]   =       0;
63                 p2[2]   =       200;
64         }
65
66
67
68 /*
69                 p1[0]   =       100;    
70                 p1[1]   =       0;
71                 p1[2]   =       0;    
72                 p2[0]   =       0;
73                 p2[1]   =       100;
74                 p2[2]   =       0;
75 */
76                 plane->SetResolution( bbGetInputXResolution(), bbGetInputYResolution() );
77                 plane->SetOrigin( p0 );
78                 plane->SetPoint1( p1 );
79                 plane->SetPoint2( p2 );
80 //              plane->Update( );
81                 plane->SetNormal( bbGetInputNormal()[0], bbGetInputNormal()[1], bbGetInputNormal()[2] );
82 //              plane->Update( );
83                 plane->SetCenter( c );
84                 plane->Update( );
85     bbSetOutputPlane( (vtkDataSet*)plane );
86     bbSetOutputPolyData( plane->GetOutput() );
87
88 }
89 //===== 
90 // 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)
91 //===== 
92 void PlaneSource::bbUserSetDefaultValues()
93 {
94    std::vector<double> c;
95    std::vector<double> n;
96         c.push_back(0);
97         c.push_back(0);
98         c.push_back(0);
99         n.push_back(1);
100         n.push_back(0);
101         n.push_back(0);
102    bbSetInputCenter(c);
103    bbSetInputNormal(n);
104    bbSetInputXResolution(100);
105    bbSetInputYResolution(100);
106 }
107 //===== 
108 // 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)
109 //===== 
110 void PlaneSource::bbUserInitializeProcessing()
111 {
112
113   
114 }
115 //===== 
116 // 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)
117 //===== 
118 void PlaneSource::bbUserFinalizeProcessing()
119 {
120
121   
122 }
123 }
124 // EO namespace bbcreaVtk
125
126