blob: 3a8658f4a02057a113ce44166b6e6abb0d48f056 (
about) (
plain)
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
|
#include "misc.hh"
#include "glob.hh"
#include <math.h>
int intlog2(int d) {
int i=0;
while (!(d&1)) {
d/= 2; i++;
}
assert(!(d/2));
return i;
}
double log2(double x) {
return log(x) /log(2.0);
}
// golden ratio
const Real PHI = (1+sqrt(5))/2;
const double ENGRAVERS_SPACE = PHI;
const double WHOLE_SPACE = 5.0; // should be settable from input
Real
duration_to_idealspace(Real d, Real w)
{
// see Roelofs, p. 57
return w * pow(ENGRAVERS_SPACE, log2(d));
}
|