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 "manualContourModelCircle.h"
28 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
32 manualContourModelCircle::manualContourModelCircle()
33 : manualContourModel()
37 manualContourModelCircle::~manualContourModelCircle()
42 // ----------------------------------------------------------------------------
43 manualContourModelCircle * manualContourModelCircle :: Clone() // virtual
45 manualContourModelCircle * clone = new manualContourModelCircle();
46 CopyAttributesTo(clone);
50 // ---------------------------------------------------------------------------
52 void manualContourModelCircle::CopyAttributesTo( manualContourModelCircle * cloneObject)
55 manualContourModel::CopyAttributesTo(cloneObject);
58 //----------------------------------------------------------------
59 int manualContourModelCircle::GetTypeModel() //virtual
64 //----------------------------------------------------------------
65 void manualContourModelCircle::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
67 double angle = _deltaAngle*i;
68 *x = _radio*cos(angle) + _centerX;
69 *y = _radio*sin(angle) + _centerY;
74 // ---------------------------------------------------------------------------
75 void manualContourModelCircle::UpdateSpline() // virtal
77 manualPoint *mpA,*mpB;
79 int np = GetSizeLstPoints( );
80 int nps = GetNumberOfPointsSpline();
81 _deltaAngle=(3.14159265*2)/(nps-1);
84 mpA = GetManualPoint(0);
85 mpB = GetManualPoint(1);
86 difX = mpA->GetX() - mpB->GetX();
87 difY = mpA->GetY() - mpB->GetY();
88 _radio = sqrt( difX*difX + difY*difY );
89 _centerX = mpA->GetX();
90 _centerY = mpA->GetY();
91 _centerZ = mpA->GetZ();