Fix units/extract RESOLUTION_FACTOR from area constants

Most of the code treats RESOLUTION_FACTOR as "number of clipper units in
a single step" -- a linear distance unit. However, there are a few
locations in which it is treated as unitless, multiplied by area
constants. This commit folds the current value of RESOLUTION_FACTOR into
these other contents in preparation for declaring it to have distance
units and increasing its value.
This commit is contained in:
David Kaufman
2025-09-18 13:12:34 -04:00
committed by Kacper Donat
parent 2f91f74ac9
commit 183e82607a
2 changed files with 7 additions and 8 deletions

View File

@@ -3153,8 +3153,7 @@ void Adaptive2d::ProcessPolyNode(Paths boundPaths, Paths toolBoundPaths)
prevDistTrend = distanceTrend;
prevDistFromStart = distFromStart;
if (area > 0.5 * MIN_CUT_AREA_FACTOR * optimalCutAreaPD
* RESOLUTION_FACTOR) { // cut is ok - record it
if (area > 0.5 * MIN_CUT_AREA_FACTOR * optimalCutAreaPD) { // cut is ok - record it
fout << "\tFinal cut acceptance" << endl;
noCutDistance = 0;
if (toClearPath.empty()) {
@@ -3220,7 +3219,7 @@ void Adaptive2d::ProcessPolyNode(Paths boundPaths, Paths toolBoundPaths)
cleared.ExpandCleared(toClearPath);
toClearPath.clear();
}
if (cumulativeCutArea > MIN_CUT_AREA_FACTOR * optimalCutAreaPD * RESOLUTION_FACTOR) {
if (cumulativeCutArea > MIN_CUT_AREA_FACTOR * optimalCutAreaPD) {
Path cleaned;
CleanPath(passToolPath, cleaned, CLEAN_PATH_TOLERANCE);
total_output_points += long(cleaned.size());
@@ -3250,7 +3249,7 @@ void Adaptive2d::ProcessPolyNode(Paths boundPaths, Paths toolBoundPaths)
this,
cleared,
moveDistance,
ENGAGE_AREA_THR_FACTOR * optimalCutAreaPD * RESOLUTION_FACTOR,
ENGAGE_AREA_THR_FACTOR * optimalCutAreaPD,
4 * referenceCutArea * stepOverFactor
)) {
// check if there are any uncleared area left
@@ -3288,7 +3287,7 @@ void Adaptive2d::ProcessPolyNode(Paths boundPaths, Paths toolBoundPaths)
this,
cleared,
moveDistance,
ENGAGE_AREA_THR_FACTOR * optimalCutAreaPD * RESOLUTION_FACTOR,
ENGAGE_AREA_THR_FACTOR * optimalCutAreaPD,
4 * referenceCutArea * stepOverFactor
)) {
break;