]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/CutModule/kernel/CutModel2Figure.cxx__
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / CutModule / kernel / CutModel2Figure.cxx__
1
2 #include "CutModelFigure.h"
3
4 //----------------------------------------------------------------------------
5 //----------------------------------------------------------------------------
6 //----------------------------------------------------------------------------
7 CutModelFigure::CutModelFigure()
8 {
9         _inversModel    = vtkTransform::New();
10         _matrixModel    = vtkTransform::New();
11         _matrixVisual   = vtkTransform::New();
12
13         _spcX=1;
14         _spcY=1;
15         _spcZ=1;
16 }
17 //----------------------------------------------------------------------------
18 CutModelFigure::~CutModelFigure() // virtual
19 {
20         _inversModel->Delete();
21 }
22 //----------------------------------------------------------------------------
23 void CutModelFigure::SetPosition(double x,double y, double z)
24 {
25         _px=x;
26         _py=y;
27         _pz=z;
28 }
29 //----------------------------------------------------------------------------
30 void CutModelFigure::SetScale(double sx,double sy, double sz)
31 {
32         _sx=sx;
33         _sy=sy;
34         _sz=sz;
35 }
36 //----------------------------------------------------------------------------
37 void CutModelFigure::SetRotation(double alfa,double beta, double teta)
38 {
39         _alfa=alfa;
40         _beta=beta;
41         _teta=teta;
42 }
43
44 //----------------------------------------------------------------------------
45 void CutModelFigure::CalculeMatrix()
46 {
47         _matrixModel->Identity();
48         _matrixModel->Translate(_px,_py,_pz);
49         _matrixModel->RotateY(_beta);
50         _matrixModel->RotateX(_alfa);
51         _matrixModel->RotateY(_teta);
52         _matrixModel->Scale(_sx,_sy,_sz);
53
54         _matrixVisual->Identity();
55         _matrixVisual->Translate( _px*_spcX  ,  _py*_spcY  ,  _pz*_spcZ  );
56         _matrixVisual->RotateY(_beta);
57         _matrixVisual->RotateX(_alfa);
58         _matrixVisual->RotateY(_teta);
59         _matrixVisual->Scale( _sx*_spcX  ,  _sy*_spcY  ,  _sz*_spcZ  );
60
61 }
62
63
64 //----------------------------------------------------------------------------
65 void CutModelFigure::CalculeInversMatrix()
66 {
67         _inversModel->Identity ();
68         _inversModel->Concatenate ( _matrixModel );
69         _inversModel->Inverse();
70 }
71 //----------------------------------------------------------------------------
72 bool CutModelFigure::IfPointInside(double x, double y, double z) // virtual
73 {
74         return true;
75 }
76
77 //----------------------------------------------------------------------------
78 vtkTransform *CutModelFigure::GetVtkTransform()
79 {
80         return _matrixVisual;
81 }
82
83 //----------------------------------------------------------------------------
84 //void CutModelFigure::SetVtkTransform(vtkTransform *matrix)
85 //{
86 //      _matrixModel = matrix;
87 //}
88
89 //----------------------------------------------------------------------------
90 double CutModelFigure::GetTheoricVolume() // virtual
91 {
92         return 0;
93 }
94
95 //----------------------------------------------------------------------------
96 double CutModelFigure::GetPositionX()
97 {
98         return _px;
99 }
100 //----------------------------------------------------------------------------
101 double CutModelFigure::GetPositionY()
102 {
103         return _py;
104 }
105 //----------------------------------------------------------------------------
106 double CutModelFigure::GetPositionZ()
107 {
108         return _pz;
109 }
110 //----------------------------------------------------------------------------
111 double CutModelFigure::GetScaleX()
112 {
113         return _sx;
114 }
115 //----------------------------------------------------------------------------
116 double CutModelFigure::GetScaleY()
117 {
118         return _sy;
119 }
120 //----------------------------------------------------------------------------
121 double CutModelFigure::GetScaleZ()
122 {
123         return _sz;
124 }
125 //----------------------------------------------------------------------------
126 double CutModelFigure::GetAngleAlfa()
127 {
128         return _alfa;
129 }
130 //----------------------------------------------------------------------------
131 double CutModelFigure::GetAngleBeta()
132 {
133         return _beta;
134 }
135 //----------------------------------------------------------------------------
136 double CutModelFigure::GetAngleTeta()
137 {
138         return _teta;
139 }
140 //----------------------------------------------------------------------------
141 char *CutModelFigure::GetName() // virtual
142 {
143         return "--";
144 }
145
146 //----------------------------------------------------------------------------
147 void CutModelFigure::SetSpacing(double spcX,double spcY, double spcZ)
148 {
149         _spcX = spcX;
150         _spcY = spcY;
151         _spcZ = spcZ;
152 }