brepjs 8.0.2 → 8.0.4
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 +2 -2
- package/dist/2d.js +3 -3
- package/dist/{Blueprint-B9fhnpFp.js → Blueprint-2_aAKNQR.js} +8 -9
- package/dist/{Blueprint-VGbo3izk.cjs → Blueprint-DLrTLXzX.cjs} +9 -10
- package/dist/{boolean2D-B1XrGVgx.cjs → boolean2D-DeFQSg1m.cjs} +10 -10
- package/dist/{boolean2D-_WiqPxWZ.js → boolean2D-XbuOXTHG.js} +10 -10
- package/dist/{booleanFns-CkccZ7UL.js → booleanFns-DGMIgJl_.js} +5 -5
- package/dist/{booleanFns-BxW-N3rP.cjs → booleanFns-ND7sZvhu.cjs} +3 -3
- package/dist/brepjs.cjs +65 -69
- package/dist/brepjs.js +114 -119
- package/dist/{cast-C4Ff_1Qe.js → cast-BEg1mN7n.js} +2 -2
- package/dist/{cast-DIiyxDLo.cjs → cast-CqDc8oFW.cjs} +2 -2
- package/dist/core.cjs +3 -3
- package/dist/core.js +3 -3
- package/dist/{cornerFinder-DzGzfiqb.js → cornerFinder-D52Bk6bt.js} +1 -1
- package/dist/{cornerFinder-BndBNtJE.cjs → cornerFinder-DhbwiYQK.cjs} +1 -1
- package/dist/{curveBuilders-BUoFO1UG.cjs → curveBuilders-BjtdNw1B.cjs} +2 -2
- package/dist/{curveBuilders-CBlIWlbU.js → curveBuilders-U26XDfxg.js} +2 -2
- package/dist/curveFns-BoG_iA07.cjs +375 -0
- package/dist/curveFns-Cg99XKe2.js +376 -0
- package/dist/{drawFns-Btmlh_Oz.js → drawFns-CqfB685D.js} +12 -13
- package/dist/{drawFns-D2eDcf4k.cjs → drawFns-DJIg_iZh.cjs} +15 -16
- package/dist/{faceFns-DDzCECn3.js → faceFns-CyokaCDr.js} +3 -3
- package/dist/{faceFns-NDRFeekj.cjs → faceFns-DcSCjDG0.cjs} +3 -3
- package/dist/{helpers-jku2V1DY.js → helpers-BCWmNSKh.js} +14 -14
- package/dist/{helpers-Ck8GJ58k.cjs → helpers-DwmieP38.cjs} +17 -17
- package/dist/io.cjs +4 -4
- package/dist/io.js +4 -4
- package/dist/kernel/curveOps.d.ts.map +1 -1
- package/dist/kernel/meshOps.d.ts.map +1 -1
- package/dist/kernel/modifierOps.d.ts.map +1 -1
- package/dist/{loft-DJXwxV_L.cjs → loft-8asn63t4.cjs} +4 -4
- package/dist/{loft-Bk9EM0gZ.js → loft-jIkZRqHm.js} +4 -4
- package/dist/{measurement-DlXaTzKc.js → measurement-DWv8kK6J.js} +3 -3
- package/dist/{measurement-LcGh4wV0.cjs → measurement-lRLwaoqD.cjs} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-c8lDKfYy.cjs → meshFns-DWuLC3fk.cjs} +29 -9
- package/dist/{meshFns-Djzdn-CS.js → meshFns-DgAIL1B-.js} +29 -9
- package/dist/{occtBoundary-6kQSl3cF.cjs → occtBoundary-DHtzU4tz.cjs} +72 -61
- package/dist/{occtBoundary-CqXvDhZY.js → occtBoundary-DYsksDtE.js} +72 -61
- package/dist/operations/patternFns.d.ts.map +1 -1
- package/dist/{operations-CrQlFDHc.js → operations-BtwU1X9p.js} +32 -10
- package/dist/{operations-Do-WZGXc.cjs → operations-CCFPvtd-.cjs} +32 -10
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/query/shapeDistanceFilter.d.ts.map +1 -1
- package/dist/query.cjs +5 -5
- package/dist/query.js +6 -6
- package/dist/{shapeTypes-BJ3Hmskg.cjs → shapeTypes-b_lhwQB7.cjs} +1 -1
- package/dist/{shapeTypes-C9sUsmEW.js → shapeTypes-i7VwMRwc.js} +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/topology/adjacencyFns.d.ts.map +1 -1
- package/dist/topology/compoundOpsFns.d.ts.map +1 -1
- package/dist/topology/meshFns.d.ts.map +1 -1
- package/dist/{topology-CtfUZwLR.js → topology-DXDdiKaF.js} +39 -18
- package/dist/{topology-DXq8dLsi.cjs → topology-uexRi0i6.cjs} +44 -23
- package/dist/topology.cjs +33 -34
- package/dist/topology.js +52 -53
- package/dist/{vectors-BVgXsYWl.js → vectors-DWLjb9-P.js} +1 -1
- package/dist/{vectors-DK2hEKcI.cjs → vectors-aQBZK0Sb.cjs} +1 -1
- package/dist/vectors.cjs +2 -2
- package/dist/vectors.js +2 -2
- package/package.json +1 -1
- package/dist/curveFns-BrJDkaWi.cjs +0 -177
- package/dist/curveFns-BshHA9Ys.js +0 -178
- package/dist/shapeFns-DQtpzndX.js +0 -203
- package/dist/shapeFns-cN4qGpbO.cjs +0 -202
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const occtBoundary = require("./occtBoundary-6kQSl3cF.cjs");
|
|
3
|
-
const shapeTypes = require("./shapeTypes-BJ3Hmskg.cjs");
|
|
4
|
-
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
5
|
-
const cast = require("./cast-DIiyxDLo.cjs");
|
|
6
|
-
const errors = require("./errors-DK1VAdP4.cjs");
|
|
7
|
-
function clone(shape) {
|
|
8
|
-
return shapeTypes.castShape(errors.unwrap(cast.downcast(shape.wrapped)));
|
|
9
|
-
}
|
|
10
|
-
function toBREP(shape) {
|
|
11
|
-
const oc = occtBoundary.getKernel().oc;
|
|
12
|
-
return oc.BRepToolsWrapper.Write(shape.wrapped);
|
|
13
|
-
}
|
|
14
|
-
function getHashCode(shape) {
|
|
15
|
-
return shape.wrapped.HashCode(vecOps.HASH_CODE_MAX);
|
|
16
|
-
}
|
|
17
|
-
function isEmpty(shape) {
|
|
18
|
-
return shape.wrapped.IsNull();
|
|
19
|
-
}
|
|
20
|
-
function isSameShape(a, b) {
|
|
21
|
-
return a.wrapped.IsSame(b.wrapped);
|
|
22
|
-
}
|
|
23
|
-
function isEqualShape(a, b) {
|
|
24
|
-
return a.wrapped.IsEqual(b.wrapped);
|
|
25
|
-
}
|
|
26
|
-
function simplify(shape) {
|
|
27
|
-
const oc = occtBoundary.getKernel().oc;
|
|
28
|
-
const r = shapeTypes.gcWithScope();
|
|
29
|
-
const upgrader = r(new oc.ShapeUpgrade_UnifySameDomain_2(shape.wrapped, true, true, false));
|
|
30
|
-
upgrader.Build();
|
|
31
|
-
return shapeTypes.castShape(upgrader.Shape());
|
|
32
|
-
}
|
|
33
|
-
function translate(shape, v) {
|
|
34
|
-
const oc = occtBoundary.getKernel().oc;
|
|
35
|
-
const trsf = new oc.gp_Trsf_1();
|
|
36
|
-
const vec = occtBoundary.toOcVec(v);
|
|
37
|
-
trsf.SetTranslation_1(vec);
|
|
38
|
-
const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
|
|
39
|
-
const result = shapeTypes.castShape(transformer.Shape());
|
|
40
|
-
transformer.delete();
|
|
41
|
-
trsf.delete();
|
|
42
|
-
vec.delete();
|
|
43
|
-
return result;
|
|
44
|
-
}
|
|
45
|
-
function rotate(shape, angle, position = [0, 0, 0], direction = [0, 0, 1]) {
|
|
46
|
-
const oc = occtBoundary.getKernel().oc;
|
|
47
|
-
const trsf = new oc.gp_Trsf_1();
|
|
48
|
-
const ax1 = occtBoundary.makeOcAx1(position, direction);
|
|
49
|
-
trsf.SetRotation_1(ax1, angle * vecOps.DEG2RAD);
|
|
50
|
-
const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
|
|
51
|
-
const result = shapeTypes.castShape(transformer.Shape());
|
|
52
|
-
transformer.delete();
|
|
53
|
-
trsf.delete();
|
|
54
|
-
ax1.delete();
|
|
55
|
-
return result;
|
|
56
|
-
}
|
|
57
|
-
function mirror(shape, planeNormal = [0, 1, 0], planeOrigin = [0, 0, 0]) {
|
|
58
|
-
const oc = occtBoundary.getKernel().oc;
|
|
59
|
-
const trsf = new oc.gp_Trsf_1();
|
|
60
|
-
const ax2 = occtBoundary.makeOcAx2(planeOrigin, planeNormal);
|
|
61
|
-
trsf.SetMirror_3(ax2);
|
|
62
|
-
const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
|
|
63
|
-
const result = shapeTypes.castShape(transformer.Shape());
|
|
64
|
-
transformer.delete();
|
|
65
|
-
trsf.delete();
|
|
66
|
-
ax2.delete();
|
|
67
|
-
return result;
|
|
68
|
-
}
|
|
69
|
-
function scale(shape, factor, center = [0, 0, 0]) {
|
|
70
|
-
const oc = occtBoundary.getKernel().oc;
|
|
71
|
-
const trsf = new oc.gp_Trsf_1();
|
|
72
|
-
const pnt = occtBoundary.toOcPnt(center);
|
|
73
|
-
trsf.SetScale(pnt, factor);
|
|
74
|
-
const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
|
|
75
|
-
const result = shapeTypes.castShape(transformer.Shape());
|
|
76
|
-
transformer.delete();
|
|
77
|
-
trsf.delete();
|
|
78
|
-
pnt.delete();
|
|
79
|
-
return result;
|
|
80
|
-
}
|
|
81
|
-
const topoCache = /* @__PURE__ */ new WeakMap();
|
|
82
|
-
function getOrCreateCache(shape) {
|
|
83
|
-
let entry = topoCache.get(shape.wrapped);
|
|
84
|
-
if (!entry) {
|
|
85
|
-
entry = {};
|
|
86
|
-
topoCache.set(shape.wrapped, entry);
|
|
87
|
-
}
|
|
88
|
-
return entry;
|
|
89
|
-
}
|
|
90
|
-
function getEdges(shape) {
|
|
91
|
-
const cache = getOrCreateCache(shape);
|
|
92
|
-
if (cache.edges) return cache.edges;
|
|
93
|
-
const edges = Array.from(cast.iterTopo(shape.wrapped, "edge")).map(
|
|
94
|
-
(e) => shapeTypes.castShape(errors.unwrap(cast.downcast(e)))
|
|
95
|
-
);
|
|
96
|
-
cache.edges = edges;
|
|
97
|
-
return edges;
|
|
98
|
-
}
|
|
99
|
-
function getFaces(shape) {
|
|
100
|
-
const cache = getOrCreateCache(shape);
|
|
101
|
-
if (cache.faces) return cache.faces;
|
|
102
|
-
const faces = Array.from(cast.iterTopo(shape.wrapped, "face")).map(
|
|
103
|
-
(e) => shapeTypes.castShape(errors.unwrap(cast.downcast(e)))
|
|
104
|
-
);
|
|
105
|
-
cache.faces = faces;
|
|
106
|
-
return faces;
|
|
107
|
-
}
|
|
108
|
-
function getWires(shape) {
|
|
109
|
-
const cache = getOrCreateCache(shape);
|
|
110
|
-
if (cache.wires) return cache.wires;
|
|
111
|
-
const wires = Array.from(cast.iterTopo(shape.wrapped, "wire")).map(
|
|
112
|
-
(e) => shapeTypes.castShape(errors.unwrap(cast.downcast(e)))
|
|
113
|
-
);
|
|
114
|
-
cache.wires = wires;
|
|
115
|
-
return wires;
|
|
116
|
-
}
|
|
117
|
-
function getVertices(shape) {
|
|
118
|
-
return Array.from(cast.iterTopo(shape.wrapped, "vertex")).map(
|
|
119
|
-
(e) => shapeTypes.castShape(errors.unwrap(cast.downcast(e)))
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
function* iterEdges(shape) {
|
|
123
|
-
for (const e of cast.iterTopo(shape.wrapped, "edge")) {
|
|
124
|
-
yield shapeTypes.castShape(errors.unwrap(cast.downcast(e)));
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
function* iterFaces(shape) {
|
|
128
|
-
for (const f of cast.iterTopo(shape.wrapped, "face")) {
|
|
129
|
-
yield shapeTypes.castShape(errors.unwrap(cast.downcast(f)));
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
function* iterWires(shape) {
|
|
133
|
-
for (const w of cast.iterTopo(shape.wrapped, "wire")) {
|
|
134
|
-
yield shapeTypes.castShape(errors.unwrap(cast.downcast(w)));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
function* iterVertices(shape) {
|
|
138
|
-
for (const v of cast.iterTopo(shape.wrapped, "vertex")) {
|
|
139
|
-
yield shapeTypes.castShape(errors.unwrap(cast.downcast(v)));
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
function getBounds(shape) {
|
|
143
|
-
const oc = occtBoundary.getKernel().oc;
|
|
144
|
-
const bbox = new oc.Bnd_Box_1();
|
|
145
|
-
oc.BRepBndLib.Add(shape.wrapped, bbox, true);
|
|
146
|
-
const xMin = { current: 0 };
|
|
147
|
-
const yMin = { current: 0 };
|
|
148
|
-
const zMin = { current: 0 };
|
|
149
|
-
const xMax = { current: 0 };
|
|
150
|
-
const yMax = { current: 0 };
|
|
151
|
-
const zMax = { current: 0 };
|
|
152
|
-
bbox.Get(xMin, yMin, zMin, xMax, yMax, zMax);
|
|
153
|
-
bbox.delete();
|
|
154
|
-
return {
|
|
155
|
-
xMin: xMin.current,
|
|
156
|
-
xMax: xMax.current,
|
|
157
|
-
yMin: yMin.current,
|
|
158
|
-
yMax: yMax.current,
|
|
159
|
-
zMin: zMin.current,
|
|
160
|
-
zMax: zMax.current
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
function describe(shape) {
|
|
164
|
-
return {
|
|
165
|
-
kind: shapeTypes.getShapeKind(shape),
|
|
166
|
-
faceCount: getFaces(shape).length,
|
|
167
|
-
edgeCount: getEdges(shape).length,
|
|
168
|
-
wireCount: getWires(shape).length,
|
|
169
|
-
vertexCount: getVertices(shape).length,
|
|
170
|
-
valid: occtBoundary.getKernel().isValid(shape.wrapped),
|
|
171
|
-
bounds: getBounds(shape)
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
function vertexPosition(vertex) {
|
|
175
|
-
const oc = occtBoundary.getKernel().oc;
|
|
176
|
-
const pnt = oc.BRep_Tool.Pnt(vertex.wrapped);
|
|
177
|
-
const result = [pnt.X(), pnt.Y(), pnt.Z()];
|
|
178
|
-
pnt.delete();
|
|
179
|
-
return result;
|
|
180
|
-
}
|
|
181
|
-
exports.clone = clone;
|
|
182
|
-
exports.describe = describe;
|
|
183
|
-
exports.getBounds = getBounds;
|
|
184
|
-
exports.getEdges = getEdges;
|
|
185
|
-
exports.getFaces = getFaces;
|
|
186
|
-
exports.getHashCode = getHashCode;
|
|
187
|
-
exports.getVertices = getVertices;
|
|
188
|
-
exports.getWires = getWires;
|
|
189
|
-
exports.isEmpty = isEmpty;
|
|
190
|
-
exports.isEqualShape = isEqualShape;
|
|
191
|
-
exports.isSameShape = isSameShape;
|
|
192
|
-
exports.iterEdges = iterEdges;
|
|
193
|
-
exports.iterFaces = iterFaces;
|
|
194
|
-
exports.iterVertices = iterVertices;
|
|
195
|
-
exports.iterWires = iterWires;
|
|
196
|
-
exports.mirror = mirror;
|
|
197
|
-
exports.rotate = rotate;
|
|
198
|
-
exports.scale = scale;
|
|
199
|
-
exports.simplify = simplify;
|
|
200
|
-
exports.toBREP = toBREP;
|
|
201
|
-
exports.translate = translate;
|
|
202
|
-
exports.vertexPosition = vertexPosition;
|