]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/CutModule/kernel/CutModelFigure.cxx__
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / CutModule / kernel / CutModelFigure.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 #include "CutModelFigure.h"
27
28 //----------------------------------------------------------------------------
29 //----------------------------------------------------------------------------
30 //----------------------------------------------------------------------------
31 CutModelFigure::CutModelFigure()
32 {
33         _inversModel    = vtkTransform::New();
34         _matrixModel    = vtkTransform::New();
35         _matrixVisual   = vtkTransform::New();
36
37         _spcX=1;
38         _spcY=1;
39         _spcZ=1;
40 }
41 //----------------------------------------------------------------------------
42 CutModelFigure::~CutModelFigure() // virtual
43 {
44         _inversModel->Delete();
45 }
46 //----------------------------------------------------------------------------
47 void CutModelFigure::SetPosition(double x,double y, double z)
48 {
49         _px=x;
50         _py=y;
51         _pz=z;
52 }
53 //----------------------------------------------------------------------------
54 void CutModelFigure::SetScale(double sx,double sy, double sz)
55 {
56         _sx=sx;
57         _sy=sy;
58         _sz=sz;
59 }
60 //----------------------------------------------------------------------------
61 void CutModelFigure::SetRotation(double alfa,double beta, double teta)
62 {
63         _alfa=alfa;
64         _beta=beta;
65         _teta=teta;
66 }
67
68 //----------------------------------------------------------------------------
69 void CutModelFigure::CalculeMatrix()
70 {
71         _matrixModel->Identity();
72         _matrixModel->Translate(_px,_py,_pz);
73         _matrixModel->RotateY(_beta);
74         _matrixModel->RotateX(_alfa);
75         _matrixModel->RotateY(_teta);
76         _matrixModel->Scale(_sx,_sy,_sz);
77
78         _matrixVisual->Identity();
79         _matrixVisual->Translate( _px*_spcX  ,  _py*_spcY  ,  _pz*_spcZ  );
80         _matrixVisual->RotateY(_beta);
81         _matrixVisual->RotateX(_alfa);
82         _matrixVisual->RotateY(_teta);
83         _matrixVisual->Scale( _sx*_spcX  ,  _sy*_spcY  ,  _sz*_spcZ  );
84
85 }
86
87
88 //----------------------------------------------------------------------------
89 void CutModelFigure::CalculeInversMatrix()
90 {
91         _inversModel->Identity ();
92         _inversModel->Concatenate ( _matrixModel );
93         _inversModel->Inverse();
94 }
95 //----------------------------------------------------------------------------
96 bool CutModelFigure::IfPointInside(double x, double y, double z) // virtual
97 {
98         return true;
99 }
100
101 //----------------------------------------------------------------------------
102 vtkTransform *CutModelFigure::GetVtkTransform()
103 {
104         return _matrixVisual;
105 }
106
107 //----------------------------------------------------------------------------
108 //void CutModelFigure::SetVtkTransform(vtkTransform *matrix)
109 //{
110 //      _matrixModel = matrix;
111 //}
112
113 //----------------------------------------------------------------------------
114 double CutModelFigure::GetTheoricVolume() // virtual
115 {
116         return 0;
117 }
118
119 //----------------------------------------------------------------------------
120 double CutModelFigure::GetPositionX()
121 {
122         return _px;
123 }
124 //----------------------------------------------------------------------------
125 double CutModelFigure::GetPositionY()
126 {
127         return _py;
128 }
129 //----------------------------------------------------------------------------
130 double CutModelFigure::GetPositionZ()
131 {
132         return _pz;
133 }
134 //----------------------------------------------------------------------------
135 double CutModelFigure::GetScaleX()
136 {
137         return _sx;
138 }
139 //----------------------------------------------------------------------------
140 double CutModelFigure::GetScaleY()
141 {
142         return _sy;
143 }
144 //----------------------------------------------------------------------------
145 double CutModelFigure::GetScaleZ()
146 {
147         return _sz;
148 }
149 //----------------------------------------------------------------------------
150 double CutModelFigure::GetAngleAlfa()
151 {
152         return _alfa;
153 }
154 //----------------------------------------------------------------------------
155 double CutModelFigure::GetAngleBeta()
156 {
157         return _beta;
158 }
159 //----------------------------------------------------------------------------
160 double CutModelFigure::GetAngleTeta()
161 {
162         return _teta;
163 }
164 //----------------------------------------------------------------------------
165 char *CutModelFigure::GetName() // virtual
166 {
167         return "--";
168 }
169
170 //----------------------------------------------------------------------------
171 void CutModelFigure::SetSpacing(double spcX,double spcY, double spcZ)
172 {
173         _spcX = spcX;
174         _spcY = spcY;
175         _spcZ = spcZ;
176 }