]> Creatis software - creaMaracasVisu.git/blob
f9a145ba89bdb54198e8dd6ecfba1e2f6a9b5dfb
[creaMaracasVisu.git] /
1 #include "manualContourModelBullEyeSector.h"
2
3
4 // ----------------------------------------------------------------------------
5 // ----------------------------------------------------------------------------
6 // ----------------------------------------------------------------------------
7
8 manualContourModelBullEyeSector::manualContourModelBullEyeSector()
9 : manualContourModel()
10 {
11 }
12
13 manualContourModelBullEyeSector::~manualContourModelBullEyeSector()
14 {
15 }
16
17
18 // ----------------------------------------------------------------------------
19 manualContourModelBullEyeSector * manualContourModelBullEyeSector :: Clone()  // virtual
20 {
21         manualContourModelBullEyeSector * clone = new manualContourModelBullEyeSector();
22         CopyAttributesTo(clone);
23         return clone;
24 }
25
26 // ---------------------------------------------------------------------------
27
28 void manualContourModelBullEyeSector::CopyAttributesTo( manualContourModelBullEyeSector * cloneObject)
29 {
30         // Fathers object
31         manualContourModel::CopyAttributesTo(cloneObject);
32 }
33
34 //----------------------------------------------------------------
35 int manualContourModelBullEyeSector::GetTypeModel() //virtual
36 {
37         return 5;
38 }
39
40
41 //----------------------------------------------------------------
42 void manualContourModelBullEyeSector::SetSector(        double radioA,
43                                                 double radioB,
44                                                 double ang,
45                                                 double angDelta)
46 {
47         _radioA         = radioA;
48         _radioB         = radioB;
49         _ang            = ang*3.14159265/180.0;
50         _angDelta       = angDelta*3.14159265/180.0;
51 }
52
53 //----------------------------------------------------------------
54 void manualContourModelBullEyeSector::GetSector(
55                                                 double *radioA,
56                                                 double *radioB,
57                                                 double *ang,
58                                                 double *angDelta)
59 {
60         *radioA         = _radioA;
61         *radioB         = _radioB;
62         *ang            = _ang;
63         *angDelta       = _angDelta;
64 }
65
66 // ----------------------------------------------------------------------------
67 void manualContourModelBullEyeSector::SetCenter(double cx,double cy)
68 {
69         _cx = cx;
70         _cy = cy;
71 }
72
73 //----------------------------------------------------------------
74 void manualContourModelBullEyeSector::SetSize(double ww,double hh)
75 {
76         _ww = ww;
77         _hh = hh;
78 }
79
80 //----------------------------------------------------------------
81 void manualContourModelBullEyeSector::GetSpline_i_Point(int i, double *x, double *y, double *z)
82 {
83 //EED004
84
85         int ii,nps;
86 //      double x,y,z;
87         double ang,angcos, angsin;
88         double radio;
89
90         nps     =  GetNumberOfPointsSpline() - 3;
91
92         if (i==GetNumberOfPointsSpline()-1)
93         {
94                 i=0;
95         }
96
97         if (i<=nps/2)
98         {
99                 ii=i;
100                 radio=_radioA;
101         } else {
102                 ii=nps-i+1;
103                 radio=_radioB;
104         }
105         ang = ((double)ii/(nps/2))*_angDelta + _ang;
106         angcos =  cos(ang);
107         angsin =  sin(ang);
108
109         *x = _ww*radio*angcos + _cx;
110         *y = _hh*radio*angsin + _cy;
111         *z= 900;
112 }
113
114 //----------------------------------------------------------------
115 void manualContourModelBullEyeSector::Save(FILE *ff) // virtual
116 {
117         manualContourModel::Save(ff);
118         fprintf(ff,"rA= %f rB= %f ang= %f deltaAng= %f\n", _radioA,_radioB, _ang , _angDelta);
119 }
120
121 //----------------------------------------------------------------
122 void manualContourModelBullEyeSector::Open(FILE *ff) // virtual
123 {
124         char tmp[255];
125         fscanf(ff,"%s",tmp); // TypeModel
126         fscanf(ff,"%s",tmp); // ##
127
128         manualContourModel::Open(ff);
129
130
131         fscanf(ff,"%s",tmp); // radioA=
132         fscanf(ff,"%s",tmp); // radioA
133         _radioA = atof(tmp);
134
135         fscanf(ff,"%s",tmp); // radioB=
136         fscanf(ff,"%s",tmp); // radioB
137         _radioB = atof(tmp);
138
139         fscanf(ff,"%s",tmp); // ang=
140         fscanf(ff,"%s",tmp); // ang
141         _ang = atof(tmp);
142
143         fscanf(ff,"%s",tmp); // deltaAng=
144         fscanf(ff,"%s",tmp); // deltaAng
145         _angDelta = atof(tmp);
146 }
147
148