forked from ondratu/stl2dat-cp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc_reel.h
207 lines (204 loc) · 3.7 KB
/
c_reel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
void eps_change(
const double new_eps
)
/*-
! Use: Change value of eps
*/
;
void eps_empile(
const double new_eps
)
/*-
! Use: Change value of eps, and save old value on top of the stack.
*/
;
void eps_empile_rel(
const double coef_eps
)
/*-
! Use: Multiply current value of eps by coef_eps,
! and save old value on top of the stack.
*/
;
void eps_depile()
/*-
! Use: Restore previous value of eps from the stack.
*/
;
double current_eps( )
/*-
! Use: Return the current value of eps by.
*/
;
bool is_small(const double r)
/*-
! Use: Return true if fabs(r) is lower than eps.
*/
;
bool equal(const double r1, const double r2)
/*-
! Use: Return true if fabs(r1 - r2) is lower than eps.
*/
;
long signe(const double r)
/*-
! Use: Return 1 if r >= 0
! -1 if r < 0.
*/
;
double radian(
const double t // angle in degrees.
)
/*-
! Use: Return t in radians.
*/
;
double degre(
const double t // angle in radians
)
/*-
! Use: Return t in degrees.
*/
;
double angle(
const double u, // Adjacent side (cosinus)
const double v // Opposite side (sinus)
)
/*-
! Use: Return the angle defined by u and v.
! u and v do not need to be normalised.
! Result: in radian, between [0 .. 2pi[
*/
;
double tang(const double r)
/*-
! Use: Return tangent of r.
! Return v_erreur if (is_small(cos(r)).
*/
;
double arcsin(const double r)
/*-
! Use: Return arc sinus of r.
! Return v_erreur if (fabs(r) >= 1).
*/
;
double arccos(const double r)
/*-
! Use: Return arc cosinus of r.
! Return v_erreur if (fabs(r) >= 1).
*/
;
double substitue(
const double y,
const double a,
const double b,
const double c
)
/*
! Use: Solve the linear equation ax + by + c = 0 knowing a,b,c,y.
*/
;
short eq2d(
const double a,
const double b,
const double c,
double &x1, // First or unique solution
double &x2 // Second solution
)
/*
! Use: Compute real solutions (when existing) of equation
! 2
! a x + b x + c = 0
!
! Result: -2 when equation is like c = 0
! 0 when no real solution
! 1 when 1 solution
! 2 when 2 solutions
! PRECONDITION: None
! Warning: Distinction between case 1 and 2 depends on the value of eps.
*/
;
void exchange(
double &x,
double &y
)
/*-
! Use: Exchange x and y.
*/
;
double Mmax(
const double x,
const double y
)
/*-
! Use: Return maximum of x and y.
*/
;
double Mmin(
const double x,
const double y
)
/*-
! Use: Return minimum of x and y.
*/
;
void roriente(
double &x,
double &y
)
;
double Mftrunc(
const double r,
const double y
)
/*
! Use: Trunc the real on the given precision.
! result = r - i*y with result < r
*/
;
double Mfround(
const double r,
const double y
)
/*
! Use: Round the real on the given precision.
*/
;
/*-
! Use: Equivalent of Pascal ROUND function.
*/
;
long r_round32(const double r)
/*
! Use: Portable round function (works on all machines).
! Prefer this function to Pascal ROUND function.
*/
;
long r_trunc32(const double r)
/*
! Use: Portable trunc function (works on all machines).
! Prefer this function to Pascal TRUNC function.
*/
;
short r_round16(double r)
/*
! Use: Portable round function (works on all machines).
! Prefer this function to Pascal ROUND function.
*/
;
short r_trunc16(const double r)
/*
! Use: Portable trunc function (works on all machines).
! Prefer this function to Pascal TRUNC function.
*/
;
double Mfactorial(
const long r
)
;
double Mpower(
const double r1,
const double r0,
double& r2
)
;