]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelCircle.cpp
creaButtonContainer & creaPanelButtonContainer: Updates in doxygen documentation...
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / manualContour / manualContourModelCircle.cpp
1 #include "manualContourModelCircle.h"
2
3 // ----------------------------------------------------------------------------
4 // ----------------------------------------------------------------------------
5 // ----------------------------------------------------------------------------
6
7 manualContourModelCircle::manualContourModelCircle()
8 : manualContourModel()
9 {
10 }
11
12 manualContourModelCircle::~manualContourModelCircle()
13 {
14 }
15
16
17 // ----------------------------------------------------------------------------
18 manualContourModelCircle * manualContourModelCircle :: Clone()  // virtual
19 {
20         manualContourModelCircle * clone = new manualContourModelCircle();
21         CopyAttributesTo(clone);
22         return clone;
23 }
24
25 // ---------------------------------------------------------------------------
26
27 void manualContourModelCircle::CopyAttributesTo( manualContourModelCircle * cloneObject)
28 {
29         // Fathers object
30         manualContourModel::CopyAttributesTo(cloneObject);
31 }
32
33 //----------------------------------------------------------------
34 int manualContourModelCircle::GetTypeModel() //virtual
35 {
36         return 3;
37 }
38
39 //----------------------------------------------------------------
40 void manualContourModelCircle::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
41 {
42         double angle = _deltaAngle*i;
43         *x = _radio*cos(angle) + _centerX;
44         *y = _radio*sin(angle) + _centerY;
45         *z = _centerZ;
46 }
47
48 //
49 // ---------------------------------------------------------------------------
50 void manualContourModelCircle::UpdateSpline() // virtal
51 {
52         manualPoint     *mpA,*mpB;
53         double difX,difY;
54     int np      = GetSizeLstPoints( );
55         int nps = GetNumberOfPointsSpline();
56         _deltaAngle=(3.14159265*2)/(nps-1);
57
58         if (np==2){
59                 mpA                     = GetManualPoint(0);
60                 mpB                     = GetManualPoint(1);
61                 difX            = mpA->GetX() - mpB->GetX();
62                 difY            = mpA->GetY() - mpB->GetY();
63                 _radio          = sqrt( difX*difX + difY*difY );
64                 _centerX        = mpA->GetX();
65                 _centerY        = mpA->GetY();
66                 _centerZ        = mpA->GetZ();
67         } else {
68                 _radio          = -1;
69                 _centerX        = -1;
70                 _centerY        = -1;
71                 _centerZ        = -1;
72         }
73 }