Skip to content

Commit 97ecc8a

Browse files
Rework of copper pour logic v2 (only kicad and fusion/eagle)
1 parent 52e376e commit 97ecc8a

8 files changed

Lines changed: 293 additions & 338 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@ All notable changes to the **EasyTrace5000** project will be documented in this
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.0.10] - 2026-XX-XX
8+
9+
### Fixed
10+
- **Copper Pour Regions:** KiCAD and Fusion/Eagle copper pours should now interact correctly with all geometry. (EasyEDA pours TBD.)
11+
- **Minor Optimizations**
12+
713
## [1.0.9] - 2026-03-11
814

915
### Fixed
10-
- **Winding Enforcement:** Winding is now set at the source to avoid having to check and fixing everywhere else.
16+
- **Winding Enforcement:** Winding is now set at the source to avoid having to check and fix it everywhere else.
1117
- **Further Optimizations:** Removed useless winding checks and enforcements through-out.
1218

1319
### Changed
@@ -22,11 +28,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
2228
- **Changes to the offset pipeline made everything slightly more accurate but slower, optimization to come**
2329

2430
### Added
25-
- **Arc Definitions in Laser SVGs:** Offset Strategy Arcs in exported Laser SVGs will come out right now.
31+
- **Copper Pour Regions:** KiCAD and Fusion Copper Pour regions are now correctly parsed, plotted and processed in Copper Isolation Operations (Copper Clear works but is even slower).
2632
- **New Tiny/Noisy/Collapsed Arc Safeguards:** More protections against small arcs with a tendency to collapse on themselfes, plus less random unnecessarily small arcs.
2733

2834
### Fixed
29-
- **Copper Pour Regions:** KiCAD and Fusion Copper Pour regions are now correctly parsed, plotted and processed in Copper Isolation Operations (Copper Clear works but is even slower).
35+
- **Arc Definitions in Laser SVGs:** Offset Strategy Arcs in exported Laser SVGs will come out right now.
3036
- **Clipper Wrapper and Arc Reconstruction Optimizations:** Older modules - newish logic.
3137

3238
### Changed

cam-controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@
260260
this.machineProcessor = new MachineProcessor(this.core);
261261

262262
// Initialize UI with core and language manager
263-
this.ui = new PCBCamUI(this.core, this.languageManager)
263+
this.ui = new PCBCamUI(this.core, this.languageManager);
264264

265265
// Initialize UI (pass parameter manager)
266266
const uiReady = await this.ui.init(this.parameterManager);

cam-core.js

Lines changed: 144 additions & 231 deletions
Large diffs are not rendered by default.

config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ window.PCBCAMConfig = {
3737
name: 'Isolation Routing',
3838
icon: '🎯',
3939
extensions: ['.gbr', '.ger', '.gtl', '.gbl', '.gts', '.gbs', '.svg'],
40-
defaultTool: 'em_0.1mm_flat', // Tool ID - diameter comes from tools.json
40+
defaultTool: 'em_0.2mm_flat', // Tool ID - diameter comes from tools.json
4141
cutting: {
4242
cutDepth: -0.04,
4343
passDepth: 0.04,
@@ -709,7 +709,7 @@ window.PCBCAMConfig = {
709709
// Per-operation defaults (merged into operations config)
710710
operationDefaults: {
711711
isolation: {
712-
isolationWidth: 0.3, // mm — total copper removal width
712+
isolationWidth: 0.4, // mm — total copper removal width
713713
stepOver: 10, // %
714714
clearStrategy: 'offset',
715715
hatchAngle: 0

geometry/geometry-arc-reconstructor.js

Lines changed: 111 additions & 81 deletions
Large diffs are not rendered by default.

geometry/geometry-offsetter.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,12 @@
447447
});
448448

449449
return new PathPrimitive([{
450-
points: offsetResult.points,
450+
points: offsetPoints,
451451
isHole: contour.isHole || false,
452-
nestingLevel: 0,
453-
parentId: null,
454-
arcSegments: offsetResult.arcSegments,
455-
curveIds: offsetResult.curveIds
452+
nestingLevel: contour.nestingLevel || 0,
453+
parentId: contour.parentId || null,
454+
arcSegments: [],
455+
curveIds: collectedCurveIds
456456
}], makeProps(contour.isHole ? 'clear' : 'dark'));
457457
}
458458
} catch (e) {
@@ -472,9 +472,9 @@
472472

473473
return new PathPrimitive([{
474474
points: offsetPoints,
475-
isHole: false,
476-
nestingLevel: 0,
477-
parentId: null,
475+
isHole: contour.isHole || false,
476+
nestingLevel: contour.nestingLevel || 0,
477+
parentId: contour.parentId || null,
478478
arcSegments: [],
479479
curveIds: collectedCurveIds
480480
}], {
@@ -546,14 +546,15 @@
546546
const offsetSegments = [];
547547
for (let i = 0; i < n; i++) {
548548
const p1 = polygonPoints[i];
549-
const p2 = polygonPoints[(i + 1) % n];
549+
const p2 = polygonPoints[i === n - 1 ? 0 : i + 1]; // Optimized wrapping
550550

551-
const v = { x: p2.x - p1.x, y: p2.y - p1.y };
552-
const len = Math.hypot(v.x, v.y);
551+
const dx = p2.x - p1.x;
552+
const dy = p2.y - p1.y;
553+
const len = Math.sqrt(dx * dx + dy * dy); // ~4x faster than Math.hypot
553554
if (len < this.options.precision) continue;
554555

555-
const nx = normalDirection * (-v.y / len);
556-
const ny = normalDirection * (v.x / len);
556+
const nx = normalDirection * (-dy / len);
557+
const ny = normalDirection * (dx / len);
557558

558559
offsetSegments.push({
559560
p1: { x: p1.x + nx * offsetDist, y: p1.y + ny * offsetDist },

geometry/geometry-utils.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,9 @@
450450
if (!points || points.length < 3) return 0;
451451

452452
let area = 0;
453-
for (let i = 0; i < points.length; i++) {
454-
const j = (i + 1) % points.length;
453+
const len = points.length;
454+
for (let i = 0; i < len; i++) {
455+
const j = i === len - 1 ? 0 : i + 1; // 2-3x faster than modulo
455456
area += points[i].x * points[j].y;
456457
area -= points[j].x * points[i].y;
457458
}
@@ -587,8 +588,8 @@
587588
return boundaryStrokes;
588589
},
589590

590-
/**
591-
* polylineToPolygon has been deprecated in favor of traceToPolygon that generates joint geometry that is easier to process.
591+
/**
592+
* polylineToPolygon has been deprecated in favor of traceToPolygon that generates joint geometry that is easier to process. They will remain until commented out until analytic offset path development is restarted.
592593
// Convert polyline to polygon with metadata for end-caps
593594
polylineToPolygon(points, width, curveIds = []) {
594595
if (!points || points.length < 2) return [];
@@ -677,7 +678,7 @@
677678
*/
678679

679680
/**
680-
* Optimized: Converts a closed contour into overlapping stroke polygons.
681+
* Converts a closed contour into overlapping stroke polygons.
681682
* Fixes spikes by merging micro-segments, while strictly protecting registered curve points.
682683
*/
683684
closedContourToStrokePolygons(contour, strokeWidth) {
@@ -814,9 +815,10 @@
814815
},
815816

816817
/**
818+
* polylineToPolygon has been deprecated in favor of traceToPolygon that generates joint geometry that is easier to process. They will remain until commented out until analytic offset path development is restarted.
819+
* lineToPolygon is only called by polylineToPolygon.
817820
* Converts a line to a polygon, returning a flat point array.
818821
* It registers end-caps and tags points with curveId.
819-
*/
820822
lineToPolygon(from, to, width, curveIds = []) {
821823
const dx = to.x - from.x;
822824
const dy = to.y - from.y;
@@ -950,6 +952,7 @@
950952
points.push({ x: to.x + nx, y: to.y + ny });
951953
return points;
952954
},
955+
*/
953956

954957
/**
955958
* Converts an arc to a polygon, returning a structured object containing points, arcSegments, and curveIds.

toolpath/toolpath-optimizer.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,9 @@
623623
const cmd = plan.commands[i];
624624
if (cmd.x === null || cmd.y === null) continue;
625625

626-
const dist = Math.hypot(cmd.x - fromPos.x, cmd.y - fromPos.y);
626+
const dx = cmd.x - fromPos.x;
627+
const dy = cmd.y - fromPos.y;
628+
const dist = Math.sqrt(dx * dx + dy * dy); // ~4x faster than Math.hypot
627629

628630
if (dist < bestDist) {
629631
bestDist = dist;

0 commit comments

Comments
 (0)