comparison data/model/PowerOfSqrtTwoZoomConstraint.cpp @ 1069:32ab6c48efaa

Merge from branch tonioni
author Chris Cannam
date Mon, 20 Apr 2015 09:11:34 +0100
parents cc27f35aa75c
children d4a28d1479a8 48e9f538e6e9
comparison
equal deleted inserted replaced
1036:682d64f05e72 1069:32ab6c48efaa
42 type = -1; 42 type = -1;
43 power = 0; 43 power = 0;
44 float val = 1.0, prevVal = 1.0; 44 float val = 1.0, prevVal = 1.0;
45 while (val + 0.01 < blockSize) { 45 while (val + 0.01 < blockSize) {
46 prevVal = val; 46 prevVal = val;
47 val *= sqrt(2.f); 47 val *= sqrtf(2.f);
48 } 48 }
49 int rval; 49 int rval;
50 if (dir == RoundUp) rval = int(val + 0.01); 50 if (dir == RoundUp) rval = int(val + 0.01f);
51 else if (dir == RoundDown) rval = int(prevVal + 0.01); 51 else if (dir == RoundDown) rval = int(prevVal + 0.01f);
52 else if (val - blockSize < blockSize - prevVal) rval = int(val + 0.01); 52 else if (val - float(blockSize) <
53 float(blockSize) - prevVal) rval = int(val + 0.01f);
53 else rval = int(prevVal + 0.01); 54 else rval = int(prevVal + 0.01);
54 // SVDEBUG << "returning " << rval << endl; 55 // SVDEBUG << "returning " << rval << endl;
55 return rval; 56 return rval;
56 } 57 }
57 58