MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
stcylindrical.cpp
Aller à la documentation de ce fichier.
1 //####//------------------------------------------------------------
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 
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 
45 {
46  return id_axis2_placement_3d;
47 }
48 
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 }
108 {
109  return 1;
110 }
112 {
113  return 0;
114 }
116 {
117  return 2.*M_PI;
118 }
120 {
121  return 0;
122 }
124 {
125  return 0.;
126 }
128 {
129  return 2.*M_PI;
130 }
132 {
133  return -1e300;
134 }
136 {
137  return 1e300;
138 }
139 
141 {
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;
191 }
192 
193 
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);
208 }
209 
210 
211 
213 {
214  util=true;
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 
ST_AXIS2_PLACEMENT_3D::get_id_direction2
virtual long get_id_direction2(void)
Definition: staxis2place3d.cpp:47
ST_GESTIONNAIRE
Definition: st_gestionnaire.h:55
OT_VECTEUR_3D::change_z
virtual void change_z(double z)
Definition: ot_mathematique.cpp:444
ST_CYLINDRICAL::get_id_axis2_placement_3d
virtual long get_id_axis2_placement_3d(void)
Definition: stcylindrical.cpp:44
ST_AXIS2_PLACEMENT_3D
Definition: staxis2place3d.h:32
OT_MATRICE_3D::change_vecteur3
void change_vecteur3(OT_VECTEUR_3D v)
Definition: ot_mathematique.cpp:810
ST_GESTIONNAIRE::lst_direction
TPL_MAP_ENTITE< class ST_DIRECTION * > lst_direction
Definition: st_gestionnaire.h:90
st_gestionnaire.h
ST_CYLINDRICAL::origine
OT_VECTEUR_3D origine
Definition: stcylindrical.h:67
ST_POINT::evaluer
virtual void evaluer(double *xyz)
Definition: st_point.cpp:50
OT_VECTEUR_3D::change_y
virtual void change_y(double y)
Definition: ot_mathematique.cpp:439
ST_AXIS2_PLACEMENT_3D::est_util
virtual void est_util(class ST_GESTIONNAIRE *gest)
Definition: staxis2place3d.cpp:53
OT_MATRICE_3D::get_vecteur1
OT_VECTEUR_3D & get_vecteur1(void)
Definition: ot_mathematique.cpp:814
OT_VECTEUR_3D::get_x
virtual double get_x(void) const
Definition: ot_mathematique.cpp:417
OT_MATRICE_3D::transpose
void transpose(OT_MATRICE_3D &res) const
Definition: ot_mathematique.cpp:750
ST_CYLINDRICAL::est_util
virtual void est_util(class ST_GESTIONNAIRE *gest)
Definition: stcylindrical.cpp:212
ST_GESTIONNAIRE::lst_point
TPL_MAP_ENTITE< class ST_POINT * > lst_point
Definition: st_gestionnaire.h:91
ST_DIRECTION
Definition: stdirection.h:32
ST_CYLINDRICAL::rayon
double rayon
Definition: stcylindrical.h:65
ST_POINT
Definition: st_point.h:30
ST_CYLINDRICAL::repere
OT_MATRICE_3D repere
Definition: stcylindrical.h:66
ST_CYLINDRICAL::evaluer
virtual void evaluer(double *uv, double *xyz)
Definition: stcylindrical.cpp:53
ST_CYLINDRICAL::initialiser
virtual void initialiser(class ST_GESTIONNAIRE *gest)
Definition: stcylindrical.cpp:140
OPERATEUR::egal
static int egal(double a, double b, double eps)
Definition: ot_mathematique.cpp:1629
OT_MATRICE_3D
Definition: ot_mathematique.h:160
stcylindrical.h
constantegeo.h
OT_MATRICE_3D::get_vecteur3
OT_VECTEUR_3D & get_vecteur3(void)
Definition: ot_mathematique.cpp:822
TPL_LISTE_ENTITE::ajouter
virtual void ajouter(X x)
Definition: tpl_liste_entite.h:38
ST_CYLINDRICAL::get_periode_v
virtual double get_periode_v(void)
Definition: stcylindrical.cpp:119
ST_AXIS2_PLACEMENT_3D::get_id_point
virtual long get_id_point(void)
Definition: staxis2place3d.cpp:37
OT_MATRICE_3D::change_vecteur2
void change_vecteur2(OT_VECTEUR_3D v)
Definition: ot_mathematique.cpp:806
OT_VECTEUR_3D::norme
virtual void norme(void)
Definition: ot_mathematique.cpp:494
ST_CYLINDRICAL::deriver_seconde
virtual void deriver_seconde(double *uv, double *xyzduu, double *xyzduv, double *xyzdvv, double *xyz=NULL, double *xyzdu=NULL, double *xyzdv=NULL)
Definition: stcylindrical.cpp:74
ST_CYLINDRICAL::get_periode_u
virtual double get_periode_u(void)
Definition: stcylindrical.cpp:115
ST_CYLINDRICAL::get_vmax
virtual double get_vmax(void)
Definition: stcylindrical.cpp:135
ST_GESTIONNAIRE::lst_axis2_placement_3d
TPL_MAP_ENTITE< class ST_AXIS2_PLACEMENT_3D * > lst_axis2_placement_3d
Definition: st_gestionnaire.h:81
ST_SURFACE
Definition: st_surface.h:29
ST_AXIS2_PLACEMENT_3D::get_id_direction1
virtual long get_id_direction1(void)
Definition: staxis2place3d.cpp:42
OT_VECTEUR_3D::get_y
virtual double get_y(void) const
Definition: ot_mathematique.cpp:423
acos
double2 acos(double2 &val)
Definition: ot_doubleprecision.cpp:224
OT_VECTEUR_3D
Definition: ot_mathematique.h:94
ST_DIRECTION::get_direction
virtual double * get_direction(void)
Definition: stdirection.cpp:42
TPL_MAP_ENTITE::getid
virtual X getid(unsigned long num)
Definition: tpl_map_entite.h:96
ST_CYLINDRICAL::get_umax
virtual double get_umax(void)
Definition: stcylindrical.cpp:127
ST_CYLINDRICAL::id_axis2_placement_3d
long id_axis2_placement_3d
Definition: stcylindrical.h:64
ST_CYLINDRICAL::inverser
virtual void inverser(double *uv, double *xyz, double precision=1e-6)
Definition: stcylindrical.cpp:91
ST_CYLINDRICAL::est_periodique_v
virtual int est_periodique_v(void)
Definition: stcylindrical.cpp:111
ST_CYLINDRICAL::get_param_NURBS
virtual void get_param_NURBS(int &indx_premier_ptctr, TPL_LISTE_ENTITE< double > &param)
Definition: stcylindrical.cpp:220
ST_CYLINDRICAL::est_periodique_u
virtual int est_periodique_u(void)
Definition: stcylindrical.cpp:107
OT_VECTEUR_3D::get_z
virtual double get_z(void) const
Definition: ot_mathematique.cpp:429
TPL_LISTE_ENTITE< double >
ST_IDENTIFICATEUR::util
bool util
Definition: st_ident.h:46
ST_CYLINDRICAL::get_type_geometrique
virtual int get_type_geometrique(TPL_LISTE_ENTITE< double > &param)
Definition: stcylindrical.cpp:194
ST_CYLINDRICAL::get_umin
virtual double get_umin(void)
Definition: stcylindrical.cpp:123
ST_CYLINDRICAL::get_rayon
virtual double get_rayon(void)
Definition: stcylindrical.cpp:49
cos
double2 cos(double2 &val)
Definition: ot_doubleprecision.cpp:206
ST_CYLINDRICAL::ST_CYLINDRICAL
ST_CYLINDRICAL(long LigneCourante, std::string idori, long axis2d, double ray)
Definition: stcylindrical.cpp:34
ST_CYLINDRICAL::get_vmin
virtual double get_vmin(void)
Definition: stcylindrical.cpp:131
OT_MATRICE_3D::change_vecteur1
void change_vecteur1(OT_VECTEUR_3D v)
Definition: ot_mathematique.cpp:802
OT_VECTEUR_3D::change_x
virtual void change_x(double x)
Definition: ot_mathematique.cpp:434
GEOMETRIE::CONST::Co_CYLINDRE
@ Co_CYLINDRE
Definition: constantegeo.h:32
ST_CYLINDRICAL::deriver
virtual void deriver(double *uv, double *xyzdu, double *xyzdv)
Definition: stcylindrical.cpp:61
sin
double2 sin(double2 &val)
Definition: ot_doubleprecision.cpp:250