@faicad/sheetmetal 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/allowanceFns.d.ts +1 -1
  2. package/dist/allowanceFns.d.ts.map +1 -1
  3. package/dist/allowanceFns.js +1 -1
  4. package/dist/allowanceFns.js.map +1 -1
  5. package/dist/api.d.ts +21 -20
  6. package/dist/api.d.ts.map +1 -1
  7. package/dist/api.js +20 -20
  8. package/dist/api.js.map +1 -1
  9. package/dist/authorFns.d.ts +2 -2
  10. package/dist/authorFns.d.ts.map +1 -1
  11. package/dist/authorFns.js +61 -51
  12. package/dist/authorFns.js.map +1 -1
  13. package/dist/bendTableFns.d.ts +1 -1
  14. package/dist/bendTableFns.d.ts.map +1 -1
  15. package/dist/bendTableFns.js +1 -1
  16. package/dist/bendTableFns.js.map +1 -1
  17. package/dist/contourFlangeFns.d.ts +5 -4
  18. package/dist/contourFlangeFns.d.ts.map +1 -1
  19. package/dist/contourFlangeFns.js +59 -44
  20. package/dist/contourFlangeFns.js.map +1 -1
  21. package/dist/cutoutFns.d.ts +5 -5
  22. package/dist/cutoutFns.d.ts.map +1 -1
  23. package/dist/cutoutFns.js +22 -14
  24. package/dist/cutoutFns.js.map +1 -1
  25. package/dist/dxfFns.d.ts +1 -1
  26. package/dist/dxfFns.d.ts.map +1 -1
  27. package/dist/dxfFns.js +1 -1
  28. package/dist/dxfFns.js.map +1 -1
  29. package/dist/facade.d.ts +43 -42
  30. package/dist/facade.d.ts.map +1 -1
  31. package/dist/facade.js +83 -83
  32. package/dist/facade.js.map +1 -1
  33. package/dist/featureTreeFns.d.ts +1 -1
  34. package/dist/featureTreeFns.d.ts.map +1 -1
  35. package/dist/featureTreeFns.js +1 -1
  36. package/dist/featureTreeFns.js.map +1 -1
  37. package/dist/foldFns.d.ts +3 -3
  38. package/dist/foldFns.d.ts.map +1 -1
  39. package/dist/foldFns.js +12 -12
  40. package/dist/foldFns.js.map +1 -1
  41. package/dist/foreignUnfoldFns.d.ts +2 -1
  42. package/dist/foreignUnfoldFns.d.ts.map +1 -1
  43. package/dist/foreignUnfoldFns.js +21 -10
  44. package/dist/foreignUnfoldFns.js.map +1 -1
  45. package/dist/formFns.d.ts +4 -4
  46. package/dist/formFns.d.ts.map +1 -1
  47. package/dist/formFns.js +91 -76
  48. package/dist/formFns.js.map +1 -1
  49. package/dist/geometryOps.d.ts +32 -0
  50. package/dist/geometryOps.d.ts.map +1 -0
  51. package/dist/geometryOps.js +83 -0
  52. package/dist/geometryOps.js.map +1 -0
  53. package/dist/hemFns.d.ts +2 -2
  54. package/dist/hemFns.d.ts.map +1 -1
  55. package/dist/hemFns.js +4 -4
  56. package/dist/hemFns.js.map +1 -1
  57. package/dist/internal.d.ts +2 -1
  58. package/dist/internal.d.ts.map +1 -1
  59. package/dist/internal.js +1 -1
  60. package/dist/internal.js.map +1 -1
  61. package/dist/jogFns.d.ts +2 -2
  62. package/dist/jogFns.d.ts.map +1 -1
  63. package/dist/jogFns.js +6 -6
  64. package/dist/jogFns.js.map +1 -1
  65. package/dist/loftedFlangeFns.d.ts +2 -2
  66. package/dist/loftedFlangeFns.d.ts.map +1 -1
  67. package/dist/loftedFlangeFns.js +35 -25
  68. package/dist/loftedFlangeFns.js.map +1 -1
  69. package/dist/miterFns.d.ts +3 -3
  70. package/dist/miterFns.d.ts.map +1 -1
  71. package/dist/miterFns.js +30 -19
  72. package/dist/miterFns.js.map +1 -1
  73. package/dist/nestFns.d.ts +1 -1
  74. package/dist/nestFns.d.ts.map +1 -1
  75. package/dist/nestFns.js +1 -1
  76. package/dist/nestFns.js.map +1 -1
  77. package/dist/polygonFns.d.ts +2 -2
  78. package/dist/polygonFns.d.ts.map +1 -1
  79. package/dist/polygonFns.js +1 -1
  80. package/dist/polygonFns.js.map +1 -1
  81. package/dist/reliefFns.d.ts +4 -4
  82. package/dist/reliefFns.d.ts.map +1 -1
  83. package/dist/reliefFns.js +39 -31
  84. package/dist/reliefFns.js.map +1 -1
  85. package/dist/reportFns.d.ts +1 -1
  86. package/dist/reportFns.d.ts.map +1 -1
  87. package/dist/reportFns.js +1 -1
  88. package/dist/reportFns.js.map +1 -1
  89. package/dist/tabFns.d.ts +3 -3
  90. package/dist/tabFns.d.ts.map +1 -1
  91. package/dist/tabFns.js +21 -13
  92. package/dist/tabFns.js.map +1 -1
  93. package/dist/types.d.ts +21 -1
  94. package/dist/types.d.ts.map +1 -1
  95. package/dist/types.js.map +1 -1
  96. package/dist/unfoldFns.d.ts +1 -1
  97. package/dist/unfoldFns.d.ts.map +1 -1
  98. package/dist/unfoldFns.js +2 -2
  99. package/dist/unfoldFns.js.map +1 -1
  100. package/dist/validateFns.d.ts.map +1 -1
  101. package/dist/validateFns.js +4 -6
  102. package/dist/validateFns.js.map +1 -1
  103. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE/E,qDAAqD;AACrD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF;qFACqF;AACrF,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,OA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AAQ,EAAE,GAAG,SAAS,CAAC;CAChC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IACpC,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,kFAAkF;IAClF,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC;IACvC,sFAAsF;IACtF,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;IACjC,0EAA0E;IAC1E,SAAS,CAAC,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC;CACpC"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Solid, Wire, Edge, Bounds3D } from '@faicad/faijs/brepjs-compat';\n\n/** Which edge of a flat a child flange folds off. */\nexport type FlatSide = 'xmin' | 'xmax' | 'ymin' | 'ymax';\n\n/**\n * Reference to the parent edge a flange folds from. `faceIndex` keeps the legacy\n * construction-order scheme (`face-0` = base flat). `parentId` names the parent\n * flat directly (a flange id for chained flanges, or undefined for the base) and\n * `side`/`offset`/`extent` locate the flange along that parent edge — the data\n * the recursive unfold walk and the feature tree consume.\n */\nexport type EdgeRef = {\n kind: 'index';\n faceIndex: number;\n edgeIndex: number;\n parentId?: string | undefined;\n side?: FlatSide | undefined;\n offset?: number | undefined;\n extent?: number | undefined;\n};\n\n/** Bend-deduction rule: a bend's inner radius plus its K-factor, with an optional\n * allowance, deduction, or bend-table reference as the length-compensation basis. */\nexport interface BendRule {\n innerRadius: number;\n kFactor: number;\n allowance?: number | undefined;\n deduction?: number | undefined;\n bendTableRef?: string | undefined;\n}\n\n/** A stock material: a name and thickness, plus the default {@link BendRule} applied\n * to bends made from it. */\nexport interface MaterialSpec {\n name: string;\n thickness: number;\n defaultRule: BendRule;\n}\n\n/** Miter between two adjacent flange ends: a cut gap, with `style` currently always\n * `'auto'` (the corner geometry is derived automatically). */\nexport interface MiterSpec {\n gap: number;\n style: 'auto';\n}\n\n/** A single bend in the folded part: a 3D fold axis (origin + direction), the bend\n * angle and direction, and the {@link BendRule} used to develop it. */\nexport interface BendFeature {\n id: string;\n axisOrigin: [number, number, number];\n axisDir: [number, number, number];\n angleDeg: number;\n direction: 'up' | 'down';\n rule: BendRule;\n}\n\n/** A flange folded up from an edge of a parent flat (the base or another flange):\n * length, span, angle, optional miter, and the {@link BendRule} it folds with. */\nexport interface FlangeFeature {\n id: string;\n baseEdge: EdgeRef;\n length: number;\n /** Extent along the bend axis — the flange's cross-width in the developed strip. */\n span: number;\n /** Start position of the flange measured along the parent edge (0 = edge start). */\n offset?: number | undefined;\n angleDeg: number;\n direction?: 'up' | 'down' | undefined;\n rule: BendRule;\n /** World-space AABB of the folded flange, recorded by {@link authorPart} from the\n * real placed geometry. The collision check prefers this over an analytic re-fold,\n * which is only correct for root flanges (chained flanges fold off an off-plane edge). */\n foldedBounds?: Bounds3D | undefined;\n miter?: MiterSpec | undefined;\n}\n\n/** A recorded corner miter between two perpendicular flanges. */\nexport interface CornerMiter {\n flangeA: string;\n flangeB: string;\n gap: number;\n}\n\n/**\n * A relief cut to make a multi-bend part manufacturable. `shape` records the intent:\n * `rectangular` is a plain slot, `obround` the rounded-slot (semicircular-ended,\n * lower-stress) standard relief. In this version both produce rectangular geometry —\n * `obround` only carries the rounded-end intent onto the recorded feature; the\n * developed notch and 3D cut are rectangular for both. `width` runs along the parent\n * edge (the slot's narrow extent, default ≈ material thickness); `depth` cuts\n * perpendicular into the parent flat (default ≈ the bend's developed length plus a\n * small clearance). For a corner relief, `width` sets the square notch side (default\n * ≈ depth).\n */\nexport interface ReliefSpec {\n shape: 'rectangular' | 'obround';\n width?: number | undefined;\n depth?: number | undefined;\n}\n\n/**\n * A recorded relief, mirroring {@link CornerMiter}: enough information for the\n * unfold to replay the 2D notch without reparsing geometry. `kind` distinguishes a\n * bend relief (a slot at each end of a partial bend line, into the parent flat)\n * from a corner relief (a notch at the shared corner of two flanges). `notches`\n * are the developed-plane (flat-pattern) rectangles to subtract from the outline;\n * each is also cut from the 3D solid. `shape` carries the rounded-end option onto\n * the developed outline.\n */\nexport interface ReliefFeature {\n kind: 'bend' | 'corner';\n shape: 'rectangular' | 'obround';\n /** The flange the relief was applied to (bend relief) or the first flange (corner relief). */\n flangeA: string;\n /** The second flange of a corner relief; undefined for a bend relief. */\n flangeB?: string | undefined;\n width: number;\n depth: number;\n /** Developed-plane notch rectangles `[x0, y0, x1, y1]` subtracted from the outline. */\n notches: [number, number, number, number][];\n}\n\n/**\n * A 2D feature punched through a named flat region's thickness, in that region's\n * LOCAL frame: the origin is the region frame origin, `+x` runs along the region's\n * `u` axis and `+y` along its `v` axis (so `(0,0)` is the region's near corner).\n * `region` is a flange id, or `'root'`/`'base'` for the base flat.\n *\n * - `hole` — a circular hole centred at `(x, y)`.\n * - `slot` — a slot centred at `(x, y)`, `length` along the slot axis by `width`\n * across; `angleDeg` rotates the slot in-plane (CCW about its centre);\n * `round` makes the ends semicircular (obround) rather than square.\n * - `polygon`— an arbitrary closed polygon given by its local `points` (≥ 3).\n *\n * `region` names the flat the cutout sits on: a flange id, or `'root'`/`'base'`/\n * `'face-0'` for the base flat (the three base aliases the rest of the package\n * accepts). Coordinates are region-local: `+x` along the bend axis, `+y` along the\n * run, origin at the region's frame origin.\n */\nexport type CutoutSpec =\n | { kind: 'hole'; region: string; x: number; y: number; diameter: number }\n | {\n kind: 'slot';\n region: string;\n x: number;\n y: number;\n length: number;\n width: number;\n angleDeg?: number | undefined;\n round?: boolean | undefined;\n }\n | { kind: 'polygon'; region: string; points: [number, number][] };\n\n/**\n * A recorded cutout, mirroring {@link ReliefFeature}: enough to replay the 2D loop\n * in the developed pattern without re-deriving geometry. `spec` is the original\n * region-local feature (so {@link FoldRegion} can re-apply it on a re-fold); `loop`\n * is the closed cutout boundary already mapped into developed-plane coordinates via\n * the region's unfold frame; `area` is the loop's enclosed area, subtracted from the\n * developed area.\n */\nexport interface CutoutFeature {\n spec: CutoutSpec;\n /** The region (flange id, or `'root'`) the cutout was applied to. */\n region: string;\n /** Closed cutout boundary `[x, y]` in the developed (flat-pattern) plane. */\n loop: [number, number][];\n /** Enclosed area of the loop. */\n area: number;\n}\n\n/**\n * A rectangular tab: additive material extending OUTWARD from a flat region's edge\n * (the additive counterpart of a cutout). `region` names the flat (a flange id, or\n * `'base'`/`'root'` for the base); `side` is the region-local edge it protrudes\n * from; `offset` is its start position along that edge and `width` its extent along\n * it; `length` is how far it sticks out past the edge. The tab is full thickness.\n */\nexport interface TabSpec {\n region: string;\n side: FlatSide;\n offset: number;\n width: number;\n length: number;\n}\n\n/**\n * A recorded tab, mirroring {@link CutoutFeature}: enough to replay the developed\n * protrusion and re-fuse the 3D material on a re-fold. `rect` is the developed-plane\n * rectangle `[x0, y0, x1, y1]` added to the outer outline; `area` is its area, added\n * to the developed area.\n */\nexport interface TabFeature {\n spec: TabSpec;\n /** The region (flange id, or `'root'`) the tab protrudes from. */\n region: string;\n /** Developed-plane protrusion rectangle `[x0, y0, x1, y1]`. */\n rect: [number, number, number, number];\n /** Area of the protrusion rectangle (`width · length`). */\n area: number;\n}\n\n/**\n * A form feature: a louver (vent flap) or an emboss/dimple (round bump), formed\n * locally on a flat region's face. Forms do not remove or add net material, so the\n * developed outline is unchanged; the flat pattern carries the fabrication markers\n * (the louver U-cut + hinge line, the emboss footprint circle) on a FORM layer.\n *\n * - `louver` — a vent cut on three sides with the flap formed up along the hinge.\n * `length` runs along the hinge, `width` is the flap depth (perpendicular), and\n * `height` is how far the flap rises. `direction` picks the formed face (`up` =\n * +n, the default).\n * - `emboss` / `dimple` — a round local form of `diameter` rising (`emboss`) or\n * recessed (`dimple`) by `height`.\n *\n * Coordinates are region-local: `(x, y)` is the form centre, `+x` along the region\n * `u` axis, `+y` along `v`.\n */\nexport type FormSpec =\n | {\n kind: 'louver';\n region: string;\n x: number;\n y: number;\n length: number;\n width: number;\n height: number;\n direction?: 'up' | 'down' | undefined;\n }\n | {\n kind: 'emboss';\n region: string;\n x: number;\n y: number;\n diameter: number;\n height: number;\n form: 'dimple' | 'emboss';\n };\n\n/**\n * A recorded form feature, mirroring {@link CutoutFeature}. `spec` is the original\n * region-local feature (so {@link FoldRegion} can re-apply it on a re-fold). `cuts`\n * are OPEN developed-plane cut paths: the louver's three cut sides — all but the\n * {@link FormFeature.hinge} side — as an open polyline the fabricator cuts to free\n * the flap; empty for an emboss/dimple, which removes no material. `markers` are\n * closed developed-plane marker loops (the emboss/dimple footprint circle; empty for\n * a louver). `hinge` is the developed-plane fold segment of a louver — the one\n * footprint side NOT cut — and is `undefined` for an emboss/dimple.\n */\nexport interface FormFeature {\n spec: FormSpec;\n /** The region (flange id, or `'root'`) the form sits on. */\n region: string;\n /** Developed-plane cut paths (open) a fabricator cuts; empty for embosses. */\n cuts: [number, number][][];\n /** Developed-plane marker loops (closed) for the FORM layer. */\n markers: [number, number][][];\n /** Developed-plane hinge segment `[a, b]` for a louver; undefined otherwise. */\n hinge?: [[number, number], [number, number]] | undefined;\n}\n\n/**\n * One segment of a contour-flange profile: an open 2D polyline of straight `line`\n * runs joined by circular-`arc` bends, swept along a straight base edge. A `line`\n * is a flat leg of `length`; an `arc` is a bend of `radius` turning `angleDeg`\n * either `up` (toward the parent normal) or `down`. Each arc becomes a recorded\n * {@link BendFeature}; each line a flat leg of the developed strip.\n */\nexport type ProfileSegment =\n | { kind: 'line'; length: number }\n | { kind: 'arc'; radius: number; angleDeg: number; direction: 'up' | 'down' };\n\n/**\n * A contour flange: an OPEN 2D profile (alternating line/arc {@link ProfileSegment}s)\n * swept along a straight edge of the base flat (`side`). Unlike a plain flange (one\n * bend + one flat) this chains an arbitrary multi-bend cross-section — a return, a\n * hat/top-hat, a J — in one feature. The development is EXACT: the developed strip\n * length is the sum of each segment's developed length (lines: `length`; arcs: the\n * canonical {@link bendAllowance}).\n */\nexport interface ContourFlangeSpec {\n id: string;\n side: FlatSide;\n profile: ProfileSegment[];\n rule?: BendRule | undefined;\n /** Extent along the base edge (the bend-axis width). Default = full edge length. */\n width?: number | undefined;\n /** Start position along the base edge. Default `0`. */\n offset?: number | undefined;\n}\n\n/**\n * A recorded contour flange, mirroring {@link FlangeFeature}: enough for the unfold\n * to lay the developed strip out straight along the base edge without re-deriving\n * the 3D geometry. `segments` carries each developed segment in order (a flat leg or\n * a developed bend arc); `developedLength` is their exact sum (the strip length out\n * from the base edge); `span`/`offset` locate the strip along the base edge.\n */\nexport interface ContourFlangeFeature {\n id: string;\n side: FlatSide;\n /** Start position along the base edge. */\n offset: number;\n /** Extent along the base edge (the developed strip width). */\n span: number;\n /** Exact developed length out from the base edge (Σ segment developed lengths). */\n developedLength: number;\n segments: {\n kind: 'line' | 'arc';\n /** Developed length of this segment along the strip. */\n dev: number;\n angleDeg?: number | undefined;\n direction?: 'up' | 'down' | undefined;\n /** Id of the recorded {@link BendFeature} for an arc segment. */\n bendId?: string | undefined;\n }[];\n}\n\n/**\n * A lofted / ruled transition flange: a ruled surface lofted between two parallel\n * OPEN profiles (`profileA`, `profileB`) separated by `height` along +Z, thickened\n * to a valid solid. The development is by TRIANGULATION — the standard sheet-metal\n * transition development pairing profile vertices into triangles laid flat\n * preserving edge lengths. Exact to tolerance for a genuinely developable (single-\n * curvature, straight-generator) transition; an approximation otherwise, in which\n * case the unfold emits a {@link SheetMetalWarning} `DEVELOPMENT_APPROXIMATE`.\n */\nexport interface LoftedFlangeSpec {\n id: string;\n /** Open polyline of the near profile, in the base plane (z = 0). */\n profileA: [number, number][];\n /** Open polyline of the far profile (its z is `height`). */\n profileB: [number, number][];\n height: number;\n thickness?: number | undefined;\n}\n\n/**\n * A recorded lofted flange, mirroring {@link ContourFlangeFeature}. `developedLoop`\n * is the triangulated flat boundary (a closed developed-plane polygon); `developedArea`\n * the summed triangle areas; `approximate` flags a non-developable transition the\n * triangulated development only approximates (the unfold emits the warning).\n */\nexport interface LoftedFlangeFeature {\n id: string;\n /** Triangulated developed boundary `[x, y]` (closed) in the developed plane. */\n developedLoop: [number, number][];\n /** Summed area of the triangulated development. */\n developedArea: number;\n /** True when the transition is not developable; the development is an approximation. */\n approximate: boolean;\n}\n\n/**\n * A hem: an edge folded back ~180°+ onto its parent flat, then running a short\n * return leg. `region` names the flat the hem folds off (a flange id, or\n * `'base'`/`'root'` for the base flat); `side` is that region's local edge. The\n * four `type`s set the curl angle and the gap between the return and the parent:\n *\n * - `closed` — a tight ~180° fold, the return runs flat against the parent\n * (`gap ≈ 0`; a HAIR clearance keeps the fused solid valid). `length` is the\n * return-leg length out along the parent.\n * - `open` — a ~180° fold with a `gap` (defaults to `radius`) between the\n * return and the parent, the return running parallel offset by the gap.\n * - `teardrop` — a >180° curl leaving a small teardrop opening, then a short\n * return tangent to the curl.\n * - `rolled` — a full ~270° circular roll (a curled edge / safe edge), no return.\n *\n * `radius` is the inner bend radius (defaults to one material thickness). `gap`\n * applies to `open` only. `rule` overrides the part's per-bend allowance rule.\n */\nexport interface HemSpec {\n region: string;\n side: FlatSide;\n type: 'closed' | 'open' | 'teardrop' | 'rolled';\n /** Optional unique id; defaults to `hem-<region>-<side>-<type>`. Set this to\n * place more than one hem of the same type on the same region edge (e.g. at\n * different offsets). Must not contain `::`. */\n id?: string | undefined;\n /** Return-leg length out along the parent. Required for closed/open/teardrop. */\n length?: number | undefined;\n /** Inner bend radius. Default = one thickness (closed defaults to ≈0, just the\n * HAIR clearance, so it folds flat). */\n radius?: number | undefined;\n /** Open-hem physical clear distance between the return and the parent (the inner\n * radius is set to gap/2). Default = one thickness. */\n gap?: number | undefined;\n /** Start position along the region edge. Default `0`. */\n offset?: number | undefined;\n /** Extent along the region edge. Default = full edge length. */\n width?: number | undefined;\n rule?: BendRule | undefined;\n}\n\n/**\n * A recorded hem, mirroring {@link ContourFlangeFeature}: enough for the unfold to\n * lay its developed strip out straight along the parent edge. `subBends` are the\n * `hem::<id>::<n>` curl bends (one per ≤180° sub-arc); `returnLength` is the flat\n * return leg past the curl. `developedLength` is the EXACT strip length out from\n * the edge: Σ curl bend allowances + `returnLength`. `segments` mirrors the\n * contour-flange developed segment list (a flat leg or a developed bend arc), so\n * the unfold lays bend lines at their exact cumulative developed offsets.\n */\nexport interface HemFeature {\n id: string;\n type: HemSpec['type'];\n /** The flat region the hem folds off (a flange id, or `'root'` for the base). */\n region: string;\n side: FlatSide;\n /** Start position along the parent edge. */\n offset: number;\n /** Extent along the parent edge (the developed strip width). */\n span: number;\n /** Flat return-leg length past the curl (0 for a rolled hem). */\n returnLength: number;\n /** Exact developed length out from the parent edge (Σ curl allowances + return). */\n developedLength: number;\n subBends: string[];\n segments: {\n kind: 'line' | 'arc';\n /** Developed length of this segment along the strip. */\n dev: number;\n angleDeg?: number | undefined;\n direction?: 'up' | 'down' | undefined;\n /** Id of the recorded {@link BendFeature} for an arc segment. */\n bendId?: string | undefined;\n }[];\n}\n\n/**\n * A jog (joggle): two opposite bends (`+θ` then `−θ`) that step a flat by\n * `offsetHeight` perpendicular to its plane, then continue parallel past the step.\n * `region` names the flat the jog runs across (a flange id, or `'base'`/`'root'`);\n * `side` is the region edge the jog develops out from; `position` is how far out\n * along the run the jog sits; `offsetHeight` is the Z-step the two bends produce.\n * `angle` (default 45°) is the magnitude of each bend — a shallower angle gives a\n * longer, gentler step; the connecting step run is `offsetHeight / sin(angle)`.\n * `runOut` is the flat leg continuing past the second bend. `rule` overrides the\n * per-bend allowance rule.\n */\nexport interface JogSpec {\n region: string;\n side: FlatSide;\n /** Optional unique id; defaults to `jog-<region>-<side>`. Set this to place more\n * than one jog on the same region edge (e.g. at different positions). Must not\n * contain `::`. */\n id?: string | undefined;\n /** Distance out along the run from the region edge to the first bend. */\n position: number;\n /** The perpendicular step the two opposite bends produce. Must be > 0. */\n offsetHeight: number;\n /** Magnitude of each opposite bend, in degrees (0, 90). Default `45`. */\n angle?: number | undefined;\n /** Flat leg continuing past the second bend. Default = `position`. */\n runOut?: number | undefined;\n /** Inner bend radius. Default = one material thickness. */\n radius?: number | undefined;\n /** Start position along the region edge. Default `0`. */\n offset?: number | undefined;\n /** Extent along the region edge. Default = full edge length. */\n width?: number | undefined;\n rule?: BendRule | undefined;\n}\n\n/**\n * A recorded jog, mirroring {@link HemFeature}. `bends` are the two opposite curl\n * bends (`jog::<id>::0` up, `jog::<id>::1` down); `offsetHeight` is the requested\n * perpendicular step; `segments` is the developed leg/arc list (position leg →\n * up bend → step run → down bend → runOut leg). `developedLength` is the exact\n * strip length out from the edge (Σ legs + Σ bend allowances).\n */\nexport interface JogFeature {\n id: string;\n /** The flat region the jog runs across (a flange id, or `'root'` for the base). */\n region: string;\n side: FlatSide;\n offset: number;\n span: number;\n offsetHeight: number;\n angleDeg: number;\n developedLength: number;\n bends: string[];\n segments: {\n kind: 'line' | 'arc';\n dev: number;\n angleDeg?: number | undefined;\n direction?: 'up' | 'down' | undefined;\n bendId?: string | undefined;\n }[];\n}\n\n/** A fully-defined sheet-metal part: thickness, base-flat extents, material, and the\n * feature lists (flanges, bends, reliefs, cutouts, tabs, forms, …) that build it. */\nexport interface SheetMetalPart {\n thickness: number;\n /** Base flat extent along +X (x∈[0, baseLength]); the east-run length. */\n baseLength: number;\n /** Base flat cross-width (extent perpendicular to the run); the developed-strip width. */\n width: number;\n material?: MaterialSpec | undefined;\n flanges: FlangeFeature[];\n bends: BendFeature[];\n solid?: Solid | undefined;\n miters?: CornerMiter[] | undefined;\n reliefs?: ReliefFeature[] | undefined;\n cutouts?: CutoutFeature[] | undefined;\n tabs?: TabFeature[] | undefined;\n forms?: FormFeature[] | undefined;\n contourFlanges?: ContourFlangeFeature[] | undefined;\n loftedFlanges?: LoftedFlangeFeature[] | undefined;\n hems?: HemFeature[] | undefined;\n jogs?: JogFeature[] | undefined;\n}\n\n/** The developed 2D flat of a part: the outer outline, fold bend-lines, interior\n * cutouts, form cut/marker/hinge annotations, lofted developments, and area. */\nexport interface FlatPattern {\n outline: Wire;\n bendLines: {\n id: string;\n line: Edge;\n angleDeg: number;\n direction: 'up' | 'down';\n /** Unit direction in the developed plane pointing into the parent flat (the\n * side a bend relief notches), opposite the develop-out direction. */\n inward: [number, number];\n }[];\n /** Interior cutout loops (holes/slots/polygons) as closed wires in the developed plane. */\n holes: Wire[];\n /** Form cut paths (louver U-cuts) a fabricator cuts before forming, as open wires\n * (the three non-hinge sides; the hinge rides in {@link FlatPattern.formHinges}). */\n formCuts: Wire[];\n /** Form marker loops (emboss/dimple footprints) for annotation, as closed wires. */\n formMarkers: Wire[];\n /** Form hinge lines (louver fold lines) for annotation, as edges. */\n formHinges: Edge[];\n /**\n * Lofted/ruled transition developed boundaries, as closed wires in the developed\n * plane (one per recorded {@link LoftedFlangeFeature}). The outline laid out by the\n * rectilinear union covers the base + straight flanges; a ruled transition's\n * triangulated development is non-rectilinear and rides here instead.\n */\n loftedDevelopments: Wire[];\n developedArea: number;\n}\n\n/** Per-bend summary of a development: each bend's radius, allowance and flat length,\n * plus the overall flat-pattern size. */\nexport interface BendReport {\n bends: {\n id: string;\n angleDeg: number;\n radius: number;\n allowance: number;\n flatLength: number;\n direction: 'up' | 'down';\n }[];\n totalFlatSize: [number, number];\n}\n\n/** A non-fatal problem encountered while unfolding or nesting a part: a\n * machine-readable code, a human message, and an optional offending feature id. */\nexport type SheetMetalWarning = {\n code:\n | 'COLLISION'\n | 'SEAM_CUT'\n | 'MIN_RADIUS'\n | 'INVALID_SOLID'\n | 'MITER_NOT_DEVELOPED'\n | 'DEVELOPMENT_APPROXIMATE'\n /** Foreign unfold: a face is outside the supported planar/cylindrical class\n * (unknown surface type, or a cylinder that didn't fit) and was ignored. */\n | 'UNSUPPORTED_FACE'\n /** Foreign unfold: the part is a valid solid but its detected structure is\n * incomplete (non-uniform thickness, a dropped panel, or a bend not joining\n * exactly two flats), so the flat pattern may be partial. */\n | 'DETECTION_INCOMPLETE'\n /** A bend-table query fell outside the tabulated (thickness, radius, angle)\n * range and was clamped to the nearest entry (no extrapolation). Distinct from\n * MIN_RADIUS, which means a bend's inner radius is below one thickness. */\n | 'TABLE_CLAMP'\n /** Nesting: a flat pattern's outline bounding box does not fit the usable stock\n * sheet (sheet minus margin) even rotated 90°, so it was left unplaced. */\n | 'PART_TOO_LARGE';\n message: string;\n featureId?: string | undefined;\n};\n\n/** The outcome of unfolding a part: the {@link FlatPattern}, its {@link BendReport},\n * and any {@link SheetMetalWarning}s raised along the way. */\nexport interface UnfoldResult {\n pattern: FlatPattern;\n report: BendReport;\n warnings: SheetMetalWarning[];\n}\n\n/**\n * One fold-up region in a {@link FlatInput}: a rectangle in the flat pattern that\n * folds about a fold line off its parent region (the base by default, or another\n * region via `parent`). The region-tree is the inverse of the unfold layout, and is\n * recovered purely from the 2D flat-pattern geometry by `patternToFlatInput` — so\n * folding it up just re-runs the forward author geometry. `side`/`offset`/`width`\n * locate the fold line along the parent edge exactly as the authoring `FlangeSpec`\n * does (`side` is expressed in the parent region's local frame).\n */\nexport interface FoldRegion {\n id: string;\n /** Flat extent of the region away from the fold line (becomes the flange length). */\n length: number;\n angleDeg: number;\n direction: 'up' | 'down';\n rule: BendRule;\n /** Which edge of the parent region this region folds off. Default `'xmax'`. */\n side?: FlatSide | undefined;\n /** Id of another fold region this one chains off. Default = base region. */\n parent?: string | undefined;\n /** Start position along the parent edge. Default `0`. */\n offset?: number | undefined;\n /** Extent along the parent edge. Default = full parent-edge length. */\n width?: number | undefined;\n miter?: MiterSpec | undefined;\n /** Bend relief to add at this region's partial-span fold-line ends after folding. */\n bendRelief?: ReliefSpec | undefined;\n /** Cutouts to punch into this region (in region-local coords) after folding. */\n cutouts?: CutoutSpec[] | undefined;\n /** Tabs to fuse onto this region's edges (in region-local coords) after folding. */\n tabs?: TabSpec[] | undefined;\n /** Form features (louvers / embosses) on this region (region-local) after folding. */\n forms?: FormSpec[] | undefined;\n}\n\n/**\n * A flat pattern to fold up into a 3D part: the base region (a rectangle) plus a\n * tree of {@link FoldRegion}s, each folding off its parent about a fold line. This\n * is the inverse of {@link unfold}: a region-tree rather than a 2D outline, which\n * avoids fragile auto-partitioning of an arbitrary developed polygon and maps\n * one-to-one onto the authored feature tree.\n */\nexport interface FlatInput {\n thickness: number;\n /** Base region extent along +X (the run). */\n baseLength: number;\n /** Base region extent along +Y (the developed-strip width). */\n width: number;\n material?: MaterialSpec | undefined;\n regions: FoldRegion[];\n /** Cutouts to punch into the base region (in base-local coords) after folding. */\n baseCutouts?: CutoutSpec[] | undefined;\n /** Tabs to fuse onto the base region's edges (in base-local coords) after folding. */\n baseTabs?: TabSpec[] | undefined;\n /** Form features on the base region (base-local coords) after folding. */\n baseForms?: FormSpec[] | undefined;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {SolidShape, CurveShape} from '@faicad/faijs/api';\n\n/** faijs 建模链产物(core-decouple wrapup §2.2):brepjs `Solid` 的 faijs 等价。\n * 建模 op 均为 faijs 异步 op,产物统一为 `SolidShape`。 */\nexport type Solid = SolidShape;\n\n/** 有效实体别名(断言实体性的调用点保留,等价 `SolidShape`)。 */\nexport type ValidSolid = SolidShape;\n\n/** faijs 曲线形状(edge / wire)——brepjs `Wire` 的 faijs 等价。 */\nexport type Wire = CurveShape;\n\n/** faijs 曲线形状(edge)——brepjs `Edge` 的 faijs 等价。 */\nexport type Edge = CurveShape;\n\n/** faijs 面(携带面句柄的 solid shape)——brepjs `Face` 的 faijs 等价。 */\nexport type Face = SolidShape;\n\n/** 轴对齐包围盒(大写字段形态;由 faijs `bounds3D`(brep 引擎包围盒)组合,见 geometryOps.getBounds)。 */\nexport interface Bounds3D {\n xMin: number;\n xMax: number;\n yMin: number;\n yMax: number;\n zMin: number;\n zMax: number;\n}\n\n/** Which edge of a flat a child flange folds off. */\nexport type FlatSide = 'xmin' | 'xmax' | 'ymin' | 'ymax';\n\n/**\n * Reference to the parent edge a flange folds from. `faceIndex` keeps the legacy\n * construction-order scheme (`face-0` = base flat). `parentId` names the parent\n * flat directly (a flange id for chained flanges, or undefined for the base) and\n * `side`/`offset`/`extent` locate the flange along that parent edge — the data\n * the recursive unfold walk and the feature tree consume.\n */\nexport type EdgeRef = {\n kind: 'index';\n faceIndex: number;\n edgeIndex: number;\n parentId?: string | undefined;\n side?: FlatSide | undefined;\n offset?: number | undefined;\n extent?: number | undefined;\n};\n\n/** Bend-deduction rule: a bend's inner radius plus its K-factor, with an optional\n * allowance, deduction, or bend-table reference as the length-compensation basis. */\nexport interface BendRule {\n innerRadius: number;\n kFactor: number;\n allowance?: number | undefined;\n deduction?: number | undefined;\n bendTableRef?: string | undefined;\n}\n\n/** A stock material: a name and thickness, plus the default {@link BendRule} applied\n * to bends made from it. */\nexport interface MaterialSpec {\n name: string;\n thickness: number;\n defaultRule: BendRule;\n}\n\n/** Miter between two adjacent flange ends: a cut gap, with `style` currently always\n * `'auto'` (the corner geometry is derived automatically). */\nexport interface MiterSpec {\n gap: number;\n style: 'auto';\n}\n\n/** A single bend in the folded part: a 3D fold axis (origin + direction), the bend\n * angle and direction, and the {@link BendRule} used to develop it. */\nexport interface BendFeature {\n id: string;\n axisOrigin: [number, number, number];\n axisDir: [number, number, number];\n angleDeg: number;\n direction: 'up' | 'down';\n rule: BendRule;\n}\n\n/** A flange folded up from an edge of a parent flat (the base or another flange):\n * length, span, angle, optional miter, and the {@link BendRule} it folds with. */\nexport interface FlangeFeature {\n id: string;\n baseEdge: EdgeRef;\n length: number;\n /** Extent along the bend axis — the flange's cross-width in the developed strip. */\n span: number;\n /** Start position of the flange measured along the parent edge (0 = edge start). */\n offset?: number | undefined;\n angleDeg: number;\n direction?: 'up' | 'down' | undefined;\n rule: BendRule;\n /** World-space AABB of the folded flange, recorded by {@link authorPart} from the\n * real placed geometry. The collision check prefers this over an analytic re-fold,\n * which is only correct for root flanges (chained flanges fold off an off-plane edge). */\n foldedBounds?: Bounds3D | undefined;\n miter?: MiterSpec | undefined;\n}\n\n/** A recorded corner miter between two perpendicular flanges. */\nexport interface CornerMiter {\n flangeA: string;\n flangeB: string;\n gap: number;\n}\n\n/**\n * A relief cut to make a multi-bend part manufacturable. `shape` records the intent:\n * `rectangular` is a plain slot, `obround` the rounded-slot (semicircular-ended,\n * lower-stress) standard relief. In this version both produce rectangular geometry —\n * `obround` only carries the rounded-end intent onto the recorded feature; the\n * developed notch and 3D cut are rectangular for both. `width` runs along the parent\n * edge (the slot's narrow extent, default ≈ material thickness); `depth` cuts\n * perpendicular into the parent flat (default ≈ the bend's developed length plus a\n * small clearance). For a corner relief, `width` sets the square notch side (default\n * ≈ depth).\n */\nexport interface ReliefSpec {\n shape: 'rectangular' | 'obround';\n width?: number | undefined;\n depth?: number | undefined;\n}\n\n/**\n * A recorded relief, mirroring {@link CornerMiter}: enough information for the\n * unfold to replay the 2D notch without reparsing geometry. `kind` distinguishes a\n * bend relief (a slot at each end of a partial bend line, into the parent flat)\n * from a corner relief (a notch at the shared corner of two flanges). `notches`\n * are the developed-plane (flat-pattern) rectangles to subtract from the outline;\n * each is also cut from the 3D solid. `shape` carries the rounded-end option onto\n * the developed outline.\n */\nexport interface ReliefFeature {\n kind: 'bend' | 'corner';\n shape: 'rectangular' | 'obround';\n /** The flange the relief was applied to (bend relief) or the first flange (corner relief). */\n flangeA: string;\n /** The second flange of a corner relief; undefined for a bend relief. */\n flangeB?: string | undefined;\n width: number;\n depth: number;\n /** Developed-plane notch rectangles `[x0, y0, x1, y1]` subtracted from the outline. */\n notches: [number, number, number, number][];\n}\n\n/**\n * A 2D feature punched through a named flat region's thickness, in that region's\n * LOCAL frame: the origin is the region frame origin, `+x` runs along the region's\n * `u` axis and `+y` along its `v` axis (so `(0,0)` is the region's near corner).\n * `region` is a flange id, or `'root'`/`'base'` for the base flat.\n *\n * - `hole` — a circular hole centred at `(x, y)`.\n * - `slot` — a slot centred at `(x, y)`, `length` along the slot axis by `width`\n * across; `angleDeg` rotates the slot in-plane (CCW about its centre);\n * `round` makes the ends semicircular (obround) rather than square.\n * - `polygon`— an arbitrary closed polygon given by its local `points` (≥ 3).\n *\n * `region` names the flat the cutout sits on: a flange id, or `'root'`/`'base'`/\n * `'face-0'` for the base flat (the three base aliases the rest of the package\n * accepts). Coordinates are region-local: `+x` along the bend axis, `+y` along the\n * run, origin at the region's frame origin.\n */\nexport type CutoutSpec =\n | { kind: 'hole'; region: string; x: number; y: number; diameter: number }\n | {\n kind: 'slot';\n region: string;\n x: number;\n y: number;\n length: number;\n width: number;\n angleDeg?: number | undefined;\n round?: boolean | undefined;\n }\n | { kind: 'polygon'; region: string; points: [number, number][] };\n\n/**\n * A recorded cutout, mirroring {@link ReliefFeature}: enough to replay the 2D loop\n * in the developed pattern without re-deriving geometry. `spec` is the original\n * region-local feature (so {@link FoldRegion} can re-apply it on a re-fold); `loop`\n * is the closed cutout boundary already mapped into developed-plane coordinates via\n * the region's unfold frame; `area` is the loop's enclosed area, subtracted from the\n * developed area.\n */\nexport interface CutoutFeature {\n spec: CutoutSpec;\n /** The region (flange id, or `'root'`) the cutout was applied to. */\n region: string;\n /** Closed cutout boundary `[x, y]` in the developed (flat-pattern) plane. */\n loop: [number, number][];\n /** Enclosed area of the loop. */\n area: number;\n}\n\n/**\n * A rectangular tab: additive material extending OUTWARD from a flat region's edge\n * (the additive counterpart of a cutout). `region` names the flat (a flange id, or\n * `'base'`/`'root'` for the base); `side` is the region-local edge it protrudes\n * from; `offset` is its start position along that edge and `width` its extent along\n * it; `length` is how far it sticks out past the edge. The tab is full thickness.\n */\nexport interface TabSpec {\n region: string;\n side: FlatSide;\n offset: number;\n width: number;\n length: number;\n}\n\n/**\n * A recorded tab, mirroring {@link CutoutFeature}: enough to replay the developed\n * protrusion and re-fuse the 3D material on a re-fold. `rect` is the developed-plane\n * rectangle `[x0, y0, x1, y1]` added to the outer outline; `area` is its area, added\n * to the developed area.\n */\nexport interface TabFeature {\n spec: TabSpec;\n /** The region (flange id, or `'root'`) the tab protrudes from. */\n region: string;\n /** Developed-plane protrusion rectangle `[x0, y0, x1, y1]`. */\n rect: [number, number, number, number];\n /** Area of the protrusion rectangle (`width · length`). */\n area: number;\n}\n\n/**\n * A form feature: a louver (vent flap) or an emboss/dimple (round bump), formed\n * locally on a flat region's face. Forms do not remove or add net material, so the\n * developed outline is unchanged; the flat pattern carries the fabrication markers\n * (the louver U-cut + hinge line, the emboss footprint circle) on a FORM layer.\n *\n * - `louver` — a vent cut on three sides with the flap formed up along the hinge.\n * `length` runs along the hinge, `width` is the flap depth (perpendicular), and\n * `height` is how far the flap rises. `direction` picks the formed face (`up` =\n * +n, the default).\n * - `emboss` / `dimple` — a round local form of `diameter` rising (`emboss`) or\n * recessed (`dimple`) by `height`.\n *\n * Coordinates are region-local: `(x, y)` is the form centre, `+x` along the region\n * `u` axis, `+y` along `v`.\n */\nexport type FormSpec =\n | {\n kind: 'louver';\n region: string;\n x: number;\n y: number;\n length: number;\n width: number;\n height: number;\n direction?: 'up' | 'down' | undefined;\n }\n | {\n kind: 'emboss';\n region: string;\n x: number;\n y: number;\n diameter: number;\n height: number;\n form: 'dimple' | 'emboss';\n };\n\n/**\n * A recorded form feature, mirroring {@link CutoutFeature}. `spec` is the original\n * region-local feature (so {@link FoldRegion} can re-apply it on a re-fold). `cuts`\n * are OPEN developed-plane cut paths: the louver's three cut sides — all but the\n * {@link FormFeature.hinge} side — as an open polyline the fabricator cuts to free\n * the flap; empty for an emboss/dimple, which removes no material. `markers` are\n * closed developed-plane marker loops (the emboss/dimple footprint circle; empty for\n * a louver). `hinge` is the developed-plane fold segment of a louver — the one\n * footprint side NOT cut — and is `undefined` for an emboss/dimple.\n */\nexport interface FormFeature {\n spec: FormSpec;\n /** The region (flange id, or `'root'`) the form sits on. */\n region: string;\n /** Developed-plane cut paths (open) a fabricator cuts; empty for embosses. */\n cuts: [number, number][][];\n /** Developed-plane marker loops (closed) for the FORM layer. */\n markers: [number, number][][];\n /** Developed-plane hinge segment `[a, b]` for a louver; undefined otherwise. */\n hinge?: [[number, number], [number, number]] | undefined;\n}\n\n/**\n * One segment of a contour-flange profile: an open 2D polyline of straight `line`\n * runs joined by circular-`arc` bends, swept along a straight base edge. A `line`\n * is a flat leg of `length`; an `arc` is a bend of `radius` turning `angleDeg`\n * either `up` (toward the parent normal) or `down`. Each arc becomes a recorded\n * {@link BendFeature}; each line a flat leg of the developed strip.\n */\nexport type ProfileSegment =\n | { kind: 'line'; length: number }\n | { kind: 'arc'; radius: number; angleDeg: number; direction: 'up' | 'down' };\n\n/**\n * A contour flange: an OPEN 2D profile (alternating line/arc {@link ProfileSegment}s)\n * swept along a straight edge of the base flat (`side`). Unlike a plain flange (one\n * bend + one flat) this chains an arbitrary multi-bend cross-section — a return, a\n * hat/top-hat, a J — in one feature. The development is EXACT: the developed strip\n * length is the sum of each segment's developed length (lines: `length`; arcs: the\n * canonical {@link bendAllowance}).\n */\nexport interface ContourFlangeSpec {\n id: string;\n side: FlatSide;\n profile: ProfileSegment[];\n rule?: BendRule | undefined;\n /** Extent along the base edge (the bend-axis width). Default = full edge length. */\n width?: number | undefined;\n /** Start position along the base edge. Default `0`. */\n offset?: number | undefined;\n}\n\n/**\n * A recorded contour flange, mirroring {@link FlangeFeature}: enough for the unfold\n * to lay the developed strip out straight along the base edge without re-deriving\n * the 3D geometry. `segments` carries each developed segment in order (a flat leg or\n * a developed bend arc); `developedLength` is their exact sum (the strip length out\n * from the base edge); `span`/`offset` locate the strip along the base edge.\n */\nexport interface ContourFlangeFeature {\n id: string;\n side: FlatSide;\n /** Start position along the base edge. */\n offset: number;\n /** Extent along the base edge (the developed strip width). */\n span: number;\n /** Exact developed length out from the base edge (Σ segment developed lengths). */\n developedLength: number;\n segments: {\n kind: 'line' | 'arc';\n /** Developed length of this segment along the strip. */\n dev: number;\n angleDeg?: number | undefined;\n direction?: 'up' | 'down' | undefined;\n /** Id of the recorded {@link BendFeature} for an arc segment. */\n bendId?: string | undefined;\n }[];\n}\n\n/**\n * A lofted / ruled transition flange: a ruled surface lofted between two parallel\n * OPEN profiles (`profileA`, `profileB`) separated by `height` along +Z, thickened\n * to a valid solid. The development is by TRIANGULATION — the standard sheet-metal\n * transition development pairing profile vertices into triangles laid flat\n * preserving edge lengths. Exact to tolerance for a genuinely developable (single-\n * curvature, straight-generator) transition; an approximation otherwise, in which\n * case the unfold emits a {@link SheetMetalWarning} `DEVELOPMENT_APPROXIMATE`.\n */\nexport interface LoftedFlangeSpec {\n id: string;\n /** Open polyline of the near profile, in the base plane (z = 0). */\n profileA: [number, number][];\n /** Open polyline of the far profile (its z is `height`). */\n profileB: [number, number][];\n height: number;\n thickness?: number | undefined;\n}\n\n/**\n * A recorded lofted flange, mirroring {@link ContourFlangeFeature}. `developedLoop`\n * is the triangulated flat boundary (a closed developed-plane polygon); `developedArea`\n * the summed triangle areas; `approximate` flags a non-developable transition the\n * triangulated development only approximates (the unfold emits the warning).\n */\nexport interface LoftedFlangeFeature {\n id: string;\n /** Triangulated developed boundary `[x, y]` (closed) in the developed plane. */\n developedLoop: [number, number][];\n /** Summed area of the triangulated development. */\n developedArea: number;\n /** True when the transition is not developable; the development is an approximation. */\n approximate: boolean;\n}\n\n/**\n * A hem: an edge folded back ~180°+ onto its parent flat, then running a short\n * return leg. `region` names the flat the hem folds off (a flange id, or\n * `'base'`/`'root'` for the base flat); `side` is that region's local edge. The\n * four `type`s set the curl angle and the gap between the return and the parent:\n *\n * - `closed` — a tight ~180° fold, the return runs flat against the parent\n * (`gap ≈ 0`; a HAIR clearance keeps the fused solid valid). `length` is the\n * return-leg length out along the parent.\n * - `open` — a ~180° fold with a `gap` (defaults to `radius`) between the\n * return and the parent, the return running parallel offset by the gap.\n * - `teardrop` — a >180° curl leaving a small teardrop opening, then a short\n * return tangent to the curl.\n * - `rolled` — a full ~270° circular roll (a curled edge / safe edge), no return.\n *\n * `radius` is the inner bend radius (defaults to one material thickness). `gap`\n * applies to `open` only. `rule` overrides the part's per-bend allowance rule.\n */\nexport interface HemSpec {\n region: string;\n side: FlatSide;\n type: 'closed' | 'open' | 'teardrop' | 'rolled';\n /** Optional unique id; defaults to `hem-<region>-<side>-<type>`. Set this to\n * place more than one hem of the same type on the same region edge (e.g. at\n * different offsets). Must not contain `::`. */\n id?: string | undefined;\n /** Return-leg length out along the parent. Required for closed/open/teardrop. */\n length?: number | undefined;\n /** Inner bend radius. Default = one thickness (closed defaults to ≈0, just the\n * HAIR clearance, so it folds flat). */\n radius?: number | undefined;\n /** Open-hem physical clear distance between the return and the parent (the inner\n * radius is set to gap/2). Default = one thickness. */\n gap?: number | undefined;\n /** Start position along the region edge. Default `0`. */\n offset?: number | undefined;\n /** Extent along the region edge. Default = full edge length. */\n width?: number | undefined;\n rule?: BendRule | undefined;\n}\n\n/**\n * A recorded hem, mirroring {@link ContourFlangeFeature}: enough for the unfold to\n * lay its developed strip out straight along the parent edge. `subBends` are the\n * `hem::<id>::<n>` curl bends (one per ≤180° sub-arc); `returnLength` is the flat\n * return leg past the curl. `developedLength` is the EXACT strip length out from\n * the edge: Σ curl bend allowances + `returnLength`. `segments` mirrors the\n * contour-flange developed segment list (a flat leg or a developed bend arc), so\n * the unfold lays bend lines at their exact cumulative developed offsets.\n */\nexport interface HemFeature {\n id: string;\n type: HemSpec['type'];\n /** The flat region the hem folds off (a flange id, or `'root'` for the base). */\n region: string;\n side: FlatSide;\n /** Start position along the parent edge. */\n offset: number;\n /** Extent along the parent edge (the developed strip width). */\n span: number;\n /** Flat return-leg length past the curl (0 for a rolled hem). */\n returnLength: number;\n /** Exact developed length out from the parent edge (Σ curl allowances + return). */\n developedLength: number;\n subBends: string[];\n segments: {\n kind: 'line' | 'arc';\n /** Developed length of this segment along the strip. */\n dev: number;\n angleDeg?: number | undefined;\n direction?: 'up' | 'down' | undefined;\n /** Id of the recorded {@link BendFeature} for an arc segment. */\n bendId?: string | undefined;\n }[];\n}\n\n/**\n * A jog (joggle): two opposite bends (`+θ` then `−θ`) that step a flat by\n * `offsetHeight` perpendicular to its plane, then continue parallel past the step.\n * `region` names the flat the jog runs across (a flange id, or `'base'`/`'root'`);\n * `side` is the region edge the jog develops out from; `position` is how far out\n * along the run the jog sits; `offsetHeight` is the Z-step the two bends produce.\n * `angle` (default 45°) is the magnitude of each bend — a shallower angle gives a\n * longer, gentler step; the connecting step run is `offsetHeight / sin(angle)`.\n * `runOut` is the flat leg continuing past the second bend. `rule` overrides the\n * per-bend allowance rule.\n */\nexport interface JogSpec {\n region: string;\n side: FlatSide;\n /** Optional unique id; defaults to `jog-<region>-<side>`. Set this to place more\n * than one jog on the same region edge (e.g. at different positions). Must not\n * contain `::`. */\n id?: string | undefined;\n /** Distance out along the run from the region edge to the first bend. */\n position: number;\n /** The perpendicular step the two opposite bends produce. Must be > 0. */\n offsetHeight: number;\n /** Magnitude of each opposite bend, in degrees (0, 90). Default `45`. */\n angle?: number | undefined;\n /** Flat leg continuing past the second bend. Default = `position`. */\n runOut?: number | undefined;\n /** Inner bend radius. Default = one material thickness. */\n radius?: number | undefined;\n /** Start position along the region edge. Default `0`. */\n offset?: number | undefined;\n /** Extent along the region edge. Default = full edge length. */\n width?: number | undefined;\n rule?: BendRule | undefined;\n}\n\n/**\n * A recorded jog, mirroring {@link HemFeature}. `bends` are the two opposite curl\n * bends (`jog::<id>::0` up, `jog::<id>::1` down); `offsetHeight` is the requested\n * perpendicular step; `segments` is the developed leg/arc list (position leg →\n * up bend → step run → down bend → runOut leg). `developedLength` is the exact\n * strip length out from the edge (Σ legs + Σ bend allowances).\n */\nexport interface JogFeature {\n id: string;\n /** The flat region the jog runs across (a flange id, or `'root'` for the base). */\n region: string;\n side: FlatSide;\n offset: number;\n span: number;\n offsetHeight: number;\n angleDeg: number;\n developedLength: number;\n bends: string[];\n segments: {\n kind: 'line' | 'arc';\n dev: number;\n angleDeg?: number | undefined;\n direction?: 'up' | 'down' | undefined;\n bendId?: string | undefined;\n }[];\n}\n\n/** A fully-defined sheet-metal part: thickness, base-flat extents, material, and the\n * feature lists (flanges, bends, reliefs, cutouts, tabs, forms, …) that build it. */\nexport interface SheetMetalPart {\n thickness: number;\n /** Base flat extent along +X (x∈[0, baseLength]); the east-run length. */\n baseLength: number;\n /** Base flat cross-width (extent perpendicular to the run); the developed-strip width. */\n width: number;\n material?: MaterialSpec | undefined;\n flanges: FlangeFeature[];\n bends: BendFeature[];\n solid?: Solid | undefined;\n miters?: CornerMiter[] | undefined;\n reliefs?: ReliefFeature[] | undefined;\n cutouts?: CutoutFeature[] | undefined;\n tabs?: TabFeature[] | undefined;\n forms?: FormFeature[] | undefined;\n contourFlanges?: ContourFlangeFeature[] | undefined;\n loftedFlanges?: LoftedFlangeFeature[] | undefined;\n hems?: HemFeature[] | undefined;\n jogs?: JogFeature[] | undefined;\n}\n\n/** The developed 2D flat of a part: the outer outline, fold bend-lines, interior\n * cutouts, form cut/marker/hinge annotations, lofted developments, and area. */\nexport interface FlatPattern {\n outline: Wire;\n bendLines: {\n id: string;\n line: Edge;\n angleDeg: number;\n direction: 'up' | 'down';\n /** Unit direction in the developed plane pointing into the parent flat (the\n * side a bend relief notches), opposite the develop-out direction. */\n inward: [number, number];\n }[];\n /** Interior cutout loops (holes/slots/polygons) as closed wires in the developed plane. */\n holes: Wire[];\n /** Form cut paths (louver U-cuts) a fabricator cuts before forming, as open wires\n * (the three non-hinge sides; the hinge rides in {@link FlatPattern.formHinges}). */\n formCuts: Wire[];\n /** Form marker loops (emboss/dimple footprints) for annotation, as closed wires. */\n formMarkers: Wire[];\n /** Form hinge lines (louver fold lines) for annotation, as edges. */\n formHinges: Edge[];\n /**\n * Lofted/ruled transition developed boundaries, as closed wires in the developed\n * plane (one per recorded {@link LoftedFlangeFeature}). The outline laid out by the\n * rectilinear union covers the base + straight flanges; a ruled transition's\n * triangulated development is non-rectilinear and rides here instead.\n */\n loftedDevelopments: Wire[];\n developedArea: number;\n}\n\n/** Per-bend summary of a development: each bend's radius, allowance and flat length,\n * plus the overall flat-pattern size. */\nexport interface BendReport {\n bends: {\n id: string;\n angleDeg: number;\n radius: number;\n allowance: number;\n flatLength: number;\n direction: 'up' | 'down';\n }[];\n totalFlatSize: [number, number];\n}\n\n/** A non-fatal problem encountered while unfolding or nesting a part: a\n * machine-readable code, a human message, and an optional offending feature id. */\nexport type SheetMetalWarning = {\n code:\n | 'COLLISION'\n | 'SEAM_CUT'\n | 'MIN_RADIUS'\n | 'INVALID_SOLID'\n | 'MITER_NOT_DEVELOPED'\n | 'DEVELOPMENT_APPROXIMATE'\n /** Foreign unfold: a face is outside the supported planar/cylindrical class\n * (unknown surface type, or a cylinder that didn't fit) and was ignored. */\n | 'UNSUPPORTED_FACE'\n /** Foreign unfold: the part is a valid solid but its detected structure is\n * incomplete (non-uniform thickness, a dropped panel, or a bend not joining\n * exactly two flats), so the flat pattern may be partial. */\n | 'DETECTION_INCOMPLETE'\n /** A bend-table query fell outside the tabulated (thickness, radius, angle)\n * range and was clamped to the nearest entry (no extrapolation). Distinct from\n * MIN_RADIUS, which means a bend's inner radius is below one thickness. */\n | 'TABLE_CLAMP'\n /** Nesting: a flat pattern's outline bounding box does not fit the usable stock\n * sheet (sheet minus margin) even rotated 90°, so it was left unplaced. */\n | 'PART_TOO_LARGE';\n message: string;\n featureId?: string | undefined;\n};\n\n/** The outcome of unfolding a part: the {@link FlatPattern}, its {@link BendReport},\n * and any {@link SheetMetalWarning}s raised along the way. */\nexport interface UnfoldResult {\n pattern: FlatPattern;\n report: BendReport;\n warnings: SheetMetalWarning[];\n}\n\n/**\n * One fold-up region in a {@link FlatInput}: a rectangle in the flat pattern that\n * folds about a fold line off its parent region (the base by default, or another\n * region via `parent`). The region-tree is the inverse of the unfold layout, and is\n * recovered purely from the 2D flat-pattern geometry by `patternToFlatInput` — so\n * folding it up just re-runs the forward author geometry. `side`/`offset`/`width`\n * locate the fold line along the parent edge exactly as the authoring `FlangeSpec`\n * does (`side` is expressed in the parent region's local frame).\n */\nexport interface FoldRegion {\n id: string;\n /** Flat extent of the region away from the fold line (becomes the flange length). */\n length: number;\n angleDeg: number;\n direction: 'up' | 'down';\n rule: BendRule;\n /** Which edge of the parent region this region folds off. Default `'xmax'`. */\n side?: FlatSide | undefined;\n /** Id of another fold region this one chains off. Default = base region. */\n parent?: string | undefined;\n /** Start position along the parent edge. Default `0`. */\n offset?: number | undefined;\n /** Extent along the parent edge. Default = full parent-edge length. */\n width?: number | undefined;\n miter?: MiterSpec | undefined;\n /** Bend relief to add at this region's partial-span fold-line ends after folding. */\n bendRelief?: ReliefSpec | undefined;\n /** Cutouts to punch into this region (in region-local coords) after folding. */\n cutouts?: CutoutSpec[] | undefined;\n /** Tabs to fuse onto this region's edges (in region-local coords) after folding. */\n tabs?: TabSpec[] | undefined;\n /** Form features (louvers / embosses) on this region (region-local) after folding. */\n forms?: FormSpec[] | undefined;\n}\n\n/**\n * A flat pattern to fold up into a 3D part: the base region (a rectangle) plus a\n * tree of {@link FoldRegion}s, each folding off its parent about a fold line. This\n * is the inverse of {@link unfold}: a region-tree rather than a 2D outline, which\n * avoids fragile auto-partitioning of an arbitrary developed polygon and maps\n * one-to-one onto the authored feature tree.\n */\nexport interface FlatInput {\n thickness: number;\n /** Base region extent along +X (the run). */\n baseLength: number;\n /** Base region extent along +Y (the developed-strip width). */\n width: number;\n material?: MaterialSpec | undefined;\n regions: FoldRegion[];\n /** Cutouts to punch into the base region (in base-local coords) after folding. */\n baseCutouts?: CutoutSpec[] | undefined;\n /** Tabs to fuse onto the base region's edges (in base-local coords) after folding. */\n baseTabs?: TabSpec[] | undefined;\n /** Form features on the base region (base-local coords) after folding. */\n baseForms?: FormSpec[] | undefined;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { type Result } from '@faicad/faijs/brepjs-compat';
1
+ import { type Result } from '@faicad/faijs/api';
2
2
  import type { SheetMetalPart, UnfoldResult, BendReport, SheetMetalWarning, FlatSide } from './types.js';
3
3
  import { type FeatureTree } from './featureTreeFns.js';
4
4
  type Pt2 = [number, number];
@@ -1 +1 @@
1
- {"version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, line, wire, wireLoop, } from '@faicad/faijs/brepjs-compat';
1
+ import { ok, err, validationError, line, wireLoop, assembleWire } from '@faicad/faijs/api';
2
2
  import { featureTree, ROOT_FLAT_ID } from './featureTreeFns.js';
3
3
  import { developedLength } from './allowanceFns.js';
4
4
  import { sideFromAxisDir } from './internal.js';
@@ -492,7 +492,7 @@ function openPathWire(path) {
492
492
  }
493
493
  edges.push(line([a[0], a[1], 0], [b[0], b[1], 0]));
494
494
  }
495
- return wire(edges);
495
+ return assembleWire(edges);
496
496
  }
497
497
  function rectOf(f) {
498
498
  const c0 = f.origin;
@@ -1 +1 @@
1
- {"version":3,"file":"unfoldFns.js","sourceRoot":"","sources":["../src/unfoldFns.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,EAAE,EACF,GAAG,EACH,eAAe,EACf,IAAI,EACJ,IAAI,EACJ,QAAQ,GACT,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EAAE,WAAW,EAAoB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAIhD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,MAAM,CAAC,IAAoB;IACzC,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,UAAU,CAAC,EAAE;QAAE,OAAO,UAAU,CAAC;IACtC,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC;IAE9B,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACnC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,IAAI,CAAC,EAAE,CAAC;QACpD,OAAO,GAAG,CAAC,eAAe,CAAC,qBAAqB,EAAE,yCAAyC,UAAU,EAAE,CAAC,CAAC,CAAC;IAC5G,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAA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n wire,\n wireLoop,\n} from '@faicad/faijs/brepjs-compat';\nimport type {\n SheetMetalPart,\n UnfoldResult,\n FlatPattern,\n BendReport,\n SheetMetalWarning,\n CornerMiter,\n FlatSide,\n} from './types.js';\nimport { featureTree, type FeatureTree, ROOT_FLAT_ID } from './featureTreeFns.js';\nimport { developedLength } from './allowanceFns.js';\nimport { sideFromAxisDir } from './internal.js';\n\ntype Pt2 = [number, number];\n\n/**\n * Tree-driven analytic unfold of an arbitrary straight-bend part into its flat\n * pattern. Walks the feature tree in BFS order placing every flat in the flat\n * plane: the base occupies `[0,baseLength]×[0,width]`; each child flange lays a\n * developed-bend strip (width = neutral-axis arc length) along the parent edge it\n * folds from — respecting its offset/span along that edge — then its own flat past\n * the strip, perpendicular to the edge and pointing outward. The developed outline\n * is the rectilinear union of the base and every placed flat/strip rectangle,\n * emitted as a single closed morph wire. A recorded corner miter replaces the\n * shared reflex corner of two perpendicular base flanges with a 45° chamfer.\n * Closed profiles produce a SEAM_CUT warning (the cycle-closing bend is left\n * unfolded). Warnings ride inside the Ok payload.\n *\n * @param part - the sheet-metal part to develop into its flat pattern\n * @returns the flat pattern (outline, bend lines, holes, form cuts/markers/hinges,\n * lofted developments, developed area), the bend report, and any warnings — or\n * an error if the part cannot be unfolded\n */\nexport function unfold(part: SheetMetalPart): Result<UnfoldResult> {\n const treeResult = featureTree(part);\n if (!treeResult.ok) return treeResult;\n const tree = treeResult.value;\n\n const baseLength = part.baseLength;\n if (!Number.isFinite(baseLength) || baseLength <= 0) {\n return err(validationError('INVALID_BASE_LENGTH', `part baseLength must be positive, got ${baseLength}`));\n }\n const width = part.width;\n if (!Number.isFinite(width) || width <= 0) {\n return err(validationError('INVALID_WIDTH', `part width must be positive, got ${width}`));\n }\n\n const warnings: SheetMetalWarning[] = [...tree.warnings];\n\n const layoutResult = layoutTree(part, tree, baseLength, width, (warning) => warnings.push(warning));\n if (!layoutResult.ok) return layoutResult;\n const layout = layoutResult.value;\n\n for (const placed of layout.flats) {\n if (placed.kind !== 'flange') continue;\n if (part.thickness > 0 && placed.rule.innerRadius < part.thickness) {\n warnings.push({\n code: 'MIN_RADIUS',\n message: `bend '${placed.id}' inner radius ${placed.rule.innerRadius} < thickness ${part.thickness}`,\n featureId: placed.id,\n });\n }\n }\n\n // Contour-flange developed strips lay out straight along their base edge; compute\n // them first so their rectangles join the outline union below.\n const contourResult = buildContourDevelopments(part);\n if (!contourResult.ok) return contourResult;\n\n // Hems and jogs lay their multi-bend developed strips out straight along their\n // region edge (the base or a flange), exactly like a contour flange.\n const hemJogResult = buildHemJogDevelopments(part, layout);\n if (!hemJogResult.ok) return hemJogResult;\n\n const rects: Rect[] = [];\n for (const placed of layout.flats) rects.push(placed.rect);\n for (const strip of layout.strips) rects.push(strip);\n for (const strip of contourResult.value.strips) rects.push(strip);\n for (const strip of hemJogResult.value.strips) rects.push(strip);\n\n // Tabs are additive protrusions: their developed rectangles join the outer-outline\n // union and add to the developed area.\n const tabRects: Rect[] = (part.tabs ?? []).map((t) => ({ x0: t.rect[0], y0: t.rect[1], x1: t.rect[2], y1: t.rect[3] }));\n for (const r of tabRects) rects.push(r);\n\n const notches: Rect[] = (part.reliefs ?? []).flatMap((relief) =>\n relief.notches.map(([x0, y0, x1, y1]) => ({ x0, y0, x1, y1 }))\n );\n // The L-miter chamfer special-case can't express tabs either; once any tab is\n // recorded, fall through to the rectilinear-union path (which absorbs tab rects).\n // The 3D corner-miter cut still stands; only the developed chamfer is omitted.\n const miters = tabRects.length > 0 ? [] : part.miters ?? [];\n if (tabRects.length > 0 && (part.miters ?? []).length > 0) {\n warnings.push({\n code: 'MITER_NOT_DEVELOPED',\n message: 'developed outline omits the corner-miter chamfer because a tab is present; the 3D miter cut is unaffected',\n });\n }\n const outlineResult = buildOutline(rects, layout, miters, notches);\n if (!outlineResult.ok) return outlineResult;\n layout.developedArea -= removedNotchArea(rects, notches);\n for (const t of part.tabs ?? []) layout.developedArea += t.area;\n\n const holesResult = buildHoles(part);\n if (!holesResult.ok) return holesResult;\n for (const c of part.cutouts ?? []) layout.developedArea -= c.area;\n\n const formsResult = buildForms(part);\n if (!formsResult.ok) return formsResult;\n\n const loftedResult = buildLoftedDevelopments(part);\n if (!loftedResult.ok) return loftedResult;\n for (const lf of part.loftedFlanges ?? []) {\n layout.developedArea += lf.developedArea;\n if (lf.approximate) {\n warnings.push({\n code: 'DEVELOPMENT_APPROXIMATE',\n message: `lofted flange '${lf.id}' transition is not developable; its triangulated flat development is an approximation`,\n featureId: lf.id,\n });\n }\n }\n\n for (const cf of part.contourFlanges ?? []) {\n layout.developedArea += cf.developedLength * cf.span;\n }\n\n for (const h of part.hems ?? []) {\n layout.developedArea += h.developedLength * h.span;\n }\n for (const j of part.jogs ?? []) {\n layout.developedArea += j.developedLength * j.span;\n }\n\n const bendLines = layout.flats\n .filter((p): p is PlacedFlange => p.kind === 'flange')\n .map((p) => ({\n id: p.id,\n line: bendLineEdge(p),\n angleDeg: p.angleDeg,\n direction: p.direction,\n // The child frame's v axis is the develop-out direction; into-parent is its\n // negation. Correct for chained flanges too (it is local to the placement).\n inward: [-p.frame.v[0], -p.frame.v[1]] as [number, number],\n }))\n .concat(contourResult.value.bendLines)\n .concat(hemJogResult.value.bendLines);\n\n const pattern: FlatPattern = {\n outline: outlineResult.value,\n bendLines,\n holes: holesResult.value,\n formCuts: formsResult.value.cuts,\n formMarkers: formsResult.value.markers,\n formHinges: formsResult.value.hinges,\n loftedDevelopments: loftedResult.value,\n developedArea: layout.developedArea,\n };\n\n const report = reportFromLayout(layout);\n\n return ok({ pattern, report, warnings });\n}\n\n/** A placed flat rectangle in the developed (flat-pattern) plane. */\nexport interface Rect {\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n}\n\n/** 2D frame of a placed flat: occupies [0,uLen]×[0,vLen] in (u,v) from `origin`. */\nexport interface Frame2 {\n origin: Pt2;\n u: Pt2;\n v: Pt2;\n uLen: number;\n vLen: number;\n}\n\n/** A placed base flat: the root rectangle `[0,baseLength]×[0,width]`. */\nexport interface PlacedBase {\n kind: 'base';\n id: string;\n rect: Rect;\n frame: Frame2;\n}\n\n/** A placed flange flat: a developed strip laid along a parent edge plus its own flat. */\nexport interface PlacedFlange {\n kind: 'flange';\n id: string;\n rect: Rect;\n frame: Frame2;\n /** Strip rectangle laid along the parent edge (developed bend). */\n strip: Rect;\n /** Bend line endpoints (along the parent edge, over the flange span). */\n bendA: Pt2;\n bendB: Pt2;\n dev: number;\n length: number;\n span: number;\n angleDeg: number;\n direction: 'up' | 'down';\n rule: { innerRadius: number; kFactor: number; allowance?: number | undefined };\n /** True when this flange folds directly off the base and spans its full edge. */\n baseFull: boolean;\n side: FlatSide;\n}\n\n/** A placed flat in the developed plane: either the base or a flange. */\nexport type Placed = PlacedBase | PlacedFlange;\n\n/** The result of {@link layoutTree}: developed dimensions, placed flats, and strips. */\nexport interface TreeLayout {\n baseLength: number;\n width: number;\n developedArea: number;\n flats: Placed[];\n strips: Rect[];\n}\n\n/**\n * Lay out the feature tree's flats in the flat plane, starting from the base and\n * placing each bend's child flange along its parent edge: a developed strip laid\n * outward from the edge, then the child's own flat. Produces the placed flats,\n * their strips, and the total developed area.\n *\n * @param part - the sheet-metal part whose features are laid out\n * @param tree - the feature tree built from the part\n * @param baseLength - length of the base flat (u extent)\n * @param width - width of the base flat (v extent)\n * @param onWarning - optional callback invoked for warnings raised while unfolding\n * @returns the laid-out flats, strips, and developed area, or an error if a\n * referenced flat has no flange feature or is missing from the layout\n */\nexport function layoutTree(\n part: SheetMetalPart,\n tree: FeatureTree,\n baseLength: number,\n width: number,\n onWarning?: (warning: SheetMetalWarning) => void\n): Result<TreeLayout> {\n const frames = new Map<string, Frame2>();\n frames.set(ROOT_FLAT_ID, {\n origin: [0, 0],\n u: [1, 0],\n v: [0, 1],\n uLen: baseLength,\n vLen: width,\n });\n\n const flats: Placed[] = [\n {\n kind: 'base',\n id: ROOT_FLAT_ID,\n frame: frames.get(ROOT_FLAT_ID) as Frame2,\n rect: rectOf(frames.get(ROOT_FLAT_ID) as Frame2),\n },\n ];\n const strips: Rect[] = [];\n let developedArea = baseLength * width;\n\n for (const treeBend of tree.bends) {\n const childNode = tree.nodes.get(treeBend.child);\n if (childNode === undefined || childNode.flange === undefined) {\n return err(\n validationError('UNKNOWN_FLAT', `child flat '${treeBend.child}' has no flange feature`)\n );\n }\n const flange = childNode.flange;\n const parentFrame = frames.get(treeBend.parent);\n if (parentFrame === undefined) {\n return err(\n validationError('UNKNOWN_FLAT', `parent flat '${treeBend.parent}' missing from layout`)\n );\n }\n\n const devResult = developedLength(treeBend.bend.angleDeg, part.thickness, treeBend.bend.rule, onWarning);\n if (!devResult.ok) return devResult;\n const dev = devResult.value;\n\n // Authored parts always record `baseEdge.side`; hand-built fixtures may encode\n // the develop direction only via the bend axis, so fall back to that.\n const side: FlatSide = flange.baseEdge.side ?? sideFromAxisDir(treeBend.bend.axisDir) ?? 'xmax';\n const offset = flange.offset ?? flange.baseEdge.offset ?? 0;\n const span = flange.span;\n const length = flange.length;\n\n const placed = placeChild(flange.id, parentFrame, side, offset, span, dev, length, {\n angleDeg: treeBend.bend.angleDeg,\n direction: treeBend.bend.direction,\n rule: treeBend.bend.rule,\n baseFull: treeBend.parent === ROOT_FLAT_ID && offset <= 1e-6 && span >= edgeLength(parentFrame, side) - 1e-6,\n side,\n });\n frames.set(flange.id, placed.frame);\n flats.push(placed);\n strips.push(placed.strip);\n developedArea += (dev + length) * span;\n }\n\n return ok({ baseLength, width, developedArea, flats, strips });\n}\n\nfunction edgeLength(f: Frame2, side: FlatSide): number {\n return side === 'xmax' || side === 'xmin' ? f.vLen : f.uLen;\n}\n\n/**\n * Place a child flange off `parent`'s edge `side`. The strip (developed bend) is\n * laid from the edge outward by `dev`; the child flat follows for `length`. The\n * child's own 2D frame starts past the strip so grandchildren chain correctly.\n */\nfunction placeChild(\n id: string,\n parent: Frame2,\n side: FlatSide,\n offset: number,\n span: number,\n dev: number,\n length: number,\n meta: {\n angleDeg: number;\n direction: 'up' | 'down';\n rule: { innerRadius: number; kFactor: number; allowance?: number | undefined };\n baseFull: boolean;\n side: FlatSide;\n }\n): PlacedFlange {\n // Edge basis in 2D: `along` runs the edge (bend axis), `out` points outward.\n const { along, out, edgeOrigin } = edgeBasis2(parent, side);\n\n const base = add2(edgeOrigin, scale2(along, offset));\n const bendA = base;\n const bendB = add2(base, scale2(along, span));\n\n const stripFar = add2(base, scale2(out, dev));\n\n const strip = rectFromCorners(base, add2(bendB, scale2(out, dev)));\n const flatRect = rectFromCorners(stripFar, add2(add2(stripFar, scale2(along, span)), scale2(out, length)));\n\n const childFrame: Frame2 = {\n origin: stripFar,\n u: along,\n v: out,\n uLen: span,\n vLen: length,\n };\n\n return {\n kind: 'flange',\n id,\n frame: childFrame,\n rect: flatRect,\n strip,\n bendA,\n bendB,\n dev,\n length,\n span,\n angleDeg: meta.angleDeg,\n direction: meta.direction,\n rule: meta.rule,\n baseFull: meta.baseFull,\n side: meta.side,\n };\n}\n\n/**\n * Edge origin and along/out unit directions for one side of a 2D frame. `along`\n * runs along the edge (the bend axis), `out` points outward from the frame, and\n * `edgeOrigin` is the starting corner of that edge.\n *\n * @param f - the 2D frame whose edge basis is computed\n * @param side - which side of the frame ('xmax' | 'xmin' | 'ymax' | 'ymin')\n * @returns the along/out unit directions and the edge's origin corner\n */\nexport function edgeBasis2(f: Frame2, side: FlatSide): { along: Pt2; out: Pt2; edgeOrigin: Pt2 } {\n const uTop = add2(f.origin, scale2(f.u, f.uLen));\n const vTop = add2(f.origin, scale2(f.v, f.vLen));\n switch (side) {\n case 'xmax':\n return { along: f.v, out: f.u, edgeOrigin: uTop };\n case 'xmin':\n return { along: f.v, out: neg2(f.u), edgeOrigin: f.origin };\n case 'ymax':\n return { along: f.u, out: f.v, edgeOrigin: vTop };\n case 'ymin':\n return { along: f.u, out: neg2(f.v), edgeOrigin: f.origin };\n default:\n return side satisfies never;\n }\n}\n\nfunction bendLineEdge(p: PlacedFlange): Edge {\n return line([p.bendA[0], p.bendA[1], 0], [p.bendB[0], p.bendB[1], 0]);\n}\n\n/**\n * One closed developed-plane {@link Wire} per recorded cutout, traced from the\n * feature's already-mapped `loop` (which {@link addCutout} positioned via the\n * region's developed frame, so the loop sits at the cutout's matching flat-pattern\n * spot). Emitted as interior holes of the pattern; the outer outline is unchanged.\n */\nfunction buildHoles(part: SheetMetalPart): Result<Wire[]> {\n const wires: Wire[] = [];\n for (const c of part.cutouts ?? []) {\n const loop = c.loop;\n if (loop.length < 3) {\n return err(validationError('CUTOUT_LOOP_TOO_SMALL', `cutout loop has ${loop.length} points, need ≥ 3`));\n }\n const edges: Edge[] = [];\n for (let i = 0; i < loop.length; i += 1) {\n const a = loop[i];\n const b = loop[(i + 1) % loop.length];\n if (a === undefined || b === undefined) {\n return err(validationError('CUTOUT_LOOP_FAILED', 'failed to index cutout loop'));\n }\n edges.push(line([a[0], a[1], 0], [b[0], b[1], 0]));\n }\n const wire = wireLoop(edges);\n if (!wire.ok) return wire;\n wires.push(wire.value);\n }\n return ok(wires);\n}\n\ninterface FormWires {\n cuts: Wire[];\n markers: Wire[];\n hinges: Edge[];\n}\n\n/**\n * Developed-plane wires for recorded form features: each louver U-cut and emboss\n * footprint as a closed {@link Wire}, plus each louver hinge as an {@link Edge}. The\n * loops were already mapped into developed coordinates when the form was recorded\n * (via the region's developed frame), so this just traces them. Forms are net-\n * material-neutral, so the outer outline and developed area are untouched.\n */\nfunction buildForms(part: SheetMetalPart): Result<FormWires> {\n const cuts: Wire[] = [];\n const markers: Wire[] = [];\n const hinges: Edge[] = [];\n for (const form of part.forms ?? []) {\n for (const path of form.cuts) {\n const cutWire = openPathWire(path);\n if (!cutWire.ok) return cutWire;\n cuts.push(cutWire.value);\n }\n for (const loop of form.markers) {\n const markerWire = closedLoopWire(loop);\n if (!markerWire.ok) return markerWire;\n markers.push(markerWire.value);\n }\n if (form.hinge !== undefined) {\n const [a, b] = form.hinge;\n hinges.push(line([a[0], a[1], 0], [b[0], b[1], 0]));\n }\n }\n return ok({ cuts, markers, hinges });\n}\n\n/**\n * Closed developed-plane {@link Wire}s for recorded lofted/ruled transition flanges.\n * Each feature's triangulated `developedLoop` was already laid out flat when the\n * flange was authored, so this just traces it into a wire; the boundary is non-\n * rectilinear so it rides separately from the rectilinear-union outline.\n */\nfunction buildLoftedDevelopments(part: SheetMetalPart): Result<Wire[]> {\n const wires: Wire[] = [];\n for (const lf of part.loftedFlanges ?? []) {\n const w = closedLoopWire(lf.developedLoop);\n if (!w.ok) return w;\n wires.push(w.value);\n }\n return ok(wires);\n}\n\ninterface ContourDevelopments {\n /** Developed strip rectangles (one per contour flange) for the outline union. */\n strips: Rect[];\n /** Developed bend lines (one per arc segment) in the flat pattern. */\n bendLines: FlatPattern['bendLines'];\n}\n\n/**\n * Lay each recorded contour flange's developed strip out STRAIGHT along its base\n * edge: a rectangle `span` wide along the edge by `developedLength` out from it,\n * returned for the outer-outline union. One bend line per arc segment is placed at\n * that segment's cumulative developed offset out from the base edge — the EXACT\n * arc-length sum, so the strip length equals Σ segment developed lengths with no\n * error.\n */\nfunction buildContourDevelopments(part: SheetMetalPart): Result<ContourDevelopments> {\n const strips: Rect[] = [];\n const bendLines: FlatPattern['bendLines'] = [];\n const baseFrame: Frame2 = {\n origin: [0, 0],\n u: [1, 0],\n v: [0, 1],\n uLen: part.baseLength,\n vLen: part.width,\n };\n\n for (const cf of part.contourFlanges ?? []) {\n const { along, out, edgeOrigin } = edgeBasis2(baseFrame, cf.side);\n const base = add2(edgeOrigin, scale2(along, cf.offset));\n strips.push(\n rectFromCorners(base, add2(add2(base, scale2(along, cf.span)), scale2(out, cf.developedLength)))\n );\n\n let cumulative = 0;\n for (const seg of cf.segments) {\n if (seg.kind === 'arc') {\n const a = add2(base, scale2(out, cumulative));\n const b = add2(a, scale2(along, cf.span));\n bendLines.push({\n id: seg.bendId ?? cf.id,\n line: line([a[0], a[1], 0], [b[0], b[1], 0]),\n angleDeg: seg.angleDeg ?? 0,\n direction: seg.direction ?? 'up',\n inward: [-out[0], -out[1]] as [number, number],\n });\n }\n cumulative += seg.dev;\n }\n }\n return ok({ strips, bendLines });\n}\n\ninterface HemJogDevelopments {\n /** Developed strip rectangles (one per hem/jog) for the outline union. */\n strips: Rect[];\n /** Developed bend lines (one per curl/step sub-bend) in the flat pattern. */\n bendLines: FlatPattern['bendLines'];\n}\n\n/**\n * Lay each recorded hem and jog developed strip out STRAIGHT along its region edge\n * (the base or a flange), mirroring {@link buildContourDevelopments}. The region's\n * developed-plane {@link Frame2} comes from the tree layout (so a hem on a flange\n * lands on that flange's developed face). Each sub-bend (a hem curl arc or a jog\n * step arc) gets a bend line at its EXACT cumulative developed offset out from the\n * edge — Σ segment developed lengths, so the strip length is exact.\n */\nfunction buildHemJogDevelopments(part: SheetMetalPart, layout: TreeLayout): Result<HemJogDevelopments> {\n const strips: Rect[] = [];\n const bendLines: FlatPattern['bendLines'] = [];\n\n const frameFor = (region: string): Frame2 | undefined => {\n const id = region === 'base' || region === 'face-0' ? ROOT_FLAT_ID : region;\n for (const p of layout.flats) {\n if (p.id === id) return p.frame;\n }\n return undefined;\n };\n\n interface Strip {\n region: string;\n side: FlatSide;\n offset: number;\n span: number;\n developedLength: number;\n segments: {\n kind: 'line' | 'arc';\n dev: number;\n angleDeg?: number | undefined;\n direction?: 'up' | 'down' | undefined;\n bendId?: string | undefined;\n }[];\n }\n const allStrips: Strip[] = [\n ...(part.hems ?? []).map((h) => ({\n region: h.region,\n side: h.side,\n offset: h.offset,\n span: h.span,\n developedLength: h.developedLength,\n segments: h.segments,\n })),\n ...(part.jogs ?? []).map((j) => ({\n region: j.region,\n side: j.side,\n offset: j.offset,\n span: j.span,\n developedLength: j.developedLength,\n segments: j.segments,\n })),\n ];\n\n for (const s of allStrips) {\n const regionFrame = frameFor(s.region);\n if (regionFrame === undefined) {\n return err(validationError('UNKNOWN_HEMJOG_REGION', `hem/jog region '${s.region}' missing from layout`));\n }\n const { along, out, edgeOrigin } = edgeBasis2(regionFrame, s.side);\n const base = add2(edgeOrigin, scale2(along, s.offset));\n strips.push(rectFromCorners(base, add2(add2(base, scale2(along, s.span)), scale2(out, s.developedLength))));\n\n let cumulative = 0;\n for (const seg of s.segments) {\n if (seg.kind === 'arc') {\n const a = add2(base, scale2(out, cumulative));\n const b = add2(a, scale2(along, s.span));\n bendLines.push({\n id: seg.bendId ?? s.region,\n line: line([a[0], a[1], 0], [b[0], b[1], 0]),\n angleDeg: seg.angleDeg ?? 0,\n direction: seg.direction ?? 'up',\n inward: [-out[0], -out[1]] as [number, number],\n });\n }\n cumulative += seg.dev;\n }\n }\n return ok({ strips, bendLines });\n}\n\n/** Trace a closed developed-plane loop (≥ 3 points) into a morph {@link Wire}. */\nfunction closedLoopWire(loop: Pt2[]): Result<Wire> {\n if (loop.length < 3) {\n return err(validationError('FORM_LOOP_TOO_SMALL', `form loop has ${loop.length} points, need ≥ 3`));\n }\n const edges: Edge[] = [];\n for (let i = 0; i < loop.length; i += 1) {\n const a = loop[i];\n const b = loop[(i + 1) % loop.length];\n if (a === undefined || b === undefined) {\n return err(validationError('FORM_LOOP_FAILED', 'failed to index form loop'));\n }\n edges.push(line([a[0], a[1], 0], [b[0], b[1], 0]));\n }\n return wireLoop(edges);\n}\n\n/** Trace an OPEN developed-plane path (≥ 2 points) into a morph {@link Wire}. */\nfunction openPathWire(path: Pt2[]): Result<Wire> {\n if (path.length < 2) {\n return err(validationError('FORM_PATH_TOO_SHORT', `form cut path has ${path.length} points, need ≥ 2`));\n }\n const edges: Edge[] = [];\n for (let i = 0; i + 1 < path.length; i += 1) {\n const a = path[i];\n const b = path[i + 1];\n if (a === undefined || b === undefined) {\n return err(validationError('FORM_LOOP_FAILED', 'failed to index form cut path'));\n }\n edges.push(line([a[0], a[1], 0], [b[0], b[1], 0]));\n }\n return wire(edges);\n}\n\nfunction rectOf(f: Frame2): Rect {\n const c0 = f.origin;\n const c1 = add2(add2(f.origin, scale2(f.u, f.uLen)), scale2(f.v, f.vLen));\n return rectFromCorners(c0, c1);\n}\n\nfunction rectFromCorners(a: Pt2, b: Pt2): Rect {\n return {\n x0: Math.min(a[0], b[0]),\n y0: Math.min(a[1], b[1]),\n x1: Math.max(a[0], b[0]),\n y1: Math.max(a[1], b[1]),\n };\n}\n\nfunction add2(a: Pt2, b: Pt2): Pt2 {\n return [a[0] + b[0], a[1] + b[1]];\n}\nfunction scale2(a: Pt2, s: number): Pt2 {\n return [a[0] * s, a[1] * s];\n}\nfunction neg2(a: Pt2): Pt2 {\n return [-a[0], -a[1]];\n}\n\n/**\n * Outline of the developed pattern. For the simple two-perpendicular-flange L\n * (base + an east + a north flange) a recorded corner miter chamfers the reflex\n * vertex; otherwise the outline is the rectilinear union of all placed rectangles\n * emitted as one closed loop. Holes are not possible for the supported shapes\n * (every arm attaches to the simply-connected base or a chain thereof).\n */\nfunction buildOutline(\n rects: Rect[],\n layout: TreeLayout,\n miters: CornerMiter[],\n notches: Rect[]\n): Result<Wire> {\n // The lShapedMiter chamfer special-case can't express a notch, so once any relief\n // is recorded fall through to the rectilinear-union path (which subtracts notches).\n const miterCorners = notches.length > 0 ? undefined : lShapedMiter(layout, miters);\n const corners = miterCorners ?? rectilinearUnion(rects, notches);\n if (corners.length < 3) {\n return err(validationError('OUTLINE_BUILD_FAILED', 'developed outline has fewer than 3 vertices'));\n }\n const edges: Edge[] = [];\n for (let i = 0; i < corners.length; i += 1) {\n const from = corners[i];\n const to = corners[(i + 1) % corners.length];\n if (from === undefined || to === undefined) {\n return err(validationError('OUTLINE_BUILD_FAILED', 'failed to index outline corners'));\n }\n edges.push(line([from[0], from[1], 0], [to[0], to[1], 0]));\n }\n return wireLoop(edges);\n}\n\n/**\n * Special-case the classic L: a base with exactly one east (+X) and one north\n * (+Y) full-span flange and a recorded miter between them. Returns the chamfered\n * hexagon; `undefined` if this isn't that shape (fall back to the union outline).\n */\nfunction lShapedMiter(layout: TreeLayout, miters: CornerMiter[]): Pt2[] | undefined {\n const flanges = layout.flats.filter((p): p is PlacedFlange => p.kind === 'flange');\n if (flanges.length !== 2) return undefined;\n const east = flanges.find((f) => f.baseFull && f.side === 'xmax');\n const north = flanges.find((f) => f.baseFull && f.side === 'ymax');\n if (east === undefined || north === undefined) return undefined;\n\n const baseLength = layout.baseLength;\n const width = layout.width;\n const maxX = baseLength + east.dev + east.length;\n const maxY = width + north.dev + north.length;\n const gap = miterGapFor(miters, east.id, north.id);\n\n if (gap === undefined || gap <= 0) {\n return [\n [0, 0],\n [maxX, 0],\n [maxX, width],\n [baseLength, width],\n [baseLength, maxY],\n [0, maxY],\n ];\n }\n return [\n [0, 0],\n [maxX, 0],\n [maxX, width],\n [baseLength + gap, width],\n [baseLength, width + gap],\n [baseLength, maxY],\n [0, maxY],\n ];\n}\n\nfunction miterGapFor(miters: CornerMiter[], aId: string, bId: string): number | undefined {\n for (const m of miters) {\n if ((m.flangeA === aId && m.flangeB === bId) || (m.flangeA === bId && m.flangeB === aId)) {\n return m.gap;\n }\n }\n return undefined;\n}\n\n/**\n * Outline loop of the union of axis-aligned rectangles, assuming the union is a\n * single simply-connected rectilinear region (true for every shape this package\n * authors: arms attached to a connected base). Built by a vertical-line sweep\n * tracking the covered y-spans, then tracing the boundary contour. The sweep emits\n * a CCW loop of corner points with no collinear duplicates.\n */\nfunction rectilinearUnion(rects: Rect[], notches: Rect[] = []): Pt2[] {\n const cuts = [...rects.flatMap((r) => [r.x0, r.x1]), ...notches.flatMap((r) => [r.x0, r.x1])];\n const cutsY = [...rects.flatMap((r) => [r.y0, r.y1]), ...notches.flatMap((r) => [r.y0, r.y1])];\n const xs = uniqueSorted(cuts);\n const ys = uniqueSorted(cutsY);\n if (xs.length < 2 || ys.length < 2) return [];\n\n // Cell-occupancy grid: a cell is filled if its centre lies in the rectangle union\n // and in no notch (notches subtract material; they sit on the boundary so the\n // result stays simply-connected).\n const nx = xs.length - 1;\n const ny = ys.length - 1;\n const filled = new Set<number>();\n for (let i = 0; i < nx; i += 1) {\n const cx = ((xs[i] as number) + (xs[i + 1] as number)) / 2;\n for (let j = 0; j < ny; j += 1) {\n const cy = ((ys[j] as number) + (ys[j + 1] as number)) / 2;\n const inRect = rects.some((r) => cx > r.x0 && cx < r.x1 && cy > r.y0 && cy < r.y1);\n const inNotch = notches.some((r) => cx > r.x0 && cx < r.x1 && cy > r.y0 && cy < r.y1);\n if (inRect && !inNotch) filled.add(i * ny + j);\n }\n }\n\n // Collect boundary unit-edges (segments between adjacent grid nodes that border\n // a filled and an unfilled cell), oriented CCW (filled cell on the left).\n const segs: { a: Pt2; b: Pt2 }[] = [];\n const isFilled = (i: number, j: number): boolean =>\n i >= 0 && i < nx && j >= 0 && j < ny && filled.has(i * ny + j);\n\n for (let i = 0; i < nx; i += 1) {\n for (let j = 0; j < ny; j += 1) {\n if (!isFilled(i, j)) continue;\n const x0 = xs[i] as number;\n const x1 = xs[i + 1] as number;\n const y0 = ys[j] as number;\n const y1 = ys[j + 1] as number;\n // Bottom edge: boundary if cell below is empty. CCW → left-to-right.\n if (!isFilled(i, j - 1)) segs.push({ a: [x0, y0], b: [x1, y0] });\n // Top edge: boundary if cell above empty. CCW → right-to-left.\n if (!isFilled(i, j + 1)) segs.push({ a: [x1, y1], b: [x0, y1] });\n // Left edge: boundary if cell left empty. CCW → top-to-bottom.\n if (!isFilled(i - 1, j)) segs.push({ a: [x0, y1], b: [x0, y0] });\n // Right edge: boundary if cell right empty. CCW → bottom-to-top.\n if (!isFilled(i + 1, j)) segs.push({ a: [x1, y0], b: [x1, y1] });\n }\n }\n\n return traceLoop(segs);\n}\n\n/**\n * Area of material removed by the relief notches: the portion of each notch that\n * overlaps the rectangle union, summed over a shared cell grid so overlapping\n * notches (e.g. two corner reliefs meeting) are not double-counted.\n */\nfunction removedNotchArea(rects: Rect[], notches: Rect[]): number {\n if (notches.length === 0) return 0;\n const xs = uniqueSorted([\n ...rects.flatMap((r) => [r.x0, r.x1]),\n ...notches.flatMap((r) => [r.x0, r.x1]),\n ]);\n const ys = uniqueSorted([\n ...rects.flatMap((r) => [r.y0, r.y1]),\n ...notches.flatMap((r) => [r.y0, r.y1]),\n ]);\n let area = 0;\n for (let i = 0; i + 1 < xs.length; i += 1) {\n const x0 = xs[i] as number;\n const x1 = xs[i + 1] as number;\n const cx = (x0 + x1) / 2;\n for (let j = 0; j + 1 < ys.length; j += 1) {\n const y0 = ys[j] as number;\n const y1 = ys[j + 1] as number;\n const cy = (y0 + y1) / 2;\n const inRect = rects.some((r) => cx > r.x0 && cx < r.x1 && cy > r.y0 && cy < r.y1);\n const inNotch = notches.some((r) => cx > r.x0 && cx < r.x1 && cy > r.y0 && cy < r.y1);\n if (inRect && inNotch) area += (x1 - x0) * (y1 - y0);\n }\n }\n return area;\n}\n\n/** Chain oriented boundary segments into a single loop, dropping collinear points. */\nfunction traceLoop(segs: { a: Pt2; b: Pt2 }[]): Pt2[] {\n if (segs.length === 0) return [];\n const key = (p: Pt2): string => `${p[0]}|${p[1]}`;\n const from = new Map<string, Pt2>();\n for (const s of segs) from.set(key(s.a), s.b);\n\n const startSeg = segs[0] as { a: Pt2; b: Pt2 };\n const start = startSeg.a;\n const raw: Pt2[] = [start];\n let cur = startSeg.b;\n let guard = 0;\n const limit = segs.length + 4;\n while (key(cur) !== key(start) && guard < limit) {\n raw.push(cur);\n const next = from.get(key(cur));\n if (next === undefined) break;\n cur = next;\n guard += 1;\n }\n\n // Drop collinear interior points so consecutive edges aren't degenerate.\n const out: Pt2[] = [];\n for (let i = 0; i < raw.length; i += 1) {\n const prev = raw[(i - 1 + raw.length) % raw.length] as Pt2;\n const here = raw[i] as Pt2;\n const next = raw[(i + 1) % raw.length] as Pt2;\n const d1x = here[0] - prev[0];\n const d1y = here[1] - prev[1];\n const d2x = next[0] - here[0];\n const d2y = next[1] - here[1];\n if (Math.abs(d1x * d2y - d1y * d2x) > 1e-9) out.push(here);\n }\n return out;\n}\n\nfunction uniqueSorted(values: number[]): number[] {\n const sorted = [...values].sort((a, b) => a - b);\n const out: number[] = [];\n for (const v of sorted) {\n const last = out[out.length - 1];\n if (last === undefined || Math.abs(v - last) > 1e-9) out.push(v);\n }\n return out;\n}\n\n/**\n * Build the bend report for a laid-out tree: one entry per placed flange with its\n * angle, radius, allowance, flat length, and direction, plus the overall\n * bounding-box span of the developed pattern.\n *\n * @param layout - the tree layout produced by {@link layoutTree}\n * @returns the bend entries and the total flat pattern size\n */\nexport function reportFromLayout(layout: TreeLayout): BendReport {\n const flanges = layout.flats.filter((p): p is PlacedFlange => p.kind === 'flange');\n const bends = flanges.map((f) => ({\n id: f.id,\n angleDeg: f.angleDeg,\n radius: f.rule.innerRadius,\n allowance: f.dev,\n flatLength: f.length,\n direction: f.direction,\n }));\n\n // totalFlatSize is the overall bounding-box span of the developed pattern, which\n // for parts whose flanges extend into negative coordinates (xmin/ymin sides) is\n // the max−min extent, not just the max.\n let minX = 0;\n let minY = 0;\n let maxX = layout.baseLength;\n let maxY = layout.width;\n for (const r of layout.flats.map((p) => p.rect).concat(layout.strips)) {\n if (r.x0 < minX) minX = r.x0;\n if (r.y0 < minY) minY = r.y0;\n if (r.x1 > maxX) maxX = r.x1;\n if (r.y1 > maxY) maxY = r.y1;\n }\n return { bends, totalFlatSize: [maxX - minX, maxY - minY] };\n}\n"]}
1
+ {"version":3,"file":"unfoldFns.js","sourceRoot":"","sources":["../src/unfoldFns.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,EAAE,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAUtG,OAAO,EAAE,WAAW,EAAoB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAIhD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,MAAM,CAAC,IAAoB;IACzC,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC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AC;QAC7B,IAAI,CAAC,CAAC,EAAE,GAAG,IAAI;YAAE,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC;QAC7B,IAAI,CAAC,CAAC,EAAE,GAAG,IAAI;YAAE,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC;IAC/B,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;AAC9D,CAAC","sourcesContent":["import type { Wire, Edge } from './types.js';\nimport {type Result, ok, err, validationError, line, wireLoop, assembleWire} from '@faicad/faijs/api';\nimport type {\n SheetMetalPart,\n UnfoldResult,\n FlatPattern,\n BendReport,\n SheetMetalWarning,\n CornerMiter,\n FlatSide,\n} from './types.js';\nimport { featureTree, type FeatureTree, ROOT_FLAT_ID } from './featureTreeFns.js';\nimport { developedLength } from './allowanceFns.js';\nimport { sideFromAxisDir } from './internal.js';\n\ntype Pt2 = [number, number];\n\n/**\n * Tree-driven analytic unfold of an arbitrary straight-bend part into its flat\n * pattern. Walks the feature tree in BFS order placing every flat in the flat\n * plane: the base occupies `[0,baseLength]×[0,width]`; each child flange lays a\n * developed-bend strip (width = neutral-axis arc length) along the parent edge it\n * folds from — respecting its offset/span along that edge — then its own flat past\n * the strip, perpendicular to the edge and pointing outward. The developed outline\n * is the rectilinear union of the base and every placed flat/strip rectangle,\n * emitted as a single closed morph wire. A recorded corner miter replaces the\n * shared reflex corner of two perpendicular base flanges with a 45° chamfer.\n * Closed profiles produce a SEAM_CUT warning (the cycle-closing bend is left\n * unfolded). Warnings ride inside the Ok payload.\n *\n * @param part - the sheet-metal part to develop into its flat pattern\n * @returns the flat pattern (outline, bend lines, holes, form cuts/markers/hinges,\n * lofted developments, developed area), the bend report, and any warnings — or\n * an error if the part cannot be unfolded\n */\nexport function unfold(part: SheetMetalPart): Result<UnfoldResult> {\n const treeResult = featureTree(part);\n if (!treeResult.ok) return treeResult;\n const tree = treeResult.value;\n\n const baseLength = part.baseLength;\n if (!Number.isFinite(baseLength) || baseLength <= 0) {\n return err(validationError('INVALID_BASE_LENGTH', `part baseLength must be positive, got ${baseLength}`));\n }\n const width = part.width;\n if (!Number.isFinite(width) || width <= 0) {\n return err(validationError('INVALID_WIDTH', `part width must be positive, got ${width}`));\n }\n\n const warnings: SheetMetalWarning[] = [...tree.warnings];\n\n const layoutResult = layoutTree(part, tree, baseLength, width, (warning) => warnings.push(warning));\n if (!layoutResult.ok) return layoutResult;\n const layout = layoutResult.value;\n\n for (const placed of layout.flats) {\n if (placed.kind !== 'flange') continue;\n if (part.thickness > 0 && placed.rule.innerRadius < part.thickness) {\n warnings.push({\n code: 'MIN_RADIUS',\n message: `bend '${placed.id}' inner radius ${placed.rule.innerRadius} < thickness ${part.thickness}`,\n featureId: placed.id,\n });\n }\n }\n\n // Contour-flange developed strips lay out straight along their base edge; compute\n // them first so their rectangles join the outline union below.\n const contourResult = buildContourDevelopments(part);\n if (!contourResult.ok) return contourResult;\n\n // Hems and jogs lay their multi-bend developed strips out straight along their\n // region edge (the base or a flange), exactly like a contour flange.\n const hemJogResult = buildHemJogDevelopments(part, layout);\n if (!hemJogResult.ok) return hemJogResult;\n\n const rects: Rect[] = [];\n for (const placed of layout.flats) rects.push(placed.rect);\n for (const strip of layout.strips) rects.push(strip);\n for (const strip of contourResult.value.strips) rects.push(strip);\n for (const strip of hemJogResult.value.strips) rects.push(strip);\n\n // Tabs are additive protrusions: their developed rectangles join the outer-outline\n // union and add to the developed area.\n const tabRects: Rect[] = (part.tabs ?? []).map((t) => ({ x0: t.rect[0], y0: t.rect[1], x1: t.rect[2], y1: t.rect[3] }));\n for (const r of tabRects) rects.push(r);\n\n const notches: Rect[] = (part.reliefs ?? []).flatMap((relief) =>\n relief.notches.map(([x0, y0, x1, y1]) => ({ x0, y0, x1, y1 }))\n );\n // The L-miter chamfer special-case can't express tabs either; once any tab is\n // recorded, fall through to the rectilinear-union path (which absorbs tab rects).\n // The 3D corner-miter cut still stands; only the developed chamfer is omitted.\n const miters = tabRects.length > 0 ? [] : part.miters ?? [];\n if (tabRects.length > 0 && (part.miters ?? []).length > 0) {\n warnings.push({\n code: 'MITER_NOT_DEVELOPED',\n message: 'developed outline omits the corner-miter chamfer because a tab is present; the 3D miter cut is unaffected',\n });\n }\n const outlineResult = buildOutline(rects, layout, miters, notches);\n if (!outlineResult.ok) return outlineResult;\n layout.developedArea -= removedNotchArea(rects, notches);\n for (const t of part.tabs ?? []) layout.developedArea += t.area;\n\n const holesResult = buildHoles(part);\n if (!holesResult.ok) return holesResult;\n for (const c of part.cutouts ?? []) layout.developedArea -= c.area;\n\n const formsResult = buildForms(part);\n if (!formsResult.ok) return formsResult;\n\n const loftedResult = buildLoftedDevelopments(part);\n if (!loftedResult.ok) return loftedResult;\n for (const lf of part.loftedFlanges ?? []) {\n layout.developedArea += lf.developedArea;\n if (lf.approximate) {\n warnings.push({\n code: 'DEVELOPMENT_APPROXIMATE',\n message: `lofted flange '${lf.id}' transition is not developable; its triangulated flat development is an approximation`,\n featureId: lf.id,\n });\n }\n }\n\n for (const cf of part.contourFlanges ?? []) {\n layout.developedArea += cf.developedLength * cf.span;\n }\n\n for (const h of part.hems ?? []) {\n layout.developedArea += h.developedLength * h.span;\n }\n for (const j of part.jogs ?? []) {\n layout.developedArea += j.developedLength * j.span;\n }\n\n const bendLines = layout.flats\n .filter((p): p is PlacedFlange => p.kind === 'flange')\n .map((p) => ({\n id: p.id,\n line: bendLineEdge(p),\n angleDeg: p.angleDeg,\n direction: p.direction,\n // The child frame's v axis is the develop-out direction; into-parent is its\n // negation. Correct for chained flanges too (it is local to the placement).\n inward: [-p.frame.v[0], -p.frame.v[1]] as [number, number],\n }))\n .concat(contourResult.value.bendLines)\n .concat(hemJogResult.value.bendLines);\n\n const pattern: FlatPattern = {\n outline: outlineResult.value,\n bendLines,\n holes: holesResult.value,\n formCuts: formsResult.value.cuts,\n formMarkers: formsResult.value.markers,\n formHinges: formsResult.value.hinges,\n loftedDevelopments: loftedResult.value,\n developedArea: layout.developedArea,\n };\n\n const report = reportFromLayout(layout);\n\n return ok({ pattern, report, warnings });\n}\n\n/** A placed flat rectangle in the developed (flat-pattern) plane. */\nexport interface Rect {\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n}\n\n/** 2D frame of a placed flat: occupies [0,uLen]×[0,vLen] in (u,v) from `origin`. */\nexport interface Frame2 {\n origin: Pt2;\n u: Pt2;\n v: Pt2;\n uLen: number;\n vLen: number;\n}\n\n/** A placed base flat: the root rectangle `[0,baseLength]×[0,width]`. */\nexport interface PlacedBase {\n kind: 'base';\n id: string;\n rect: Rect;\n frame: Frame2;\n}\n\n/** A placed flange flat: a developed strip laid along a parent edge plus its own flat. */\nexport interface PlacedFlange {\n kind: 'flange';\n id: string;\n rect: Rect;\n frame: Frame2;\n /** Strip rectangle laid along the parent edge (developed bend). */\n strip: Rect;\n /** Bend line endpoints (along the parent edge, over the flange span). */\n bendA: Pt2;\n bendB: Pt2;\n dev: number;\n length: number;\n span: number;\n angleDeg: number;\n direction: 'up' | 'down';\n rule: { innerRadius: number; kFactor: number; allowance?: number | undefined };\n /** True when this flange folds directly off the base and spans its full edge. */\n baseFull: boolean;\n side: FlatSide;\n}\n\n/** A placed flat in the developed plane: either the base or a flange. */\nexport type Placed = PlacedBase | PlacedFlange;\n\n/** The result of {@link layoutTree}: developed dimensions, placed flats, and strips. */\nexport interface TreeLayout {\n baseLength: number;\n width: number;\n developedArea: number;\n flats: Placed[];\n strips: Rect[];\n}\n\n/**\n * Lay out the feature tree's flats in the flat plane, starting from the base and\n * placing each bend's child flange along its parent edge: a developed strip laid\n * outward from the edge, then the child's own flat. Produces the placed flats,\n * their strips, and the total developed area.\n *\n * @param part - the sheet-metal part whose features are laid out\n * @param tree - the feature tree built from the part\n * @param baseLength - length of the base flat (u extent)\n * @param width - width of the base flat (v extent)\n * @param onWarning - optional callback invoked for warnings raised while unfolding\n * @returns the laid-out flats, strips, and developed area, or an error if a\n * referenced flat has no flange feature or is missing from the layout\n */\nexport function layoutTree(\n part: SheetMetalPart,\n tree: FeatureTree,\n baseLength: number,\n width: number,\n onWarning?: (warning: SheetMetalWarning) => void\n): Result<TreeLayout> {\n const frames = new Map<string, Frame2>();\n frames.set(ROOT_FLAT_ID, {\n origin: [0, 0],\n u: [1, 0],\n v: [0, 1],\n uLen: baseLength,\n vLen: width,\n });\n\n const flats: Placed[] = [\n {\n kind: 'base',\n id: ROOT_FLAT_ID,\n frame: frames.get(ROOT_FLAT_ID) as Frame2,\n rect: rectOf(frames.get(ROOT_FLAT_ID) as Frame2),\n },\n ];\n const strips: Rect[] = [];\n let developedArea = baseLength * width;\n\n for (const treeBend of tree.bends) {\n const childNode = tree.nodes.get(treeBend.child);\n if (childNode === undefined || childNode.flange === undefined) {\n return err(\n validationError('UNKNOWN_FLAT', `child flat '${treeBend.child}' has no flange feature`)\n );\n }\n const flange = childNode.flange;\n const parentFrame = frames.get(treeBend.parent);\n if (parentFrame === undefined) {\n return err(\n validationError('UNKNOWN_FLAT', `parent flat '${treeBend.parent}' missing from layout`)\n );\n }\n\n const devResult = developedLength(treeBend.bend.angleDeg, part.thickness, treeBend.bend.rule, onWarning);\n if (!devResult.ok) return devResult;\n const dev = devResult.value;\n\n // Authored parts always record `baseEdge.side`; hand-built fixtures may encode\n // the develop direction only via the bend axis, so fall back to that.\n const side: FlatSide = flange.baseEdge.side ?? sideFromAxisDir(treeBend.bend.axisDir) ?? 'xmax';\n const offset = flange.offset ?? flange.baseEdge.offset ?? 0;\n const span = flange.span;\n const length = flange.length;\n\n const placed = placeChild(flange.id, parentFrame, side, offset, span, dev, length, {\n angleDeg: treeBend.bend.angleDeg,\n direction: treeBend.bend.direction,\n rule: treeBend.bend.rule,\n baseFull: treeBend.parent === ROOT_FLAT_ID && offset <= 1e-6 && span >= edgeLength(parentFrame, side) - 1e-6,\n side,\n });\n frames.set(flange.id, placed.frame);\n flats.push(placed);\n strips.push(placed.strip);\n developedArea += (dev + length) * span;\n }\n\n return ok({ baseLength, width, developedArea, flats, strips });\n}\n\nfunction edgeLength(f: Frame2, side: FlatSide): number {\n return side === 'xmax' || side === 'xmin' ? f.vLen : f.uLen;\n}\n\n/**\n * Place a child flange off `parent`'s edge `side`. The strip (developed bend) is\n * laid from the edge outward by `dev`; the child flat follows for `length`. The\n * child's own 2D frame starts past the strip so grandchildren chain correctly.\n */\nfunction placeChild(\n id: string,\n parent: Frame2,\n side: FlatSide,\n offset: number,\n span: number,\n dev: number,\n length: number,\n meta: {\n angleDeg: number;\n direction: 'up' | 'down';\n rule: { innerRadius: number; kFactor: number; allowance?: number | undefined };\n baseFull: boolean;\n side: FlatSide;\n }\n): PlacedFlange {\n // Edge basis in 2D: `along` runs the edge (bend axis), `out` points outward.\n const { along, out, edgeOrigin } = edgeBasis2(parent, side);\n\n const base = add2(edgeOrigin, scale2(along, offset));\n const bendA = base;\n const bendB = add2(base, scale2(along, span));\n\n const stripFar = add2(base, scale2(out, dev));\n\n const strip = rectFromCorners(base, add2(bendB, scale2(out, dev)));\n const flatRect = rectFromCorners(stripFar, add2(add2(stripFar, scale2(along, span)), scale2(out, length)));\n\n const childFrame: Frame2 = {\n origin: stripFar,\n u: along,\n v: out,\n uLen: span,\n vLen: length,\n };\n\n return {\n kind: 'flange',\n id,\n frame: childFrame,\n rect: flatRect,\n strip,\n bendA,\n bendB,\n dev,\n length,\n span,\n angleDeg: meta.angleDeg,\n direction: meta.direction,\n rule: meta.rule,\n baseFull: meta.baseFull,\n side: meta.side,\n };\n}\n\n/**\n * Edge origin and along/out unit directions for one side of a 2D frame. `along`\n * runs along the edge (the bend axis), `out` points outward from the frame, and\n * `edgeOrigin` is the starting corner of that edge.\n *\n * @param f - the 2D frame whose edge basis is computed\n * @param side - which side of the frame ('xmax' | 'xmin' | 'ymax' | 'ymin')\n * @returns the along/out unit directions and the edge's origin corner\n */\nexport function edgeBasis2(f: Frame2, side: FlatSide): { along: Pt2; out: Pt2; edgeOrigin: Pt2 } {\n const uTop = add2(f.origin, scale2(f.u, f.uLen));\n const vTop = add2(f.origin, scale2(f.v, f.vLen));\n switch (side) {\n case 'xmax':\n return { along: f.v, out: f.u, edgeOrigin: uTop };\n case 'xmin':\n return { along: f.v, out: neg2(f.u), edgeOrigin: f.origin };\n case 'ymax':\n return { along: f.u, out: f.v, edgeOrigin: vTop };\n case 'ymin':\n return { along: f.u, out: neg2(f.v), edgeOrigin: f.origin };\n default:\n return side satisfies never;\n }\n}\n\nfunction bendLineEdge(p: PlacedFlange): Edge {\n return line([p.bendA[0], p.bendA[1], 0], [p.bendB[0], p.bendB[1], 0]);\n}\n\n/**\n * One closed developed-plane {@link Wire} per recorded cutout, traced from the\n * feature's already-mapped `loop` (which {@link addCutout} positioned via the\n * region's developed frame, so the loop sits at the cutout's matching flat-pattern\n * spot). Emitted as interior holes of the pattern; the outer outline is unchanged.\n */\nfunction buildHoles(part: SheetMetalPart): Result<Wire[]> {\n const wires: Wire[] = [];\n for (const c of part.cutouts ?? []) {\n const loop = c.loop;\n if (loop.length < 3) {\n return err(validationError('CUTOUT_LOOP_TOO_SMALL', `cutout loop has ${loop.length} points, need ≥ 3`));\n }\n const edges: Edge[] = [];\n for (let i = 0; i < loop.length; i += 1) {\n const a = loop[i];\n const b = loop[(i + 1) % loop.length];\n if (a === undefined || b === undefined) {\n return err(validationError('CUTOUT_LOOP_FAILED', 'failed to index cutout loop'));\n }\n edges.push(line([a[0], a[1], 0], [b[0], b[1], 0]));\n }\n const wire = wireLoop(edges);\n if (!wire.ok) return wire;\n wires.push(wire.value);\n }\n return ok(wires);\n}\n\ninterface FormWires {\n cuts: Wire[];\n markers: Wire[];\n hinges: Edge[];\n}\n\n/**\n * Developed-plane wires for recorded form features: each louver U-cut and emboss\n * footprint as a closed {@link Wire}, plus each louver hinge as an {@link Edge}. The\n * loops were already mapped into developed coordinates when the form was recorded\n * (via the region's developed frame), so this just traces them. Forms are net-\n * material-neutral, so the outer outline and developed area are untouched.\n */\nfunction buildForms(part: SheetMetalPart): Result<FormWires> {\n const cuts: Wire[] = [];\n const markers: Wire[] = [];\n const hinges: Edge[] = [];\n for (const form of part.forms ?? []) {\n for (const path of form.cuts) {\n const cutWire = openPathWire(path);\n if (!cutWire.ok) return cutWire;\n cuts.push(cutWire.value);\n }\n for (const loop of form.markers) {\n const markerWire = closedLoopWire(loop);\n if (!markerWire.ok) return markerWire;\n markers.push(markerWire.value);\n }\n if (form.hinge !== undefined) {\n const [a, b] = form.hinge;\n hinges.push(line([a[0], a[1], 0], [b[0], b[1], 0]));\n }\n }\n return ok({ cuts, markers, hinges });\n}\n\n/**\n * Closed developed-plane {@link Wire}s for recorded lofted/ruled transition flanges.\n * Each feature's triangulated `developedLoop` was already laid out flat when the\n * flange was authored, so this just traces it into a wire; the boundary is non-\n * rectilinear so it rides separately from the rectilinear-union outline.\n */\nfunction buildLoftedDevelopments(part: SheetMetalPart): Result<Wire[]> {\n const wires: Wire[] = [];\n for (const lf of part.loftedFlanges ?? []) {\n const w = closedLoopWire(lf.developedLoop);\n if (!w.ok) return w;\n wires.push(w.value);\n }\n return ok(wires);\n}\n\ninterface ContourDevelopments {\n /** Developed strip rectangles (one per contour flange) for the outline union. */\n strips: Rect[];\n /** Developed bend lines (one per arc segment) in the flat pattern. */\n bendLines: FlatPattern['bendLines'];\n}\n\n/**\n * Lay each recorded contour flange's developed strip out STRAIGHT along its base\n * edge: a rectangle `span` wide along the edge by `developedLength` out from it,\n * returned for the outer-outline union. One bend line per arc segment is placed at\n * that segment's cumulative developed offset out from the base edge — the EXACT\n * arc-length sum, so the strip length equals Σ segment developed lengths with no\n * error.\n */\nfunction buildContourDevelopments(part: SheetMetalPart): Result<ContourDevelopments> {\n const strips: Rect[] = [];\n const bendLines: FlatPattern['bendLines'] = [];\n const baseFrame: Frame2 = {\n origin: [0, 0],\n u: [1, 0],\n v: [0, 1],\n uLen: part.baseLength,\n vLen: part.width,\n };\n\n for (const cf of part.contourFlanges ?? []) {\n const { along, out, edgeOrigin } = edgeBasis2(baseFrame, cf.side);\n const base = add2(edgeOrigin, scale2(along, cf.offset));\n strips.push(\n rectFromCorners(base, add2(add2(base, scale2(along, cf.span)), scale2(out, cf.developedLength)))\n );\n\n let cumulative = 0;\n for (const seg of cf.segments) {\n if (seg.kind === 'arc') {\n const a = add2(base, scale2(out, cumulative));\n const b = add2(a, scale2(along, cf.span));\n bendLines.push({\n id: seg.bendId ?? cf.id,\n line: line([a[0], a[1], 0], [b[0], b[1], 0]),\n angleDeg: seg.angleDeg ?? 0,\n direction: seg.direction ?? 'up',\n inward: [-out[0], -out[1]] as [number, number],\n });\n }\n cumulative += seg.dev;\n }\n }\n return ok({ strips, bendLines });\n}\n\ninterface HemJogDevelopments {\n /** Developed strip rectangles (one per hem/jog) for the outline union. */\n strips: Rect[];\n /** Developed bend lines (one per curl/step sub-bend) in the flat pattern. */\n bendLines: FlatPattern['bendLines'];\n}\n\n/**\n * Lay each recorded hem and jog developed strip out STRAIGHT along its region edge\n * (the base or a flange), mirroring {@link buildContourDevelopments}. The region's\n * developed-plane {@link Frame2} comes from the tree layout (so a hem on a flange\n * lands on that flange's developed face). Each sub-bend (a hem curl arc or a jog\n * step arc) gets a bend line at its EXACT cumulative developed offset out from the\n * edge — Σ segment developed lengths, so the strip length is exact.\n */\nfunction buildHemJogDevelopments(part: SheetMetalPart, layout: TreeLayout): Result<HemJogDevelopments> {\n const strips: Rect[] = [];\n const bendLines: FlatPattern['bendLines'] = [];\n\n const frameFor = (region: string): Frame2 | undefined => {\n const id = region === 'base' || region === 'face-0' ? ROOT_FLAT_ID : region;\n for (const p of layout.flats) {\n if (p.id === id) return p.frame;\n }\n return undefined;\n };\n\n interface Strip {\n region: string;\n side: FlatSide;\n offset: number;\n span: number;\n developedLength: number;\n segments: {\n kind: 'line' | 'arc';\n dev: number;\n angleDeg?: number | undefined;\n direction?: 'up' | 'down' | undefined;\n bendId?: string | undefined;\n }[];\n }\n const allStrips: Strip[] = [\n ...(part.hems ?? []).map((h) => ({\n region: h.region,\n side: h.side,\n offset: h.offset,\n span: h.span,\n developedLength: h.developedLength,\n segments: h.segments,\n })),\n ...(part.jogs ?? []).map((j) => ({\n region: j.region,\n side: j.side,\n offset: j.offset,\n span: j.span,\n developedLength: j.developedLength,\n segments: j.segments,\n })),\n ];\n\n for (const s of allStrips) {\n const regionFrame = frameFor(s.region);\n if (regionFrame === undefined) {\n return err(validationError('UNKNOWN_HEMJOG_REGION', `hem/jog region '${s.region}' missing from layout`));\n }\n const { along, out, edgeOrigin } = edgeBasis2(regionFrame, s.side);\n const base = add2(edgeOrigin, scale2(along, s.offset));\n strips.push(rectFromCorners(base, add2(add2(base, scale2(along, s.span)), scale2(out, s.developedLength))));\n\n let cumulative = 0;\n for (const seg of s.segments) {\n if (seg.kind === 'arc') {\n const a = add2(base, scale2(out, cumulative));\n const b = add2(a, scale2(along, s.span));\n bendLines.push({\n id: seg.bendId ?? s.region,\n line: line([a[0], a[1], 0], [b[0], b[1], 0]),\n angleDeg: seg.angleDeg ?? 0,\n direction: seg.direction ?? 'up',\n inward: [-out[0], -out[1]] as [number, number],\n });\n }\n cumulative += seg.dev;\n }\n }\n return ok({ strips, bendLines });\n}\n\n/** Trace a closed developed-plane loop (≥ 3 points) into a morph {@link Wire}. */\nfunction closedLoopWire(loop: Pt2[]): Result<Wire> {\n if (loop.length < 3) {\n return err(validationError('FORM_LOOP_TOO_SMALL', `form loop has ${loop.length} points, need ≥ 3`));\n }\n const edges: Edge[] = [];\n for (let i = 0; i < loop.length; i += 1) {\n const a = loop[i];\n const b = loop[(i + 1) % loop.length];\n if (a === undefined || b === undefined) {\n return err(validationError('FORM_LOOP_FAILED', 'failed to index form loop'));\n }\n edges.push(line([a[0], a[1], 0], [b[0], b[1], 0]));\n }\n return wireLoop(edges);\n}\n\n/** Trace an OPEN developed-plane path (≥ 2 points) into a morph {@link Wire}. */\nfunction openPathWire(path: Pt2[]): Result<Wire> {\n if (path.length < 2) {\n return err(validationError('FORM_PATH_TOO_SHORT', `form cut path has ${path.length} points, need ≥ 2`));\n }\n const edges: Edge[] = [];\n for (let i = 0; i + 1 < path.length; i += 1) {\n const a = path[i];\n const b = path[i + 1];\n if (a === undefined || b === undefined) {\n return err(validationError('FORM_LOOP_FAILED', 'failed to index form cut path'));\n }\n edges.push(line([a[0], a[1], 0], [b[0], b[1], 0]));\n }\n return assembleWire(edges);\n}\n\nfunction rectOf(f: Frame2): Rect {\n const c0 = f.origin;\n const c1 = add2(add2(f.origin, scale2(f.u, f.uLen)), scale2(f.v, f.vLen));\n return rectFromCorners(c0, c1);\n}\n\nfunction rectFromCorners(a: Pt2, b: Pt2): Rect {\n return {\n x0: Math.min(a[0], b[0]),\n y0: Math.min(a[1], b[1]),\n x1: Math.max(a[0], b[0]),\n y1: Math.max(a[1], b[1]),\n };\n}\n\nfunction add2(a: Pt2, b: Pt2): Pt2 {\n return [a[0] + b[0], a[1] + b[1]];\n}\nfunction scale2(a: Pt2, s: number): Pt2 {\n return [a[0] * s, a[1] * s];\n}\nfunction neg2(a: Pt2): Pt2 {\n return [-a[0], -a[1]];\n}\n\n/**\n * Outline of the developed pattern. For the simple two-perpendicular-flange L\n * (base + an east + a north flange) a recorded corner miter chamfers the reflex\n * vertex; otherwise the outline is the rectilinear union of all placed rectangles\n * emitted as one closed loop. Holes are not possible for the supported shapes\n * (every arm attaches to the simply-connected base or a chain thereof).\n */\nfunction buildOutline(\n rects: Rect[],\n layout: TreeLayout,\n miters: CornerMiter[],\n notches: Rect[]\n): Result<Wire> {\n // The lShapedMiter chamfer special-case can't express a notch, so once any relief\n // is recorded fall through to the rectilinear-union path (which subtracts notches).\n const miterCorners = notches.length > 0 ? undefined : lShapedMiter(layout, miters);\n const corners = miterCorners ?? rectilinearUnion(rects, notches);\n if (corners.length < 3) {\n return err(validationError('OUTLINE_BUILD_FAILED', 'developed outline has fewer than 3 vertices'));\n }\n const edges: Edge[] = [];\n for (let i = 0; i < corners.length; i += 1) {\n const from = corners[i];\n const to = corners[(i + 1) % corners.length];\n if (from === undefined || to === undefined) {\n return err(validationError('OUTLINE_BUILD_FAILED', 'failed to index outline corners'));\n }\n edges.push(line([from[0], from[1], 0], [to[0], to[1], 0]));\n }\n return wireLoop(edges);\n}\n\n/**\n * Special-case the classic L: a base with exactly one east (+X) and one north\n * (+Y) full-span flange and a recorded miter between them. Returns the chamfered\n * hexagon; `undefined` if this isn't that shape (fall back to the union outline).\n */\nfunction lShapedMiter(layout: TreeLayout, miters: CornerMiter[]): Pt2[] | undefined {\n const flanges = layout.flats.filter((p): p is PlacedFlange => p.kind === 'flange');\n if (flanges.length !== 2) return undefined;\n const east = flanges.find((f) => f.baseFull && f.side === 'xmax');\n const north = flanges.find((f) => f.baseFull && f.side === 'ymax');\n if (east === undefined || north === undefined) return undefined;\n\n const baseLength = layout.baseLength;\n const width = layout.width;\n const maxX = baseLength + east.dev + east.length;\n const maxY = width + north.dev + north.length;\n const gap = miterGapFor(miters, east.id, north.id);\n\n if (gap === undefined || gap <= 0) {\n return [\n [0, 0],\n [maxX, 0],\n [maxX, width],\n [baseLength, width],\n [baseLength, maxY],\n [0, maxY],\n ];\n }\n return [\n [0, 0],\n [maxX, 0],\n [maxX, width],\n [baseLength + gap, width],\n [baseLength, width + gap],\n [baseLength, maxY],\n [0, maxY],\n ];\n}\n\nfunction miterGapFor(miters: CornerMiter[], aId: string, bId: string): number | undefined {\n for (const m of miters) {\n if ((m.flangeA === aId && m.flangeB === bId) || (m.flangeA === bId && m.flangeB === aId)) {\n return m.gap;\n }\n }\n return undefined;\n}\n\n/**\n * Outline loop of the union of axis-aligned rectangles, assuming the union is a\n * single simply-connected rectilinear region (true for every shape this package\n * authors: arms attached to a connected base). Built by a vertical-line sweep\n * tracking the covered y-spans, then tracing the boundary contour. The sweep emits\n * a CCW loop of corner points with no collinear duplicates.\n */\nfunction rectilinearUnion(rects: Rect[], notches: Rect[] = []): Pt2[] {\n const cuts = [...rects.flatMap((r) => [r.x0, r.x1]), ...notches.flatMap((r) => [r.x0, r.x1])];\n const cutsY = [...rects.flatMap((r) => [r.y0, r.y1]), ...notches.flatMap((r) => [r.y0, r.y1])];\n const xs = uniqueSorted(cuts);\n const ys = uniqueSorted(cutsY);\n if (xs.length < 2 || ys.length < 2) return [];\n\n // Cell-occupancy grid: a cell is filled if its centre lies in the rectangle union\n // and in no notch (notches subtract material; they sit on the boundary so the\n // result stays simply-connected).\n const nx = xs.length - 1;\n const ny = ys.length - 1;\n const filled = new Set<number>();\n for (let i = 0; i < nx; i += 1) {\n const cx = ((xs[i] as number) + (xs[i + 1] as number)) / 2;\n for (let j = 0; j < ny; j += 1) {\n const cy = ((ys[j] as number) + (ys[j + 1] as number)) / 2;\n const inRect = rects.some((r) => cx > r.x0 && cx < r.x1 && cy > r.y0 && cy < r.y1);\n const inNotch = notches.some((r) => cx > r.x0 && cx < r.x1 && cy > r.y0 && cy < r.y1);\n if (inRect && !inNotch) filled.add(i * ny + j);\n }\n }\n\n // Collect boundary unit-edges (segments between adjacent grid nodes that border\n // a filled and an unfilled cell), oriented CCW (filled cell on the left).\n const segs: { a: Pt2; b: Pt2 }[] = [];\n const isFilled = (i: number, j: number): boolean =>\n i >= 0 && i < nx && j >= 0 && j < ny && filled.has(i * ny + j);\n\n for (let i = 0; i < nx; i += 1) {\n for (let j = 0; j < ny; j += 1) {\n if (!isFilled(i, j)) continue;\n const x0 = xs[i] as number;\n const x1 = xs[i + 1] as number;\n const y0 = ys[j] as number;\n const y1 = ys[j + 1] as number;\n // Bottom edge: boundary if cell below is empty. CCW → left-to-right.\n if (!isFilled(i, j - 1)) segs.push({ a: [x0, y0], b: [x1, y0] });\n // Top edge: boundary if cell above empty. CCW → right-to-left.\n if (!isFilled(i, j + 1)) segs.push({ a: [x1, y1], b: [x0, y1] });\n // Left edge: boundary if cell left empty. CCW → top-to-bottom.\n if (!isFilled(i - 1, j)) segs.push({ a: [x0, y1], b: [x0, y0] });\n // Right edge: boundary if cell right empty. CCW → bottom-to-top.\n if (!isFilled(i + 1, j)) segs.push({ a: [x1, y0], b: [x1, y1] });\n }\n }\n\n return traceLoop(segs);\n}\n\n/**\n * Area of material removed by the relief notches: the portion of each notch that\n * overlaps the rectangle union, summed over a shared cell grid so overlapping\n * notches (e.g. two corner reliefs meeting) are not double-counted.\n */\nfunction removedNotchArea(rects: Rect[], notches: Rect[]): number {\n if (notches.length === 0) return 0;\n const xs = uniqueSorted([\n ...rects.flatMap((r) => [r.x0, r.x1]),\n ...notches.flatMap((r) => [r.x0, r.x1]),\n ]);\n const ys = uniqueSorted([\n ...rects.flatMap((r) => [r.y0, r.y1]),\n ...notches.flatMap((r) => [r.y0, r.y1]),\n ]);\n let area = 0;\n for (let i = 0; i + 1 < xs.length; i += 1) {\n const x0 = xs[i] as number;\n const x1 = xs[i + 1] as number;\n const cx = (x0 + x1) / 2;\n for (let j = 0; j + 1 < ys.length; j += 1) {\n const y0 = ys[j] as number;\n const y1 = ys[j + 1] as number;\n const cy = (y0 + y1) / 2;\n const inRect = rects.some((r) => cx > r.x0 && cx < r.x1 && cy > r.y0 && cy < r.y1);\n const inNotch = notches.some((r) => cx > r.x0 && cx < r.x1 && cy > r.y0 && cy < r.y1);\n if (inRect && inNotch) area += (x1 - x0) * (y1 - y0);\n }\n }\n return area;\n}\n\n/** Chain oriented boundary segments into a single loop, dropping collinear points. */\nfunction traceLoop(segs: { a: Pt2; b: Pt2 }[]): Pt2[] {\n if (segs.length === 0) return [];\n const key = (p: Pt2): string => `${p[0]}|${p[1]}`;\n const from = new Map<string, Pt2>();\n for (const s of segs) from.set(key(s.a), s.b);\n\n const startSeg = segs[0] as { a: Pt2; b: Pt2 };\n const start = startSeg.a;\n const raw: Pt2[] = [start];\n let cur = startSeg.b;\n let guard = 0;\n const limit = segs.length + 4;\n while (key(cur) !== key(start) && guard < limit) {\n raw.push(cur);\n const next = from.get(key(cur));\n if (next === undefined) break;\n cur = next;\n guard += 1;\n }\n\n // Drop collinear interior points so consecutive edges aren't degenerate.\n const out: Pt2[] = [];\n for (let i = 0; i < raw.length; i += 1) {\n const prev = raw[(i - 1 + raw.length) % raw.length] as Pt2;\n const here = raw[i] as Pt2;\n const next = raw[(i + 1) % raw.length] as Pt2;\n const d1x = here[0] - prev[0];\n const d1y = here[1] - prev[1];\n const d2x = next[0] - here[0];\n const d2y = next[1] - here[1];\n if (Math.abs(d1x * d2y - d1y * d2x) > 1e-9) out.push(here);\n }\n return out;\n}\n\nfunction uniqueSorted(values: number[]): number[] {\n const sorted = [...values].sort((a, b) => a - b);\n const out: number[] = [];\n for (const v of sorted) {\n const last = out[out.length - 1];\n if (last === undefined || Math.abs(v - last) > 1e-9) out.push(v);\n }\n return out;\n}\n\n/**\n * Build the bend report for a laid-out tree: one entry per placed flange with its\n * angle, radius, allowance, flat length, and direction, plus the overall\n * bounding-box span of the developed pattern.\n *\n * @param layout - the tree layout produced by {@link layoutTree}\n * @returns the bend entries and the total flat pattern size\n */\nexport function reportFromLayout(layout: TreeLayout): BendReport {\n const flanges = layout.flats.filter((p): p is PlacedFlange => p.kind === 'flange');\n const bends = flanges.map((f) => ({\n id: f.id,\n angleDeg: f.angleDeg,\n radius: f.rule.innerRadius,\n allowance: f.dev,\n flatLength: f.length,\n direction: f.direction,\n }));\n\n // totalFlatSize is the overall bounding-box span of the developed pattern, which\n // for parts whose flanges extend into negative coordinates (xmin/ymin sides) is\n // the max−min extent, not just the max.\n let minX = 0;\n let minY = 0;\n let maxX = layout.baseLength;\n let maxY = layout.width;\n for (const r of layout.flats.map((p) => p.rect).concat(layout.strips)) {\n if (r.x0 < minX) minX = r.x0;\n if (r.y0 < minY) minY = r.y0;\n if (r.x1 > maxX) maxX = r.x1;\n if (r.y1 > maxY) maxY = r.y1;\n }\n return { bends, totalFlatSize: [maxX - minX, maxY - minY] };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"validateFns.d.ts","sourceRoot":"","sources":["../src/validateFns.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAe,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAKjF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,iBAAiB,EAAE,CAMtE"}
1
+ {"version":3,"file":"validateFns.d.ts","sourceRoot":"","sources":["../src/validateFns.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAe,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAKjF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,iBAAiB,EAAE,CAMtE"}
@@ -1,4 +1,5 @@
1
- import { isValid, measureVolume, getBounds, vecNormalize, vecAdd, vecScale, vecCross, } from '@faicad/faijs/brepjs-compat';
1
+ import { getBounds } from './geometryOps.js';
2
+ import { isValid, measureVolume, vecNormalize, vecAdd, vecScale, vecCross } from '@faicad/faijs/api';
2
3
  import { ROOT_FLAT_ID } from './featureTreeFns.js';
3
4
  const OVERLAP_TOL = 1e-6;
4
5
  /**
@@ -32,14 +33,11 @@ function checkSolid(part) {
32
33
  return [{ code: 'INVALID_SOLID', message: 'folded solid failed kernel validity check' }];
33
34
  }
34
35
  const vol = measureVolume(solid);
35
- if (!vol.ok) {
36
- return [{ code: 'INVALID_SOLID', message: 'folded solid volume could not be measured' }];
37
- }
38
- if (vol.value <= 0) {
36
+ if (vol <= 0) {
39
37
  return [
40
38
  {
41
39
  code: 'INVALID_SOLID',
42
- message: `folded solid has non-positive volume ${vol.value}`,
40
+ message: `folded solid has non-positive volume ${vol}`,
43
41
  },
44
42
  ];
45
43
  }