brepjs 4.29.3 → 5.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/blueprints/customCorners.d.ts.map +1 -1
- package/dist/2d.cjs +2 -2
- package/dist/2d.js +4 -4
- package/dist/{Blueprint-DWZVcMld.js → Blueprint-Bp2u4V7e.js} +27 -78
- package/dist/{Blueprint-Cno_0Wpi.cjs → Blueprint-DV-yKdrQ.cjs} +26 -77
- package/dist/{boolean2D-DxahcPf3.js → boolean2D-DKFinpPn.js} +8 -7
- package/dist/{boolean2D-B51UPopc.cjs → boolean2D-DShTIA0X.cjs} +50 -49
- package/dist/{booleanFns-B9kEhspU.cjs → booleanFns-7VTkk7ns.cjs} +10 -9
- package/dist/{booleanFns-kjYhY1ps.js → booleanFns-BXYMeWJJ.js} +2 -1
- package/dist/brepjs.cjs +56 -62
- package/dist/brepjs.js +178 -184
- package/dist/core/geometryHelpers.d.ts +1 -39
- package/dist/core/geometryHelpers.d.ts.map +1 -1
- package/dist/core.cjs +26 -25
- package/dist/core.js +31 -30
- package/dist/{curveFns-CidPI2dK.js → curveFns-nJKh5suT.js} +12 -12
- package/dist/{drawFns-DSjaPq12.js → drawFns-BWKbpjfT.js} +10 -9
- package/dist/{drawFns-SwCxMNpz.cjs → drawFns-DC4_4g56.cjs} +69 -68
- package/dist/{faceFns-CmWtNK51.js → faceFns-DkX5kyA0.js} +2 -2
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/io.cjs +1 -1
- package/dist/io.js +1 -1
- package/dist/{loft-B1NuMnJJ.cjs → loft-BcY4iWZf.cjs} +7 -7
- package/dist/{loft-DF5lixg8.js → loft-DQH8oG0m.js} +2 -2
- package/dist/{measurement-D35A3KCo.js → measurement-BqDgy3Wf.js} +1 -1
- package/dist/measurement.js +1 -1
- package/dist/operations.cjs +15 -15
- package/dist/operations.js +5 -5
- package/dist/query/finderFns.d.ts +21 -9
- package/dist/query/finderFns.d.ts.map +1 -1
- package/dist/query/helpers.d.ts +2 -3
- package/dist/query/helpers.d.ts.map +1 -1
- package/dist/{helpers-vmGlq3vp.js → query-BWgSLodB.js} +10 -380
- package/dist/{helpers-B7vbI0Uk.cjs → query-Dd1h9qFw.cjs} +21 -391
- package/dist/query.cjs +5 -21
- package/dist/query.d.ts +1 -3
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +2 -18
- package/dist/{shapeFns-DMEsBDvX.js → shapeFns-CQRwRotS.js} +11 -11
- package/dist/{shapeFns-DdAGaJP-.cjs → shapeFns-Df3OAlpp.cjs} +3 -3
- package/dist/{shapeHelpers-CSdTgxxD.js → shapeHelpers-DJ6shRx4.js} +1 -1
- package/dist/{shapeHelpers-CNv5JX--.cjs → shapeHelpers-HGNl3W6O.cjs} +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/topology/index.d.ts +1 -1
- package/dist/topology/index.d.ts.map +1 -1
- package/dist/topology/shapeBooleans.d.ts +1 -14
- package/dist/topology/shapeBooleans.d.ts.map +1 -1
- package/dist/topology/shapeModifiers.d.ts +4 -4
- package/dist/topology/shapeModifiers.d.ts.map +1 -1
- package/dist/{topology-DrVYZO1r.js → topology-D8QgS_pc.js} +6 -6
- package/dist/{topology-rx6wzsmA.cjs → topology-DvO7sWFA.cjs} +7 -7
- package/dist/topology.cjs +4 -4
- package/dist/topology.js +31 -31
- package/dist/vecOps-CjRL1jau.cjs +92 -0
- package/dist/vecOps-ZDdZWbwT.js +93 -0
- package/dist/vectors-CCdx6erh.cjs +79 -0
- package/dist/{vectors-FtQioBub.js → vectors-CxYq-oQ7.js} +4 -94
- package/dist/vectors.cjs +20 -19
- package/dist/vectors.js +19 -18
- package/package.json +1 -1
- package/dist/compat.d.ts +0 -128
- package/dist/compat.d.ts.map +0 -1
- package/dist/operations/batchBooleans.d.ts +0 -31
- package/dist/operations/batchBooleans.d.ts.map +0 -1
- package/dist/query/cornerFinder.d.ts +0 -79
- package/dist/query/cornerFinder.d.ts.map +0 -1
- package/dist/query/definitions.d.ts +0 -84
- package/dist/query/definitions.d.ts.map +0 -1
- package/dist/query/edgeFinder.d.ts +0 -68
- package/dist/query/edgeFinder.d.ts.map +0 -1
- package/dist/query/faceFinder.d.ts +0 -59
- package/dist/query/faceFinder.d.ts.map +0 -1
- package/dist/query/generic3dfinder.d.ts +0 -90
- package/dist/query/generic3dfinder.d.ts.map +0 -1
- package/dist/query/index.d.ts +0 -20
- package/dist/query/index.d.ts.map +0 -1
- package/dist/vectors-CVRXEGfA.cjs +0 -169
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customCorners.d.ts","sourceRoot":"","sources":["../../../src/2d/blueprints/customCorners.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"customCorners.d.ts","sourceRoot":"","sources":["../../../src/2d/blueprints/customCorners.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAU,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAgF9C;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,WAE7E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,WAE9E"}
|
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-DV-yKdrQ.cjs");
|
|
4
|
+
const boolean2D = require("./boolean2D-DShTIA0X.cjs");
|
|
5
5
|
function reverseCurve(curve) {
|
|
6
6
|
const cloned = curve.clone();
|
|
7
7
|
cloned.reverse();
|
package/dist/2d.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as Blueprint } from "./Blueprint-
|
|
2
|
-
import { a, C, b } from "./Blueprint-
|
|
3
|
-
import { c as cut2D, f as fuse2D, i as intersect2D } from "./boolean2D-
|
|
4
|
-
import { b as b2, C as C2, d, e, g, o, p, r } from "./boolean2D-
|
|
1
|
+
import { B as Blueprint } from "./Blueprint-Bp2u4V7e.js";
|
|
2
|
+
import { a, C, b } from "./Blueprint-Bp2u4V7e.js";
|
|
3
|
+
import { c as cut2D, f as fuse2D, i as intersect2D } from "./boolean2D-DKFinpPn.js";
|
|
4
|
+
import { b as b2, C as C2, d, e, g, o, p, r } from "./boolean2D-DKFinpPn.js";
|
|
5
5
|
function reverseCurve(curve) {
|
|
6
6
|
const cloned = curve.clone();
|
|
7
7
|
cloned.reverse();
|
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
import { r as resolvePlane
|
|
2
|
-
import { g as getKernel, a as toVec3, m as makeOcAx2
|
|
1
|
+
import { r as resolvePlane } from "./vectors-CxYq-oQ7.js";
|
|
2
|
+
import { g as getKernel, a as toVec3, m as makeOcAx2 } from "./occtBoundary-Bo41qJLE.js";
|
|
3
3
|
import { o as localGC, y as registerForCleanup, z as unregisterFromCleanup, n as gcWithScope, t as createEdge, s as createWire } from "./shapeTypes-C1OUu4VG.js";
|
|
4
|
-
import { u as uvBounds,
|
|
5
|
-
import {
|
|
4
|
+
import { u as uvBounds, a as faceGeomType, f as faceCenter, h as uvCoordinates } from "./faceFns-DkX5kyA0.js";
|
|
5
|
+
import { j as findCurveType, m as getOrientation } from "./curveFns-nJKh5suT.js";
|
|
6
6
|
import { u as unwrap, l as ok, e as err, b as computationError, x as validationError } from "./errors-EPHOk9hi.js";
|
|
7
|
-
import { A as zip, o as makeFace } from "./shapeHelpers-
|
|
8
|
-
import { i as distance2d, s as samePoint, h as scalarMultiply2d, b as add2d, n as normalize2d, a as subtract2d, g as getSingleFace } from "./
|
|
7
|
+
import { A as zip, o as makeFace } from "./shapeHelpers-DJ6shRx4.js";
|
|
8
|
+
import { i as distance2d, s as samePoint, h as scalarMultiply2d, b as add2d, n as normalize2d, a as subtract2d, g as getSingleFace } from "./query-BWgSLodB.js";
|
|
9
9
|
import { c as cast } from "./cast-3pDXduc8.js";
|
|
10
|
+
import { R as RAD2DEG, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
|
|
10
11
|
import { bug } from "./result.js";
|
|
11
|
-
const makePlaneFromFace = (face, originOnSurface = [0, 0]) => {
|
|
12
|
-
const originPoint = face.pointOnSurface(...originOnSurface);
|
|
13
|
-
const normal = face.normalAt(originPoint);
|
|
14
|
-
const ref = [0, 0, 1];
|
|
15
|
-
let xd = vecCross(ref, normal);
|
|
16
|
-
if (vecLength(xd) < 1e-8) {
|
|
17
|
-
xd = [1, 0, 0];
|
|
18
|
-
}
|
|
19
|
-
xd = vecNormalize(xd);
|
|
20
|
-
return createPlane(originPoint, xd, normal);
|
|
21
|
-
};
|
|
22
12
|
function makePlane(plane, origin) {
|
|
23
13
|
if (plane && typeof plane !== "string") {
|
|
24
14
|
return { ...plane };
|
|
@@ -26,31 +16,6 @@ function makePlane(plane, origin) {
|
|
|
26
16
|
return resolvePlane(plane ?? "XY", origin);
|
|
27
17
|
}
|
|
28
18
|
}
|
|
29
|
-
function rotate(shape, angle, position = [0, 0, 0], direction = [0, 0, 1]) {
|
|
30
|
-
const oc = getKernel().oc;
|
|
31
|
-
const [r, gc] = localGC();
|
|
32
|
-
const posVec = toVec3(position);
|
|
33
|
-
const dirVec = toVec3(direction);
|
|
34
|
-
const ax = r(makeOcAx1(posVec, dirVec));
|
|
35
|
-
const trsf = r(new oc.gp_Trsf_1());
|
|
36
|
-
trsf.SetRotation_1(ax, angle * DEG2RAD);
|
|
37
|
-
const transformer = r(new oc.BRepBuilderAPI_Transform_2(shape, trsf, true));
|
|
38
|
-
const newShape = transformer.ModifiedShape(shape);
|
|
39
|
-
gc();
|
|
40
|
-
return newShape;
|
|
41
|
-
}
|
|
42
|
-
function translate(shape, vector) {
|
|
43
|
-
const oc = getKernel().oc;
|
|
44
|
-
const [r, gc] = localGC();
|
|
45
|
-
const vecArr = toVec3(vector);
|
|
46
|
-
const ocVec = r(toOcVec(vecArr));
|
|
47
|
-
const trsf = r(new oc.gp_Trsf_1());
|
|
48
|
-
trsf.SetTranslation_1(ocVec);
|
|
49
|
-
const transformer = r(new oc.BRepBuilderAPI_Transform_2(shape, trsf, true));
|
|
50
|
-
const newShape = transformer.ModifiedShape(shape);
|
|
51
|
-
gc();
|
|
52
|
-
return newShape;
|
|
53
|
-
}
|
|
54
19
|
function mirror(shape, inputPlane, origin) {
|
|
55
20
|
const oc = getKernel().oc;
|
|
56
21
|
const [r, gc] = localGC();
|
|
@@ -79,18 +44,6 @@ function mirror(shape, inputPlane, origin) {
|
|
|
79
44
|
gc();
|
|
80
45
|
return newShape;
|
|
81
46
|
}
|
|
82
|
-
function scale(shape, center, scaleFactor) {
|
|
83
|
-
const oc = getKernel().oc;
|
|
84
|
-
const [r, gc] = localGC();
|
|
85
|
-
const centerVec = toVec3(center);
|
|
86
|
-
const pnt2 = r(toOcPnt(centerVec));
|
|
87
|
-
const trsf = r(new oc.gp_Trsf_1());
|
|
88
|
-
trsf.SetScale(pnt2, scaleFactor);
|
|
89
|
-
const transformer = r(new oc.BRepBuilderAPI_Transform_2(shape, trsf, true));
|
|
90
|
-
const newShape = transformer.ModifiedShape(shape);
|
|
91
|
-
gc();
|
|
92
|
-
return newShape;
|
|
93
|
-
}
|
|
94
47
|
function isPoint2D(point) {
|
|
95
48
|
return Array.isArray(point) && point.length === 2 && typeof point[0] === "number" && typeof point[1] === "number";
|
|
96
49
|
}
|
|
@@ -828,7 +781,7 @@ const scaleTransform2d = (scaleFactor, center = [0, 0]) => {
|
|
|
828
781
|
gc();
|
|
829
782
|
return transform;
|
|
830
783
|
};
|
|
831
|
-
function curvesAsEdgesOnFace(curves, face,
|
|
784
|
+
function curvesAsEdgesOnFace(curves, face, scale = "original") {
|
|
832
785
|
const [r, gc] = localGC();
|
|
833
786
|
const oc = getKernel().oc;
|
|
834
787
|
let geomSurf = r(oc.BRep_Tool.Surface_2(face.wrapped));
|
|
@@ -836,7 +789,7 @@ function curvesAsEdgesOnFace(curves, face, scale2 = "original") {
|
|
|
836
789
|
let transformation = null;
|
|
837
790
|
const uAxis = r(axis2d([0, 0], [0, 1]));
|
|
838
791
|
const _vAxis = r(axis2d([0, 0], [1, 0]));
|
|
839
|
-
if (
|
|
792
|
+
if (scale === "original" && faceGeomType(face) !== "PLANE") {
|
|
840
793
|
if (faceGeomType(face) !== "CYLINDRE")
|
|
841
794
|
return err(
|
|
842
795
|
validationError(
|
|
@@ -851,7 +804,7 @@ function curvesAsEdgesOnFace(curves, face, scale2 = "original") {
|
|
|
851
804
|
const radius = cylinder.Radius();
|
|
852
805
|
transformation = stretchTransform2d(1 / radius, [0, 1]);
|
|
853
806
|
}
|
|
854
|
-
if (
|
|
807
|
+
if (scale === "bounds") {
|
|
855
808
|
transformation = r(new oc.gp_GTrsf2d_1());
|
|
856
809
|
transformation.SetAffinity(uAxis, bounds.uMax - bounds.uMin);
|
|
857
810
|
if (bounds.uMin !== 0) {
|
|
@@ -1209,27 +1162,23 @@ export {
|
|
|
1209
1162
|
Curve2D as C,
|
|
1210
1163
|
BoundingBox2d as a,
|
|
1211
1164
|
axis2d as b,
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1165
|
+
make2dSegmentCurve as c,
|
|
1166
|
+
approximateAsBSpline as d,
|
|
1167
|
+
make2dCircle as e,
|
|
1168
|
+
make2dThreePointArc as f,
|
|
1169
|
+
make2dArcFromCenter as g,
|
|
1170
|
+
asSVG as h,
|
|
1218
1171
|
isPoint2D as i,
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1172
|
+
make2dTangentArc as j,
|
|
1173
|
+
make2dEllipseArc as k,
|
|
1174
|
+
make2dBezierCurve as l,
|
|
1222
1175
|
makePlane as m,
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
viewbox as v,
|
|
1232
|
-
make2dInerpolatedBSplineCurve as w,
|
|
1233
|
-
make2dEllipse as x,
|
|
1234
|
-
deserializeCurve2D as y
|
|
1176
|
+
mirror as n,
|
|
1177
|
+
approximateAsSvgCompatibleCurve as o,
|
|
1178
|
+
edgeToCurve as p,
|
|
1179
|
+
make2dInerpolatedBSplineCurve as q,
|
|
1180
|
+
removeDuplicatePoints as r,
|
|
1181
|
+
make2dEllipse as s,
|
|
1182
|
+
deserializeCurve2D as t,
|
|
1183
|
+
viewbox as v
|
|
1235
1184
|
};
|
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const vectors = require("./vectors-
|
|
2
|
+
const vectors = require("./vectors-CCdx6erh.cjs");
|
|
3
3
|
const occtBoundary = require("./occtBoundary-du8_ex-p.cjs");
|
|
4
4
|
const shapeTypes = require("./shapeTypes-DKhwEnUM.cjs");
|
|
5
5
|
const faceFns = require("./faceFns-BOc1QawY.cjs");
|
|
6
6
|
const curveFns = require("./curveFns-DqT7DqLQ.cjs");
|
|
7
7
|
const errors = require("./errors-C7Inmd1n.cjs");
|
|
8
|
-
const shapeHelpers = require("./shapeHelpers-
|
|
9
|
-
const
|
|
8
|
+
const shapeHelpers = require("./shapeHelpers-HGNl3W6O.cjs");
|
|
9
|
+
const query = require("./query-Dd1h9qFw.cjs");
|
|
10
10
|
const cast = require("./cast-CQ7SKb6A.cjs");
|
|
11
|
+
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
11
12
|
const result = require("./result.cjs");
|
|
12
|
-
const makePlaneFromFace = (face, originOnSurface = [0, 0]) => {
|
|
13
|
-
const originPoint = face.pointOnSurface(...originOnSurface);
|
|
14
|
-
const normal = face.normalAt(originPoint);
|
|
15
|
-
const ref = [0, 0, 1];
|
|
16
|
-
let xd = vectors.vecCross(ref, normal);
|
|
17
|
-
if (vectors.vecLength(xd) < 1e-8) {
|
|
18
|
-
xd = [1, 0, 0];
|
|
19
|
-
}
|
|
20
|
-
xd = vectors.vecNormalize(xd);
|
|
21
|
-
return vectors.createPlane(originPoint, xd, normal);
|
|
22
|
-
};
|
|
23
13
|
function makePlane(plane, origin) {
|
|
24
14
|
if (plane && typeof plane !== "string") {
|
|
25
15
|
return { ...plane };
|
|
@@ -27,31 +17,6 @@ function makePlane(plane, origin) {
|
|
|
27
17
|
return vectors.resolvePlane(plane ?? "XY", origin);
|
|
28
18
|
}
|
|
29
19
|
}
|
|
30
|
-
function rotate(shape, angle, position = [0, 0, 0], direction = [0, 0, 1]) {
|
|
31
|
-
const oc = occtBoundary.getKernel().oc;
|
|
32
|
-
const [r, gc] = shapeTypes.localGC();
|
|
33
|
-
const posVec = occtBoundary.toVec3(position);
|
|
34
|
-
const dirVec = occtBoundary.toVec3(direction);
|
|
35
|
-
const ax = r(occtBoundary.makeOcAx1(posVec, dirVec));
|
|
36
|
-
const trsf = r(new oc.gp_Trsf_1());
|
|
37
|
-
trsf.SetRotation_1(ax, angle * vectors.DEG2RAD);
|
|
38
|
-
const transformer = r(new oc.BRepBuilderAPI_Transform_2(shape, trsf, true));
|
|
39
|
-
const newShape = transformer.ModifiedShape(shape);
|
|
40
|
-
gc();
|
|
41
|
-
return newShape;
|
|
42
|
-
}
|
|
43
|
-
function translate(shape, vector) {
|
|
44
|
-
const oc = occtBoundary.getKernel().oc;
|
|
45
|
-
const [r, gc] = shapeTypes.localGC();
|
|
46
|
-
const vecArr = occtBoundary.toVec3(vector);
|
|
47
|
-
const ocVec = r(occtBoundary.toOcVec(vecArr));
|
|
48
|
-
const trsf = r(new oc.gp_Trsf_1());
|
|
49
|
-
trsf.SetTranslation_1(ocVec);
|
|
50
|
-
const transformer = r(new oc.BRepBuilderAPI_Transform_2(shape, trsf, true));
|
|
51
|
-
const newShape = transformer.ModifiedShape(shape);
|
|
52
|
-
gc();
|
|
53
|
-
return newShape;
|
|
54
|
-
}
|
|
55
20
|
function mirror(shape, inputPlane, origin) {
|
|
56
21
|
const oc = occtBoundary.getKernel().oc;
|
|
57
22
|
const [r, gc] = shapeTypes.localGC();
|
|
@@ -80,18 +45,6 @@ function mirror(shape, inputPlane, origin) {
|
|
|
80
45
|
gc();
|
|
81
46
|
return newShape;
|
|
82
47
|
}
|
|
83
|
-
function scale(shape, center, scaleFactor) {
|
|
84
|
-
const oc = occtBoundary.getKernel().oc;
|
|
85
|
-
const [r, gc] = shapeTypes.localGC();
|
|
86
|
-
const centerVec = occtBoundary.toVec3(center);
|
|
87
|
-
const pnt2 = r(occtBoundary.toOcPnt(centerVec));
|
|
88
|
-
const trsf = r(new oc.gp_Trsf_1());
|
|
89
|
-
trsf.SetScale(pnt2, scaleFactor);
|
|
90
|
-
const transformer = r(new oc.BRepBuilderAPI_Transform_2(shape, trsf, true));
|
|
91
|
-
const newShape = transformer.ModifiedShape(shape);
|
|
92
|
-
gc();
|
|
93
|
-
return newShape;
|
|
94
|
-
}
|
|
95
48
|
function isPoint2D(point) {
|
|
96
49
|
return Array.isArray(point) && point.length === 2 && typeof point[0] === "number" && typeof point[1] === "number";
|
|
97
50
|
}
|
|
@@ -338,8 +291,8 @@ class Curve2D {
|
|
|
338
291
|
}
|
|
339
292
|
return Math.min(
|
|
340
293
|
curveToPoint,
|
|
341
|
-
|
|
342
|
-
|
|
294
|
+
query.distance2d(point, this.firstPoint),
|
|
295
|
+
query.distance2d(point, this.lastPoint)
|
|
343
296
|
);
|
|
344
297
|
}
|
|
345
298
|
distanceFromCurve(curve) {
|
|
@@ -395,8 +348,8 @@ class Curve2D {
|
|
|
395
348
|
lowerDistance = projector.LowerDistance();
|
|
396
349
|
lowerDistanceParameter = projector.LowerDistanceParameter();
|
|
397
350
|
} catch {
|
|
398
|
-
if (
|
|
399
|
-
if (
|
|
351
|
+
if (query.samePoint(point, this.firstPoint, precision)) return errors.ok(this.firstParameter);
|
|
352
|
+
if (query.samePoint(point, this.lastPoint, precision)) return errors.ok(this.lastParameter);
|
|
400
353
|
return errors.err(errors.computationError("PARAMETER_NOT_FOUND", "Failed to find parameter"));
|
|
401
354
|
}
|
|
402
355
|
if (lowerDistance > precision) {
|
|
@@ -536,7 +489,7 @@ function approximateAsSvgCompatibleCurve(curves, options = {
|
|
|
536
489
|
return curves.flatMap((curve) => {
|
|
537
490
|
const adaptor = r(curve.adaptor());
|
|
538
491
|
const curveType = errors.unwrap(curveFns.findCurveType(adaptor.GetType()));
|
|
539
|
-
if (curveType === "ELLIPSE" || curveType === "CIRCLE" &&
|
|
492
|
+
if (curveType === "ELLIPSE" || curveType === "CIRCLE" && query.samePoint(curve.firstPoint, curve.lastPoint)) {
|
|
540
493
|
return curve.splitAt([0.5]);
|
|
541
494
|
}
|
|
542
495
|
if (["LINE", "ELLIPSE", "CIRCLE"].includes(curveType)) {
|
|
@@ -567,7 +520,7 @@ const make2dSegmentCurve = (startPoint, endPoint) => {
|
|
|
567
520
|
const [r, gc] = shapeTypes.localGC();
|
|
568
521
|
const segment = r(new oc.GCE2d_MakeSegment_1(r(pnt(startPoint)), r(pnt(endPoint)))).Value();
|
|
569
522
|
const curve = new Curve2D(segment);
|
|
570
|
-
if (!
|
|
523
|
+
if (!query.samePoint(curve.firstPoint, startPoint)) {
|
|
571
524
|
curve.reverse();
|
|
572
525
|
}
|
|
573
526
|
gc();
|
|
@@ -581,7 +534,7 @@ const make2dThreePointArc = (startPoint, midPoint, endPoint) => {
|
|
|
581
534
|
).Value();
|
|
582
535
|
gc();
|
|
583
536
|
const curve = new Curve2D(segment);
|
|
584
|
-
if (!
|
|
537
|
+
if (!query.samePoint(curve.firstPoint, startPoint)) {
|
|
585
538
|
curve.wrapped.get().SetTrim(curve.lastParameter, curve.firstParameter, true, true);
|
|
586
539
|
}
|
|
587
540
|
return curve;
|
|
@@ -594,7 +547,7 @@ const make2dTangentArc = (startPoint, tangent, endPoint) => {
|
|
|
594
547
|
).Value();
|
|
595
548
|
gc();
|
|
596
549
|
const curve = new Curve2D(segment);
|
|
597
|
-
if (!
|
|
550
|
+
if (!query.samePoint(curve.firstPoint, startPoint)) {
|
|
598
551
|
curve.wrapped.get().SetTrim(curve.lastParameter, curve.firstParameter, true, true);
|
|
599
552
|
}
|
|
600
553
|
return curve;
|
|
@@ -677,12 +630,12 @@ function make2dInerpolatedBSplineCurve(points, {
|
|
|
677
630
|
return errors.ok(new Curve2D(splineBuilder.Curve()));
|
|
678
631
|
}
|
|
679
632
|
const make2dArcFromCenter = (startPoint, endPoint, center, longArc = false) => {
|
|
680
|
-
const midChord =
|
|
681
|
-
const orientedRadius =
|
|
682
|
-
const midChordDir =
|
|
633
|
+
const midChord = query.scalarMultiply2d(query.add2d(startPoint, endPoint), 0.5);
|
|
634
|
+
const orientedRadius = query.distance2d(center, startPoint) * (longArc ? -1 : 1);
|
|
635
|
+
const midChordDir = query.normalize2d(query.subtract2d(midChord, center));
|
|
683
636
|
return make2dThreePointArc(
|
|
684
637
|
startPoint,
|
|
685
|
-
|
|
638
|
+
query.add2d(query.scalarMultiply2d(midChordDir, orientedRadius), center),
|
|
686
639
|
endPoint
|
|
687
640
|
);
|
|
688
641
|
};
|
|
@@ -723,7 +676,7 @@ const adaptedCurveToPathElem = (adaptor, lastPoint) => {
|
|
|
723
676
|
const radius = curve.Radius();
|
|
724
677
|
const p1 = adaptor.FirstParameter();
|
|
725
678
|
const p2 = adaptor.LastParameter();
|
|
726
|
-
const paramAngle = (p2 - p1) *
|
|
679
|
+
const paramAngle = (p2 - p1) * vecOps.RAD2DEG;
|
|
727
680
|
const end = paramAngle !== 360 ? endpoint : `${round5(endX)} ${round5(endY + 1e-4)}`;
|
|
728
681
|
return `A ${radius} ${radius} 0 ${Math.abs(paramAngle) > 180 ? "1" : "0"} ${curve.IsDirect() ? "1" : "0"} ${end}`;
|
|
729
682
|
}
|
|
@@ -733,12 +686,12 @@ const adaptedCurveToPathElem = (adaptor, lastPoint) => {
|
|
|
733
686
|
const ry = curve.MinorRadius();
|
|
734
687
|
const p1 = adaptor.FirstParameter();
|
|
735
688
|
const p2 = adaptor.LastParameter();
|
|
736
|
-
const paramAngle = (p2 - p1) *
|
|
689
|
+
const paramAngle = (p2 - p1) * vecOps.RAD2DEG;
|
|
737
690
|
const end = paramAngle !== 360 ? endpoint : `${round5(endX)} ${round5(endY + 1e-4)}`;
|
|
738
691
|
const dir0 = r(new oc.gp_Dir2d_1());
|
|
739
692
|
const xAxis = r(curve.XAxis());
|
|
740
693
|
const xDir = r(xAxis.Direction());
|
|
741
|
-
const angle = 180 - xDir.Angle(dir0) *
|
|
694
|
+
const angle = 180 - xDir.Angle(dir0) * vecOps.RAD2DEG;
|
|
742
695
|
return `A ${round5(rx)} ${round5(ry)} ${round5(angle)} ${Math.abs(paramAngle) > 180 ? "1" : "0"} ${curve.IsDirect() ? "1" : "0"} ${end}`;
|
|
743
696
|
}
|
|
744
697
|
result.bug("adaptedCurveToPathElem", `Unsupported curve type: ${curveType}`);
|
|
@@ -829,7 +782,7 @@ const scaleTransform2d = (scaleFactor, center = [0, 0]) => {
|
|
|
829
782
|
gc();
|
|
830
783
|
return transform;
|
|
831
784
|
};
|
|
832
|
-
function curvesAsEdgesOnFace(curves, face,
|
|
785
|
+
function curvesAsEdgesOnFace(curves, face, scale = "original") {
|
|
833
786
|
const [r, gc] = shapeTypes.localGC();
|
|
834
787
|
const oc = occtBoundary.getKernel().oc;
|
|
835
788
|
let geomSurf = r(oc.BRep_Tool.Surface_2(face.wrapped));
|
|
@@ -837,7 +790,7 @@ function curvesAsEdgesOnFace(curves, face, scale2 = "original") {
|
|
|
837
790
|
let transformation = null;
|
|
838
791
|
const uAxis = r(axis2d([0, 0], [0, 1]));
|
|
839
792
|
const _vAxis = r(axis2d([0, 0], [1, 0]));
|
|
840
|
-
if (
|
|
793
|
+
if (scale === "original" && faceFns.faceGeomType(face) !== "PLANE") {
|
|
841
794
|
if (faceFns.faceGeomType(face) !== "CYLINDRE")
|
|
842
795
|
return errors.err(
|
|
843
796
|
errors.validationError(
|
|
@@ -852,7 +805,7 @@ function curvesAsEdgesOnFace(curves, face, scale2 = "original") {
|
|
|
852
805
|
const radius = cylinder.Radius();
|
|
853
806
|
transformation = stretchTransform2d(1 / radius, [0, 1]);
|
|
854
807
|
}
|
|
855
|
-
if (
|
|
808
|
+
if (scale === "bounds") {
|
|
856
809
|
transformation = r(new oc.gp_GTrsf2d_1());
|
|
857
810
|
transformation.SetAffinity(uAxis, bounds.uMax - bounds.uMin);
|
|
858
811
|
if (bounds.uMin !== 0) {
|
|
@@ -1003,7 +956,7 @@ class Blueprint {
|
|
|
1003
956
|
* @returns A new rotated Blueprint.
|
|
1004
957
|
*/
|
|
1005
958
|
rotate(angle, center) {
|
|
1006
|
-
const curves = transformCurves(this.curves, rotateTransform2d(angle *
|
|
959
|
+
const curves = transformCurves(this.curves, rotateTransform2d(angle * vecOps.DEG2RAD, center));
|
|
1007
960
|
return new Blueprint(curves);
|
|
1008
961
|
}
|
|
1009
962
|
translate(xDistOrPoint, yDist = 0) {
|
|
@@ -1088,14 +1041,14 @@ class Blueprint {
|
|
|
1088
1041
|
} = {}) {
|
|
1089
1042
|
const oc = occtBoundary.getKernel().oc;
|
|
1090
1043
|
const gc = shapeTypes.gcWithScope();
|
|
1091
|
-
const foundFace = errors.unwrap(
|
|
1044
|
+
const foundFace = errors.unwrap(query.getSingleFace(face, shape));
|
|
1092
1045
|
const hole = this.subFace(foundFace, origin);
|
|
1093
1046
|
const maker = gc(
|
|
1094
1047
|
new oc.BRepFeat_MakeDPrism_1(
|
|
1095
1048
|
shape.wrapped,
|
|
1096
1049
|
hole.wrapped,
|
|
1097
1050
|
foundFace.wrapped,
|
|
1098
|
-
draftAngle *
|
|
1051
|
+
draftAngle * vecOps.DEG2RAD,
|
|
1099
1052
|
0,
|
|
1100
1053
|
false
|
|
1101
1054
|
)
|
|
@@ -1180,7 +1133,7 @@ class Blueprint {
|
|
|
1180
1133
|
}
|
|
1181
1134
|
/** Check whether the first and last points coincide (the profile is closed). */
|
|
1182
1135
|
isClosed() {
|
|
1183
|
-
return
|
|
1136
|
+
return query.samePoint(this.firstPoint, this.lastPoint);
|
|
1184
1137
|
}
|
|
1185
1138
|
/**
|
|
1186
1139
|
* Test whether this blueprint's curves intersect with another blueprint's curves.
|
|
@@ -1225,10 +1178,6 @@ exports.make2dSegmentCurve = make2dSegmentCurve;
|
|
|
1225
1178
|
exports.make2dTangentArc = make2dTangentArc;
|
|
1226
1179
|
exports.make2dThreePointArc = make2dThreePointArc;
|
|
1227
1180
|
exports.makePlane = makePlane;
|
|
1228
|
-
exports.makePlaneFromFace = makePlaneFromFace;
|
|
1229
1181
|
exports.mirror = mirror;
|
|
1230
1182
|
exports.removeDuplicatePoints = removeDuplicatePoints;
|
|
1231
|
-
exports.rotate = rotate;
|
|
1232
|
-
exports.scale = scale;
|
|
1233
|
-
exports.translate = translate;
|
|
1234
1183
|
exports.viewbox = viewbox;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as makeFace, u as makeNewFaceWithinFace, a as assembleWire, A as zip } from "./shapeHelpers-
|
|
1
|
+
import { a as createPlane } from "./vectors-CxYq-oQ7.js";
|
|
2
|
+
import { o as makeFace, u as makeNewFaceWithinFace, a as assembleWire, A as zip } from "./shapeHelpers-DJ6shRx4.js";
|
|
3
3
|
import { l as ok, e as err, b as computationError, u as unwrap, g as isOk } from "./errors-EPHOk9hi.js";
|
|
4
4
|
import { d as downcast } from "./cast-3pDXduc8.js";
|
|
5
5
|
import { g as getKernel, a as toVec3 } from "./occtBoundary-Bo41qJLE.js";
|
|
6
|
-
import {
|
|
6
|
+
import { n as vecScale, j as vecNormalize, b as vecCross, D as DEG2RAD, R as RAD2DEG } from "./vecOps-ZDdZWbwT.js";
|
|
7
|
+
import { r as revolution, c as complexExtrude, t as twistExtrude, b as basicFaceExtrusion, g as genericSweep, l as loft } from "./loft-DQH8oG0m.js";
|
|
7
8
|
import { n as gcWithScope, q as createFace, s as createWire, o as localGC, t as createEdge } from "./shapeTypes-C1OUu4VG.js";
|
|
8
|
-
import {
|
|
9
|
-
import { u as uvBounds, p as pointOnSurface, n as normalAt } from "./faceFns-
|
|
9
|
+
import { e as curveStartPoint, a as curveTangentAt, c as curveIsClosed } from "./curveFns-nJKh5suT.js";
|
|
10
|
+
import { u as uvBounds, p as pointOnSurface, n as normalAt } from "./faceFns-DkX5kyA0.js";
|
|
10
11
|
import { bug } from "./result.js";
|
|
11
|
-
import { s as samePoint$1, n as normalize2d, a as subtract2d, b as add2d, d as crossProduct2d, h as scalarMultiply2d, p as polarToCartesian, i as distance2d, r as rotate2d, j as cartesianToPolar, k as polarAngle2d, P as PRECISION_INTERSECTION } from "./
|
|
12
|
-
import { C as Curve2D,
|
|
12
|
+
import { s as samePoint$1, n as normalize2d, a as subtract2d, b as add2d, d as crossProduct2d, h as scalarMultiply2d, p as polarToCartesian, i as distance2d, r as rotate2d, j as cartesianToPolar, k as polarAngle2d, P as PRECISION_INTERSECTION } from "./query-BWgSLodB.js";
|
|
13
|
+
import { C as Curve2D, c as make2dSegmentCurve, d as approximateAsBSpline, i as isPoint2D, e as make2dCircle, f as make2dThreePointArc, g as make2dArcFromCenter, a as BoundingBox2d, v as viewbox, h as asSVG, B as Blueprint, j as make2dTangentArc, k as make2dEllipseArc, l as make2dBezierCurve, b as axis2d, r as removeDuplicatePoints } from "./Blueprint-Bp2u4V7e.js";
|
|
13
14
|
function* pointsIteration(intersector) {
|
|
14
15
|
const nPoints = intersector.NbPoints();
|
|
15
16
|
if (!nPoints) return;
|