]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkPointRotation.cxx
#2469 creaVtk Bug New Normal windows compilation conflit witn math.h definitions
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkPointRotation.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 "bbcreaVtkPointRotation.h"
5 #include "bbcreaVtkPackage.h"
6
7 #define _USE_MATH_DEFINES // for C
8 #include <math.h>
9
10 namespace bbcreaVtk
11 {
12
13 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,PointRotation)
14 BBTK_BLACK_BOX_IMPLEMENTATION(PointRotation,bbtk::AtomicBlackBox);
15 //===== 
16 // 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)
17 //===== 
18 void PointRotation::Process()
19 {
20
21 // THE MAIN PROCESSING METHOD BODY
22 //   Here we simply set the input 'In' value to the output 'Out'
23 //   And print out the output value
24 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
25 //    void bbSet{Input|Output}NAME(const TYPE&)
26 //    const TYPE& bbGet{Input|Output}NAME() const 
27 //    Where :
28 //    * NAME is the name of the input/output
29 //      (the one provided in the attribute 'name' of the tag 'input')
30 //    * TYPE is the C++ type of the input/output
31 //      (the one provided in the attribute 'type' of the tag 'input')
32
33
34 printf("EED PointRotation::Process Start\n");
35
36         if   (bbGetInputCenter().size()==3) 
37         {
38                 std::vector<double> newpoint;
39                 double nx,cx = bbGetInputCenter()[0];
40                 double ny,cy = bbGetInputCenter()[1];
41                 double nz,cz = bbGetInputCenter()[2];
42                 double angRad = bbGetInputAngle()*M_PI/180;
43                 nx = bbGetInputSize() * cos( angRad ) + cx;
44                 ny = bbGetInputSize() * sin( angRad ) + cy;
45                 nz = cz;
46                 newpoint.push_back(nx);
47                 newpoint.push_back(ny);
48                 newpoint.push_back(nz);
49         bbSetOutputOut( newpoint );
50         } // if
51 printf("EED PointRotation::Process End\n");
52   
53 }
54 //===== 
55 // 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)
56 //===== 
57 void PointRotation::bbUserSetDefaultValues()
58 {
59
60 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
61 //    Here we initialize the input 'In' to 0
62
63         std::vector<double> point;
64         point.push_back(1);
65         point.push_back(0);
66         point.push_back(0);
67
68         std::vector<double> center;
69         center.push_back(0);
70         center.push_back(0);
71         center.push_back(0);
72
73    bbSetInputSize(1);
74    bbSetInputCenter(center);
75    bbSetInputAngle(0);
76    bbSetOutputOut(point);
77 }
78 //===== 
79 // 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)
80 //===== 
81 void PointRotation::bbUserInitializeProcessing()
82 {
83
84 //  THE INITIALIZATION METHOD BODY :
85 //    Here does nothing 
86 //    but this is where you should allocate the internal/output pointers 
87 //    if any 
88
89   
90 }
91 //===== 
92 // 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)
93 //===== 
94 void PointRotation::bbUserFinalizeProcessing()
95 {
96
97 //  THE FINALIZATION METHOD BODY :
98 //    Here does nothing 
99 //    but this is where you should desallocate the internal/output pointers 
100 //    if any
101   
102 }
103 }
104 // EO namespace bbcreaVtk
105
106