brepjs 11.0.1 → 12.0.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.
- package/dist/2d/lib/definitions.d.ts +2 -1
- package/dist/2d/lib/definitions.d.ts.map +1 -1
- package/dist/2d/lib/precision.d.ts +4 -7
- package/dist/2d/lib/precision.d.ts.map +1 -1
- package/dist/2d/lib/vectorOperations.d.ts +1 -37
- package/dist/2d/lib/vectorOperations.d.ts.map +1 -1
- package/dist/2d.cjs +2 -2
- package/dist/2d.js +3 -3
- package/dist/{Blueprint-BbgdNjMG.cjs → Blueprint-CFdLzoy5.cjs} +16 -8
- package/dist/{Blueprint-SMLvu1pH.js → Blueprint-DQ18yiAI.js} +21 -13
- package/dist/{boolean2D-DiHJyuu4.cjs → boolean2D-C5tjWX5T.cjs} +18 -18
- package/dist/{boolean2D-BGxBWwCm.js → boolean2D-Dq3HF-Pd.js} +9 -9
- package/dist/{booleanFns-Bl8hInM_.js → booleanFns-DdU6eLxI.js} +5 -5
- package/dist/{booleanFns-BaMEij5u.cjs → booleanFns-PbcD1St_.cjs} +5 -5
- package/dist/brepjs.cjs +24 -20
- package/dist/brepjs.js +204 -200
- package/dist/core/errors.d.ts +4 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/kernelCall.d.ts.map +1 -1
- package/dist/core.cjs +4 -3
- package/dist/core.d.ts +1 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +10 -9
- package/dist/{cornerFinder-CDkc5qfD.cjs → cornerFinder-BphV9OLn.cjs} +1 -1
- package/dist/{cornerFinder-C_rN-yag.js → cornerFinder-Dv3C7Yen.js} +1 -1
- package/dist/{curveFns-Dtaf2CvG.cjs → curveFns-CeHbFVDc.cjs} +2 -2
- package/dist/{curveFns-DeYQQ18o.js → curveFns-GOcBuoCc.js} +2 -2
- package/dist/{drawFns-CkFd3lT4.js → drawFns-7fN_tn1I.js} +13 -13
- package/dist/{drawFns-NsqGSBEK.cjs → drawFns-F5uDtd2v.cjs} +13 -13
- package/dist/{errors-DiTn5EoC.cjs → errors-9fDehDNc.cjs} +7 -1
- package/dist/{errors-lBwyc8YG.js → errors-B7kgv0cd.js} +21 -15
- package/dist/{faceFns-DVo4NiOl.cjs → faceFns-Bhlm333o.cjs} +2 -2
- package/dist/{faceFns-DZU8VAlq.js → faceFns-g5hzl_xe.js} +2 -2
- package/dist/{helpers-BOPjTzbq.cjs → helpers-D3jdmQoR.cjs} +9 -18
- package/dist/{helpers-D8jYqufG.js → helpers-Vqsg_fss.js} +8 -17
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/io.cjs +4 -4
- package/dist/io.js +4 -4
- package/dist/kernel/brepkit2d.d.ts +6 -0
- package/dist/kernel/brepkit2d.d.ts.map +1 -1
- package/dist/kernel/index.d.ts.map +1 -1
- package/dist/kernel/meshOps.d.ts +3 -18
- package/dist/kernel/meshOps.d.ts.map +1 -1
- package/dist/{loft-BpScchbu.cjs → loft-B3ZDn94G.cjs} +5 -5
- package/dist/{loft-BmO0VYht.js → loft-BGHICbBS.js} +5 -5
- package/dist/{measurement-Crexq3aQ.cjs → measurement--jEL3ePF.cjs} +2 -2
- package/dist/{measurement-CZzV1bmg.js → measurement-Ce4oE8Fg.js} +2 -2
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-DE8uUdKS.js → meshFns-bHjCcOZp.js} +3 -3
- package/dist/{meshFns-d6Ta_uov.cjs → meshFns-rTBykpgO.cjs} +3 -3
- package/dist/{operations-CGbdoQvO.cjs → operations-Cb4gWPwL.cjs} +6 -6
- package/dist/{operations-Qr5m0lUU.js → operations-D3BtYsAB.js} +6 -6
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/projection/cameraFns.d.ts.map +1 -1
- package/dist/query.cjs +4 -4
- package/dist/query.js +5 -5
- package/dist/result.cjs +1 -1
- package/dist/result.js +7 -7
- package/dist/{shapeFns-vrqpeRIf.cjs → shapeFns-BHSGfqFS.cjs} +3 -3
- package/dist/{shapeFns-BmOzkjTF.js → shapeFns-smSl7yhL.js} +3 -3
- package/dist/{shapeTypes-CHvr4HNj.cjs → shapeTypes-BzrjB5be.cjs} +4 -307
- package/dist/{shapeTypes-CGYrwYIi.js → shapeTypes-Py3LEyDe.js} +4 -307
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{solidBuilders-Bo8N2UV1.cjs → solidBuilders-DINhvxLC.cjs} +3 -3
- package/dist/{solidBuilders-CDzxISP2.js → solidBuilders-Jh5Bnm02.js} +3 -3
- package/dist/{surfaceBuilders-DIPPckQg.cjs → surfaceBuilders-BCd-ugN2.cjs} +3 -3
- package/dist/{surfaceBuilders-CIEQ9j7C.js → surfaceBuilders-CD_9kc1m.js} +3 -3
- package/dist/{topology-DiWPQ0YS.cjs → topology-B15z3Ts4.cjs} +9 -9
- package/dist/{topology-9-u8A3nq.js → topology-DmQY6469.js} +9 -9
- package/dist/topology.cjs +6 -6
- package/dist/topology.js +6 -6
- package/dist/utils/vec2d.d.ts +55 -0
- package/dist/utils/vec2d.d.ts.map +1 -0
- package/dist/{vectors-DqQXtR8s.cjs → vectors-TlfO1hu2.cjs} +1 -1
- package/dist/{vectors-B8RRTytu.js → vectors-cec8p8NQ.js} +1 -1
- package/dist/vectors.cjs +1 -1
- package/dist/vectors.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Point2D } from '../../utils/vec2d.js';
|
|
1
2
|
/** A 2D point or vector represented as an `[x, y]` tuple. */
|
|
2
|
-
export type Point2D
|
|
3
|
+
export type { Point2D } from '../../utils/vec2d.js';
|
|
3
4
|
/** Type guard that checks whether a value is a `Point2D`. */
|
|
4
5
|
export declare function isPoint2D(point: unknown): point is Point2D;
|
|
5
6
|
/** A 2x2 matrix represented as two row tuples. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../src/2d/lib/definitions.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../src/2d/lib/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,6DAA6D;AAC7D,YAAY,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,6DAA6D;AAC7D,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAO1D;AAED,kDAAkD;AAClD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE7D,+DAA+D;AAC/D,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,SAAS,CAYhE"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared precision constants for the 2D module.
|
|
2
|
+
* Shared precision constants for the 2D module — re-exports from Layer 0.
|
|
3
|
+
*
|
|
4
|
+
* ADR-0006: src/utils/vec2d.ts is the canonical source.
|
|
3
5
|
*
|
|
4
6
|
* Hierarchy (from tightest to loosest):
|
|
5
7
|
* - PRECISION_INTERSECTION (1e-9): curve intersection, parameter lookups
|
|
6
8
|
* - PRECISION_OFFSET (1e-8): offset operations (scaled ×10, ÷100, ×100 internally)
|
|
7
9
|
* - PRECISION_POINT (1e-6): point-equality checks (default for samePoint)
|
|
8
10
|
*/
|
|
9
|
-
|
|
10
|
-
export declare const PRECISION_INTERSECTION = 1e-9;
|
|
11
|
-
/** Base precision for offset operations — scaled internally for sub-tasks. */
|
|
12
|
-
export declare const PRECISION_OFFSET = 1e-8;
|
|
13
|
-
/** Default precision for point-equality comparisons. */
|
|
14
|
-
export declare const PRECISION_POINT = 0.000001;
|
|
11
|
+
export { PRECISION_INTERSECTION, PRECISION_OFFSET, PRECISION_POINT } from '../../utils/vec2d.js';
|
|
15
12
|
//# sourceMappingURL=precision.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"precision.d.ts","sourceRoot":"","sources":["../../../src/2d/lib/precision.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"precision.d.ts","sourceRoot":"","sources":["../../../src/2d/lib/precision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,45 +1,9 @@
|
|
|
1
1
|
import { Point2D } from './definitions.js';
|
|
2
|
-
|
|
3
|
-
export declare const samePoint: ([x0, y0]: Point2D, [x1, y1]: Point2D, precision?: number) => boolean;
|
|
4
|
-
/** Add two 2D vectors component-wise. */
|
|
5
|
-
export declare const add2d: ([x0, y0]: Point2D, [x1, y1]: Point2D) => Point2D;
|
|
6
|
-
/** Subtract the second 2D vector from the first. */
|
|
7
|
-
export declare const subtract2d: ([x0, y0]: Point2D, [x1, y1]: Point2D) => Point2D;
|
|
8
|
-
/** Multiply a 2D vector by a scalar. */
|
|
9
|
-
export declare const scalarMultiply2d: ([x0, y0]: Point2D, scalar: number) => Point2D;
|
|
10
|
-
/** Compute the Euclidean distance between two 2D points (defaults to distance from origin). */
|
|
11
|
-
export declare const distance2d: ([x0, y0]: Point2D, [x1, y1]?: Point2D) => number;
|
|
12
|
-
/** Compute the squared Euclidean distance between two 2D points (avoids a sqrt). */
|
|
13
|
-
export declare const squareDistance2d: ([x0, y0]: Point2D, [x1, y1]?: Point2D) => number;
|
|
14
|
-
/** Compute the 2D cross product (z-component of the 3D cross product). */
|
|
15
|
-
export declare function crossProduct2d([x0, y0]: Point2D, [x1, y1]: Point2D): number;
|
|
16
|
-
/** Compute the dot product of two 2D vectors. */
|
|
17
|
-
export declare function dotProduct2d([x0, y0]: Point2D, [x1, y1]: Point2D): number;
|
|
18
|
-
/** Compute the signed angle (in radians) between two 2D vectors. */
|
|
19
|
-
export declare const angle2d: ([x0, y0]: Point2D, [x1, y1]?: Point2D) => number;
|
|
20
|
-
/** Compute the polar angle (in radians) from the first point to the second. */
|
|
21
|
-
export declare const polarAngle2d: ([x0, y0]: Point2D, [x1, y1]?: Point2D) => number;
|
|
2
|
+
export { samePoint, add2d, subtract2d, scalarMultiply2d, distance2d, squareDistance2d, crossProduct2d, dotProduct2d, angle2d, polarAngle2d, rotate2d, polarToCartesian, cartesianToPolar, } from '../../utils/vec2d.js';
|
|
22
3
|
/**
|
|
23
4
|
* Normalize a 2D vector to unit length.
|
|
24
5
|
*
|
|
25
6
|
* @throws When the vector has near-zero length.
|
|
26
7
|
*/
|
|
27
8
|
export declare const normalize2d: ([x0, y0]: Point2D) => Point2D;
|
|
28
|
-
/**
|
|
29
|
-
* Rotate a 2D point around a center by a given angle (in radians).
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```ts
|
|
33
|
-
* rotate2d([1, 0], Math.PI / 2); // approximately [0, 1]
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export declare const rotate2d: (point: Point2D, angle: number, center?: Point2D) => Point2D;
|
|
37
|
-
/** Convert polar coordinates (r, theta) to a Cartesian Point2D. */
|
|
38
|
-
export declare const polarToCartesian: (r: number, theta: number) => Point2D;
|
|
39
|
-
/**
|
|
40
|
-
* Convert a Cartesian Point2D to polar coordinates.
|
|
41
|
-
*
|
|
42
|
-
* @returns A tuple of `[radius, theta]`.
|
|
43
|
-
*/
|
|
44
|
-
export declare const cartesianToPolar: ([x, y]: Point2D) => [number, number];
|
|
45
9
|
//# sourceMappingURL=vectorOperations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vectorOperations.d.ts","sourceRoot":"","sources":["../../../src/2d/lib/vectorOperations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD,
|
|
1
|
+
{"version":3,"file":"vectorOperations.d.ts","sourceRoot":"","sources":["../../../src/2d/lib/vectorOperations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD,OAAO,EACL,SAAS,EACT,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,OAAO,KAAG,OAM/C,CAAC"}
|
package/dist/2d.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const Blueprint = require("./Blueprint-
|
|
4
|
-
const boolean2D = require("./boolean2D-
|
|
3
|
+
const Blueprint = require("./Blueprint-CFdLzoy5.cjs");
|
|
4
|
+
const boolean2D = require("./boolean2D-C5tjWX5T.cjs");
|
|
5
5
|
function reverseCurve(curve) {
|
|
6
6
|
const cloned = curve.clone();
|
|
7
7
|
cloned.reverse();
|
package/dist/2d.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as Blueprint } from "./Blueprint-
|
|
2
|
-
import { d, C } from "./Blueprint-
|
|
3
|
-
import { e, C as C2, f, l, g, n, k, q, o, p, r } from "./boolean2D-
|
|
1
|
+
import { B as Blueprint } from "./Blueprint-DQ18yiAI.js";
|
|
2
|
+
import { d, C } from "./Blueprint-DQ18yiAI.js";
|
|
3
|
+
import { e, C as C2, f, l, g, n, k, q, o, p, r } from "./boolean2D-Dq3HF-Pd.js";
|
|
4
4
|
function reverseCurve(curve) {
|
|
5
5
|
const cloned = curve.clone();
|
|
6
6
|
cloned.reverse();
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const vectors = require("./vectors-
|
|
2
|
+
const vectors = require("./vectors-TlfO1hu2.cjs");
|
|
3
3
|
const types = require("./types-CA_xrgDq.cjs");
|
|
4
|
-
const shapeTypes = require("./shapeTypes-
|
|
5
|
-
const faceFns = require("./faceFns-
|
|
6
|
-
const curveFns = require("./curveFns-
|
|
7
|
-
const errors = require("./errors-
|
|
8
|
-
const helpers = require("./helpers-
|
|
4
|
+
const shapeTypes = require("./shapeTypes-BzrjB5be.cjs");
|
|
5
|
+
const faceFns = require("./faceFns-Bhlm333o.cjs");
|
|
6
|
+
const curveFns = require("./curveFns-CeHbFVDc.cjs");
|
|
7
|
+
const errors = require("./errors-9fDehDNc.cjs");
|
|
8
|
+
const helpers = require("./helpers-D3jdmQoR.cjs");
|
|
9
9
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
10
|
-
const surfaceBuilders = require("./surfaceBuilders-
|
|
10
|
+
const surfaceBuilders = require("./surfaceBuilders-BCd-ugN2.cjs");
|
|
11
11
|
const result = require("./result.cjs");
|
|
12
12
|
function makePlane(plane, origin) {
|
|
13
13
|
if (plane && typeof plane !== "string") {
|
|
@@ -139,6 +139,13 @@ class BoundingBox2d {
|
|
|
139
139
|
return !shapeTypes.getKernel2D().isBBox2dOutPoint(this.wrapped, other[0], other[1]);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
+
const normalize2d = ([x0, y0]) => {
|
|
143
|
+
const l = helpers.distance2d([x0, y0]);
|
|
144
|
+
if (l < 1e-12) {
|
|
145
|
+
result.bug("normalize2d", "Cannot normalize zero-length vector");
|
|
146
|
+
}
|
|
147
|
+
return [x0 / l, y0 / l];
|
|
148
|
+
};
|
|
142
149
|
function deserializeCurve2D(data) {
|
|
143
150
|
return new Curve2D(shapeTypes.getKernel().deserializeCurve2d(data));
|
|
144
151
|
}
|
|
@@ -504,7 +511,7 @@ function make2dInerpolatedBSplineCurve(points, {
|
|
|
504
511
|
const make2dArcFromCenter = (startPoint, endPoint, center, longArc = false) => {
|
|
505
512
|
const midChord = helpers.scalarMultiply2d(helpers.add2d(startPoint, endPoint), 0.5);
|
|
506
513
|
const orientedRadius = helpers.distance2d(center, startPoint) * (longArc ? -1 : 1);
|
|
507
|
-
const midChordDir =
|
|
514
|
+
const midChordDir = normalize2d(helpers.subtract2d(midChord, center));
|
|
508
515
|
return make2dThreePointArc(
|
|
509
516
|
startPoint,
|
|
510
517
|
helpers.add2d(helpers.scalarMultiply2d(midChordDir, orientedRadius), center),
|
|
@@ -991,5 +998,6 @@ exports.make2dTangentArc = make2dTangentArc;
|
|
|
991
998
|
exports.make2dThreePointArc = make2dThreePointArc;
|
|
992
999
|
exports.makePlane = makePlane;
|
|
993
1000
|
exports.mirror = mirror;
|
|
1001
|
+
exports.normalize2d = normalize2d;
|
|
994
1002
|
exports.removeDuplicatePoints = removeDuplicatePoints;
|
|
995
1003
|
exports.viewbox = viewbox;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { r as resolvePlane } from "./vectors-
|
|
1
|
+
import { r as resolvePlane } from "./vectors-cec8p8NQ.js";
|
|
2
2
|
import { a as toVec3 } from "./types-CWDdqcrq.js";
|
|
3
|
-
import { B as getKernel, J as getKernel2D, K as registerForCleanup, L as unregisterFromCleanup, H as createEdge, G as createWire } from "./shapeTypes-
|
|
4
|
-
import { u as uvBounds, f as faceGeomType, e as faceCenter, h as uvCoordinates, c as cast } from "./faceFns-
|
|
5
|
-
import { g as getOrientation } from "./curveFns-
|
|
6
|
-
import { o as ok, e as err, b as computationError,
|
|
7
|
-
import { d as distance2d, s as samePoint, b as scalarMultiply2d, c as add2d,
|
|
3
|
+
import { B as getKernel, J as getKernel2D, K as registerForCleanup, L as unregisterFromCleanup, H as createEdge, G as createWire } from "./shapeTypes-Py3LEyDe.js";
|
|
4
|
+
import { u as uvBounds, f as faceGeomType, e as faceCenter, h as uvCoordinates, c as cast } from "./faceFns-g5hzl_xe.js";
|
|
5
|
+
import { g as getOrientation } from "./curveFns-GOcBuoCc.js";
|
|
6
|
+
import { o as ok, e as err, b as computationError, r as unwrap, y as validationError } from "./errors-B7kgv0cd.js";
|
|
7
|
+
import { d as distance2d, s as samePoint, b as scalarMultiply2d, c as add2d, e as subtract2d, g as getSingleFace } from "./helpers-Vqsg_fss.js";
|
|
8
8
|
import { R as RAD2DEG, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
|
|
9
|
-
import { m as makeFace } from "./surfaceBuilders-
|
|
9
|
+
import { m as makeFace } from "./surfaceBuilders-CD_9kc1m.js";
|
|
10
10
|
import { bug } from "./result.js";
|
|
11
11
|
function makePlane(plane, origin) {
|
|
12
12
|
if (plane && typeof plane !== "string") {
|
|
@@ -138,6 +138,13 @@ class BoundingBox2d {
|
|
|
138
138
|
return !getKernel2D().isBBox2dOutPoint(this.wrapped, other[0], other[1]);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
+
const normalize2d = ([x0, y0]) => {
|
|
142
|
+
const l = distance2d([x0, y0]);
|
|
143
|
+
if (l < 1e-12) {
|
|
144
|
+
bug("normalize2d", "Cannot normalize zero-length vector");
|
|
145
|
+
}
|
|
146
|
+
return [x0 / l, y0 / l];
|
|
147
|
+
};
|
|
141
148
|
function deserializeCurve2D(data) {
|
|
142
149
|
return new Curve2D(getKernel().deserializeCurve2d(data));
|
|
143
150
|
}
|
|
@@ -986,11 +993,12 @@ export {
|
|
|
986
993
|
isPoint2D as k,
|
|
987
994
|
make2dThreePointArc as l,
|
|
988
995
|
mirror as m,
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
996
|
+
normalize2d as n,
|
|
997
|
+
asSVG as o,
|
|
998
|
+
make2dEllipseArc as p,
|
|
999
|
+
make2dTangentArc as q,
|
|
1000
|
+
make2dBezierCurve as r,
|
|
1001
|
+
removeDuplicatePoints as s,
|
|
1002
|
+
makePlane as t,
|
|
995
1003
|
viewbox as v
|
|
996
1004
|
};
|
|
@@ -44,18 +44,18 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
44
44
|
};
|
|
45
45
|
return next();
|
|
46
46
|
};
|
|
47
|
-
const vectors = require("./vectors-
|
|
48
|
-
const errors = require("./errors-
|
|
49
|
-
const faceFns = require("./faceFns-
|
|
47
|
+
const vectors = require("./vectors-TlfO1hu2.cjs");
|
|
48
|
+
const errors = require("./errors-9fDehDNc.cjs");
|
|
49
|
+
const faceFns = require("./faceFns-Bhlm333o.cjs");
|
|
50
50
|
const types = require("./types-CA_xrgDq.cjs");
|
|
51
51
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
52
|
-
const loft = require("./loft-
|
|
53
|
-
const shapeTypes = require("./shapeTypes-
|
|
54
|
-
const curveFns = require("./curveFns-
|
|
55
|
-
const surfaceBuilders = require("./surfaceBuilders-
|
|
52
|
+
const loft = require("./loft-B3ZDn94G.cjs");
|
|
53
|
+
const shapeTypes = require("./shapeTypes-BzrjB5be.cjs");
|
|
54
|
+
const curveFns = require("./curveFns-CeHbFVDc.cjs");
|
|
55
|
+
const surfaceBuilders = require("./surfaceBuilders-BCd-ugN2.cjs");
|
|
56
56
|
const result = require("./result.cjs");
|
|
57
|
-
const helpers = require("./helpers-
|
|
58
|
-
const Blueprint = require("./Blueprint-
|
|
57
|
+
const helpers = require("./helpers-D3jdmQoR.cjs");
|
|
58
|
+
const Blueprint = require("./Blueprint-CFdLzoy5.cjs");
|
|
59
59
|
const intersectCurves = (first, second, precision = 1e-9) => {
|
|
60
60
|
if (first.boundingBox.isOut(second.boundingBox))
|
|
61
61
|
return errors.ok({ intersections: [], commonSegments: [], commonSegmentsPoints: [] });
|
|
@@ -92,7 +92,7 @@ const selfIntersections = (curve, precision = 1e-9) => {
|
|
|
92
92
|
return errors.ok(intersections);
|
|
93
93
|
};
|
|
94
94
|
const offsetEndPoints = (firstPoint, lastPoint, offset) => {
|
|
95
|
-
const tangent =
|
|
95
|
+
const tangent = Blueprint.normalize2d(helpers.subtract2d(lastPoint, firstPoint));
|
|
96
96
|
const normal = [tangent[1], -tangent[0]];
|
|
97
97
|
const offsetVec = [normal[0] * offset, normal[1] * offset];
|
|
98
98
|
return {
|
|
@@ -113,7 +113,7 @@ const make2dOffset = (curve, offset) => {
|
|
|
113
113
|
if (newRadius < 1e-10) {
|
|
114
114
|
const center = [cx, cy];
|
|
115
115
|
const offsetViaCenter = (point) => {
|
|
116
|
-
const [x, y] =
|
|
116
|
+
const [x, y] = Blueprint.normalize2d(helpers.subtract2d(point, center));
|
|
117
117
|
return helpers.add2d(point, [orientedOffset * x, orientedOffset * y]);
|
|
118
118
|
};
|
|
119
119
|
return {
|
|
@@ -170,7 +170,7 @@ function removeCorner(firstCurve, secondCurve, radius) {
|
|
|
170
170
|
const center = potentialCenter;
|
|
171
171
|
const splitForFillet = (curve, offsetCurve) => {
|
|
172
172
|
const [x, y] = offsetCurve.tangentAt(center);
|
|
173
|
-
const normal =
|
|
173
|
+
const normal = Blueprint.normalize2d([-y, x]);
|
|
174
174
|
const splitPoint = helpers.add2d(center, helpers.scalarMultiply2d(normal, offset));
|
|
175
175
|
const splitParam = errors.unwrap(curve.parameter(splitPoint, 1e-6));
|
|
176
176
|
return curve.splitAt([splitParam]);
|
|
@@ -196,8 +196,8 @@ function chamferCurves(firstCurve, secondCurve, radius) {
|
|
|
196
196
|
return [first, Blueprint.make2dSegmentCurve(first.lastPoint, second.firstPoint), second];
|
|
197
197
|
}
|
|
198
198
|
function dogboneFilletCurves(firstCurve, secondCurve, radius) {
|
|
199
|
-
const tgt1 =
|
|
200
|
-
const tgt2 =
|
|
199
|
+
const tgt1 = Blueprint.normalize2d(firstCurve.tangentAt(1));
|
|
200
|
+
const tgt2 = Blueprint.normalize2d(secondCurve.tangentAt(0));
|
|
201
201
|
const sinAngle = helpers.crossProduct2d(tgt1, tgt2);
|
|
202
202
|
const a = Math.asin(sinAngle);
|
|
203
203
|
if (Math.abs(sinAngle) < 1e-10) return [firstCurve, secondCurve];
|
|
@@ -1251,7 +1251,7 @@ function makeEllipseArcFromSvgParams(startUV, endUV, majorRadius, minorRadius, r
|
|
|
1251
1251
|
const convertAxis = (ax) => helpers.distance2d(convertToUV(ax));
|
|
1252
1252
|
const r1 = convertAxis(helpers.polarToCartesian(majorRadius, radRotationAngle));
|
|
1253
1253
|
const r2 = convertAxis(helpers.polarToCartesian(minorRadius, radRotationAngle + Math.PI / 2));
|
|
1254
|
-
const xDir =
|
|
1254
|
+
const xDir = Blueprint.normalize2d(convertToUV(helpers.rotate2d([1, 0], radRotationAngle)));
|
|
1255
1255
|
const [, newRotationAngle] = helpers.cartesianToPolar(xDir);
|
|
1256
1256
|
const { cx, cy, startAngle, endAngle, clockwise, rx, ry } = convertSvgEllipseParams(
|
|
1257
1257
|
startUV,
|
|
@@ -1407,7 +1407,7 @@ class BaseSketcher2d {
|
|
|
1407
1407
|
/** Draw a line tangent to the previous curve, extending by the given distance. */
|
|
1408
1408
|
tangentLine(distance) {
|
|
1409
1409
|
const previousCurve = this._requireLastCurve("Sketcher2d.tangentLine", "sketch a tangent line");
|
|
1410
|
-
const direction =
|
|
1410
|
+
const direction = Blueprint.normalize2d(this._convertFromUV(previousCurve.tangentAt(1)));
|
|
1411
1411
|
return this.line(direction[0] * distance, direction[1] * distance);
|
|
1412
1412
|
}
|
|
1413
1413
|
// ── Three-point arcs ──
|
|
@@ -1569,7 +1569,7 @@ class BaseSketcher2d {
|
|
|
1569
1569
|
} else {
|
|
1570
1570
|
startPoleDirection = this._convertFromUV(previousCurve.tangentAt(1));
|
|
1571
1571
|
}
|
|
1572
|
-
startPoleDirection =
|
|
1572
|
+
startPoleDirection = Blueprint.normalize2d(startPoleDirection);
|
|
1573
1573
|
const startControl = [
|
|
1574
1574
|
this.pointer[0] + startPoleDirection[0] * startFactor * defaultDistance,
|
|
1575
1575
|
this.pointer[1] + startPoleDirection[1] * startFactor * defaultDistance
|
|
@@ -1580,7 +1580,7 @@ class BaseSketcher2d {
|
|
|
1580
1580
|
} else {
|
|
1581
1581
|
endPoleDirection = endTangent;
|
|
1582
1582
|
}
|
|
1583
|
-
endPoleDirection =
|
|
1583
|
+
endPoleDirection = Blueprint.normalize2d(endPoleDirection);
|
|
1584
1584
|
const endControl = [
|
|
1585
1585
|
end[0] - endPoleDirection[0] * endFactor * defaultDistance,
|
|
1586
1586
|
end[1] - endPoleDirection[1] * endFactor * defaultDistance
|
|
@@ -43,18 +43,18 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
43
43
|
};
|
|
44
44
|
return next();
|
|
45
45
|
};
|
|
46
|
-
import { a as createPlane } from "./vectors-
|
|
47
|
-
import { o as ok, e as err, b as computationError,
|
|
48
|
-
import { d as downcast, u as uvBounds, p as pointOnSurface, n as normalAt } from "./faceFns-
|
|
46
|
+
import { a as createPlane } from "./vectors-cec8p8NQ.js";
|
|
47
|
+
import { o as ok, e as err, b as computationError, r as unwrap, g as isOk } from "./errors-B7kgv0cd.js";
|
|
48
|
+
import { d as downcast, u as uvBounds, p as pointOnSurface, n as normalAt } from "./faceFns-g5hzl_xe.js";
|
|
49
49
|
import { a as toVec3 } from "./types-CWDdqcrq.js";
|
|
50
50
|
import { n as vecScale, j as vecNormalize, b as vecCross, D as DEG2RAD, R as RAD2DEG } from "./vecOps-ZDdZWbwT.js";
|
|
51
|
-
import { r as revolution, c as complexExtrude, t as twistExtrude, b as basicFaceExtrusion, g as genericSweep, l as loft } from "./loft-
|
|
52
|
-
import { J as getKernel2D, I as createFace, G as createWire, B as getKernel, H as createEdge, D as DisposalScope } from "./shapeTypes-
|
|
53
|
-
import { d as curveStartPoint, c as curveTangentAt, e as curveIsClosed } from "./curveFns-
|
|
54
|
-
import { m as makeFace, l as makeNewFaceWithinFace, b as assembleWire, z as zip } from "./surfaceBuilders-
|
|
51
|
+
import { r as revolution, c as complexExtrude, t as twistExtrude, b as basicFaceExtrusion, g as genericSweep, l as loft } from "./loft-BGHICbBS.js";
|
|
52
|
+
import { J as getKernel2D, I as createFace, G as createWire, B as getKernel, H as createEdge, D as DisposalScope } from "./shapeTypes-Py3LEyDe.js";
|
|
53
|
+
import { d as curveStartPoint, c as curveTangentAt, e as curveIsClosed } from "./curveFns-GOcBuoCc.js";
|
|
54
|
+
import { m as makeFace, l as makeNewFaceWithinFace, b as assembleWire, z as zip } from "./surfaceBuilders-CD_9kc1m.js";
|
|
55
55
|
import { bug } from "./result.js";
|
|
56
|
-
import { s as samePoint$1,
|
|
57
|
-
import { C as Curve2D, a as make2dSegmentCurve, j as approximateAsBSpline, b as make2dArcFromCenter, k as isPoint2D, g as make2dCircle, l as make2dThreePointArc, d as BoundingBox2d, v as viewbox,
|
|
56
|
+
import { s as samePoint$1, e as subtract2d, c as add2d, i as crossProduct2d, b as scalarMultiply2d, f as polarToCartesian, r as rotate2d, j as cartesianToPolar, d as distance2d, p as polarAngle2d, k as PRECISION_INTERSECTION } from "./helpers-Vqsg_fss.js";
|
|
57
|
+
import { C as Curve2D, a as make2dSegmentCurve, j as approximateAsBSpline, n as normalize2d, b as make2dArcFromCenter, k as isPoint2D, g as make2dCircle, l as make2dThreePointArc, d as BoundingBox2d, v as viewbox, o as asSVG, B as Blueprint, p as make2dEllipseArc, q as make2dTangentArc, r as make2dBezierCurve, s as removeDuplicatePoints } from "./Blueprint-DQ18yiAI.js";
|
|
58
58
|
const intersectCurves = (first, second, precision = 1e-9) => {
|
|
59
59
|
if (first.boundingBox.isOut(second.boundingBox))
|
|
60
60
|
return ok({ intersections: [], commonSegments: [], commonSegmentsPoints: [] });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { B as getKernel, c as castShape, p as isShape3D } from "./shapeTypes-
|
|
2
|
-
import { o as ok, d as isErr, e as err,
|
|
3
|
-
import { r as resolvePlane } from "./vectors-
|
|
1
|
+
import { B as getKernel, c as castShape, p as isShape3D } from "./shapeTypes-Py3LEyDe.js";
|
|
2
|
+
import { o as ok, d as isErr, e as err, y as validationError, B as BrepErrorCode, p as typeCastError, k as kernelError } from "./errors-B7kgv0cd.js";
|
|
3
|
+
import { r as resolvePlane } from "./vectors-cec8p8NQ.js";
|
|
4
4
|
import { H as HASH_CODE_MAX, n as vecScale, v as vecAdd } from "./vecOps-ZDdZWbwT.js";
|
|
5
|
-
import { a as getFaces, p as propagateOriginsFromEvolution, b as propagateOriginsByHash, g as getFaceOrigins, c as getWires, d as getEdges, e as getVertices } from "./shapeFns-
|
|
6
|
-
import { m as makeFace } from "./surfaceBuilders-
|
|
5
|
+
import { a as getFaces, p as propagateOriginsFromEvolution, b as propagateOriginsByHash, g as getFaceOrigins, c as getWires, d as getEdges, e as getVertices } from "./shapeFns-smSl7yhL.js";
|
|
6
|
+
import { m as makeFace } from "./surfaceBuilders-CD_9kc1m.js";
|
|
7
7
|
const shapeTagStore = /* @__PURE__ */ new WeakMap();
|
|
8
8
|
const tagMetadataStore = /* @__PURE__ */ new WeakMap();
|
|
9
9
|
function hasFaceTags(shape) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const shapeTypes = require("./shapeTypes-
|
|
3
|
-
const errors = require("./errors-
|
|
4
|
-
const vectors = require("./vectors-
|
|
2
|
+
const shapeTypes = require("./shapeTypes-BzrjB5be.cjs");
|
|
3
|
+
const errors = require("./errors-9fDehDNc.cjs");
|
|
4
|
+
const vectors = require("./vectors-TlfO1hu2.cjs");
|
|
5
5
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
6
|
-
const shapeFns = require("./shapeFns-
|
|
7
|
-
const surfaceBuilders = require("./surfaceBuilders-
|
|
6
|
+
const shapeFns = require("./shapeFns-BHSGfqFS.cjs");
|
|
7
|
+
const surfaceBuilders = require("./surfaceBuilders-BCd-ugN2.cjs");
|
|
8
8
|
const shapeTagStore = /* @__PURE__ */ new WeakMap();
|
|
9
9
|
const tagMetadataStore = /* @__PURE__ */ new WeakMap();
|
|
10
10
|
function hasFaceTags(shape) {
|
package/dist/brepjs.cjs
CHANGED
|
@@ -45,31 +45,31 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
45
45
|
return next();
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
48
|
-
const shapeTypes = require("./shapeTypes-
|
|
49
|
-
const errors = require("./errors-
|
|
48
|
+
const shapeTypes = require("./shapeTypes-BzrjB5be.cjs");
|
|
49
|
+
const errors = require("./errors-9fDehDNc.cjs");
|
|
50
50
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
51
|
-
const Blueprint = require("./Blueprint-
|
|
52
|
-
const loft$2 = require("./loft-
|
|
53
|
-
const operations = require("./operations-
|
|
54
|
-
const boolean2D = require("./boolean2D-
|
|
51
|
+
const Blueprint = require("./Blueprint-CFdLzoy5.cjs");
|
|
52
|
+
const loft$2 = require("./loft-B3ZDn94G.cjs");
|
|
53
|
+
const operations = require("./operations-Cb4gWPwL.cjs");
|
|
54
|
+
const boolean2D = require("./boolean2D-C5tjWX5T.cjs");
|
|
55
55
|
const _2d = require("./2d.cjs");
|
|
56
|
-
const helpers = require("./helpers-
|
|
56
|
+
const helpers = require("./helpers-D3jdmQoR.cjs");
|
|
57
57
|
const io = require("./io.cjs");
|
|
58
|
-
const drawFns = require("./drawFns-
|
|
58
|
+
const drawFns = require("./drawFns-F5uDtd2v.cjs");
|
|
59
59
|
const types = require("./types-CA_xrgDq.cjs");
|
|
60
|
-
const vectors = require("./vectors-
|
|
61
|
-
const shapeFns = require("./shapeFns-
|
|
62
|
-
const booleanFns = require("./booleanFns-
|
|
63
|
-
const topology = require("./topology-
|
|
64
|
-
const curveFns = require("./curveFns-
|
|
65
|
-
const faceFns = require("./faceFns-
|
|
66
|
-
const meshFns = require("./meshFns-
|
|
67
|
-
const measurement = require("./measurement
|
|
68
|
-
const surfaceBuilders = require("./surfaceBuilders-
|
|
60
|
+
const vectors = require("./vectors-TlfO1hu2.cjs");
|
|
61
|
+
const shapeFns = require("./shapeFns-BHSGfqFS.cjs");
|
|
62
|
+
const booleanFns = require("./booleanFns-PbcD1St_.cjs");
|
|
63
|
+
const topology = require("./topology-B15z3Ts4.cjs");
|
|
64
|
+
const curveFns = require("./curveFns-CeHbFVDc.cjs");
|
|
65
|
+
const faceFns = require("./faceFns-Bhlm333o.cjs");
|
|
66
|
+
const meshFns = require("./meshFns-rTBykpgO.cjs");
|
|
67
|
+
const measurement = require("./measurement--jEL3ePF.cjs");
|
|
68
|
+
const surfaceBuilders = require("./surfaceBuilders-BCd-ugN2.cjs");
|
|
69
69
|
const query = require("./query.cjs");
|
|
70
|
-
const solidBuilders = require("./solidBuilders-
|
|
70
|
+
const solidBuilders = require("./solidBuilders-DINhvxLC.cjs");
|
|
71
71
|
const result = require("./result.cjs");
|
|
72
|
-
const cornerFinder = require("./cornerFinder-
|
|
72
|
+
const cornerFinder = require("./cornerFinder-BphV9OLn.cjs");
|
|
73
73
|
const worker = require("./worker.cjs");
|
|
74
74
|
function supportsProjection(kernel) {
|
|
75
75
|
return "projectShape" in kernel;
|
|
@@ -82,7 +82,10 @@ const errorFactories = {
|
|
|
82
82
|
MODULE_INIT: (code, message, cause) => ({ kind: "MODULE_INIT", code, message, cause }),
|
|
83
83
|
COMPUTATION: (code, message, cause) => ({ kind: "COMPUTATION", code, message, cause }),
|
|
84
84
|
IO: (code, message, cause) => ({ kind: "IO", code, message, cause }),
|
|
85
|
-
QUERY: (code, message, cause) => ({ kind: "QUERY", code, message, cause })
|
|
85
|
+
QUERY: (code, message, cause) => ({ kind: "QUERY", code, message, cause }),
|
|
86
|
+
// NB: UNSUPPORTED exists for Record<BrepErrorKind> exhaustiveness.
|
|
87
|
+
// Prefer explicit `return err(unsupportedError(...))` in adapter code (ADR-0006).
|
|
88
|
+
UNSUPPORTED: (code, message, cause) => ({ kind: "UNSUPPORTED", code, message, cause })
|
|
86
89
|
};
|
|
87
90
|
function kernelCall(fn, code, message, kind = "KERNEL_OPERATION") {
|
|
88
91
|
try {
|
|
@@ -2663,6 +2666,7 @@ exports.tapErr = errors.tapErr;
|
|
|
2663
2666
|
exports.tryCatch = errors.tryCatch;
|
|
2664
2667
|
exports.tryCatchAsync = errors.tryCatchAsync;
|
|
2665
2668
|
exports.typeCastError = errors.typeCastError;
|
|
2669
|
+
exports.unsupportedError = errors.unsupportedError;
|
|
2666
2670
|
exports.unwrap = errors.unwrap;
|
|
2667
2671
|
exports.unwrapErr = errors.unwrapErr;
|
|
2668
2672
|
exports.unwrapOr = errors.unwrapOr;
|