- Remove IsBetterValidFill overlap gate for FillLinear results; the
geometry-aware spacing in FillLinear is sufficient and the overlap
check produced false positives on parts with arcs/curves, causing
valid grid layouts to be rejected in favor of inferior pair fills.
- Add FillRectangleBestFit strategy that uses BestCombination to mix
normal and rotated orientations, filling remnant strips for higher
part counts on rectangular parts.
- All Fill overloads now compare linear, rectangle best-fit, and
pair-based strategies, picking whichever yields the most parts.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The perpendicular sweep started at perpMin (e.g. -8.75) which with
coarse step sizes never landed on offset=0, missing the perfect
side-by-side and stacked same-orientation patterns for rectangular parts.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Part.Intersects included rapid move geometry (G00 traversals) when
checking for overlaps, causing false positives. The overlap validation
added in 5bebfcb rejected all FillLinear configs, producing 0 parts.
Every other GetShapes caller already filters SpecialLayers.Rapid.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- GpuEvaluatorFactory probes for CUDA/OpenCL devices at startup
- Status bar shows "GPU : <device name>" (green) or "GPU : None (CPU)" (gray)
- Factory skips GPU evaluator creation entirely when no device found
- Logs actual exception message on failure for debugging
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Introduces the OpenNest.Gpu class library with ILGPU dependencies and a
PartBitmap class that rasterizes Drawing closed shapes into integer grids
for GPU-based overlap testing. Supports rotation and spacing dilation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Offset the moving shape's geometry by PartSpacing instead of adding
spacing linearly to the copy distance. This guarantees minimum clearance
in all directions for curved/complex shapes, not just along the slide axis.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pressing Escape from ActionSelect now restores the previous action
(e.g. ActionClone) instead of staying in Select mode. Adds
ConnectEvents() to the Action base class for action resume support.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ActionClone.Fill() now computes the largest open rectangle from the
cursor position (trying both vertical and horizontal) and passes it
to the engine, so fills no longer overlap existing parts.
Pattern fills try all convex hull edge angles to find the rotation
that maximizes part count.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SetPlate clears SelectedParts, which broke bounds drawing and rotation
for surviving actions. Add OnPlateChanged hook so ActionClone can
re-populate SelectedParts after a plate switch.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SetPlate unconditionally reset the action to ActionSelect, clearing
the clone pattern when switching plates. Add SurvivesPlateChange
virtual property to Action base class so actions can opt in to
persisting across plate changes.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merge ActionAddPart into ActionClone by adding a Drawing constructor,
eliminating the redundant class. ActionClone now handles both adding
new parts from a drawing and cloning selected part groups. Added
Ctrl+F fill support for groups using FillLinear pattern tiling, and
adopted quadrant-aware push directions from ActionAddPart. Refactored
FillLinear to extract shared helpers and add a Fill(Pattern) overload
for tiling arbitrary part groups across the work area.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fill(NestItem) now uses actual part geometry instead of bounding boxes.
Also fixes Fill(NestItem, maxCount) which previously threw NotImplementedException.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Polygon offset at concave corners creates geometry that folds back
through itself. Added RemoveSelfIntersections() to Polygon that
detects non-adjacent edge crossings and removes the smaller loop
at each crossing. Applied to both collision detection and rendering.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
RayEdgeDistance returned double.MaxValue for touching vertices (dist ≈ 0),
causing rays from other vertices to hit the far side of stationary parts
and allow movement through obstacles. Now returns 0 when touching so the
distance > 0 check in PushSelected correctly prevents further movement.
Added directional edge filtering using outward normals to discard
back-facing edges before ray checks, reducing line count by ~2/3.
DirectionalDistance now checks both StartPoint and EndPoint per line
to preserve vertices at filtered edge boundaries.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ProgramReader treats 'E' as a code letter, so values like
"6.66E-08" get split into X:"6.66" and E:"-08", corrupting
the parsed coordinate. Use fixed-point format string instead.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SetRotation always forced CW regardless of the requested rotation,
so cutouts (which should be CCW for kerf-left) were also set to CW.
Now uses the rotation parameter to set the correct winding direction.
Also reverts the Shape.OffsetEntity cutout side inversion since the
correct fix is proper winding from the converter.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cutouts wind opposite to the perimeter, so using the same OffsetSide
expands holes instead of shrinking them. Invert the side for cutouts
so the offset buffer correctly contracts holes inward.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>