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 |
|
|
// ot_decalage_parametre.cpp |
16 |
|
|
// |
17 |
|
|
//------------------------------------------------------------ |
18 |
|
|
//------------------------------------------------------------ |
19 |
|
|
// COPYRIGHT 2000 |
20 |
|
|
// Version du 02/03/2006 � 11H23 |
21 |
|
|
//------------------------------------------------------------ |
22 |
|
|
//------------------------------------------------------------ |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
#include "gestionversion.h" |
26 |
|
|
#include "ot_decalage_parametre.h" |
27 |
francois |
536 |
#include <math.h> |
28 |
francois |
283 |
|
29 |
|
|
OT_DECALAGE_PARAMETRE::OT_DECALAGE_PARAMETRE(double periodeu,double periodev):periode_u(periodeu),periode_v(periodev) |
30 |
|
|
{ |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
OT_DECALAGE_PARAMETRE::~OT_DECALAGE_PARAMETRE() |
34 |
|
|
{ |
35 |
|
|
} |
36 |
|
|
|
37 |
|
|
double OT_DECALAGE_PARAMETRE::calcul_decalage_parametre_u(double par) |
38 |
|
|
{ |
39 |
|
|
double res; |
40 |
|
|
if (periode_u==0.) res=0.; |
41 |
|
|
else res=0.5*periode_u-par; |
42 |
|
|
return res; |
43 |
|
|
} |
44 |
|
|
|
45 |
|
|
double OT_DECALAGE_PARAMETRE::calcul_decalage_parametre_v(double par) |
46 |
|
|
{ |
47 |
|
|
double res; |
48 |
|
|
if (periode_v==0.) res=0.; |
49 |
|
|
else res=0.5*periode_v-par; |
50 |
|
|
return res; |
51 |
|
|
} |
52 |
|
|
|
53 |
|
|
double OT_DECALAGE_PARAMETRE::decalage_parametre_u(double par,double dpar) |
54 |
|
|
{ |
55 |
|
|
double res=par+dpar; |
56 |
|
|
if (periode_u!=0.) |
57 |
|
|
{ |
58 |
|
|
if (res>periode_u-0.0001) res=res-periode_u; |
59 |
|
|
if (res<0.) res=res+periode_u; |
60 |
|
|
} |
61 |
|
|
return res; |
62 |
|
|
} |
63 |
|
|
|
64 |
francois |
536 |
double OT_DECALAGE_PARAMETRE::decalage_parametre_u(double par,double parbase,double dpar) |
65 |
|
|
{ |
66 |
|
|
double res=par+dpar; |
67 |
|
|
if (periode_u!=0.) |
68 |
|
|
{ |
69 |
|
|
if (res>periode_u-0.0001) res=res-periode_u; |
70 |
|
|
if (res<0.) res=res+periode_u; |
71 |
|
|
if (fabs(res+periode_u-parbase)<fabs(res-parbase)) res=res+periode_u; |
72 |
|
|
else if (fabs(res-periode_u-parbase)<fabs(res-parbase)) res=res-periode_u; |
73 |
|
|
} |
74 |
|
|
return res; |
75 |
|
|
} |
76 |
|
|
|
77 |
francois |
283 |
double OT_DECALAGE_PARAMETRE::decalage_parametre_v(double par,double dpar) |
78 |
|
|
{ |
79 |
|
|
double res=par+dpar; |
80 |
|
|
if (periode_v!=0.) |
81 |
|
|
{ |
82 |
|
|
if (res>periode_v-0.0001) res=res-periode_v; |
83 |
|
|
if (res<0.) res=res+periode_v; |
84 |
|
|
} |
85 |
|
|
return res; |
86 |
|
|
} |
87 |
francois |
536 |
|
88 |
|
|
double OT_DECALAGE_PARAMETRE::decalage_parametre_v(double par,double parbase,double dpar) |
89 |
|
|
{ |
90 |
|
|
double res=par+dpar; |
91 |
|
|
if (periode_v!=0.) |
92 |
|
|
{ |
93 |
|
|
if (res>periode_v-0.0001) res=res-periode_v; |
94 |
|
|
if (res<0.) res=res+periode_v; |
95 |
|
|
if (fabs(res+periode_v-parbase)<fabs(res-parbase)) res=res+periode_v; |
96 |
|
|
else if (fabs(res-periode_v-parbase)<fabs(res-parbase)) res=res-periode_v; |
97 |
|
|
} |
98 |
|
|
return res; |
99 |
|
|
} |