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;

View File

@@ -208,9 +208,9 @@ private: // constants for fine tuning
const int DIRECTION_SMOOTHING_BUFLEN = 3; // gyro points - used for angle smoothing
const double MIN_CUT_AREA_FACTOR = 0.1; // used for filtering out of insignificant cuts (should
// be < ENGAGE_AREA_THR_FACTOR)
const double ENGAGE_AREA_THR_FACTOR = 0.5; // influences minimal engage area
const double MIN_CUT_AREA_FACTOR = 0.1
* 16; // used for filtering out of insignificant cuts (should be < ENGAGE_AREA_THR_FACTOR)
const double ENGAGE_AREA_THR_FACTOR = 0.5 * 16; // influences minimal engage area
const double ENGAGE_SCAN_DISTANCE_FACTOR = 0.2; // influences the engage scan/stepping distance
const double CLEAN_PATH_TOLERANCE = 1.41; // should be >1