brepjs 18.124.0 → 18.124.2
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.cjs +10 -8
- package/dist/2d.js +10 -8
- package/dist/{adjacencyFns-BJ6jcQ-N.cjs → adjacencyFns-CpKlADYt.cjs} +3 -3
- package/dist/{adjacencyFns-CnehwLNj.js → adjacencyFns-DECdcer5.js} +3 -3
- package/dist/{blueprint-BGWbpQ-w.js → blueprint-CaY00-X2.js} +16 -11
- package/dist/{blueprint-BSfG0Uik.cjs → blueprint-CpJLcUJV.cjs} +14 -10
- package/dist/{blueprintFns-C0-nGqlW.cjs → blueprintFns-B5nFaJI0.cjs} +2 -2
- package/dist/{blueprintFns-Bt1hKlL7.js → blueprintFns-vgwEIgI0.js} +2 -2
- package/dist/{blueprintSketcher-Bd5ZS9p6.cjs → blueprintSketcher-4e0yYtCY.cjs} +19 -11
- package/dist/{blueprintSketcher-BTGRoQ_G.js → blueprintSketcher-BjBjj2cK.js} +19 -11
- package/dist/{boolean2D-Cr6oLsbf.cjs → boolean2D-7heWA1co.cjs} +12 -8
- package/dist/{boolean2D-zZ9-qR5a.js → boolean2D-Bk-VrRyQ.js} +14 -9
- package/dist/brepjs.cjs +121 -81
- package/dist/brepjs.js +132 -85
- package/dist/{cameraFns-j2I9G3L_.cjs → cameraFns-CGwrxgqB.cjs} +5 -4
- package/dist/{cameraFns-CGMawqfi.js → cameraFns-DKEilV2v.js} +5 -4
- package/dist/core.cjs +2 -2
- package/dist/core.js +2 -2
- package/dist/{cornerFinder-CaXBdZz9.js → cornerFinder-C4s6pVZ-.js} +1 -1
- package/dist/{cornerFinder-CPwSLgpM.cjs → cornerFinder-zEgIFMnk.cjs} +1 -1
- package/dist/{curveFns-BBLaLG1U.cjs → curveFns-BZZYHVow.cjs} +8 -5
- package/dist/{curveFns-BoHbhtqX.js → curveFns-RczIU30U.js} +8 -5
- package/dist/{drawFns-DOkSdo8E.cjs → drawFns-BcXzWFfn.cjs} +59 -30
- package/dist/{drawFns-BrRbAeYB.js → drawFns-BjT3RaeQ.js} +59 -30
- package/dist/{faceFns-UozswcwP.cjs → faceFns-C4xNv2zn.cjs} +4 -3
- package/dist/{faceFns-Ce7Fq6j5.js → faceFns-fvp_zfuI.js} +6 -4
- package/dist/{healingFns-Dn0EFSHm.js → healingFns-AE5182Ds.js} +38 -21
- package/dist/{healingFns-mKogaVOk.cjs → healingFns-SxSiVPQa.cjs} +38 -21
- package/dist/{helpers-DuTAcGVX.cjs → helpers-CHYzwQMk.cjs} +6 -6
- package/dist/{helpers-CZsK8STz.js → helpers-CyLQ07aD.js} +6 -6
- package/dist/{importFns-Ch2YwieP.cjs → importFns-90S7P_7P.cjs} +5 -6
- package/dist/{importFns-CE4byS-8.js → importFns-DdXOAX6k.js} +5 -6
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
- package/dist/{loftFns-BYiUcAxk.cjs → loftFns-B3mbh5RA.cjs} +15 -9
- package/dist/{loftFns-DQVg8qxM.js → loftFns-CyY4qfvC.js} +15 -9
- package/dist/{measureFns-BbLLBg5q.js → measureFns-B1uLQugf.js} +3 -3
- package/dist/{measureFns-Cao9gY1L.cjs → measureFns-Cx2XJVVC.cjs} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-CnYIUU9b.cjs → meshFns-2ZxW-X9I.cjs} +3 -3
- package/dist/{meshFns-B6NveFwc.js → meshFns-DrO3d03M.js} +3 -3
- package/dist/{occtWasmAdapter-BQKQXF63.js → occtWasmAdapter-BEe---7w.js} +3 -1
- package/dist/{occtWasmAdapter-Aubfbks6.cjs → occtWasmAdapter-DEpy64ji.cjs} +3 -1
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{originTrackingFns-uz38yuMp.cjs → originTrackingFns-D3rUK08B.cjs} +2 -2
- package/dist/{originTrackingFns-DXcggmgf.js → originTrackingFns-DIAwMSih.js} +2 -2
- package/dist/{primitiveFns-CmmTWOkO.js → primitiveFns-CDPqVTcc.js} +7 -5
- package/dist/{primitiveFns-DmEPf6av.cjs → primitiveFns-c7wqS-K2.cjs} +7 -5
- 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-CnPEaqHw.cjs → refResolveFns-Cm8ZHPl5.cjs} +10 -8
- package/dist/{refResolveFns-DqY7Cd00.js → refResolveFns-o3-Gdnjn.js} +10 -8
- package/dist/{rolldown-runtime-DakpK96I.cjs → rolldown-runtime-C0BPl7ul.cjs} +1 -1
- package/dist/{shapeFns-BLZ1dDSz.cjs → shapeFns-CJ6mph9b.cjs} +2 -2
- package/dist/{shapeFns-mYczuWOy.js → shapeFns-DEpbxB9Z.js} +2 -2
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeTypes-bHlssytH.js → shapeTypes-BHRboc_x.js} +235 -20
- package/dist/{shapeTypes-DZKuRt24.cjs → shapeTypes-D5Y41q7x.cjs} +219 -12
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-5tA9O1SM.cjs → solidBuilders-CsUkRC69.cjs} +14 -9
- package/dist/{solidBuilders-9s-j-ZiW.js → solidBuilders-DQQ0re9T.js} +14 -9
- package/dist/{surfaceBuilders-0x7j0ibk.cjs → surfaceBuilders-BXNZydNl.cjs} +7 -5
- package/dist/{surfaceBuilders-B7UnwkQz.js → surfaceBuilders-C8k0K7DR.js} +7 -5
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-DE3M-E9o.js → textBlueprints-BAyLXffK.js} +36 -21
- package/dist/{textBlueprints-BPbIpA4-.cjs → textBlueprints-t8MdWfki.cjs} +37 -22
- package/dist/{textMetrics-D3Bly1w4.js → textMetrics-CefI-bMN.js} +3 -2
- package/dist/{textMetrics-rRuWxQG_.cjs → textMetrics-DUEI9s5M.cjs} +3 -2
- package/dist/{threadFns-BAjFNk2_.js → threadFns-Bau5Sqad.js} +17 -12
- package/dist/{threadFns-BMT6ziG_.cjs → threadFns-OVYAleOH.cjs} +17 -12
- package/dist/topology.cjs +9 -9
- package/dist/topology.js +9 -9
- package/dist/{topologyQueryFns-DVhWxBwT.js → topologyQueryFns-QvPyCF-7.js} +1 -1
- package/dist/{topologyQueryFns-DZUpJz2p.cjs → topologyQueryFns-gah07J7-.cjs} +1 -1
- package/dist/{validityTypes-19mfqWVv.js → validityTypes-DokbYKzd.js} +1 -1
- package/dist/{validityTypes-CCnRq3A9.cjs → validityTypes-Dx-04qO0.cjs} +1 -1
- package/package.json +7 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_constants = require("./constants-BOVyEYGH.cjs");
|
|
2
2
|
const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
3
|
-
const require_helpers = require("./helpers-
|
|
3
|
+
const require_helpers = require("./helpers-CHYzwQMk.cjs");
|
|
4
4
|
//#region src/query/cornerFinder.ts
|
|
5
5
|
var PI_2 = 2 * Math.PI;
|
|
6
6
|
function positiveHalfAngle(angle) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-D5Y41q7x.cjs");
|
|
2
2
|
const require_errors = require("./errors-RHkKO5bZ.cjs");
|
|
3
3
|
//#region src/topology/curveFns.ts
|
|
4
4
|
/**
|
|
@@ -133,7 +133,8 @@ function flipOrientation(shape) {
|
|
|
133
133
|
function interpolateCurve(points, options = {}) {
|
|
134
134
|
if (points.length < 2) return require_errors.err(require_errors.typeCastError("INTERPOLATE_MIN_POINTS", "Interpolation requires at least 2 points"));
|
|
135
135
|
try {
|
|
136
|
-
const
|
|
136
|
+
const result = require_shapeTypes.getKernel().interpolatePoints(points, options);
|
|
137
|
+
const cast = require_shapeTypes.castResultShape(result);
|
|
137
138
|
if (!require_shapeTypes.isEdge(cast)) {
|
|
138
139
|
require_shapeTypes.disposeResultShape(cast);
|
|
139
140
|
return require_errors.err(require_errors.typeCastError("INTERPOLATE_NOT_EDGE", "Interpolation did not produce an edge"));
|
|
@@ -153,7 +154,8 @@ function interpolateCurve(points, options = {}) {
|
|
|
153
154
|
function approximateCurve(points, options = {}) {
|
|
154
155
|
if (points.length < 2) return require_errors.err(require_errors.typeCastError("APPROXIMATE_MIN_POINTS", "Approximation requires at least 2 points"));
|
|
155
156
|
try {
|
|
156
|
-
const
|
|
157
|
+
const result = require_shapeTypes.getKernel().approximatePoints(points, options);
|
|
158
|
+
const cast = require_shapeTypes.castResultShape(result);
|
|
157
159
|
if (!require_shapeTypes.isEdge(cast)) {
|
|
158
160
|
require_shapeTypes.disposeResultShape(cast);
|
|
159
161
|
return require_errors.err(require_errors.typeCastError("APPROXIMATE_NOT_EDGE", "Approximation did not produce an edge"));
|
|
@@ -172,12 +174,13 @@ function approximateCurve(points, options = {}) {
|
|
|
172
174
|
* @returns Ok with the offset wire, or Err if the operation fails.
|
|
173
175
|
*/
|
|
174
176
|
function offsetWire2D(wire, offset, kind = "arc") {
|
|
175
|
-
const
|
|
177
|
+
const resultShape = require_shapeTypes.getKernel().offsetWire2D(wire.wrapped, offset, {
|
|
176
178
|
arc: "arc",
|
|
177
179
|
intersection: "intersection",
|
|
178
180
|
tangent: "tangent",
|
|
179
181
|
chamfer: "intersection"
|
|
180
|
-
}[kind])
|
|
182
|
+
}[kind]);
|
|
183
|
+
const wrapped = require_shapeTypes.castResultShape(resultShape);
|
|
181
184
|
if (!require_shapeTypes.isWire(wrapped)) {
|
|
182
185
|
require_shapeTypes.disposeResultShape(wrapped);
|
|
183
186
|
return require_errors.err(require_errors.typeCastError("OFFSET_NOT_WIRE", "Offset did not produce a Wire"));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { K as getKernel, T as isWire, h as disposeResultShape, n as castResultShape, v as isEdge } from "./shapeTypes-
|
|
1
|
+
import { K as getKernel, T as isWire, h as disposeResultShape, n as castResultShape, v as isEdge } from "./shapeTypes-BHRboc_x.js";
|
|
2
2
|
import { E as ok, g as err, l as typeCastError } from "./errors-MHLiNE-C.js";
|
|
3
3
|
//#region src/topology/curveFns.ts
|
|
4
4
|
/**
|
|
@@ -133,7 +133,8 @@ function flipOrientation(shape) {
|
|
|
133
133
|
function interpolateCurve(points, options = {}) {
|
|
134
134
|
if (points.length < 2) return err(typeCastError("INTERPOLATE_MIN_POINTS", "Interpolation requires at least 2 points"));
|
|
135
135
|
try {
|
|
136
|
-
const
|
|
136
|
+
const result = getKernel().interpolatePoints(points, options);
|
|
137
|
+
const cast = castResultShape(result);
|
|
137
138
|
if (!isEdge(cast)) {
|
|
138
139
|
disposeResultShape(cast);
|
|
139
140
|
return err(typeCastError("INTERPOLATE_NOT_EDGE", "Interpolation did not produce an edge"));
|
|
@@ -153,7 +154,8 @@ function interpolateCurve(points, options = {}) {
|
|
|
153
154
|
function approximateCurve(points, options = {}) {
|
|
154
155
|
if (points.length < 2) return err(typeCastError("APPROXIMATE_MIN_POINTS", "Approximation requires at least 2 points"));
|
|
155
156
|
try {
|
|
156
|
-
const
|
|
157
|
+
const result = getKernel().approximatePoints(points, options);
|
|
158
|
+
const cast = castResultShape(result);
|
|
157
159
|
if (!isEdge(cast)) {
|
|
158
160
|
disposeResultShape(cast);
|
|
159
161
|
return err(typeCastError("APPROXIMATE_NOT_EDGE", "Approximation did not produce an edge"));
|
|
@@ -172,12 +174,13 @@ function approximateCurve(points, options = {}) {
|
|
|
172
174
|
* @returns Ok with the offset wire, or Err if the operation fails.
|
|
173
175
|
*/
|
|
174
176
|
function offsetWire2D(wire, offset, kind = "arc") {
|
|
175
|
-
const
|
|
177
|
+
const resultShape = getKernel().offsetWire2D(wire.wrapped, offset, {
|
|
176
178
|
arc: "arc",
|
|
177
179
|
intersection: "intersection",
|
|
178
180
|
tangent: "tangent",
|
|
179
181
|
chamfer: "intersection"
|
|
180
|
-
}[kind])
|
|
182
|
+
}[kind]);
|
|
183
|
+
const wrapped = castResultShape(resultShape);
|
|
181
184
|
if (!isWire(wrapped)) {
|
|
182
185
|
disposeResultShape(wrapped);
|
|
183
186
|
return err(typeCastError("OFFSET_NOT_WIRE", "Offset did not produce a Wire"));
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-D5Y41q7x.cjs");
|
|
2
2
|
const require_bug = require("./bug-O02CsAmt.cjs");
|
|
3
3
|
const require_errors = require("./errors-RHkKO5bZ.cjs");
|
|
4
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
4
|
+
const require_topologyQueryFns = require("./topologyQueryFns-gah07J7-.cjs");
|
|
5
5
|
const require_constants = require("./constants-BOVyEYGH.cjs");
|
|
6
6
|
const require_types = require("./types-KjA8tY4Y.cjs");
|
|
7
7
|
const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
|
|
8
8
|
const require_planeOps = require("./planeOps-VlFxtvzY.cjs");
|
|
9
|
-
const require_faceFns = require("./faceFns-
|
|
10
|
-
const require_curveFns = require("./curveFns-
|
|
9
|
+
const require_faceFns = require("./faceFns-C4xNv2zn.cjs");
|
|
10
|
+
const require_curveFns = require("./curveFns-BZZYHVow.cjs");
|
|
11
11
|
const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
12
|
-
const require_surfaceBuilders = require("./surfaceBuilders-
|
|
13
|
-
const require_blueprintSketcher = require("./blueprintSketcher-
|
|
14
|
-
const require_helpers = require("./helpers-
|
|
15
|
-
const require_blueprint = require("./blueprint-
|
|
16
|
-
const require_cornerFinder = require("./cornerFinder-
|
|
17
|
-
const require_boolean2D = require("./boolean2D-
|
|
18
|
-
const require_textBlueprints = require("./textBlueprints-
|
|
19
|
-
const require_cameraFns = require("./cameraFns-
|
|
12
|
+
const require_surfaceBuilders = require("./surfaceBuilders-BXNZydNl.cjs");
|
|
13
|
+
const require_blueprintSketcher = require("./blueprintSketcher-4e0yYtCY.cjs");
|
|
14
|
+
const require_helpers = require("./helpers-CHYzwQMk.cjs");
|
|
15
|
+
const require_blueprint = require("./blueprint-CpJLcUJV.cjs");
|
|
16
|
+
const require_cornerFinder = require("./cornerFinder-zEgIFMnk.cjs");
|
|
17
|
+
const require_boolean2D = require("./boolean2D-7heWA1co.cjs");
|
|
18
|
+
const require_textBlueprints = require("./textBlueprints-t8MdWfki.cjs");
|
|
19
|
+
const require_cameraFns = require("./cameraFns-CGwrxgqB.cjs");
|
|
20
20
|
//#region src/2d/lib/stitching.ts
|
|
21
21
|
/**
|
|
22
22
|
* Group a flat list of curves into connected chains by matching endpoints.
|
|
@@ -116,7 +116,8 @@ var Sketcher = class extends require_blueprintSketcher.BaseSketcher2d {
|
|
|
116
116
|
var _usingCtx$4 = require_shapeTypes._usingCtx();
|
|
117
117
|
if (!this.pendingCurves.length) require_bug.bug("Sketcher.buildWire", "No lines to convert into a wire");
|
|
118
118
|
const scope = _usingCtx$4.u(new require_shapeTypes.DisposalScope());
|
|
119
|
-
|
|
119
|
+
const edges = require_blueprint.curvesAsEdgesOnPlane(this.pendingCurves, this.plane).map((e) => scope.register(e));
|
|
120
|
+
return require_errors.unwrap(require_surfaceBuilders.assembleWire(edges));
|
|
120
121
|
} catch (_) {
|
|
121
122
|
_usingCtx$4.e = _;
|
|
122
123
|
} finally {
|
|
@@ -145,9 +146,16 @@ var Sketcher = class extends require_blueprintSketcher.BaseSketcher2d {
|
|
|
145
146
|
if (require_helpers.samePoint(this.pointer, this.firstPoint)) require_bug.bug("Sketcher.closeWithMirror", "Cannot close with a mirror when the sketch is already closed");
|
|
146
147
|
const wire = this.buildWire();
|
|
147
148
|
const pointer3d = require_planeOps.planeToWorld(this.plane, this.pointer);
|
|
148
|
-
const
|
|
149
|
+
const firstPoint3d = require_planeOps.planeToWorld(this.plane, this.firstPoint);
|
|
150
|
+
const diff = require_vecOps.vecSub(pointer3d, firstPoint3d);
|
|
151
|
+
const startToEndVector = require_vecOps.vecNormalize(diff);
|
|
152
|
+
const normal = require_vecOps.vecCross(startToEndVector, this.plane.zDir);
|
|
149
153
|
const clonedWrapped = require_errors.unwrap(require_faceFns.downcast(wire.wrapped));
|
|
150
|
-
|
|
154
|
+
const mirroredRaw = require_shapeTypes.getKernel().mirror(clonedWrapped, require_types.toVec3(pointer3d), require_types.toVec3(normal));
|
|
155
|
+
const mirroredWrapped = require_errors.unwrap(require_faceFns.downcast(mirroredRaw));
|
|
156
|
+
const mirroredWire = require_shapeTypes.createWire(mirroredWrapped);
|
|
157
|
+
const combinedWire = require_errors.unwrap(require_surfaceBuilders.assembleWire([wire, mirroredWire]));
|
|
158
|
+
return new require_textBlueprints.Sketch(combinedWire, {
|
|
151
159
|
defaultOrigin: this.plane.origin,
|
|
152
160
|
defaultDirection: this.plane.zDir
|
|
153
161
|
});
|
|
@@ -205,9 +213,10 @@ var FaceSketcher = class extends require_blueprintSketcher.BaseSketcher2d {
|
|
|
205
213
|
buildWire() {
|
|
206
214
|
const kernel = require_shapeTypes.getKernel();
|
|
207
215
|
const geomSurf = this._adaptSurface();
|
|
208
|
-
const
|
|
216
|
+
const edges = this.pendingCurves.map((curve) => {
|
|
209
217
|
return require_shapeTypes.createEdge(kernel.buildEdgeOnSurface(curve.wrapped, geomSurf));
|
|
210
|
-
})
|
|
218
|
+
});
|
|
219
|
+
const wire = require_errors.unwrap(require_surfaceBuilders.assembleWire(edges));
|
|
211
220
|
kernel.buildCurves3d(wire.wrapped);
|
|
212
221
|
return wire;
|
|
213
222
|
}
|
|
@@ -221,7 +230,8 @@ var FaceSketcher = class extends require_blueprintSketcher.BaseSketcher2d {
|
|
|
221
230
|
if (require_curveFns.curveIsClosed(wire)) {
|
|
222
231
|
const face = scope.register(sketch.clone().face());
|
|
223
232
|
const origin = require_faceFns.pointOnSurface(face, .5, .5);
|
|
224
|
-
const
|
|
233
|
+
const normal = require_faceFns.normalAt(face);
|
|
234
|
+
const direction = require_vecOps.vecScale(normal, -1);
|
|
225
235
|
sketch.defaultOrigin = [
|
|
226
236
|
origin[0],
|
|
227
237
|
origin[1],
|
|
@@ -302,7 +312,9 @@ var sketchCircle = (radius, planeConfig = {}) => {
|
|
|
302
312
|
try {
|
|
303
313
|
var _usingCtx$2 = require_shapeTypes._usingCtx();
|
|
304
314
|
const plane = planeConfig.plane && typeof planeConfig.plane !== "string" ? { ...planeConfig.plane } : require_errors.unwrap(require_planeOps.resolvePlane(planeConfig.plane ?? "XY", planeConfig.origin));
|
|
305
|
-
|
|
315
|
+
const scope = _usingCtx$2.u(new require_shapeTypes.DisposalScope());
|
|
316
|
+
const wire = require_errors.unwrap(require_surfaceBuilders.assembleWire([scope.register(require_surfaceBuilders.makeCircle(radius, plane.origin, plane.zDir))]));
|
|
317
|
+
return new require_textBlueprints.Sketch(wire, {
|
|
306
318
|
defaultOrigin: [...plane.origin],
|
|
307
319
|
defaultDirection: [...plane.zDir]
|
|
308
320
|
});
|
|
@@ -334,7 +346,9 @@ var sketchEllipse = (xRadius = 1, yRadius = 2, planeConfig = {}) => {
|
|
|
334
346
|
majR = yRadius;
|
|
335
347
|
minR = xRadius;
|
|
336
348
|
}
|
|
337
|
-
|
|
349
|
+
const scope = _usingCtx3.u(new require_shapeTypes.DisposalScope());
|
|
350
|
+
const wire = require_errors.unwrap(require_surfaceBuilders.assembleWire([scope.register(require_errors.unwrap(require_surfaceBuilders.makeEllipse(majR, minR, plane.origin, plane.zDir, xDir)))]));
|
|
351
|
+
return new require_textBlueprints.Sketch(wire, {
|
|
338
352
|
defaultOrigin: [...plane.origin],
|
|
339
353
|
defaultDirection: [...plane.zDir]
|
|
340
354
|
});
|
|
@@ -440,7 +454,8 @@ var polysideInnerRadius = (outerRadius, sidesCount, sagitta = 0) => {
|
|
|
440
454
|
var sketchFaceOffset = (face, offset) => {
|
|
441
455
|
const defaultOrigin = [...require_faceFns.faceCenter(face)];
|
|
442
456
|
const defaultDirection = [...require_faceFns.normalAt(face)];
|
|
443
|
-
|
|
457
|
+
const wire = require_errors.unwrap(require_curveFns.offsetWire2D(require_faceFns.outerWire(face), offset));
|
|
458
|
+
return new require_textBlueprints.Sketch(wire, {
|
|
444
459
|
defaultOrigin,
|
|
445
460
|
defaultDirection
|
|
446
461
|
});
|
|
@@ -468,7 +483,8 @@ var sketchParametricFunction = (func, planeConfig = {}, { pointsCount = 400, sta
|
|
|
468
483
|
const point = func(start + t * stepSize);
|
|
469
484
|
return require_planeOps.planeToWorld(plane, point);
|
|
470
485
|
});
|
|
471
|
-
|
|
486
|
+
const wire = require_errors.unwrap(require_surfaceBuilders.assembleWire([scope.register(require_errors.unwrap(require_surfaceBuilders.makeBSplineApproximation(points, approximationConfig)))]));
|
|
487
|
+
return new require_textBlueprints.Sketch(wire, {
|
|
472
488
|
defaultOrigin: [...plane.origin],
|
|
473
489
|
defaultDirection: [...plane.zDir]
|
|
474
490
|
});
|
|
@@ -500,7 +516,9 @@ var sketchHelix = (pitch, height, radius, center = [
|
|
|
500
516
|
0,
|
|
501
517
|
1
|
|
502
518
|
], lefthand = false) => {
|
|
503
|
-
|
|
519
|
+
const centerVec3 = require_types.toVec3(center);
|
|
520
|
+
const dirVec3 = require_types.toVec3(dir);
|
|
521
|
+
return new require_textBlueprints.Sketch(require_errors.unwrap(require_surfaceBuilders.assembleWire([require_surfaceBuilders.makeHelix(pitch, height, radius, centerVec3, dirVec3, lefthand)])));
|
|
504
522
|
};
|
|
505
523
|
//#endregion
|
|
506
524
|
//#region src/sketching/shortcuts.ts
|
|
@@ -552,7 +570,8 @@ function joinMiter(appendCurve, previousLastPoint, firstPoint, previousCurve, cu
|
|
|
552
570
|
appendCurve(bevelJoiner);
|
|
553
571
|
return;
|
|
554
572
|
}
|
|
555
|
-
const
|
|
573
|
+
const midpoint = [(previousLastPoint[0] + firstPoint[0]) / 2, (previousLastPoint[1] + firstPoint[1]) / 2];
|
|
574
|
+
const miterDist = require_helpers.squareDistance2d(midpoint, offsetIntersectionPoint);
|
|
556
575
|
const endpointDist = require_helpers.squareDistance2d(previousLastPoint, firstPoint);
|
|
557
576
|
if (endpointDist < 1e-18 || miterDist > 16 * endpointDist) {
|
|
558
577
|
const bevelJoiner = require_blueprint.make2dSegmentCurve(previousLastPoint, firstPoint);
|
|
@@ -837,7 +856,10 @@ function modifyCorners(makeCorner, blueprint, radius, finder) {
|
|
|
837
856
|
function modifyCorner2D(makeCorner, shape, radius, finder) {
|
|
838
857
|
if (shape instanceof require_blueprint.Blueprint) return modifyCorners(makeCorner, shape, radius, finder);
|
|
839
858
|
if (shape instanceof require_blueprintSketcher.CompoundBlueprint) return new require_blueprintSketcher.CompoundBlueprint(shape.blueprints.map((b) => modifyCorners(makeCorner, b, radius, finder)));
|
|
840
|
-
if (shape instanceof require_blueprintSketcher.Blueprints)
|
|
859
|
+
if (shape instanceof require_blueprintSketcher.Blueprints) {
|
|
860
|
+
const bps = shape.blueprints.map((b) => modifyCorner2D(makeCorner, b, radius, finder)).filter((b) => b !== null);
|
|
861
|
+
return new require_blueprintSketcher.Blueprints(bps);
|
|
862
|
+
}
|
|
841
863
|
return null;
|
|
842
864
|
}
|
|
843
865
|
/**
|
|
@@ -1078,10 +1100,16 @@ var Drawing = class Drawing {
|
|
|
1078
1100
|
*/
|
|
1079
1101
|
function deserializeDrawing(data) {
|
|
1080
1102
|
function deserializeHelper(json) {
|
|
1081
|
-
if (json["type"] === "CompoundBlueprint")
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
else
|
|
1103
|
+
if (json["type"] === "CompoundBlueprint") {
|
|
1104
|
+
const blueprints = json["blueprints"].map(deserializeHelper);
|
|
1105
|
+
return new require_blueprintSketcher.CompoundBlueprint(blueprints);
|
|
1106
|
+
} else if (json["type"] === "Blueprints") {
|
|
1107
|
+
const blueprints = json["blueprints"].map(deserializeHelper);
|
|
1108
|
+
return new require_blueprintSketcher.Blueprints(blueprints);
|
|
1109
|
+
} else if (json["type"] === "Blueprint") {
|
|
1110
|
+
const curves = json["curves"].map((c) => require_blueprint.deserializeCurve2D(c));
|
|
1111
|
+
return new require_blueprint.Blueprint(curves);
|
|
1112
|
+
} else require_bug.bug("Drawing.deserialize", "Unknown shape type for deserialization");
|
|
1085
1113
|
}
|
|
1086
1114
|
return new Drawing(deserializeHelper(JSON.parse(data)));
|
|
1087
1115
|
}
|
|
@@ -1299,7 +1327,8 @@ function drawFaceOutline(face) {
|
|
|
1299
1327
|
var _usingCtx3 = require_shapeTypes._usingCtx();
|
|
1300
1328
|
const scope = _usingCtx3.u(new require_shapeTypes.DisposalScope());
|
|
1301
1329
|
const clonedFace = scope.register(require_shapeTypes.createFace(require_errors.unwrap(require_faceFns.copyShape(face.wrapped))));
|
|
1302
|
-
const
|
|
1330
|
+
const faceOuterWire = scope.register(require_faceFns.outerWire(clonedFace));
|
|
1331
|
+
const stitchedCurves = stitchCurves(require_topologyQueryFns.getEdges(faceOuterWire).map((e) => require_blueprint.edgeToCurve(e, face))).map((s) => new require_blueprint.Blueprint(s));
|
|
1303
1332
|
if (stitchedCurves.length === 0) return new Drawing();
|
|
1304
1333
|
if (stitchedCurves.length === 1) return new Drawing(stitchedCurves[0]);
|
|
1305
1334
|
return new Drawing(new require_blueprintSketcher.Blueprints(stitchedCurves));
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { K as getKernel, M as DisposalScope, W as _usingCtx, c as createEdge, l as createFace, p as createWire } from "./shapeTypes-
|
|
1
|
+
import { K as getKernel, M as DisposalScope, W as _usingCtx, c as createEdge, l as createFace, p as createWire } from "./shapeTypes-BHRboc_x.js";
|
|
2
2
|
import { i as wasmIndex, n as bug } from "./bug-BdOHwn_e.js";
|
|
3
3
|
import { P as unwrap, s as safeIndex } from "./errors-MHLiNE-C.js";
|
|
4
|
-
import { s as getEdges } from "./topologyQueryFns-
|
|
4
|
+
import { s as getEdges } from "./topologyQueryFns-QvPyCF-7.js";
|
|
5
5
|
import { t as DEG2RAD } from "./constants-ITRzCnCp.js";
|
|
6
6
|
import { r as toVec3 } from "./types-D24Y27N0.js";
|
|
7
7
|
import { d as vecNormalize, g as vecSub, h as vecScale, m as vecRotate, r as vecCross } from "./vecOps-SKPRvPH-.js";
|
|
8
8
|
import { a as planeToWorld, o as resolvePlane } from "./planeOps-CQahLrCx.js";
|
|
9
|
-
import { d as pointOnSurface, l as normalAt, m as uvBounds, r as faceCenter, u as outerWire, v as copyShape, y as downcast } from "./faceFns-
|
|
10
|
-
import { h as offsetWire2D, i as curveIsClosed, l as curveStartPoint } from "./curveFns-
|
|
9
|
+
import { d as pointOnSurface, l as normalAt, m as uvBounds, r as faceCenter, u as outerWire, v as copyShape, y as downcast } from "./faceFns-fvp_zfuI.js";
|
|
10
|
+
import { h as offsetWire2D, i as curveIsClosed, l as curveStartPoint } from "./curveFns-RczIU30U.js";
|
|
11
11
|
import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
|
|
12
|
-
import { c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, m as makeHelix, r as makeFace, s as assembleWire } from "./surfaceBuilders-
|
|
13
|
-
import { a as Blueprints, c as make2dOffset, i as CompoundBlueprint, l as intersectCurves, n as BaseSketcher2d, o as chamferCurves, s as filletCurves, u as Flatbush } from "./blueprintSketcher-
|
|
14
|
-
import { _ as samePoint$1, b as subtract2d, c as add2d, s as PRECISION_OFFSET, y as squareDistance2d } from "./helpers-
|
|
15
|
-
import { _ as Curve2D, a as edgeToCurve, b as BoundingBox2d, c as make2dCircle, d as make2dInerpolatedBSplineCurve, f as make2dSegmentCurve, g as approximateAsSvgCompatibleCurve, i as curvesAsEdgesOnPlane, l as make2dEllipse, o as make2dArcFromCenter, t as Blueprint, v as deserializeCurve2D } from "./blueprint-
|
|
16
|
-
import { t as cornerFinder } from "./cornerFinder-
|
|
17
|
-
import { c as roundedRectangleBlueprint, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-
|
|
18
|
-
import { _ as wrapSketchDataArray, a as Sketch, g as wrapSketchData, i as Sketches, t as textBlueprints } from "./textBlueprints-
|
|
19
|
-
import { i as projectEdges, t as cameraFromPlane } from "./cameraFns-
|
|
12
|
+
import { c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, m as makeHelix, r as makeFace, s as assembleWire } from "./surfaceBuilders-C8k0K7DR.js";
|
|
13
|
+
import { a as Blueprints, c as make2dOffset, i as CompoundBlueprint, l as intersectCurves, n as BaseSketcher2d, o as chamferCurves, s as filletCurves, u as Flatbush } from "./blueprintSketcher-BjBjj2cK.js";
|
|
14
|
+
import { _ as samePoint$1, b as subtract2d, c as add2d, s as PRECISION_OFFSET, y as squareDistance2d } from "./helpers-CyLQ07aD.js";
|
|
15
|
+
import { _ as Curve2D, a as edgeToCurve, b as BoundingBox2d, c as make2dCircle, d as make2dInerpolatedBSplineCurve, f as make2dSegmentCurve, g as approximateAsSvgCompatibleCurve, i as curvesAsEdgesOnPlane, l as make2dEllipse, o as make2dArcFromCenter, t as Blueprint, v as deserializeCurve2D } from "./blueprint-CaY00-X2.js";
|
|
16
|
+
import { t as cornerFinder } from "./cornerFinder-C4s6pVZ-.js";
|
|
17
|
+
import { c as roundedRectangleBlueprint, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-Bk-VrRyQ.js";
|
|
18
|
+
import { _ as wrapSketchDataArray, a as Sketch, g as wrapSketchData, i as Sketches, t as textBlueprints } from "./textBlueprints-BAyLXffK.js";
|
|
19
|
+
import { i as projectEdges, t as cameraFromPlane } from "./cameraFns-DKEilV2v.js";
|
|
20
20
|
//#region src/2d/lib/stitching.ts
|
|
21
21
|
/**
|
|
22
22
|
* Group a flat list of curves into connected chains by matching endpoints.
|
|
@@ -116,7 +116,8 @@ var Sketcher = class extends BaseSketcher2d {
|
|
|
116
116
|
var _usingCtx$4 = _usingCtx();
|
|
117
117
|
if (!this.pendingCurves.length) bug("Sketcher.buildWire", "No lines to convert into a wire");
|
|
118
118
|
const scope = _usingCtx$4.u(new DisposalScope());
|
|
119
|
-
|
|
119
|
+
const edges = curvesAsEdgesOnPlane(this.pendingCurves, this.plane).map((e) => scope.register(e));
|
|
120
|
+
return unwrap(assembleWire(edges));
|
|
120
121
|
} catch (_) {
|
|
121
122
|
_usingCtx$4.e = _;
|
|
122
123
|
} finally {
|
|
@@ -145,9 +146,16 @@ var Sketcher = class extends BaseSketcher2d {
|
|
|
145
146
|
if (samePoint$1(this.pointer, this.firstPoint)) bug("Sketcher.closeWithMirror", "Cannot close with a mirror when the sketch is already closed");
|
|
146
147
|
const wire = this.buildWire();
|
|
147
148
|
const pointer3d = planeToWorld(this.plane, this.pointer);
|
|
148
|
-
const
|
|
149
|
+
const firstPoint3d = planeToWorld(this.plane, this.firstPoint);
|
|
150
|
+
const diff = vecSub(pointer3d, firstPoint3d);
|
|
151
|
+
const startToEndVector = vecNormalize(diff);
|
|
152
|
+
const normal = vecCross(startToEndVector, this.plane.zDir);
|
|
149
153
|
const clonedWrapped = unwrap(downcast(wire.wrapped));
|
|
150
|
-
|
|
154
|
+
const mirroredRaw = getKernel().mirror(clonedWrapped, toVec3(pointer3d), toVec3(normal));
|
|
155
|
+
const mirroredWrapped = unwrap(downcast(mirroredRaw));
|
|
156
|
+
const mirroredWire = createWire(mirroredWrapped);
|
|
157
|
+
const combinedWire = unwrap(assembleWire([wire, mirroredWire]));
|
|
158
|
+
return new Sketch(combinedWire, {
|
|
151
159
|
defaultOrigin: this.plane.origin,
|
|
152
160
|
defaultDirection: this.plane.zDir
|
|
153
161
|
});
|
|
@@ -205,9 +213,10 @@ var FaceSketcher = class extends BaseSketcher2d {
|
|
|
205
213
|
buildWire() {
|
|
206
214
|
const kernel = getKernel();
|
|
207
215
|
const geomSurf = this._adaptSurface();
|
|
208
|
-
const
|
|
216
|
+
const edges = this.pendingCurves.map((curve) => {
|
|
209
217
|
return createEdge(kernel.buildEdgeOnSurface(curve.wrapped, geomSurf));
|
|
210
|
-
})
|
|
218
|
+
});
|
|
219
|
+
const wire = unwrap(assembleWire(edges));
|
|
211
220
|
kernel.buildCurves3d(wire.wrapped);
|
|
212
221
|
return wire;
|
|
213
222
|
}
|
|
@@ -221,7 +230,8 @@ var FaceSketcher = class extends BaseSketcher2d {
|
|
|
221
230
|
if (curveIsClosed(wire)) {
|
|
222
231
|
const face = scope.register(sketch.clone().face());
|
|
223
232
|
const origin = pointOnSurface(face, .5, .5);
|
|
224
|
-
const
|
|
233
|
+
const normal = normalAt(face);
|
|
234
|
+
const direction = vecScale(normal, -1);
|
|
225
235
|
sketch.defaultOrigin = [
|
|
226
236
|
origin[0],
|
|
227
237
|
origin[1],
|
|
@@ -302,7 +312,9 @@ var sketchCircle = (radius, planeConfig = {}) => {
|
|
|
302
312
|
try {
|
|
303
313
|
var _usingCtx$2 = _usingCtx();
|
|
304
314
|
const plane = planeConfig.plane && typeof planeConfig.plane !== "string" ? { ...planeConfig.plane } : unwrap(resolvePlane(planeConfig.plane ?? "XY", planeConfig.origin));
|
|
305
|
-
|
|
315
|
+
const scope = _usingCtx$2.u(new DisposalScope());
|
|
316
|
+
const wire = unwrap(assembleWire([scope.register(makeCircle(radius, plane.origin, plane.zDir))]));
|
|
317
|
+
return new Sketch(wire, {
|
|
306
318
|
defaultOrigin: [...plane.origin],
|
|
307
319
|
defaultDirection: [...plane.zDir]
|
|
308
320
|
});
|
|
@@ -334,7 +346,9 @@ var sketchEllipse = (xRadius = 1, yRadius = 2, planeConfig = {}) => {
|
|
|
334
346
|
majR = yRadius;
|
|
335
347
|
minR = xRadius;
|
|
336
348
|
}
|
|
337
|
-
|
|
349
|
+
const scope = _usingCtx3.u(new DisposalScope());
|
|
350
|
+
const wire = unwrap(assembleWire([scope.register(unwrap(makeEllipse(majR, minR, plane.origin, plane.zDir, xDir)))]));
|
|
351
|
+
return new Sketch(wire, {
|
|
338
352
|
defaultOrigin: [...plane.origin],
|
|
339
353
|
defaultDirection: [...plane.zDir]
|
|
340
354
|
});
|
|
@@ -440,7 +454,8 @@ var polysideInnerRadius = (outerRadius, sidesCount, sagitta = 0) => {
|
|
|
440
454
|
var sketchFaceOffset = (face, offset) => {
|
|
441
455
|
const defaultOrigin = [...faceCenter(face)];
|
|
442
456
|
const defaultDirection = [...normalAt(face)];
|
|
443
|
-
|
|
457
|
+
const wire = unwrap(offsetWire2D(outerWire(face), offset));
|
|
458
|
+
return new Sketch(wire, {
|
|
444
459
|
defaultOrigin,
|
|
445
460
|
defaultDirection
|
|
446
461
|
});
|
|
@@ -468,7 +483,8 @@ var sketchParametricFunction = (func, planeConfig = {}, { pointsCount = 400, sta
|
|
|
468
483
|
const point = func(start + t * stepSize);
|
|
469
484
|
return planeToWorld(plane, point);
|
|
470
485
|
});
|
|
471
|
-
|
|
486
|
+
const wire = unwrap(assembleWire([scope.register(unwrap(makeBSplineApproximation(points, approximationConfig)))]));
|
|
487
|
+
return new Sketch(wire, {
|
|
472
488
|
defaultOrigin: [...plane.origin],
|
|
473
489
|
defaultDirection: [...plane.zDir]
|
|
474
490
|
});
|
|
@@ -500,7 +516,9 @@ var sketchHelix = (pitch, height, radius, center = [
|
|
|
500
516
|
0,
|
|
501
517
|
1
|
|
502
518
|
], lefthand = false) => {
|
|
503
|
-
|
|
519
|
+
const centerVec3 = toVec3(center);
|
|
520
|
+
const dirVec3 = toVec3(dir);
|
|
521
|
+
return new Sketch(unwrap(assembleWire([makeHelix(pitch, height, radius, centerVec3, dirVec3, lefthand)])));
|
|
504
522
|
};
|
|
505
523
|
//#endregion
|
|
506
524
|
//#region src/sketching/shortcuts.ts
|
|
@@ -552,7 +570,8 @@ function joinMiter(appendCurve, previousLastPoint, firstPoint, previousCurve, cu
|
|
|
552
570
|
appendCurve(bevelJoiner);
|
|
553
571
|
return;
|
|
554
572
|
}
|
|
555
|
-
const
|
|
573
|
+
const midpoint = [(previousLastPoint[0] + firstPoint[0]) / 2, (previousLastPoint[1] + firstPoint[1]) / 2];
|
|
574
|
+
const miterDist = squareDistance2d(midpoint, offsetIntersectionPoint);
|
|
556
575
|
const endpointDist = squareDistance2d(previousLastPoint, firstPoint);
|
|
557
576
|
if (endpointDist < 1e-18 || miterDist > 16 * endpointDist) {
|
|
558
577
|
const bevelJoiner = make2dSegmentCurve(previousLastPoint, firstPoint);
|
|
@@ -837,7 +856,10 @@ function modifyCorners(makeCorner, blueprint, radius, finder) {
|
|
|
837
856
|
function modifyCorner2D(makeCorner, shape, radius, finder) {
|
|
838
857
|
if (shape instanceof Blueprint) return modifyCorners(makeCorner, shape, radius, finder);
|
|
839
858
|
if (shape instanceof CompoundBlueprint) return new CompoundBlueprint(shape.blueprints.map((b) => modifyCorners(makeCorner, b, radius, finder)));
|
|
840
|
-
if (shape instanceof Blueprints)
|
|
859
|
+
if (shape instanceof Blueprints) {
|
|
860
|
+
const bps = shape.blueprints.map((b) => modifyCorner2D(makeCorner, b, radius, finder)).filter((b) => b !== null);
|
|
861
|
+
return new Blueprints(bps);
|
|
862
|
+
}
|
|
841
863
|
return null;
|
|
842
864
|
}
|
|
843
865
|
/**
|
|
@@ -1078,10 +1100,16 @@ var Drawing = class Drawing {
|
|
|
1078
1100
|
*/
|
|
1079
1101
|
function deserializeDrawing(data) {
|
|
1080
1102
|
function deserializeHelper(json) {
|
|
1081
|
-
if (json["type"] === "CompoundBlueprint")
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
else
|
|
1103
|
+
if (json["type"] === "CompoundBlueprint") {
|
|
1104
|
+
const blueprints = json["blueprints"].map(deserializeHelper);
|
|
1105
|
+
return new CompoundBlueprint(blueprints);
|
|
1106
|
+
} else if (json["type"] === "Blueprints") {
|
|
1107
|
+
const blueprints = json["blueprints"].map(deserializeHelper);
|
|
1108
|
+
return new Blueprints(blueprints);
|
|
1109
|
+
} else if (json["type"] === "Blueprint") {
|
|
1110
|
+
const curves = json["curves"].map((c) => deserializeCurve2D(c));
|
|
1111
|
+
return new Blueprint(curves);
|
|
1112
|
+
} else bug("Drawing.deserialize", "Unknown shape type for deserialization");
|
|
1085
1113
|
}
|
|
1086
1114
|
return new Drawing(deserializeHelper(JSON.parse(data)));
|
|
1087
1115
|
}
|
|
@@ -1299,7 +1327,8 @@ function drawFaceOutline(face) {
|
|
|
1299
1327
|
var _usingCtx3 = _usingCtx();
|
|
1300
1328
|
const scope = _usingCtx3.u(new DisposalScope());
|
|
1301
1329
|
const clonedFace = scope.register(createFace(unwrap(copyShape(face.wrapped))));
|
|
1302
|
-
const
|
|
1330
|
+
const faceOuterWire = scope.register(outerWire(clonedFace));
|
|
1331
|
+
const stitchedCurves = stitchCurves(getEdges(faceOuterWire).map((e) => edgeToCurve(e, face))).map((s) => new Blueprint(s));
|
|
1303
1332
|
if (stitchedCurves.length === 0) return new Drawing();
|
|
1304
1333
|
if (stitchedCurves.length === 1) return new Drawing(stitchedCurves[0]);
|
|
1305
1334
|
return new Drawing(new Blueprints(stitchedCurves));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-D5Y41q7x.cjs");
|
|
2
2
|
const require_errors = require("./errors-RHkKO5bZ.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-gah07J7-.cjs");
|
|
4
4
|
const require_types = require("./types-KjA8tY4Y.cjs");
|
|
5
5
|
//#region src/topology/cast.ts
|
|
6
6
|
var TOPO_ENUM = {
|
|
@@ -180,10 +180,11 @@ function projectPointOnFace(face, point) {
|
|
|
180
180
|
const dx = v[0] - projectedPoint[0];
|
|
181
181
|
const dy = v[1] - projectedPoint[1];
|
|
182
182
|
const dz = v[2] - projectedPoint[2];
|
|
183
|
+
const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
183
184
|
return require_errors.ok({
|
|
184
185
|
uv: uvResult,
|
|
185
186
|
point: projectedPoint,
|
|
186
|
-
distance
|
|
187
|
+
distance
|
|
187
188
|
});
|
|
188
189
|
} catch (e) {
|
|
189
190
|
return require_errors.err(require_errors.typeCastError("PROJECTION_FAILED", `Point projection failed: ${e instanceof Error ? e.message : String(e)}`));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { K as getKernel, i as castShape } from "./shapeTypes-
|
|
1
|
+
import { K as getKernel, i as castShape } from "./shapeTypes-BHRboc_x.js";
|
|
2
2
|
import { E as ok, P as unwrap, g as err, l as typeCastError } from "./errors-MHLiNE-C.js";
|
|
3
|
-
import { a as getCachedSurfaceType } from "./topologyQueryFns-
|
|
3
|
+
import { a as getCachedSurfaceType } from "./topologyQueryFns-QvPyCF-7.js";
|
|
4
4
|
import { r as toVec3 } from "./types-D24Y27N0.js";
|
|
5
5
|
//#region src/topology/cast.ts
|
|
6
6
|
var TOPO_ENUM = {
|
|
@@ -125,7 +125,8 @@ var KERNEL_TO_PUBLIC_SURFACE_TYPE = {
|
|
|
125
125
|
* @returns Ok with the surface type, or Err for unrecognized kernel surface types.
|
|
126
126
|
*/
|
|
127
127
|
function getSurfaceType(face) {
|
|
128
|
-
|
|
128
|
+
const kernelType = getCachedSurfaceType(face);
|
|
129
|
+
return ok(KERNEL_TO_PUBLIC_SURFACE_TYPE[kernelType]);
|
|
129
130
|
}
|
|
130
131
|
/** Get the surface type of a face (unwrapped convenience). */
|
|
131
132
|
function faceGeomType(face) {
|
|
@@ -179,10 +180,11 @@ function projectPointOnFace(face, point) {
|
|
|
179
180
|
const dx = v[0] - projectedPoint[0];
|
|
180
181
|
const dy = v[1] - projectedPoint[1];
|
|
181
182
|
const dz = v[2] - projectedPoint[2];
|
|
183
|
+
const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
182
184
|
return ok({
|
|
183
185
|
uv: uvResult,
|
|
184
186
|
point: projectedPoint,
|
|
185
|
-
distance
|
|
187
|
+
distance
|
|
186
188
|
});
|
|
187
189
|
} catch (e) {
|
|
188
190
|
return err(typeCastError("PROJECTION_FAILED", `Point projection failed: ${e instanceof Error ? e.message : String(e)}`));
|