brepjs 20.12.5 → 20.12.7
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.
- package/dist/2d/blueprints/booleanHelpers.d.ts +0 -5
- package/dist/2d/blueprints/intersectionSegments.d.ts +6 -5
- package/dist/2d/lib/offset.d.ts +1 -1
- package/dist/2d.cjs +6 -6
- package/dist/2d.js +6 -6
- package/dist/{adjacencyFns-B2Po1gPs.js → adjacencyFns-hMihivxC.js} +3 -3
- package/dist/{adjacencyFns-Cho9v3Q3.cjs → adjacencyFns-mMmTBUBY.cjs} +3 -3
- package/dist/{blueprint-ERmwk6zG.cjs → blueprint-17RUHsoP.cjs} +7 -8
- package/dist/{blueprint-Zmt5-07y.js → blueprint-BS50D3J_.js} +7 -8
- package/dist/{blueprintFns-B_sxtIo7.cjs → blueprintFns-Dw5_4_Bk.cjs} +2 -2
- package/dist/{blueprintFns-Dtm-XukP.js → blueprintFns-zy5lo2IF.js} +2 -2
- package/dist/{blueprintSketcher-CZyokLGJ.cjs → blueprintSketcher-BG--DxWB.cjs} +32 -14
- package/dist/{blueprintSketcher-CwTAtrkY.js → blueprintSketcher-C1WCI6E0.js} +32 -14
- package/dist/{boolean2D-CRuNKgXs.cjs → boolean2D-7SQ3B0pC.cjs} +42 -50
- package/dist/{boolean2D-yUpS8onH.js → boolean2D-CsdyfjFE.js} +42 -50
- package/dist/brepjs.cjs +30 -30
- package/dist/brepjs.js +30 -30
- package/dist/{cameraFns-DB1IyMmS.cjs → cameraFns-BAtzhCYM.cjs} +3 -3
- package/dist/{cameraFns-DRok4UxZ.js → cameraFns-BVWyAscu.js} +3 -3
- package/dist/core.cjs +2 -2
- package/dist/core.js +2 -2
- package/dist/{cornerFinder-D5qnDbtZ.js → cornerFinder-Dv_2rmaY.js} +1 -1
- package/dist/{cornerFinder-DfYBHHZG.cjs → cornerFinder-e4Wc7_yp.cjs} +1 -1
- package/dist/{curveFns-BKT4Sg8q.cjs → curveFns-BAM7QHrP.cjs} +1 -1
- package/dist/{curveFns-BGPSFUWB.js → curveFns-CEI-rouh.js} +1 -1
- package/dist/{drawFns-aGufr-pr.js → drawFns-Cl1i8B_B.js} +18 -13
- package/dist/{drawFns-D8e5RiRe.cjs → drawFns-d-RvC6u6.cjs} +18 -13
- package/dist/{faceFns-Cx7cwUMx.cjs → faceFns-C-2ttg8X.cjs} +2 -2
- package/dist/{faceFns-lE2OvBfq.js → faceFns-Q87HCJrp.js} +2 -2
- package/dist/{healingFns-B94zSk1-.js → healingFns-Cm4NkKD8.js} +5 -5
- package/dist/{healingFns-CcgyrL6h.cjs → healingFns-DZkO5okn.cjs} +5 -5
- package/dist/{helpers-C4f2MV-r.cjs → helpers-BdGGaLhF.cjs} +6 -6
- package/dist/{helpers-CNgipe6l.js → helpers-DpGcM2qZ.js} +6 -6
- package/dist/{importFns-gB1X3ti2.js → importFns-Bp-p0jiP.js} +2 -2
- package/dist/{importFns-fIdcaMqt.cjs → importFns-DLiP26NW.cjs} +2 -2
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/bspline2dFit.d.ts +42 -0
- package/dist/kernel/geometry2d.d.ts +45 -0
- package/dist/kernel/occt/kernel2dOps.d.ts +1 -1
- package/dist/kernel/occtWasm/kernel2dOps.d.ts +7 -4
- package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.d.ts +2 -2
- package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
- package/dist/kernel/occtWasm/occtWasmTypes.d.ts +2 -0
- package/dist/{loftFns-AHaYxJyS.cjs → loftFns-DGV1z2NJ.cjs} +1 -1
- package/dist/{loftFns-mbyBvJ8Y.js → loftFns-DQ7Z29n3.js} +1 -1
- package/dist/{measureFns-CuabRDRL.cjs → measureFns-BdSjw5fr.cjs} +3 -3
- package/dist/{measureFns-C94G0fH8.js → measureFns-BrdCH4cH.js} +3 -3
- package/dist/measurement.cjs +2 -2
- package/dist/measurement.js +2 -2
- package/dist/{meshFns-GXF5gPZL.cjs → meshFns-BeubBqEI.cjs} +3 -3
- package/dist/{meshFns-jarDZKw1.js → meshFns-UE8tByyw.js} +3 -3
- package/dist/{occtWasmAdapter-DeoeK2iJ.cjs → occtWasmAdapter-D3qerQTq.cjs} +1260 -291
- package/dist/{occtWasmAdapter-DlNmVNUn.js → occtWasmAdapter-DA7oMgcQ.js} +1249 -292
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{originTrackingFns-BxeUD2NM.js → originTrackingFns-c2qgRZ_9.js} +2 -2
- package/dist/{originTrackingFns-C-yuMV3m.cjs → originTrackingFns-rEKOAP65.cjs} +2 -2
- package/dist/{primitiveFns-CualoFAk.js → primitiveFns-3-gs-FUX.js} +4 -4
- package/dist/{primitiveFns-BVAkYHVf.cjs → primitiveFns-CLGVLwG8.cjs} +4 -4
- package/dist/{principalBoxFns-DHh5_HCw.cjs → principalBoxFns-CiXzjOkr.cjs} +3 -3
- package/dist/{principalBoxFns-DtI7tVuS.js → principalBoxFns-RMZItjfR.js} +3 -3
- package/dist/projection.cjs +1 -1
- package/dist/projection.js +1 -1
- package/dist/query.cjs +2 -2
- package/dist/query.js +2 -2
- package/dist/{refResolveFns-CaAw-ya3.cjs → refResolveFns-DNX0bCrP.cjs} +6 -6
- package/dist/{refResolveFns--SRyN2qa.js → refResolveFns-kJg2iCad.js} +6 -6
- package/dist/{shapeFns-CdrDroOM.js → shapeFns-CZ6VF1yd.js} +2 -2
- package/dist/{shapeFns-CwjjUOr0.cjs → shapeFns-SgIrOjN4.cjs} +2 -2
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeTypes-PNVEv6ga.js → shapeTypes-BNGu103j.js} +10 -16
- package/dist/{shapeTypes-D938X2mg.cjs → shapeTypes-MUEH4XuH.cjs} +10 -16
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-Hft8Cr6a.js → solidBuilders-Bmr59cGp.js} +5 -5
- package/dist/{solidBuilders-CAkBQKWb.cjs → solidBuilders-DdG4NPHM.cjs} +5 -5
- package/dist/{surfaceBuilders-CrO_BBKM.js → surfaceBuilders-DI376ai0.js} +3 -3
- package/dist/{surfaceBuilders-BKCiVf7T.cjs → surfaceBuilders-DOmDVuMs.cjs} +3 -3
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-C9HeYc5a.cjs → textBlueprints-B7Vhr0xu.cjs} +7 -7
- package/dist/{textBlueprints-B8q2a-nN.js → textBlueprints-CE0oxB43.js} +7 -7
- package/dist/{textMetrics-1fhCSAGF.cjs → textMetrics-C6_kSht6.cjs} +1 -1
- package/dist/{textMetrics-DJfTSy6w.js → textMetrics-_VGqdewQ.js} +1 -1
- package/dist/{threadFns-CVIEbOW3.cjs → threadFns-1H60LrFX.cjs} +7 -7
- package/dist/{threadFns-f2KwibLR.js → threadFns-CHdY-4Cz.js} +7 -7
- package/dist/topology.cjs +9 -9
- package/dist/topology.js +9 -9
- package/dist/{topologyQueryFns-4WYqtSFF.cjs → topologyQueryFns-C_fXO6xL.cjs} +1 -1
- package/dist/{topologyQueryFns-BZUY10TD.js → topologyQueryFns-CltEv7Pi.js} +1 -1
- package/dist/{validityTypes-tWSx_zAH.cjs → validityTypes-CGX2ES81.cjs} +1 -1
- package/dist/{validityTypes-DAXIqwZM.js → validityTypes-GanLrmvY.js} +1 -1
- package/package.json +1 -1
|
@@ -6,11 +6,6 @@ export declare const samePoint: (x: Point2D, y: Point2D) => boolean;
|
|
|
6
6
|
* nearly-equal points.
|
|
7
7
|
*/
|
|
8
8
|
export declare function hashPoint(p: Point2D): string;
|
|
9
|
-
/**
|
|
10
|
-
* Hash a segment by both orientations for bidirectional lookup.
|
|
11
|
-
* The smaller hash comes first so that (A,B) and (B,A) produce the same key.
|
|
12
|
-
*/
|
|
13
|
-
export declare function hashSegment(first: Point2D, last: Point2D): string;
|
|
14
9
|
export type Segment = Curve2D[];
|
|
15
10
|
export type IntersectionSegment = [Segment, Segment | 'same'];
|
|
16
11
|
export declare function startOfSegment(s: Segment): Point2D;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Curve2D } from '../lib/index.js';
|
|
2
2
|
import { default as Blueprint } from './blueprint.js';
|
|
3
|
-
import { IntersectionSegment } from './booleanHelpers.js';
|
|
3
|
+
import { Segment, IntersectionSegment } from './booleanHelpers.js';
|
|
4
4
|
/**
|
|
5
|
-
* Check whether a segment
|
|
6
|
-
*
|
|
5
|
+
* Check whether a segment runs along one of the common segments, in either
|
|
6
|
+
* direction. Matching endpoints are not enough: two outlines that share an
|
|
7
|
+
* edge also join its endpoints with the rest of their boundaries.
|
|
7
8
|
*/
|
|
8
|
-
export declare function isCommonSegmentMatch(
|
|
9
|
+
export declare function isCommonSegmentMatch(commonSegments: Curve2D[], segment: Segment): boolean;
|
|
9
10
|
/**
|
|
10
11
|
* Given two closed blueprints, find their intersection points, split each
|
|
11
12
|
* blueprint's curves at those points, and pair up the resulting segments.
|
package/dist/2d/lib/offset.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { Point2D } from './definitions.js';
|
|
|
10
10
|
* instead of a `Curve2D`.
|
|
11
11
|
*
|
|
12
12
|
* @param curve - The source curve to offset.
|
|
13
|
-
* @param offset - Signed offset distance (positive =
|
|
13
|
+
* @param offset - Signed offset distance (positive = right of curve direction).
|
|
14
14
|
*
|
|
15
15
|
* @remarks Self-intersecting offset curves are replaced with a collapsed
|
|
16
16
|
* sentinel. This is a known simplification; a more robust trimming strategy
|
package/dist/2d.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
2
|
+
const require_shapeTypes = require("./shapeTypes-MUEH4XuH.cjs");
|
|
3
3
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
4
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
5
|
-
const require_blueprintSketcher = require("./blueprintSketcher-
|
|
6
|
-
const require_blueprint = require("./blueprint-
|
|
7
|
-
const require_boolean2D = require("./boolean2D-
|
|
8
|
-
const require_blueprintFns = require("./blueprintFns-
|
|
4
|
+
const require_topologyQueryFns = require("./topologyQueryFns-C_fXO6xL.cjs");
|
|
5
|
+
const require_blueprintSketcher = require("./blueprintSketcher-BG--DxWB.cjs");
|
|
6
|
+
const require_blueprint = require("./blueprint-17RUHsoP.cjs");
|
|
7
|
+
const require_boolean2D = require("./boolean2D-7SQ3B0pC.cjs");
|
|
8
|
+
const require_blueprintFns = require("./blueprintFns-Dw5_4_Bk.cjs");
|
|
9
9
|
// src/core/curve2dHandle.ts
|
|
10
10
|
/**
|
|
11
11
|
* Wrap a raw kernel 2D curve handle with brand + disposal tracking.
|
package/dist/2d.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { F as createKernelHandle, J as getKernel2D, c as createEdge } from "./shapeTypes-
|
|
1
|
+
import { F as createKernelHandle, J as getKernel2D, c as createEdge } from "./shapeTypes-BNGu103j.js";
|
|
2
2
|
import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-BTccWbtE.js";
|
|
3
|
-
import { E as kernelCallRaw } from "./topologyQueryFns-
|
|
4
|
-
import { a as Blueprints, i as CompoundBlueprint, r as organiseBlueprints } from "./blueprintSketcher-
|
|
5
|
-
import { t as Blueprint, v as Curve2D, x as BoundingBox2d } from "./blueprint-
|
|
6
|
-
import { a as fuseBlueprints, c as roundedRectangleBlueprint, i as cutBlueprints, n as fuse2D, o as intersectBlueprints, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-
|
|
7
|
-
import { S as reverseCurve, _ as curve2dIsOnCurve, a as isInside2D, b as curve2dSplitAt, c as scale2D, d as stretch2D, f as toSVGPathD, g as curve2dFirstPoint, h as curve2dDistanceFrom, i as getOrientation2D, l as sketchOnFace2D, m as curve2dBoundingBox, o as mirror2D, p as translate2D, r as getBounds2D, s as rotate2D, t as createBlueprint, u as sketchOnPlane2D, v as curve2dLastPoint, x as curve2dTangentAt, y as curve2dParameter } from "./blueprintFns-
|
|
3
|
+
import { E as kernelCallRaw } from "./topologyQueryFns-CltEv7Pi.js";
|
|
4
|
+
import { a as Blueprints, i as CompoundBlueprint, r as organiseBlueprints } from "./blueprintSketcher-C1WCI6E0.js";
|
|
5
|
+
import { t as Blueprint, v as Curve2D, x as BoundingBox2d } from "./blueprint-BS50D3J_.js";
|
|
6
|
+
import { a as fuseBlueprints, c as roundedRectangleBlueprint, i as cutBlueprints, n as fuse2D, o as intersectBlueprints, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-CsdyfjFE.js";
|
|
7
|
+
import { S as reverseCurve, _ as curve2dIsOnCurve, a as isInside2D, b as curve2dSplitAt, c as scale2D, d as stretch2D, f as toSVGPathD, g as curve2dFirstPoint, h as curve2dDistanceFrom, i as getOrientation2D, l as sketchOnFace2D, m as curve2dBoundingBox, o as mirror2D, p as translate2D, r as getBounds2D, s as rotate2D, t as createBlueprint, u as sketchOnPlane2D, v as curve2dLastPoint, x as curve2dTangentAt, y as curve2dParameter } from "./blueprintFns-zy5lo2IF.js";
|
|
8
8
|
// src/core/curve2dHandle.ts
|
|
9
9
|
/**
|
|
10
10
|
* Wrap a raw kernel 2D curve handle with brand + disposal tracking.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as GeometryCleanupError, K as getActiveKernelId, q as getKernel, r as castResultShapeWithKnownType, t as borrowShapeWithKnownType } from "./shapeTypes-
|
|
2
|
-
import {
|
|
3
|
-
import { c as getFaces, f as getVertices, l as getOrCreateCache, s as getEdges } from "./topologyQueryFns-
|
|
1
|
+
import { E as GeometryCleanupError, K as getActiveKernelId, q as getKernel, r as castResultShapeWithKnownType, t as borrowShapeWithKnownType } from "./shapeTypes-BNGu103j.js";
|
|
2
|
+
import { j as isUnsupportedKernelOperationError } from "./occtWasmAdapter-DA7oMgcQ.js";
|
|
3
|
+
import { c as getFaces, f as getVertices, l as getOrCreateCache, s as getEdges } from "./topologyQueryFns-CltEv7Pi.js";
|
|
4
4
|
import { n as HASH_CODE_MAX } from "./constants-iraOnb2p.js";
|
|
5
5
|
// src/topology/adjacencyFns.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
2
|
-
const require_occtWasmAdapter = require("./occtWasmAdapter-
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-MUEH4XuH.cjs");
|
|
2
|
+
const require_occtWasmAdapter = require("./occtWasmAdapter-D3qerQTq.cjs");
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-C_fXO6xL.cjs");
|
|
4
4
|
const require_constants = require("./constants-oee0S_x6.cjs");
|
|
5
5
|
// src/topology/adjacencyFns.ts
|
|
6
6
|
/**
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-MUEH4XuH.cjs");
|
|
2
2
|
const require_bug = require("./bug-CBcpIPuf.cjs");
|
|
3
3
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
4
4
|
const require_constants = require("./constants-oee0S_x6.cjs");
|
|
5
5
|
const require_types = require("./types-CjF9Rofr.cjs");
|
|
6
6
|
const require_planeOps = require("./planeOps-DZfLToKZ.cjs");
|
|
7
|
-
const require_faceFns = require("./faceFns-
|
|
8
|
-
const require_curveFns = require("./curveFns-
|
|
7
|
+
const require_faceFns = require("./faceFns-C-2ttg8X.cjs");
|
|
8
|
+
const require_curveFns = require("./curveFns-BAM7QHrP.cjs");
|
|
9
9
|
const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
|
|
10
|
-
const require_surfaceBuilders = require("./surfaceBuilders-
|
|
11
|
-
const require_helpers = require("./helpers-
|
|
10
|
+
const require_surfaceBuilders = require("./surfaceBuilders-DOmDVuMs.cjs");
|
|
11
|
+
const require_helpers = require("./helpers-BdGGaLhF.cjs");
|
|
12
12
|
// src/2d/lib/definitions.ts
|
|
13
13
|
/** Type guard that checks whether a value is a `Point2D`. */
|
|
14
14
|
function isPoint2D(point) {
|
|
@@ -256,9 +256,8 @@ var Curve2D = class Curve2D {
|
|
|
256
256
|
const tmpPt = this._firstPoint;
|
|
257
257
|
this._firstPoint = this._lastPoint;
|
|
258
258
|
this._lastPoint = tmpPt;
|
|
259
|
-
|
|
260
|
-
this.
|
|
261
|
-
this._lastParameter = tmpParam;
|
|
259
|
+
this._firstParameter = null;
|
|
260
|
+
this._lastParameter = null;
|
|
262
261
|
}
|
|
263
262
|
distanceFromPoint(point) {
|
|
264
263
|
const proj = require_shapeTypes.getKernel().projectPointOnCurve2d(this.wrapped, point[0], point[1]);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { B as unregisterFromCleanup, J as getKernel2D, R as registerForCleanup, c as createEdge, p as createWire, q as getKernel } from "./shapeTypes-
|
|
1
|
+
import { B as unregisterFromCleanup, J as getKernel2D, R as registerForCleanup, c as createEdge, p as createWire, q as getKernel } from "./shapeTypes-BNGu103j.js";
|
|
2
2
|
import { i as wasmIndex, n as bug } from "./bug-ClMTAJhe.js";
|
|
3
3
|
import { E as ok, P as unwrap, d as validationError, g as err, n as computationError } from "./errors-BTccWbtE.js";
|
|
4
4
|
import { r as RAD2DEG, t as DEG2RAD } from "./constants-iraOnb2p.js";
|
|
5
5
|
import { r as toVec3 } from "./types-CKXsIm9-.js";
|
|
6
6
|
import { r as makePlane } from "./planeOps-D3yDuMux.js";
|
|
7
|
-
import { _ as cast, h as uvCoordinates, i as faceGeomType, m as uvBounds, r as faceCenter } from "./faceFns-
|
|
8
|
-
import { p as getOrientation } from "./curveFns-
|
|
7
|
+
import { _ as cast, h as uvCoordinates, i as faceGeomType, m as uvBounds, r as faceCenter } from "./faceFns-Q87HCJrp.js";
|
|
8
|
+
import { p as getOrientation } from "./curveFns-CEI-rouh.js";
|
|
9
9
|
import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-BpgouNir.js";
|
|
10
|
-
import { r as makeFace } from "./surfaceBuilders-
|
|
11
|
-
import { l as add2d, m as normalize2d$1, p as distance2d, t as getSingleFace, v as samePoint, x as subtract2d, y as scalarMultiply2d } from "./helpers-
|
|
10
|
+
import { r as makeFace } from "./surfaceBuilders-DI376ai0.js";
|
|
11
|
+
import { l as add2d, m as normalize2d$1, p as distance2d, t as getSingleFace, v as samePoint, x as subtract2d, y as scalarMultiply2d } from "./helpers-DpGcM2qZ.js";
|
|
12
12
|
// src/2d/lib/definitions.ts
|
|
13
13
|
/** Type guard that checks whether a value is a `Point2D`. */
|
|
14
14
|
function isPoint2D(point) {
|
|
@@ -256,9 +256,8 @@ var Curve2D = class Curve2D {
|
|
|
256
256
|
const tmpPt = this._firstPoint;
|
|
257
257
|
this._firstPoint = this._lastPoint;
|
|
258
258
|
this._lastPoint = tmpPt;
|
|
259
|
-
|
|
260
|
-
this.
|
|
261
|
-
this._lastParameter = tmpParam;
|
|
259
|
+
this._firstParameter = null;
|
|
260
|
+
this._lastParameter = null;
|
|
262
261
|
}
|
|
263
262
|
distanceFromPoint(point) {
|
|
264
263
|
const proj = getKernel().projectPointOnCurve2d(this.wrapped, point[0], point[1]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
2
|
-
const require_blueprintSketcher = require("./blueprintSketcher-
|
|
3
|
-
const require_blueprint = require("./blueprint-
|
|
2
|
+
const require_blueprintSketcher = require("./blueprintSketcher-BG--DxWB.cjs");
|
|
3
|
+
const require_blueprint = require("./blueprint-17RUHsoP.cjs");
|
|
4
4
|
// src/2d/lib/curve2dFns.ts
|
|
5
5
|
/**
|
|
6
6
|
* Return a reversed copy of the curve (non-mutating).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-BTccWbtE.js";
|
|
2
|
-
import { i as CompoundBlueprint } from "./blueprintSketcher-
|
|
3
|
-
import { t as Blueprint } from "./blueprint-
|
|
2
|
+
import { i as CompoundBlueprint } from "./blueprintSketcher-C1WCI6E0.js";
|
|
3
|
+
import { t as Blueprint } from "./blueprint-BS50D3J_.js";
|
|
4
4
|
// src/2d/lib/curve2dFns.ts
|
|
5
5
|
/**
|
|
6
6
|
* Return a reversed copy of the curve (non-mutating).
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-MUEH4XuH.cjs");
|
|
2
2
|
const require_bug = require("./bug-CBcpIPuf.cjs");
|
|
3
3
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
4
4
|
const require_constants = require("./constants-oee0S_x6.cjs");
|
|
5
5
|
const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
|
|
6
|
-
const require_helpers = require("./helpers-
|
|
7
|
-
const require_blueprint = require("./blueprint-
|
|
6
|
+
const require_helpers = require("./helpers-BdGGaLhF.cjs");
|
|
7
|
+
const require_blueprint = require("./blueprint-17RUHsoP.cjs");
|
|
8
8
|
// node_modules/flatqueue/index.js
|
|
9
9
|
/**
|
|
10
10
|
* @typedef {Float64ArrayConstructor | Float32ArrayConstructor |
|
|
@@ -609,7 +609,7 @@ var offsetEndPoints = (firstPoint, lastPoint, offset) => {
|
|
|
609
609
|
* instead of a `Curve2D`.
|
|
610
610
|
*
|
|
611
611
|
* @param curve - The source curve to offset.
|
|
612
|
-
* @param offset - Signed offset distance (positive =
|
|
612
|
+
* @param offset - Signed offset distance (positive = right of curve direction).
|
|
613
613
|
*
|
|
614
614
|
* @remarks Self-intersecting offset curves are replaced with a collapsed
|
|
615
615
|
* sentinel. This is a known simplification; a more robust trimming strategy
|
|
@@ -627,11 +627,12 @@ var make2dOffset = (curve, offset) => {
|
|
|
627
627
|
if (curveType === "CIRCLE") {
|
|
628
628
|
const circleData = kernel.getCurve2dCircleData(curve.wrapped);
|
|
629
629
|
if (!circleData) return require_blueprint.make2dSegmentCurve(curve.firstPoint, curve.lastPoint);
|
|
630
|
-
const { cx, cy, radius
|
|
631
|
-
const
|
|
630
|
+
const { cx, cy, radius } = circleData;
|
|
631
|
+
const center = [cx, cy];
|
|
632
|
+
const counterClockwise = require_helpers.crossProduct2d(require_helpers.subtract2d(curve.firstPoint, center), curve.tangentAt(0)) > 0;
|
|
633
|
+
const orientedOffset = counterClockwise ? offset : -offset;
|
|
632
634
|
const newRadius = radius + orientedOffset;
|
|
633
635
|
if (newRadius < 1e-10) {
|
|
634
|
-
const center = [cx, cy];
|
|
635
636
|
const offsetViaCenter = (point) => {
|
|
636
637
|
const [x, y] = require_blueprint.normalize2d(require_helpers.subtract2d(point, center));
|
|
637
638
|
return require_helpers.add2d(point, [orientedOffset * x, orientedOffset * y]);
|
|
@@ -642,15 +643,22 @@ var make2dOffset = (curve, offset) => {
|
|
|
642
643
|
lastPoint: offsetViaCenter(curve.lastPoint)
|
|
643
644
|
};
|
|
644
645
|
}
|
|
645
|
-
const
|
|
646
|
-
|
|
647
|
-
|
|
646
|
+
const radial = (point) => require_helpers.add2d(center, require_helpers.scalarMultiply2d(require_helpers.subtract2d(point, center), newRadius / radius));
|
|
647
|
+
if (!require_helpers.samePoint(curve.firstPoint, curve.lastPoint)) {
|
|
648
|
+
const mid = curve.value((curve.firstParameter + curve.lastParameter) / 2);
|
|
649
|
+
return require_blueprint.make2dThreePointArc(radial(curve.firstPoint), radial(mid), radial(curve.lastPoint));
|
|
650
|
+
}
|
|
651
|
+
const fullCircle = new require_blueprint.Curve2D(kernel.makeCircle2d(cx, cy, newRadius, counterClockwise));
|
|
652
|
+
const start = radial(curve.firstPoint);
|
|
653
|
+
if (require_helpers.samePoint(fullCircle.firstPoint, start)) return fullCircle;
|
|
648
654
|
try {
|
|
649
|
-
|
|
655
|
+
const proj = kernel.projectPointOnCurve2d(fullCircle.wrapped, start[0], start[1]);
|
|
656
|
+
const from = proj ? proj.param : fullCircle.firstParameter;
|
|
657
|
+
const period = fullCircle.lastParameter - fullCircle.firstParameter;
|
|
658
|
+
return new require_blueprint.Curve2D(kernel.trimCurve2d(fullCircle.wrapped, from, from + period));
|
|
650
659
|
} finally {
|
|
651
660
|
fullCircle.delete();
|
|
652
661
|
}
|
|
653
|
-
return new require_blueprint.Curve2D(trimmedHandle);
|
|
654
662
|
}
|
|
655
663
|
if (curveType === "LINE") {
|
|
656
664
|
const { firstPoint, lastPoint } = offsetEndPoints(curve.firstPoint, curve.lastPoint, offset);
|
|
@@ -673,6 +681,16 @@ var make2dOffset = (curve, offset) => {
|
|
|
673
681
|
return approximation;
|
|
674
682
|
};
|
|
675
683
|
// src/2d/lib/customCorners.ts
|
|
684
|
+
/**
|
|
685
|
+
* The offset curves of a corner can cross more than once (a line and an arc
|
|
686
|
+
* meeting at both ends of a semicircle); the fillet center is the crossing
|
|
687
|
+
* nearest the corner, whatever order the intersector reports them in.
|
|
688
|
+
*/
|
|
689
|
+
function nearestTo(points, corner) {
|
|
690
|
+
let best;
|
|
691
|
+
for (const p of points) if (!best || require_helpers.squareDistance2d(p, corner) < require_helpers.squareDistance2d(best, corner)) best = p;
|
|
692
|
+
return best;
|
|
693
|
+
}
|
|
676
694
|
/** Unwrap an intersection, discarding the common-segment curves the caller does not use. */
|
|
677
695
|
function intersectionPoints(first, second) {
|
|
678
696
|
const result = require_errors.unwrap(intersectCurves(first, second));
|
|
@@ -733,7 +751,7 @@ function removeCorner(firstCurve, secondCurve, radius) {
|
|
|
733
751
|
intersectionResult.value.commonSegments.forEach((c) => {
|
|
734
752
|
c.delete();
|
|
735
753
|
});
|
|
736
|
-
const potentialCenter = intersectionResult.value.intersections.
|
|
754
|
+
const potentialCenter = nearestTo(intersectionResult.value.intersections, firstCurve.lastPoint);
|
|
737
755
|
if (!require_blueprint.isPoint2D(potentialCenter)) return null;
|
|
738
756
|
const center = potentialCenter;
|
|
739
757
|
const splitForFillet = (curve, offsetCurve) => {
|
|
@@ -831,7 +849,7 @@ function dogboneFilletCurves(firstCurve, secondCurve, radius) {
|
|
|
831
849
|
intersectionResult2.value.commonSegments.forEach((c) => {
|
|
832
850
|
c.delete();
|
|
833
851
|
});
|
|
834
|
-
const potentialCenter = intersectionResult2.value.intersections.
|
|
852
|
+
const potentialCenter = nearestTo(intersectionResult2.value.intersections, firstCurve.lastPoint);
|
|
835
853
|
if (!require_blueprint.isPoint2D(potentialCenter)) return [firstCurve, secondCurve];
|
|
836
854
|
circle = require_blueprint.make2dCircle(radius, potentialCenter);
|
|
837
855
|
const firstInt = intersectionPoints(firstCurve, circle)[0];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { J as getKernel2D, q as getKernel } from "./shapeTypes-
|
|
1
|
+
import { J as getKernel2D, q as getKernel } from "./shapeTypes-BNGu103j.js";
|
|
2
2
|
import { i as wasmIndex, n as bug } from "./bug-ClMTAJhe.js";
|
|
3
3
|
import { E as ok, P as unwrap, g as err, n as computationError, s as safeIndex, x as isOk } from "./errors-BTccWbtE.js";
|
|
4
4
|
import { r as RAD2DEG, t as DEG2RAD } from "./constants-iraOnb2p.js";
|
|
5
5
|
import { t as firstOrThrow } from "./arrayAccess-BpgouNir.js";
|
|
6
|
-
import { _ as rotate2d, d as cartesianToPolar, f as crossProduct2d, g as polarToCartesian, h as polarAngle2d, l as add2d, p as distance2d, v as samePoint, x as subtract2d, y as scalarMultiply2d } from "./helpers-
|
|
7
|
-
import { C as isPoint2D, b as normalize2d, c as make2dBezierCurve, d as make2dEllipseArc, g as approximateAsBSpline, h as make2dThreePointArc, l as make2dCircle, m as make2dTangentArc, n as asSVG, p as make2dSegmentCurve, r as viewbox, s as make2dArcFromCenter, t as Blueprint, v as Curve2D, x as BoundingBox2d } from "./blueprint-
|
|
6
|
+
import { _ as rotate2d, b as squareDistance2d, d as cartesianToPolar, f as crossProduct2d, g as polarToCartesian, h as polarAngle2d, l as add2d, p as distance2d, v as samePoint, x as subtract2d, y as scalarMultiply2d } from "./helpers-DpGcM2qZ.js";
|
|
7
|
+
import { C as isPoint2D, b as normalize2d, c as make2dBezierCurve, d as make2dEllipseArc, g as approximateAsBSpline, h as make2dThreePointArc, l as make2dCircle, m as make2dTangentArc, n as asSVG, p as make2dSegmentCurve, r as viewbox, s as make2dArcFromCenter, t as Blueprint, v as Curve2D, x as BoundingBox2d } from "./blueprint-BS50D3J_.js";
|
|
8
8
|
// node_modules/flatqueue/index.js
|
|
9
9
|
/**
|
|
10
10
|
* @typedef {Float64ArrayConstructor | Float32ArrayConstructor |
|
|
@@ -609,7 +609,7 @@ var offsetEndPoints = (firstPoint, lastPoint, offset) => {
|
|
|
609
609
|
* instead of a `Curve2D`.
|
|
610
610
|
*
|
|
611
611
|
* @param curve - The source curve to offset.
|
|
612
|
-
* @param offset - Signed offset distance (positive =
|
|
612
|
+
* @param offset - Signed offset distance (positive = right of curve direction).
|
|
613
613
|
*
|
|
614
614
|
* @remarks Self-intersecting offset curves are replaced with a collapsed
|
|
615
615
|
* sentinel. This is a known simplification; a more robust trimming strategy
|
|
@@ -627,11 +627,12 @@ var make2dOffset = (curve, offset) => {
|
|
|
627
627
|
if (curveType === "CIRCLE") {
|
|
628
628
|
const circleData = kernel.getCurve2dCircleData(curve.wrapped);
|
|
629
629
|
if (!circleData) return make2dSegmentCurve(curve.firstPoint, curve.lastPoint);
|
|
630
|
-
const { cx, cy, radius
|
|
631
|
-
const
|
|
630
|
+
const { cx, cy, radius } = circleData;
|
|
631
|
+
const center = [cx, cy];
|
|
632
|
+
const counterClockwise = crossProduct2d(subtract2d(curve.firstPoint, center), curve.tangentAt(0)) > 0;
|
|
633
|
+
const orientedOffset = counterClockwise ? offset : -offset;
|
|
632
634
|
const newRadius = radius + orientedOffset;
|
|
633
635
|
if (newRadius < 1e-10) {
|
|
634
|
-
const center = [cx, cy];
|
|
635
636
|
const offsetViaCenter = (point) => {
|
|
636
637
|
const [x, y] = normalize2d(subtract2d(point, center));
|
|
637
638
|
return add2d(point, [orientedOffset * x, orientedOffset * y]);
|
|
@@ -642,15 +643,22 @@ var make2dOffset = (curve, offset) => {
|
|
|
642
643
|
lastPoint: offsetViaCenter(curve.lastPoint)
|
|
643
644
|
};
|
|
644
645
|
}
|
|
645
|
-
const
|
|
646
|
-
|
|
647
|
-
|
|
646
|
+
const radial = (point) => add2d(center, scalarMultiply2d(subtract2d(point, center), newRadius / radius));
|
|
647
|
+
if (!samePoint(curve.firstPoint, curve.lastPoint)) {
|
|
648
|
+
const mid = curve.value((curve.firstParameter + curve.lastParameter) / 2);
|
|
649
|
+
return make2dThreePointArc(radial(curve.firstPoint), radial(mid), radial(curve.lastPoint));
|
|
650
|
+
}
|
|
651
|
+
const fullCircle = new Curve2D(kernel.makeCircle2d(cx, cy, newRadius, counterClockwise));
|
|
652
|
+
const start = radial(curve.firstPoint);
|
|
653
|
+
if (samePoint(fullCircle.firstPoint, start)) return fullCircle;
|
|
648
654
|
try {
|
|
649
|
-
|
|
655
|
+
const proj = kernel.projectPointOnCurve2d(fullCircle.wrapped, start[0], start[1]);
|
|
656
|
+
const from = proj ? proj.param : fullCircle.firstParameter;
|
|
657
|
+
const period = fullCircle.lastParameter - fullCircle.firstParameter;
|
|
658
|
+
return new Curve2D(kernel.trimCurve2d(fullCircle.wrapped, from, from + period));
|
|
650
659
|
} finally {
|
|
651
660
|
fullCircle.delete();
|
|
652
661
|
}
|
|
653
|
-
return new Curve2D(trimmedHandle);
|
|
654
662
|
}
|
|
655
663
|
if (curveType === "LINE") {
|
|
656
664
|
const { firstPoint, lastPoint } = offsetEndPoints(curve.firstPoint, curve.lastPoint, offset);
|
|
@@ -673,6 +681,16 @@ var make2dOffset = (curve, offset) => {
|
|
|
673
681
|
return approximation;
|
|
674
682
|
};
|
|
675
683
|
// src/2d/lib/customCorners.ts
|
|
684
|
+
/**
|
|
685
|
+
* The offset curves of a corner can cross more than once (a line and an arc
|
|
686
|
+
* meeting at both ends of a semicircle); the fillet center is the crossing
|
|
687
|
+
* nearest the corner, whatever order the intersector reports them in.
|
|
688
|
+
*/
|
|
689
|
+
function nearestTo(points, corner) {
|
|
690
|
+
let best;
|
|
691
|
+
for (const p of points) if (!best || squareDistance2d(p, corner) < squareDistance2d(best, corner)) best = p;
|
|
692
|
+
return best;
|
|
693
|
+
}
|
|
676
694
|
/** Unwrap an intersection, discarding the common-segment curves the caller does not use. */
|
|
677
695
|
function intersectionPoints(first, second) {
|
|
678
696
|
const result = unwrap(intersectCurves(first, second));
|
|
@@ -733,7 +751,7 @@ function removeCorner(firstCurve, secondCurve, radius) {
|
|
|
733
751
|
intersectionResult.value.commonSegments.forEach((c) => {
|
|
734
752
|
c.delete();
|
|
735
753
|
});
|
|
736
|
-
const potentialCenter = intersectionResult.value.intersections.
|
|
754
|
+
const potentialCenter = nearestTo(intersectionResult.value.intersections, firstCurve.lastPoint);
|
|
737
755
|
if (!isPoint2D(potentialCenter)) return null;
|
|
738
756
|
const center = potentialCenter;
|
|
739
757
|
const splitForFillet = (curve, offsetCurve) => {
|
|
@@ -831,7 +849,7 @@ function dogboneFilletCurves(firstCurve, secondCurve, radius) {
|
|
|
831
849
|
intersectionResult2.value.commonSegments.forEach((c) => {
|
|
832
850
|
c.delete();
|
|
833
851
|
});
|
|
834
|
-
const potentialCenter = intersectionResult2.value.intersections.
|
|
852
|
+
const potentialCenter = nearestTo(intersectionResult2.value.intersections, firstCurve.lastPoint);
|
|
835
853
|
if (!isPoint2D(potentialCenter)) return [firstCurve, secondCurve];
|
|
836
854
|
circle = make2dCircle(radius, potentialCenter);
|
|
837
855
|
const firstInt = intersectionPoints(firstCurve, circle)[0];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const require_bug = require("./bug-CBcpIPuf.cjs");
|
|
2
2
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
3
3
|
const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
|
|
4
|
-
const require_surfaceBuilders = require("./surfaceBuilders-
|
|
5
|
-
const require_blueprintSketcher = require("./blueprintSketcher-
|
|
6
|
-
const require_helpers = require("./helpers-
|
|
7
|
-
const require_blueprint = require("./blueprint-
|
|
4
|
+
const require_surfaceBuilders = require("./surfaceBuilders-DOmDVuMs.cjs");
|
|
5
|
+
const require_blueprintSketcher = require("./blueprintSketcher-BG--DxWB.cjs");
|
|
6
|
+
const require_helpers = require("./helpers-BdGGaLhF.cjs");
|
|
7
|
+
const require_blueprint = require("./blueprint-17RUHsoP.cjs");
|
|
8
8
|
// src/2d/blueprints/cannedBlueprints.ts
|
|
9
9
|
/**
|
|
10
10
|
* Create a regular polygon blueprint inscribed in a circle of the given radius.
|
|
@@ -91,15 +91,6 @@ var samePoint = (x, y) => require_helpers.samePoint(x, y, require_helpers.PRECIS
|
|
|
91
91
|
function hashPoint(p) {
|
|
92
92
|
return `${p[0].toFixed(9)},${p[1].toFixed(9)}`;
|
|
93
93
|
}
|
|
94
|
-
/**
|
|
95
|
-
* Hash a segment by both orientations for bidirectional lookup.
|
|
96
|
-
* The smaller hash comes first so that (A,B) and (B,A) produce the same key.
|
|
97
|
-
*/
|
|
98
|
-
function hashSegment(first, last) {
|
|
99
|
-
const h1 = hashPoint(first);
|
|
100
|
-
const h2 = hashPoint(last);
|
|
101
|
-
return h1 < h2 ? `${h1}|${h2}` : `${h2}|${h1}`;
|
|
102
|
-
}
|
|
103
94
|
function startOfSegment(s) {
|
|
104
95
|
const first = s[0];
|
|
105
96
|
if (first === void 0) require_bug.bug("startOfSegment", "empty segment");
|
|
@@ -205,15 +196,10 @@ function rotateToStartAtSegment(curves, segment) {
|
|
|
205
196
|
// src/2d/blueprints/intersectionSegments.ts
|
|
206
197
|
function* createSegmentOnPoints(curves, allIntersections, allCommonSegments) {
|
|
207
198
|
const intersectionSet = new Set(allIntersections.map(hashPoint));
|
|
208
|
-
const commonSegmentSet = new Set(allCommonSegments.map((seg) => hashSegment(seg.firstPoint, seg.lastPoint)));
|
|
209
199
|
const matchesIntersection = (point) => {
|
|
210
200
|
if (intersectionSet.has(hashPoint(point))) return true;
|
|
211
201
|
return allIntersections.some((p) => samePoint(p, point));
|
|
212
202
|
};
|
|
213
|
-
const matchesCommonSegment = (first, last) => {
|
|
214
|
-
if (commonSegmentSet.has(hashSegment(first, last))) return true;
|
|
215
|
-
return allCommonSegments.some((seg) => samePoint(seg.firstPoint, first) && samePoint(seg.lastPoint, last) || samePoint(seg.firstPoint, last) && samePoint(seg.lastPoint, first));
|
|
216
|
-
};
|
|
217
203
|
let currentCurves = [];
|
|
218
204
|
for (const curve of curves) {
|
|
219
205
|
if (samePoint(curve.firstPoint, curve.lastPoint)) {
|
|
@@ -221,7 +207,7 @@ function* createSegmentOnPoints(curves, allIntersections, allCommonSegments) {
|
|
|
221
207
|
continue;
|
|
222
208
|
}
|
|
223
209
|
const endsAtIntersection = matchesIntersection(curve.lastPoint);
|
|
224
|
-
const isCommon =
|
|
210
|
+
const isCommon = isCommonSegmentMatch(allCommonSegments, [curve]);
|
|
225
211
|
if (endsAtIntersection) {
|
|
226
212
|
currentCurves.push(curve);
|
|
227
213
|
yield currentCurves;
|
|
@@ -297,13 +283,16 @@ function splitCurvesAtIntersections(curves, curvePoints) {
|
|
|
297
283
|
});
|
|
298
284
|
}
|
|
299
285
|
/**
|
|
300
|
-
* Check whether a segment
|
|
301
|
-
*
|
|
286
|
+
* Check whether a segment runs along one of the common segments, in either
|
|
287
|
+
* direction. Matching endpoints are not enough: two outlines that share an
|
|
288
|
+
* edge also join its endpoints with the rest of their boundaries.
|
|
302
289
|
*/
|
|
303
|
-
function isCommonSegmentMatch(
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
290
|
+
function isCommonSegmentMatch(commonSegments, segment) {
|
|
291
|
+
if (segment.length === 0) return false;
|
|
292
|
+
const segmentStart = startOfSegment(segment);
|
|
293
|
+
const segmentEnd = endOfSegment(segment);
|
|
294
|
+
return commonSegments.some((common) => {
|
|
295
|
+
return (samePoint(common.firstPoint, segmentStart) && samePoint(common.lastPoint, segmentEnd) || samePoint(common.firstPoint, segmentEnd) && samePoint(common.lastPoint, segmentStart)) && segment.every((curve) => common.distanceFrom(curveMidPoint(curve)) < 1e-6);
|
|
307
296
|
});
|
|
308
297
|
}
|
|
309
298
|
/**
|
|
@@ -319,7 +308,6 @@ function blueprintsIntersectionSegments(first, second) {
|
|
|
319
308
|
if (rawIntersections.length <= 1) return null;
|
|
320
309
|
let firstCurveSegments = splitCurvesAtIntersections(first.curves, firstCurvePoints);
|
|
321
310
|
let secondCurveSegments = splitCurvesAtIntersections(second.curves, secondCurvePoints);
|
|
322
|
-
const commonSegmentsPoints = allCommonSegments.map((c) => [c.firstPoint, c.lastPoint]);
|
|
323
311
|
const allIntersections = removeNonCrossingPoints(removeNonCrossingPoints(rawIntersections, firstCurveSegments, second), secondCurveSegments, first);
|
|
324
312
|
if (allIntersections.length === 0 && allCommonSegments.length === 0) return null;
|
|
325
313
|
if (allCommonSegments.length === 0) {
|
|
@@ -340,7 +328,11 @@ function blueprintsIntersectionSegments(first, second) {
|
|
|
340
328
|
if (firstSeg !== void 0 && secondSeg !== void 0) {
|
|
341
329
|
const endpointsMismatch = !samePoint(endOfSegment(secondSeg), endOfSegment(firstSeg));
|
|
342
330
|
const commonSegmentLengthMismatch = allCommonSegments.length > 0 && secondSeg.length !== 1;
|
|
343
|
-
if (endpointsMismatch || commonSegmentLengthMismatch)
|
|
331
|
+
if (endpointsMismatch || commonSegmentLengthMismatch) {
|
|
332
|
+
secondIntersectedSegments = reverseSegments(secondIntersectedSegments);
|
|
333
|
+
const last = secondIntersectedSegments[secondIntersectedSegments.length - 1];
|
|
334
|
+
if (last !== void 0 && isCommonSegmentMatch(allCommonSegments, last)) secondIntersectedSegments = [last, ...secondIntersectedSegments.slice(0, -1)];
|
|
335
|
+
}
|
|
344
336
|
}
|
|
345
337
|
const maxLen = Math.max(firstIntersectedSegments.length, secondIntersectedSegments.length);
|
|
346
338
|
const result = [];
|
|
@@ -353,7 +345,7 @@ function blueprintsIntersectionSegments(first, second) {
|
|
|
353
345
|
result.push([available, available]);
|
|
354
346
|
continue;
|
|
355
347
|
}
|
|
356
|
-
if (isCommonSegmentMatch(
|
|
348
|
+
if (isCommonSegmentMatch(allCommonSegments, firstSeg2)) result.push([firstSeg2, "same"]);
|
|
357
349
|
else result.push([firstSeg2, secondSeg2]);
|
|
358
350
|
}
|
|
359
351
|
return result;
|
|
@@ -512,13 +504,30 @@ function booleanOperation(first, second, config) {
|
|
|
512
504
|
}
|
|
513
505
|
return require_blueprintSketcher.organiseBlueprints(paths);
|
|
514
506
|
}
|
|
507
|
+
/**
|
|
508
|
+
* A point of `outline` that is not on `other`'s boundary. Outlines that only touch
|
|
509
|
+
* can meet at a curve's midpoint, where an inside test cannot tell which side is
|
|
510
|
+
* which, so several points along each curve are tried.
|
|
511
|
+
*/
|
|
512
|
+
function pointOffBoundary(outline, other) {
|
|
513
|
+
for (const curve of outline.curves) for (const fraction of [
|
|
514
|
+
.5,
|
|
515
|
+
.25,
|
|
516
|
+
.75
|
|
517
|
+
]) {
|
|
518
|
+
const point = curve.value(curve.firstParameter + fraction * (curve.lastParameter - curve.firstParameter));
|
|
519
|
+
if (!other.curves.some((c) => c.isOnCurve(point))) return point;
|
|
520
|
+
}
|
|
521
|
+
return null;
|
|
522
|
+
}
|
|
515
523
|
function buildNoIntersectionResult(first, second) {
|
|
516
|
-
const
|
|
517
|
-
const
|
|
524
|
+
const firstPoint = pointOffBoundary(first, second);
|
|
525
|
+
const secondPoint = pointOffBoundary(second, first);
|
|
526
|
+
if (firstPoint === null || secondPoint === null) return { identical: true };
|
|
518
527
|
return {
|
|
519
528
|
identical: false,
|
|
520
|
-
firstCurveInSecond:
|
|
521
|
-
secondCurveInFirst:
|
|
529
|
+
firstCurveInSecond: second.isInside(firstPoint),
|
|
530
|
+
secondCurveInFirst: first.isInside(secondPoint)
|
|
522
531
|
};
|
|
523
532
|
}
|
|
524
533
|
// src/2d/blueprints/booleanOperations.ts
|
|
@@ -603,23 +612,6 @@ function intersectBlueprints(first, second) {
|
|
|
603
612
|
return null;
|
|
604
613
|
}
|
|
605
614
|
// src/2d/blueprints/boolean2D.ts
|
|
606
|
-
var genericIntersects = (first, second) => {
|
|
607
|
-
if (first instanceof require_blueprint.Blueprint && second instanceof require_blueprint.Blueprint) {
|
|
608
|
-
let allIntersections = [];
|
|
609
|
-
first.curves.forEach((thisCurve) => {
|
|
610
|
-
second.curves.forEach((otherCurve) => {
|
|
611
|
-
const { intersections, commonSegmentsPoints } = require_errors.unwrap(require_blueprintSketcher.intersectCurves(thisCurve, otherCurve));
|
|
612
|
-
allIntersections.push(...intersections);
|
|
613
|
-
allIntersections.push(...commonSegmentsPoints);
|
|
614
|
-
});
|
|
615
|
-
});
|
|
616
|
-
allIntersections = require_blueprint.removeDuplicatePoints(allIntersections);
|
|
617
|
-
return allIntersections.length > 1;
|
|
618
|
-
}
|
|
619
|
-
if (first instanceof require_blueprintSketcher.CompoundBlueprint || first instanceof require_blueprintSketcher.Blueprints) return first.blueprints.some((bp) => genericIntersects(bp, second));
|
|
620
|
-
if (second instanceof require_blueprintSketcher.CompoundBlueprint || second instanceof require_blueprintSketcher.Blueprints) return second.blueprints.some((bp) => genericIntersects(first, bp));
|
|
621
|
-
require_bug.bug("genericIntersects", "Unhandled shape combination in genericIntersects");
|
|
622
|
-
};
|
|
623
615
|
var genericFuse = (first, second) => {
|
|
624
616
|
if (first instanceof require_blueprintSketcher.CompoundBlueprint) {
|
|
625
617
|
if (second instanceof require_blueprint.Blueprint) return fuseBlueprintWithCompound(second, first);
|
|
@@ -656,7 +648,6 @@ var fuseIntersectingBlueprints = (blueprints) => {
|
|
|
656
648
|
otherIsFused = true;
|
|
657
649
|
}
|
|
658
650
|
if (blueprint.boundingBox.isOut(otherBlueprint.boundingBox)) return;
|
|
659
|
-
if (!genericIntersects(blueprint, otherBlueprint)) return;
|
|
660
651
|
let newFused;
|
|
661
652
|
if (blueprint instanceof require_blueprintSketcher.Blueprints || otherBlueprint instanceof require_blueprintSketcher.Blueprints) {
|
|
662
653
|
const fused = fuse2D(blueprint, otherBlueprint);
|
|
@@ -785,6 +776,7 @@ var cut2D = (first, second) => {
|
|
|
785
776
|
if (first instanceof require_blueprintSketcher.CompoundBlueprint) {
|
|
786
777
|
const wrapper = require_errors.safeIndex(first.blueprints, 0, "cut2D");
|
|
787
778
|
if (second instanceof require_blueprint.Blueprint && !second.intersects(wrapper)) {
|
|
779
|
+
if (second.isInside(wrapper.firstPoint)) return null;
|
|
788
780
|
if (!wrapper.isInside(second.firstPoint)) return first.clone();
|
|
789
781
|
const cuts = fuse2D(second, new require_blueprintSketcher.Blueprints(first.blueprints.slice(1)));
|
|
790
782
|
return require_blueprintSketcher.organiseBlueprints([wrapper, ...allBlueprints(cuts)]);
|