1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
26 #include "CutModelFigure.h"
28 //----------------------------------------------------------------------------
29 //----------------------------------------------------------------------------
30 //----------------------------------------------------------------------------
31 CutModelFigure::CutModelFigure()
33 _inversModel = vtkTransform::New();
34 _matrixModel = vtkTransform::New();
35 _matrixVisual = vtkTransform::New();
41 //----------------------------------------------------------------------------
42 CutModelFigure::~CutModelFigure() // virtual
44 _inversModel->Delete();
46 //----------------------------------------------------------------------------
47 void CutModelFigure::SetPosition(double x,double y, double z)
53 //----------------------------------------------------------------------------
54 void CutModelFigure::SetScale(double sx,double sy, double sz)
60 //----------------------------------------------------------------------------
61 void CutModelFigure::SetRotation(double alfa,double beta, double teta)
68 //----------------------------------------------------------------------------
69 void CutModelFigure::CalculeMatrix()
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);
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 );
88 //----------------------------------------------------------------------------
89 void CutModelFigure::CalculeInversMatrix()
91 _inversModel->Identity ();
92 _inversModel->Concatenate ( _matrixModel );
93 _inversModel->Inverse();
95 //----------------------------------------------------------------------------
96 bool CutModelFigure::IfPointInside(double x, double y, double z) // virtual
101 //----------------------------------------------------------------------------
102 vtkTransform *CutModelFigure::GetVtkTransform()
104 return _matrixVisual;
107 //----------------------------------------------------------------------------
108 //void CutModelFigure::SetVtkTransform(vtkTransform *matrix)
110 // _matrixModel = matrix;
113 //----------------------------------------------------------------------------
114 double CutModelFigure::GetTheoricVolume() // virtual
119 //----------------------------------------------------------------------------
120 double CutModelFigure::GetPositionX()
124 //----------------------------------------------------------------------------
125 double CutModelFigure::GetPositionY()
129 //----------------------------------------------------------------------------
130 double CutModelFigure::GetPositionZ()
134 //----------------------------------------------------------------------------
135 double CutModelFigure::GetScaleX()
139 //----------------------------------------------------------------------------
140 double CutModelFigure::GetScaleY()
144 //----------------------------------------------------------------------------
145 double CutModelFigure::GetScaleZ()
149 //----------------------------------------------------------------------------
150 double CutModelFigure::GetAngleAlfa()
154 //----------------------------------------------------------------------------
155 double CutModelFigure::GetAngleBeta()
159 //----------------------------------------------------------------------------
160 double CutModelFigure::GetAngleTeta()
164 //----------------------------------------------------------------------------
165 char *CutModelFigure::GetName() // virtual
170 //----------------------------------------------------------------------------
171 void CutModelFigure::SetSpacing(double spcX,double spcY, double spcZ)