Files
OpenNest/docs/geometry/dense-outlines.md
T
ajandClaude Opus 5.5 c48fbd87b8 fix(fill): thin dense spacing outlines and stop near-circle offset joints
A braze-casing angle whose 0.98" curve was exported as 199 lines of
0.005" made a single Fill of 33 copies take 8.6 minutes, and Auto Nest's
Irregular engine never finished its first plate in 15 minutes: it
proposes such fills as Lattice blocks.

Two causes. Shape.JoinOffsetLines tested convexity with an unnormalized
cross product, so shallow concave turns between tiny lines fell under
the epsilon, the nearly parallel offsets missed each other, and the
fallback arc swept the long way round: a near circle per joint, 414
entities in the spacing outline. A non-convex turn now gets a straight
bridge, as concave corners already do.

Spacing outlines with a dense run of tiny entities are also thinned to
Douglas-Peucker chords on an offset padded by 0.0015, so every chord
stays outside the true spacing outline: clearance can only grow, by at
most 0.003 beside the run, and validation still reads true geometry.
The angle's outline is now 21 entities; the Fill takes 69 s with no
overlaps, and Irregular finishes the whole job (24 sheets in under 5
minutes, 22 by a 15-minute limit, against 28).

Problem-nest corpus (auto-nest, fill): all layouts and counts unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 13:26:51 -05:00

3.0 KiB

Dense outlines in spacing geometry

Fill, best-fit pairs and Compactor slide parts against each part's spacing outline: PartGeometry.GetOffsetPerimeterEntities, the perimeter offset outward by the spacing (cutouts are never part of it). Every slide costs in proportion to the entities on both sides, so a perimeter carrying a curve that a CAD export wrote as hundreds of tiny lines makes every query slow.

Reproduced case

A braze-casing angle (4980 A01 PT71, 5.30 x 28.28, 3/16 steel) has a 0.98-inch curve of radius 22.9 written as 199 lines of about 0.005 inch. Its spacing outline held 414 entities, and Fill of 33 copies on a 72 x 144 sheet took 8.6 minutes; Auto Nest's Irregular engine, which proposes such fills as Lattice blocks, never finished its first plate in 15 minutes.

Two causes, both fixed:

  • Near-circle joint arcs. Shape.JoinOffsetLines tells a convex corner from a concave one by an unnormalized cross product against Tolerance.Epsilon. Between 0.005-inch lines a shallow concave turn falls under that threshold, the nearly parallel offsets do not intersect, and the fallback arc swept the long way round the corner: a near circle of the spacing radius at every joint. Those circles lie inside the true offset, so layouts stayed valid, but each one is a slide query. A turn that is not convex now gets a straight bridge between the offsets' ends, as the general join already does at concave corners; a convex turn keeps its short arc.
  • Dense runs are thinned (DenseOutline). A perimeter holding a run of at least MinRun (16) consecutive lines or arcs shorter than ShortLength (0.02 inch) is offset by the spacing plus Pad (0.0015 inch) instead, and each such run is replaced by Douglas-Peucker chords through points on that offset (arcs sampled within 0.0005, chords within 0.001). Every chord stays within the pad of the padded offset, so it lies outside the offset at the true spacing: layouts spaced on the thinned outline keep the spacing, at most twice the pad (0.003 inch) wider beside a dense run. Perimeters without a dense run keep their exact offset.

The angle's spacing outline is now 21 entities, and the same Fill takes 69 seconds with every part passing the overlap check. What remains is mostly the exact overlap check, which still triangulates the true perimeter and is deliberately not thinned. On the whole braze-casing job (219 parts, five stock sizes) Irregular now completes its normal search in under 5 minutes (24 sheets, 88.6%), and searching until a 15-minute limit reaches 22 sheets (89.9%), against 28 sheets (78.3%) before.

Boundaries

  • Thinning only ever adds clearance; it never loosens a tolerance. Validation (NestLayoutCheck, SpacingOutline, NativeContours) and the overlap check still read the true geometry.
  • Only the spacing outline is thinned. Drawings, programs, cut paths and posts are unchanged; to remove the dense run itself, simplify the drawing in the CAD Converter.
  • DenseOutlineTests covers the joint arcs, the spacing bound on both sides of a dense run, and closure.