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