MCPcopy Create free account
hub / github.com/CNCKitchen/stlTexturizer / _shouldYield

Function _shouldYield

js/decimation.js:94–99  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

92// triangle target happened to land.
93//
94// harvestTol is an upper bound (mm) on the per-collapse surface deviation; the
95// real deviation is smaller, since the cost sums squared distances over all
96// incident faces. 0.005 mm ≈ a few microns — far below FDM resolution.
97const DEFAULT_HARVEST_TOL = 0.005; // mm; harvestCeil = tol²
98
99// Time-based yield: only yield every ~100ms of wall time instead of every N iterations.
100// In foreground tabs setTimeout(0) costs ~4ms; in background tabs it's throttled to ~1s.
101// By yielding based on elapsed time we get ~10 yields per second in foreground (smooth progress)
102// and minimal extra delay in background (~10 yields × 1s = ~10s overhead instead of ~200s).

Callers 1

decimateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected