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 "manualContourModelBullEyeSector.h"
29 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
31 // ----------------------------------------------------------------------------
33 manualContourModelBullEyeSector::manualContourModelBullEyeSector()
34 : manualContourModel()
38 manualContourModelBullEyeSector::~manualContourModelBullEyeSector()
43 // ----------------------------------------------------------------------------
44 manualContourModelBullEyeSector * manualContourModelBullEyeSector :: Clone() // virtual
46 manualContourModelBullEyeSector * clone = new manualContourModelBullEyeSector();
47 CopyAttributesTo(clone);
51 // ---------------------------------------------------------------------------
53 void manualContourModelBullEyeSector::CopyAttributesTo( manualContourModelBullEyeSector * cloneObject)
56 manualContourModel::CopyAttributesTo(cloneObject);
59 //----------------------------------------------------------------
60 int manualContourModelBullEyeSector::GetTypeModel() //virtual
66 //----------------------------------------------------------------
67 void manualContourModelBullEyeSector::SetSector( double radioA,
74 _ang = ang*3.14159265/180.0;
75 _angDelta = angDelta*3.14159265/180.0;
78 //----------------------------------------------------------------
79 void manualContourModelBullEyeSector::GetSector(
88 *angDelta = _angDelta;
91 // ----------------------------------------------------------------------------
92 void manualContourModelBullEyeSector::SetCenter(double cx,double cy)
98 //----------------------------------------------------------------
99 void manualContourModelBullEyeSector::SetSize(double ww,double hh)
105 //----------------------------------------------------------------
106 void manualContourModelBullEyeSector::GetSpline_i_Point(int i, double *x, double *y, double *z)
112 double ang,angcos, angsin;
115 nps = GetNumberOfPointsSpline() - 3;
117 if (i==GetNumberOfPointsSpline()-1)
130 ang = ((double)ii/(nps/2))*_angDelta + _ang;
134 *x = _ww*radio*angcos + _cx;
135 *y = _hh*radio*angsin + _cy;
137 //EED 21 mars 2012 FLIP probleme ..PLOP..
142 //----------------------------------------------------------------
143 void manualContourModelBullEyeSector::Save(FILE *ff) // virtual
145 manualContourModel::Save(ff);
146 fprintf(ff,"rA= %f rB= %f ang= %f deltaAng= %f\n", _radioA,_radioB, _ang , _angDelta);
149 //----------------------------------------------------------------
150 void manualContourModelBullEyeSector::Open(FILE *ff) // virtual
153 fscanf(ff,"%s",tmp); // TypeModel
154 fscanf(ff,"%s",tmp); // ##
156 manualContourModel::Open(ff);
159 fscanf(ff,"%s",tmp); // radioA=
160 fscanf(ff,"%s",tmp); // radioA
163 fscanf(ff,"%s",tmp); // radioB=
164 fscanf(ff,"%s",tmp); // radioB
167 fscanf(ff,"%s",tmp); // ang=
168 fscanf(ff,"%s",tmp); // ang
171 fscanf(ff,"%s",tmp); // deltaAng=
172 fscanf(ff,"%s",tmp); // deltaAng
173 _angDelta = atof(tmp);