]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkPlaneSource.cxx
#3100 creaVtk Feature New Normal - Vectors Visu refresh
[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         double size=350;
33
34         // xy
35         if ((bbGetInputNormal()[0]==0) && (bbGetInputNormal()[1]==0) && (bbGetInputNormal()[2]==1)  ) 
36         {
37                 p1[0]   =       size;   
38                 p1[1]   =       0;
39                 p1[2]   =       0;    
40                 p2[0]   =       0;
41                 p2[1]   =       size;
42                 p2[2]   =       0;
43         }
44         
45         // xz
46         if ((bbGetInputNormal()[0]==0) && (bbGetInputNormal()[1]==1) && (bbGetInputNormal()[2]==0)  ) 
47         {
48                 p1[0]   =       size;   
49                 p1[1]   =       0;
50                 p1[2]   =       0;    
51                 p2[0]   =       0;
52                 p2[1]   =       0;
53                 p2[2]   =       size;
54         }
55
56         // yz
57         if ((bbGetInputNormal()[0]==1) && (bbGetInputNormal()[1]==0) && (bbGetInputNormal()[2]==0)  ) 
58         {
59                 p1[0]   =       0;      
60                 p1[1]   =       size;
61                 p1[2]   =       0;    
62                 p2[0]   =       0;
63                 p2[1]   =       0;
64                 p2[2]   =       size;
65         }
66
67
68
69 /*
70                 p1[0]   =       100;    
71                 p1[1]   =       0;
72                 p1[2]   =       0;    
73                 p2[0]   =       0;
74                 p2[1]   =       100;
75                 p2[2]   =       0;
76 */
77                 plane->SetResolution( bbGetInputXResolution(), bbGetInputYResolution() );
78                 plane->SetOrigin( p0 );
79                 plane->SetPoint1( p1 );
80                 plane->SetPoint2( p2 );
81 //              plane->Update( );
82                 plane->SetNormal( bbGetInputNormal()[0], bbGetInputNormal()[1], bbGetInputNormal()[2] );
83 //              plane->Update( );
84                 plane->SetCenter( c );
85                 plane->Update( );
86     bbSetOutputPlane( (vtkDataSet*)plane );
87     bbSetOutputPolyData( plane->GetOutput() );
88
89 }
90 //===== 
91 // 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)
92 //===== 
93 void PlaneSource::bbUserSetDefaultValues()
94 {
95    std::vector<double> c;
96    std::vector<double> n;
97         c.push_back(0);
98         c.push_back(0);
99         c.push_back(0);
100         n.push_back(1);
101         n.push_back(0);
102         n.push_back(0);
103    bbSetInputCenter(c);
104    bbSetInputNormal(n);
105    bbSetInputXResolution(100);
106    bbSetInputYResolution(100);
107 }
108 //===== 
109 // 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)
110 //===== 
111 void PlaneSource::bbUserInitializeProcessing()
112 {
113
114   
115 }
116 //===== 
117 // 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)
118 //===== 
119 void PlaneSource::bbUserFinalizeProcessing()
120 {
121
122   
123 }
124 }
125 // EO namespace bbcreaVtk
126
127