1 |
francois |
1158 |
//####//------------------------------------------------------------ |
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 |
|
|
//####// pir_courbe.cpp |
15 |
|
|
//####// |
16 |
|
|
//####//------------------------------------------------------------ |
17 |
|
|
//####//------------------------------------------------------------ |
18 |
|
|
//####// COPYRIGHT 2000-2024 |
19 |
|
|
//####// jeu 13 jun 2024 11:58:53 EDT |
20 |
|
|
//####//------------------------------------------------------------ |
21 |
|
|
//####//------------------------------------------------------------ |
22 |
francois |
283 |
|
23 |
|
|
|
24 |
|
|
#include "gestionversion.h" |
25 |
|
|
|
26 |
|
|
#ifdef BREP_PIRATE |
27 |
|
|
|
28 |
|
|
#include "pir_courbe.h" |
29 |
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
PIR_COURBE::PIR_COURBE(unsigned long num,PG_COURBE *crb):MG_COURBE(num),courbe(crb) |
35 |
|
|
{ |
36 |
|
|
pos=new PG_POSITION1D_COURBE((*courbe)); |
37 |
|
|
t_min=pos->get_tmin(); |
38 |
|
|
t_max=pos->get_tmax(); |
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
PIR_COURBE::PIR_COURBE(PG_COURBE *crb):MG_COURBE(),courbe(crb) |
42 |
|
|
{ |
43 |
|
|
pos=new PG_POSITION1D_COURBE((*courbe)); |
44 |
|
|
t_min=pos->get_tmin(); |
45 |
|
|
t_max=pos->get_tmax(); |
46 |
|
|
} |
47 |
|
|
|
48 |
|
|
PIR_COURBE::PIR_COURBE(PIR_COURBE& mdd):MG_COURBE(mdd),courbe(mdd.courbe) |
49 |
|
|
{ |
50 |
|
|
pos=new PG_POSITION1D_COURBE((*courbe)); |
51 |
|
|
t_min=pos->get_tmin(); |
52 |
|
|
t_max=pos->get_tmax(); |
53 |
|
|
} |
54 |
|
|
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
PIR_COURBE::~PIR_COURBE() |
58 |
|
|
{ |
59 |
|
|
delete pos; |
60 |
|
|
} |
61 |
|
|
|
62 |
|
|
void PIR_COURBE::evaluer(double t,double *xyz) |
63 |
|
|
{ |
64 |
|
|
courbe->evaluer(&t,xyz); |
65 |
|
|
} |
66 |
|
|
|
67 |
|
|
void PIR_COURBE::deriver(double t,double *xyz) |
68 |
|
|
{ |
69 |
|
|
courbe->deriver(&t,xyz); |
70 |
|
|
} |
71 |
|
|
|
72 |
|
|
void PIR_COURBE::deriver_seconde(double t,double *ddxyz,double *dxyz,double *xyz) |
73 |
|
|
{ |
74 |
|
|
double pt[3]={0,0,0}; |
75 |
|
|
double dt[3]={0,0,0}; |
76 |
|
|
double dtt[3]={0,0,0}; |
77 |
|
|
double* d2C[]={pt, dt, dtt}; |
78 |
|
|
courbe->deriver_seconde(&t,d2C); |
79 |
|
|
if (xyz!=NULL) |
80 |
|
|
{ |
81 |
|
|
xyz[0]=d2C[0][0]; |
82 |
|
|
xyz[1]=d2C[0][1]; |
83 |
|
|
xyz[2]=d2C[0][2]; |
84 |
|
|
} |
85 |
|
|
if (dxyz!=NULL) |
86 |
|
|
{ |
87 |
|
|
dxyz[0]=d2C[1][0]; |
88 |
|
|
dxyz[1]=d2C[1][1]; |
89 |
|
|
dxyz[2]=d2C[1][2]; |
90 |
|
|
} |
91 |
|
|
ddxyz[0]=d2C[2][0]; |
92 |
|
|
ddxyz[1]=d2C[2][1]; |
93 |
|
|
ddxyz[2]=d2C[2][2]; |
94 |
|
|
} |
95 |
|
|
|
96 |
|
|
void PIR_COURBE::inverser(double& t,double *xyz,double precision) |
97 |
|
|
{ |
98 |
|
|
if (precision>0.0001*pos->get_longueur()) pos->localiser(xyz,&t,0.0001*pos->get_longueur()); |
99 |
|
|
else pos->localiser(xyz,&t,precision); |
100 |
|
|
} |
101 |
|
|
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
double PIR_COURBE::get_longueur(double t1,double t2,double precis) |
106 |
|
|
{ |
107 |
|
|
int niveau; |
108 |
|
|
if ( (t1==t_min) && (t2==t_max) ) return pos->get_longueur(); |
109 |
|
|
return pos->calculer_longueur_segment(t1,t2,pos->evaluer_integrant_longueur(t1),pos->evaluer_integrant_longueur(t2),precis,niveau); |
110 |
|
|
} |
111 |
|
|
|
112 |
|
|
int PIR_COURBE::est_periodique(void) |
113 |
|
|
{ |
114 |
|
|
return courbe->estfermee(); |
115 |
|
|
} |
116 |
|
|
|
117 |
|
|
double PIR_COURBE::get_periode(void) |
118 |
|
|
{ |
119 |
|
|
return courbe->get_periode(); |
120 |
|
|
} |
121 |
|
|
|
122 |
francois |
763 |
void PIR_COURBE::enregistrer(std::ostream& o,double version) |
123 |
francois |
283 |
{ |
124 |
|
|
o << "%" << get_id() << "=COURBE_PIRATE("<< courbe->get_id()<< ");" << std::endl; |
125 |
|
|
} |
126 |
|
|
|
127 |
|
|
#endif |
128 |
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
|