239 axes << Z; |
239 axes << Z; |
240 |
240 |
241 // Make a reference distance from the threshold value. |
241 // Make a reference distance from the threshold value. |
242 // If we're only comparing one dimension, this is the square of the threshold. |
242 // If we're only comparing one dimension, this is the square of the threshold. |
243 // If we're comparing multiple dimensions, the distance is multiplied to adjust. |
243 // If we're comparing multiple dimensions, the distance is multiplied to adjust. |
244 double thresholdDistanceSquared = countof(axes) * std::pow(ui.threshold->value(), 2); |
244 double thresholdDistanceSquared = countof(axes) * pow(ui.threshold->value(), 2); |
245 // Add some tiny leeway to fix rounding errors in the rounding error fixer. |
245 // Add some tiny leeway to fix rounding errors in the rounding error fixer. |
246 thresholdDistanceSquared += 1e-10; |
246 thresholdDistanceSquared += 1e-10; |
247 |
247 |
248 auto fixVertex = [&](Vertex& vertex) |
248 auto fixVertex = [&](Vertex& vertex) |
249 { |
249 { |
250 double distanceSquared = 0.0; |
250 double distanceSquared = 0.0; |
251 |
251 |
252 for (Axis axis : axes) |
252 for (Axis axis : axes) |
253 distanceSquared += std::pow(vertex[axis] - referencePoint[axis], 2); |
253 distanceSquared += pow(vertex[axis] - referencePoint[axis], 2); |
254 |
254 |
255 if (distanceSquared < thresholdDistanceSquared) |
255 if (distanceSquared < thresholdDistanceSquared) |
256 { |
256 { |
257 // It's close enough, so clamp it |
257 // It's close enough, so clamp it |
258 for (Axis axis : axes) |
258 for (Axis axis : axes) |