ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/addin/step/src/stcylindrical.cpp
Revision: 1156
Committed: Thu Jun 13 22:02:48 2024 UTC (14 months ago) by francois
File size: 8825 byte(s)
Log Message:
compatibilité Ubuntu 22.04
Suppression des refeences à Windows
Ajout d'une banière

File Contents

# User Rev Content
1 francois 1156 //####//------------------------------------------------------------
2     //####//------------------------------------------------------------
3     //####// MAGiC
4     //####// Jean Christophe Cuilliere et Vincent FRANCOIS
5     //####// Departement de Genie Mecanique - UQTR
6     //####//------------------------------------------------------------
7     //####// MAGIC est un projet de recherche de l equipe ERICCA
8     //####// du departement de genie mecanique de l Universite du Quebec a Trois Rivieres
9     //####// http://www.uqtr.ca/ericca
10     //####// http://www.uqtr.ca/
11     //####//------------------------------------------------------------
12     //####//------------------------------------------------------------
13     //####//
14     //####// stcylindrical.cpp
15     //####//
16     //####//------------------------------------------------------------
17     //####//------------------------------------------------------------
18     //####// COPYRIGHT 2000-2024
19     //####// jeu 13 jun 2024 11:53:59 EDT
20     //####//------------------------------------------------------------
21     //####//------------------------------------------------------------
22 francois 283
23    
24    
25     #include "stcylindrical.h"
26     #include "st_gestionnaire.h"
27     #include "constantegeo.h"
28    
29     #include <math.h>
30    
31    
32    
33    
34     ST_CYLINDRICAL::ST_CYLINDRICAL(long LigneCourante,std::string idori,long axis2,double ray):ST_SURFACE(LigneCourante,idori),id_axis2_placement_3d(axis2),rayon(ray)
35     {
36     }
37    
38     ST_CYLINDRICAL::ST_CYLINDRICAL(double *xyz,double *dirz,double *dirx,double ray):ST_SURFACE(),rayon(ray)
39     {
40     initialiser(xyz,dirz,dirx);
41     }
42    
43    
44     long ST_CYLINDRICAL::get_id_axis2_placement_3d(void)
45     {
46     return id_axis2_placement_3d;
47     }
48    
49     double ST_CYLINDRICAL::get_rayon(void)
50     {
51     return rayon;
52     }
53     void ST_CYLINDRICAL::evaluer(double *uv,double *xyz)
54     {
55     OT_VECTEUR_3D local(rayon*cos(uv[0]),rayon*sin(uv[0]),uv[1]);
56     OT_VECTEUR_3D global=origine+repere*local;
57     xyz[0]=global.get_x();
58     xyz[1]=global.get_y();
59     xyz[2]=global.get_z();
60     }
61     void ST_CYLINDRICAL::deriver(double *uv,double *xyzdu, double *xyzdv)
62     {
63     OT_VECTEUR_3D localu(-rayon*sin(uv[0]),rayon*cos(uv[0]),0.);
64     OT_VECTEUR_3D localv(0.,0.,1.);
65     OT_VECTEUR_3D globalu=repere*localu;
66     OT_VECTEUR_3D globalv=repere*localv;
67     xyzdu[0]=globalu.get_x();
68     xyzdu[1]=globalu.get_y();
69     xyzdu[2]=globalu.get_z();
70     xyzdv[0]=globalv.get_x();
71     xyzdv[1]=globalv.get_y();
72     xyzdv[2]=globalv.get_z();
73     }
74     void ST_CYLINDRICAL::deriver_seconde(double *uv,double* xyzduu,double* xyzduv,double* xyzdvv,double *xyz , double *xyzdu , double *xyzdv )
75     {
76     OT_VECTEUR_3D local(-rayon*cos(uv[0]),-rayon*sin(uv[0]),0.);
77     OT_VECTEUR_3D global=repere*local;
78     xyzduu[0]=global.get_x();
79     xyzduu[1]=global.get_y();
80     xyzduu[2]=global.get_z();
81     xyzduv[0]=0.;
82     xyzduv[1]=0.;
83     xyzduv[2]=0.;
84     xyzdvv[0]=0.;
85     xyzdvv[1]=0.;
86     xyzdvv[2]=0.;
87    
88     if ((xyzdu!=NULL) && (xyzdv!=NULL ) ) deriver(uv,xyzdu,xyzdv);
89     if (xyz!=NULL) evaluer(uv,xyz);
90     }
91     void ST_CYLINDRICAL::inverser(double *uv,double *xyz,double precision)
92     {
93     double sign;
94     OT_VECTEUR_3D global(xyz[0],xyz[1],xyz[2]);
95     OT_MATRICE_3D transpose_repere;
96     repere.transpose(transpose_repere);
97     OT_VECTEUR_3D vecteur=transpose_repere*(global-origine);
98     double valeur;
99     valeur=vecteur.get_x()/rayon;
100     if (valeur>1) valeur=1;
101     if (valeur<-1) valeur=-1;
102     uv[0]=acos(valeur);
103     sign=vecteur.get_y()/rayon;
104     if (sign<-0.000001) uv[0]= 2.*M_PI-uv[0];
105     uv[1]=vecteur.get_z();
106     }
107     int ST_CYLINDRICAL::est_periodique_u(void)
108     {
109     return 1;
110     }
111     int ST_CYLINDRICAL::est_periodique_v(void)
112     {
113     return 0;
114     }
115     double ST_CYLINDRICAL::get_periode_u(void)
116     {
117     return 2.*M_PI;
118     }
119     double ST_CYLINDRICAL::get_periode_v(void)
120     {
121     return 0;
122     }
123     double ST_CYLINDRICAL::get_umin(void)
124     {
125     return 0.;
126     }
127     double ST_CYLINDRICAL::get_umax(void)
128     {
129     return 2.*M_PI;
130     }
131     double ST_CYLINDRICAL::get_vmin(void)
132     {
133     return -1e300;
134     }
135     double ST_CYLINDRICAL::get_vmax(void)
136     {
137     return 1e300;
138     }
139    
140     void ST_CYLINDRICAL::initialiser(ST_GESTIONNAIRE *gest)
141     {
142     ST_AXIS2_PLACEMENT_3D* axe=gest->lst_axis2_placement_3d.getid(id_axis2_placement_3d);
143     ST_DIRECTION* dirz=gest->lst_direction.getid(axe->get_id_direction1());
144     ST_DIRECTION* dirx=gest->lst_direction.getid(axe->get_id_direction2());
145     ST_POINT* point=gest->lst_point.getid(axe->get_id_point());
146     double xyz[3];
147     point->evaluer(xyz);
148     double *directz=dirz->get_direction();
149     double *directx=dirx->get_direction();
150     initialiser(xyz,directz,directx);
151     }
152    
153    
154    
155     void ST_CYLINDRICAL::initialiser(double *xyz,double *dirz,double *dirx)
156     {
157     double axex[3];
158     origine.change_x(xyz[0]);
159     origine.change_y(xyz[1]);
160     origine.change_z(xyz[2]);
161     OT_VECTEUR_3D z(dirz[0],dirz[1],dirz[2]);
162     z.norme();
163     if (dirx==NULL)
164     {
165     axex[0]=1.;
166     if (!(OPERATEUR::egal(z.get_z(),0.,0.0000001)))
167     {
168     axex[1]=0;
169     axex[2]=-axex[0]*z.get_x()/z.get_z();
170     }
171     else if (!(OPERATEUR::egal(z.get_y(),0.,0.0000001)))
172     {
173     axex[2]=0;
174     axex[1]=-axex[0]*z.get_x()/z.get_y();
175     }
176     else
177     {
178     axex[0]=0.;
179     axex[1]=1.;
180     axex[2]=0.;
181     }
182    
183     dirx=axex;
184     }
185     OT_VECTEUR_3D x(dirx[0],dirx[1],dirx[2]);
186     x.norme();
187     OT_VECTEUR_3D y=z&x;
188     repere.change_vecteur1(x);
189     repere.change_vecteur2(y);
190     repere.change_vecteur3(z);
191     }
192    
193    
194     int ST_CYLINDRICAL::get_type_geometrique(TPL_LISTE_ENTITE<double> &param)
195     {
196     param.ajouter(origine.get_x());
197     param.ajouter(origine.get_y());
198     param.ajouter(origine.get_z());
199     param.ajouter(repere.get_vecteur1().get_x());
200     param.ajouter(repere.get_vecteur1().get_y());
201     param.ajouter(repere.get_vecteur1().get_z());
202     param.ajouter(repere.get_vecteur3().get_x());
203     param.ajouter(repere.get_vecteur3().get_y());
204     param.ajouter(repere.get_vecteur3().get_z());
205     param.ajouter(rayon);
206     param.ajouter(rayon);
207 francois 1149 return GEOMETRIE::CONST::Co_CYLINDRE;
208 francois 283 }
209    
210    
211    
212     void ST_CYLINDRICAL::est_util(ST_GESTIONNAIRE* gest)
213     {
214     util=true;
215     ST_AXIS2_PLACEMENT_3D *axe=gest->lst_axis2_placement_3d.getid(id_axis2_placement_3d);
216     axe->est_util(gest);
217     }
218    
219    
220     void ST_CYLINDRICAL::get_param_NURBS(int& indx_premier_ptctr,TPL_LISTE_ENTITE<double> &param)
221     {
222     double uv[2];
223     double xyz[3];
224    
225     param.ajouter(2);
226    
227     param.ajouter(4);
228     param.ajouter(2);
229    
230    
231     param.ajouter(7);
232     param.ajouter(2);
233    
234    
235     param.ajouter(0);
236     param.ajouter(0);
237     param.ajouter(0);
238     param.ajouter(0.25);
239     param.ajouter(0.5);
240     param.ajouter(0.5);
241     param.ajouter(0.75);
242     param.ajouter(1);
243     param.ajouter(1);
244     param.ajouter(1);
245    
246    
247     param.ajouter(0);
248     param.ajouter(0);
249     param.ajouter(1);
250     param.ajouter(1);
251    
252    
253    
254    
255    
256    
257    
258     for (int j=0;j<2;j++)
259     {
260    
261     double z_inf=10e6;
262     if (j==0)
263     z_inf=-z_inf;
264    
265     if (j==1)
266     z_inf=z_inf;
267    
268    
269    
270     OT_VECTEUR_3D loc(rayon,0,z_inf);
271     OT_VECTEUR_3D glob=origine+repere*loc;
272    
273     xyz[0]=glob.get_x();
274     xyz[1]=glob.get_y();
275     xyz[2]=glob.get_z();
276    
277     param.ajouter(xyz[0]);
278     param.ajouter(xyz[1]);
279     param.ajouter(xyz[2]);
280     param.ajouter(1);
281    
282    
283     loc.change_y(rayon);
284     glob=origine+repere*loc;
285    
286     xyz[0]=glob.get_x();
287     xyz[1]=glob.get_y();
288     xyz[2]=glob.get_z();
289    
290     param.ajouter(xyz[0]);
291     param.ajouter(xyz[1]);
292     param.ajouter(xyz[2]);
293     param.ajouter(0.5);
294    
295    
296     loc.change_x(-rayon);
297     glob=origine+repere*loc;
298    
299    
300     xyz[0]=glob.get_x();
301     xyz[1]=glob.get_y();
302     xyz[2]=glob.get_z();
303    
304     param.ajouter(xyz[0]);
305     param.ajouter(xyz[1]);
306     param.ajouter(xyz[2]);
307     param.ajouter(0.5);
308    
309    
310     loc.change_y(0);
311    
312     glob=origine+repere*loc;
313    
314     xyz[0]=glob.get_x();
315     xyz[1]=glob.get_y();
316     xyz[2]=glob.get_z();
317    
318     param.ajouter(xyz[0]);
319     param.ajouter(xyz[1]);
320     param.ajouter(xyz[2]);
321     param.ajouter(1);
322    
323    
324    
325    
326     loc.change_y(-rayon);
327    
328     glob=origine+repere*loc;
329    
330    
331     xyz[0]=glob.get_x();
332     xyz[1]=glob.get_y();
333     xyz[2]=glob.get_z();
334    
335     param.ajouter(xyz[0]);
336     param.ajouter(xyz[1]);
337     param.ajouter(xyz[2]);
338     param.ajouter(0.5);
339    
340    
341     loc.change_x(rayon);
342    
343     glob=origine+repere*loc;
344    
345    
346     xyz[0]=glob.get_x();
347     xyz[1]=glob.get_y();
348     xyz[2]=glob.get_z();
349    
350     param.ajouter(xyz[0]);
351     param.ajouter(xyz[1]);
352     param.ajouter(xyz[2]);
353     param.ajouter(0.5);
354    
355    
356     loc.change_y(0);
357    
358     glob=origine+repere*loc;
359    
360     xyz[0]=glob.get_x();
361     xyz[1]=glob.get_y();
362     xyz[2]=glob.get_z();
363    
364    
365     param.ajouter(xyz[0]);
366     param.ajouter(xyz[1]);
367     param.ajouter(xyz[2]);
368     param.ajouter(1);
369     }
370    
371     indx_premier_ptctr=19;
372     }
373