97 100000000l, |
97 100000000l, |
98 1000000000l, |
98 1000000000l, |
99 }; |
99 }; |
100 |
100 |
101 // ============================================================================= |
101 // ============================================================================= |
102 // ----------------------------------------------------------------------------- |
102 // |
103 // Grid stuff |
103 // Grid stuff |
|
104 // |
104 cfg (Int, grid, Grid::Medium); |
105 cfg (Int, grid, Grid::Medium); |
105 cfg (Float, grid_coarse_x, 5.0f); |
106 cfg (Float, grid_coarse_x, 5.0f); |
106 cfg (Float, grid_coarse_y, 5.0f); |
107 cfg (Float, grid_coarse_y, 5.0f); |
107 cfg (Float, grid_coarse_z, 5.0f); |
108 cfg (Float, grid_coarse_z, 5.0f); |
108 cfg (Float, grid_coarse_angle, 45.0f); |
109 cfg (Float, grid_coarse_angle, 45.0f); |
123 { "Medium", { &grid_medium_x, &grid_medium_y, &grid_medium_z, &grid_medium_angle }}, |
124 { "Medium", { &grid_medium_x, &grid_medium_y, &grid_medium_z, &grid_medium_angle }}, |
124 { "Fine", { &grid_fine_x, &grid_fine_y, &grid_fine_z, &grid_fine_angle }} |
125 { "Fine", { &grid_fine_x, &grid_fine_y, &grid_fine_z, &grid_fine_angle }} |
125 }; |
126 }; |
126 |
127 |
127 // ============================================================================= |
128 // ============================================================================= |
|
129 // |
128 // Snap the given coordinate value on the current grid's given axis. |
130 // Snap the given coordinate value on the current grid's given axis. |
129 // ----------------------------------------------------------------------------- |
131 // |
130 double Grid::snap (double in, const Grid::Config axis) |
132 double Grid::snap (double in, const Grid::Config axis) |
131 { |
133 { |
132 const double gridval = *currentGrid().confs[axis]; |
134 const double gridval = *currentGrid().confs[axis]; |
133 const long mult = abs (in / gridval); |
135 const long mult = abs (in / gridval); |
134 const bool neg = (in < 0); |
136 const bool neg = (in < 0); |
279 edit_customrotpoint.y() = ui.customY->value(); |
281 edit_customrotpoint.y() = ui.customY->value(); |
280 edit_customrotpoint.z() = ui.customZ->value(); |
282 edit_customrotpoint.z() = ui.customZ->value(); |
281 } |
283 } |
282 |
284 |
283 // ============================================================================= |
285 // ============================================================================= |
284 // ----------------------------------------------------------------------------- |
286 // |
285 QString join (initlist<StringFormatArg> vals, QString delim) |
287 QString join (initlist<StringFormatArg> vals, QString delim) |
286 { |
288 { |
287 QStringList list; |
289 QStringList list; |
288 |
290 |
289 for (const StringFormatArg& arg : vals) |
291 for (const StringFormatArg& arg : vals) |
291 |
293 |
292 return list.join (delim); |
294 return list.join (delim); |
293 } |
295 } |
294 |
296 |
295 // ============================================================================= |
297 // ============================================================================= |
296 // ----------------------------------------------------------------------------- |
298 // |
297 void roundToDecimals (double& a, int decimals) |
299 void roundToDecimals (double& a, int decimals) |
298 { |
300 { |
299 assert (decimals >= 0 && decimals < (signed) (sizeof g_e10 / sizeof *g_e10)); |
301 assert (decimals >= 0 && decimals < (signed) (sizeof g_e10 / sizeof *g_e10)); |
300 a = round (a * g_e10[decimals]) / g_e10[decimals]; |
302 a = round (a * g_e10[decimals]) / g_e10[decimals]; |
301 } |
303 } |