| 260 config.setCustomRotationPoint(custompoint); |
260 config.setCustomRotationPoint(custompoint); |
| 261 } |
261 } |
| 262 |
262 |
| 263 // ============================================================================= |
263 // ============================================================================= |
| 264 // |
264 // |
| 265 void RoundToDecimals(double& a, int decimals) |
265 double RoundToDecimals(double value, int decimals) |
| 266 { |
266 { |
| 267 static const long e10[] = |
267 return std::round(value * std::pow(10, decimals)) / std::pow(10, decimals); |
| 268 { |
|
| 269 1l, |
|
| 270 10l, |
|
| 271 100l, |
|
| 272 1000l, |
|
| 273 10000l, |
|
| 274 100000l, |
|
| 275 1000000l, |
|
| 276 10000000l, |
|
| 277 100000000l, |
|
| 278 1000000000l, |
|
| 279 }; |
|
| 280 |
|
| 281 if (decimals >= 0 and decimals < countof(e10)) |
|
| 282 a = round(a * e10[decimals]) / e10[decimals]; |
|
| 283 } |
268 } |
| 284 |
269 |
| 285 // ============================================================================= |
270 // ============================================================================= |
| 286 // |
271 // |
| 287 void ApplyToMatrix(Matrix& a, ApplyToMatrixFunction func) |
272 void ApplyToMatrix(Matrix& a, ApplyToMatrixFunction func) |