]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/figureCuttingModel.cxx
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / figureCuttingModel.cxx
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26
27 #include "figureCuttingModel.h"
28
29 //----------------------------------------------------------------------------
30 //----------------------------------------------------------------------------
31 //----------------------------------------------------------------------------
32 figureCuttingModel::figureCuttingModel()
33 {
34         _inversModel    = vtkTransform::New();
35         _matrixModel    = vtkTransform::New();
36         _matrixVisual   = vtkTransform::New();
37
38         _spcX=1;
39         _spcY=1;
40         _spcZ=1;
41 }
42 //----------------------------------------------------------------------------
43 figureCuttingModel::~figureCuttingModel() // virtual
44 {
45         _inversModel->Delete();
46 }
47 //----------------------------------------------------------------------------
48 void figureCuttingModel::SetPosition(double x,double y, double z)
49 {
50         _px=x;
51         _py=y;
52         _pz=z;
53 }
54 //----------------------------------------------------------------------------
55 void figureCuttingModel::SetScale(double sx,double sy, double sz)
56 {
57         _sx=sx;
58         _sy=sy;
59         _sz=sz;
60 }
61 //----------------------------------------------------------------------------
62 void figureCuttingModel::SetRotation(double alfa,double beta, double teta)
63 {
64         _alfa=alfa;
65         _beta=beta;
66         _teta=teta;
67 }
68
69 //----------------------------------------------------------------------------
70 void figureCuttingModel::CalculeMatrix()
71 {
72         _matrixModel->Identity();
73         _matrixModel->Translate(_px,_py,_pz);
74         _matrixModel->RotateY(_beta);
75         _matrixModel->RotateX(_alfa);
76         _matrixModel->RotateY(_teta);
77         _matrixModel->Scale(_sx,_sy,_sz);
78
79         _matrixVisual->Identity();
80         _matrixVisual->Translate( _px*_spcX  ,  _py*_spcY  ,  _pz*_spcZ  );
81         _matrixVisual->RotateY(_beta);
82         _matrixVisual->RotateX(_alfa);
83         _matrixVisual->RotateY(_teta);
84         _matrixVisual->Scale( _sx*_spcX  ,  _sy*_spcY  ,  _sz*_spcZ  );
85
86 }
87
88
89 //----------------------------------------------------------------------------
90 void figureCuttingModel::CalculeInversMatrix()
91 {
92         _inversModel->Identity ();
93         _inversModel->Concatenate ( _matrixModel );
94         _inversModel->Inverse();
95 }
96 //----------------------------------------------------------------------------
97 bool figureCuttingModel::IfPointInside(double x, double y, double z) // virtual
98 {
99         return true;
100 }
101
102 //----------------------------------------------------------------------------
103 vtkTransform *figureCuttingModel::GetVtkTransform()
104 {
105         return _matrixVisual;
106 }
107
108 //----------------------------------------------------------------------------
109 //void figureCuttingModel::SetVtkTransform(vtkTransform *matrix)
110 //{
111 //      _matrixModel = matrix;
112 //}
113
114 //----------------------------------------------------------------------------
115 double figureCuttingModel::GetTheoricVolume() // virtual
116 {
117         return 0;
118 }
119
120 //----------------------------------------------------------------------------
121 double figureCuttingModel::GetPositionX()
122 {
123         return _px;
124 }
125 //----------------------------------------------------------------------------
126 double figureCuttingModel::GetPositionY()
127 {
128         return _py;
129 }
130 //----------------------------------------------------------------------------
131 double figureCuttingModel::GetPositionZ()
132 {
133         return _pz;
134 }
135 //----------------------------------------------------------------------------
136 double figureCuttingModel::GetScaleX()
137 {
138         return _sx;
139 }
140 //----------------------------------------------------------------------------
141 double figureCuttingModel::GetScaleY()
142 {
143         return _sy;
144 }
145 //----------------------------------------------------------------------------
146 double figureCuttingModel::GetScaleZ()
147 {
148         return _sz;
149 }
150 //----------------------------------------------------------------------------
151 double figureCuttingModel::GetAngleAlfa()
152 {
153         return _alfa;
154 }
155 //----------------------------------------------------------------------------
156 double figureCuttingModel::GetAngleBeta()
157 {
158         return _beta;
159 }
160 //----------------------------------------------------------------------------
161 double figureCuttingModel::GetAngleTeta()
162 {
163         return _teta;
164 }
165 //----------------------------------------------------------------------------
166 const char *figureCuttingModel::GetName() // virtual
167 {
168         return "--";
169 }
170
171 //----------------------------------------------------------------------------
172 void figureCuttingModel::SetSpacing(double spcX,double spcY, double spcZ)
173 {
174         _spcX = spcX;
175         _spcY = spcY;
176         _spcZ = spcZ;
177 }
178