1 |
francois |
283 |
//------------------------------------------------------------ |
2 |
|
|
//------------------------------------------------------------ |
3 |
|
|
// MAGiC |
4 |
|
|
// Jean Christophe Cuilli�re et Vincent FRANCOIS |
5 |
|
|
// D�partement de G�nie M�canique - UQTR |
6 |
|
|
//------------------------------------------------------------ |
7 |
|
|
// Le projet MAGIC est un projet de recherche du d�partement |
8 |
|
|
// de g�nie m�canique de l'Universit� du Qu�bec � |
9 |
|
|
// Trois Rivi�res |
10 |
|
|
// Les librairies ne peuvent �tre utilis�es sans l'accord |
11 |
|
|
// des auteurs (contact : francois@uqtr.ca) |
12 |
|
|
//------------------------------------------------------------ |
13 |
|
|
//------------------------------------------------------------ |
14 |
|
|
// |
15 |
|
|
// pir_courbe.cpp |
16 |
|
|
// |
17 |
|
|
//------------------------------------------------------------ |
18 |
|
|
//------------------------------------------------------------ |
19 |
|
|
// COPYRIGHT 2000 |
20 |
|
|
// Version du 02/03/2006 � 11H22 |
21 |
|
|
//------------------------------------------------------------ |
22 |
|
|
//------------------------------------------------------------ |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
#include "gestionversion.h" |
26 |
|
|
|
27 |
|
|
#ifdef BREP_PIRATE |
28 |
|
|
|
29 |
|
|
#include "pir_courbe.h" |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
PIR_COURBE::PIR_COURBE(unsigned long num,PG_COURBE *crb):MG_COURBE(num),courbe(crb) |
36 |
|
|
{ |
37 |
|
|
pos=new PG_POSITION1D_COURBE((*courbe)); |
38 |
|
|
t_min=pos->get_tmin(); |
39 |
|
|
t_max=pos->get_tmax(); |
40 |
|
|
} |
41 |
|
|
|
42 |
|
|
PIR_COURBE::PIR_COURBE(PG_COURBE *crb):MG_COURBE(),courbe(crb) |
43 |
|
|
{ |
44 |
|
|
pos=new PG_POSITION1D_COURBE((*courbe)); |
45 |
|
|
t_min=pos->get_tmin(); |
46 |
|
|
t_max=pos->get_tmax(); |
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
PIR_COURBE::PIR_COURBE(PIR_COURBE& mdd):MG_COURBE(mdd),courbe(mdd.courbe) |
50 |
|
|
{ |
51 |
|
|
pos=new PG_POSITION1D_COURBE((*courbe)); |
52 |
|
|
t_min=pos->get_tmin(); |
53 |
|
|
t_max=pos->get_tmax(); |
54 |
|
|
} |
55 |
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
PIR_COURBE::~PIR_COURBE() |
59 |
|
|
{ |
60 |
|
|
delete pos; |
61 |
|
|
} |
62 |
|
|
|
63 |
|
|
void PIR_COURBE::evaluer(double t,double *xyz) |
64 |
|
|
{ |
65 |
|
|
courbe->evaluer(&t,xyz); |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
void PIR_COURBE::deriver(double t,double *xyz) |
69 |
|
|
{ |
70 |
|
|
courbe->deriver(&t,xyz); |
71 |
|
|
} |
72 |
|
|
|
73 |
|
|
void PIR_COURBE::deriver_seconde(double t,double *ddxyz,double *dxyz,double *xyz) |
74 |
|
|
{ |
75 |
|
|
double pt[3]={0,0,0}; |
76 |
|
|
double dt[3]={0,0,0}; |
77 |
|
|
double dtt[3]={0,0,0}; |
78 |
|
|
double* d2C[]={pt, dt, dtt}; |
79 |
|
|
courbe->deriver_seconde(&t,d2C); |
80 |
|
|
if (xyz!=NULL) |
81 |
|
|
{ |
82 |
|
|
xyz[0]=d2C[0][0]; |
83 |
|
|
xyz[1]=d2C[0][1]; |
84 |
|
|
xyz[2]=d2C[0][2]; |
85 |
|
|
} |
86 |
|
|
if (dxyz!=NULL) |
87 |
|
|
{ |
88 |
|
|
dxyz[0]=d2C[1][0]; |
89 |
|
|
dxyz[1]=d2C[1][1]; |
90 |
|
|
dxyz[2]=d2C[1][2]; |
91 |
|
|
} |
92 |
|
|
ddxyz[0]=d2C[2][0]; |
93 |
|
|
ddxyz[1]=d2C[2][1]; |
94 |
|
|
ddxyz[2]=d2C[2][2]; |
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
void PIR_COURBE::inverser(double& t,double *xyz,double precision) |
98 |
|
|
{ |
99 |
|
|
if (precision>0.0001*pos->get_longueur()) pos->localiser(xyz,&t,0.0001*pos->get_longueur()); |
100 |
|
|
else pos->localiser(xyz,&t,precision); |
101 |
|
|
} |
102 |
|
|
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
double PIR_COURBE::get_longueur(double t1,double t2,double precis) |
107 |
|
|
{ |
108 |
|
|
int niveau; |
109 |
|
|
if ( (t1==t_min) && (t2==t_max) ) return pos->get_longueur(); |
110 |
|
|
return pos->calculer_longueur_segment(t1,t2,pos->evaluer_integrant_longueur(t1),pos->evaluer_integrant_longueur(t2),precis,niveau); |
111 |
|
|
} |
112 |
|
|
|
113 |
|
|
int PIR_COURBE::est_periodique(void) |
114 |
|
|
{ |
115 |
|
|
return courbe->estfermee(); |
116 |
|
|
} |
117 |
|
|
|
118 |
|
|
double PIR_COURBE::get_periode(void) |
119 |
|
|
{ |
120 |
|
|
return courbe->get_periode(); |
121 |
|
|
} |
122 |
|
|
|
123 |
|
|
void PIR_COURBE::enregistrer(std::ostream& o) |
124 |
|
|
{ |
125 |
|
|
o << "%" << get_id() << "=COURBE_PIRATE("<< courbe->get_id()<< ");" << std::endl; |
126 |
|
|
} |
127 |
|
|
|
128 |
|
|
#endif |
129 |
|
|
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
|