opengeometry 2.0.14 → 2.0.15
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/README.md +4 -4
- package/index.d.ts +1 -1
- package/index.js +365 -210
- package/index.js.map +1 -1
- package/opengeometry/pkg/opengeometry.d.ts +328 -317
- package/opengeometry/pkg/opengeometry.js +219 -148
- package/opengeometry/pkg/opengeometry_bg.wasm +0 -0
- package/opengeometry/pkg/opengeometry_bg.wasm.d.ts +302 -299
- package/opengeometry_bg.wasm +0 -0
- package/opengeometry_bg.wasm.d.ts +302 -299
- package/package.json +2 -4
- package/src/examples/index.d.ts +1 -1
- package/src/examples/{wall-from-offsets.d.ts → ribbon-from-offsets.d.ts} +6 -6
- package/src/operations/boolean-regions.d.ts +20 -0
- package/src/operations/index.d.ts +1 -0
- package/src/operations/offset-regions.d.ts +11 -12
- package/src/shapes/analytic-solid.d.ts +23 -7
- package/src/operations/boolean-errors.d.ts +0 -90
- package/src/shapes/boolean-subtract.d.ts +0 -21
package/index.js
CHANGED
|
@@ -137,37 +137,16 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
137
137
|
WASM_VECTOR_LEN = offset;
|
|
138
138
|
return ptr;
|
|
139
139
|
}
|
|
140
|
+
function _assertClass(instance, klass) {
|
|
141
|
+
if (!(instance instanceof klass)) {
|
|
142
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
140
145
|
function takeFromExternrefTable0(idx) {
|
|
141
146
|
const value = wasm.__wbindgen_export_2.get(idx);
|
|
142
147
|
wasm.__externref_table_dealloc(idx);
|
|
143
148
|
return value;
|
|
144
149
|
}
|
|
145
|
-
/**
|
|
146
|
-
* @param {string} local_brep_serialized
|
|
147
|
-
* @param {number} height
|
|
148
|
-
* @returns {string}
|
|
149
|
-
*/
|
|
150
|
-
function extrudeBrepFace$1(local_brep_serialized, height) {
|
|
151
|
-
let deferred3_0;
|
|
152
|
-
let deferred3_1;
|
|
153
|
-
try {
|
|
154
|
-
const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
155
|
-
const len0 = WASM_VECTOR_LEN;
|
|
156
|
-
const ret = wasm.extrudeBrepFace(ptr0, len0, height);
|
|
157
|
-
var ptr2 = ret[0];
|
|
158
|
-
var len2 = ret[1];
|
|
159
|
-
if (ret[3]) {
|
|
160
|
-
ptr2 = 0;
|
|
161
|
-
len2 = 0;
|
|
162
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
163
|
-
}
|
|
164
|
-
deferred3_0 = ptr2;
|
|
165
|
-
deferred3_1 = len2;
|
|
166
|
-
return getStringFromWasm0(ptr2, len2);
|
|
167
|
-
} finally {
|
|
168
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
150
|
let cachedFloat64ArrayMemory0 = null;
|
|
172
151
|
function getFloat64ArrayMemory0() {
|
|
173
152
|
if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
|
|
@@ -175,35 +154,69 @@ function getFloat64ArrayMemory0() {
|
|
|
175
154
|
}
|
|
176
155
|
return cachedFloat64ArrayMemory0;
|
|
177
156
|
}
|
|
178
|
-
function
|
|
179
|
-
|
|
180
|
-
getFloat64ArrayMemory0().
|
|
181
|
-
|
|
157
|
+
function getArrayF64FromWasm0(ptr, len) {
|
|
158
|
+
ptr = ptr >>> 0;
|
|
159
|
+
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
160
|
+
}
|
|
161
|
+
let cachedDataViewMemory0 = null;
|
|
162
|
+
function getDataViewMemory0() {
|
|
163
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
|
|
164
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
165
|
+
}
|
|
166
|
+
return cachedDataViewMemory0;
|
|
167
|
+
}
|
|
168
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
169
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
170
|
+
for (let i = 0; i < array.length; i++) {
|
|
171
|
+
const add = addToExternrefTable0(array[i]);
|
|
172
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
173
|
+
}
|
|
174
|
+
WASM_VECTOR_LEN = array.length;
|
|
182
175
|
return ptr;
|
|
183
176
|
}
|
|
177
|
+
function isLikeNone(x) {
|
|
178
|
+
return x === undefined || x === null;
|
|
179
|
+
}
|
|
184
180
|
/**
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
181
|
+
* @param {string} a_json
|
|
182
|
+
* @param {string} b_json
|
|
183
|
+
* @param {string} operation
|
|
184
|
+
* @returns {OGOffsetRegionsResult}
|
|
185
|
+
*/
|
|
186
|
+
function booleanRegions2D$1(a_json, b_json, operation) {
|
|
187
|
+
const ptr0 = passStringToWasm0(a_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
188
|
+
const len0 = WASM_VECTOR_LEN;
|
|
189
|
+
const ptr1 = passStringToWasm0(b_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
190
|
+
const len1 = WASM_VECTOR_LEN;
|
|
191
|
+
const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
192
|
+
const len2 = WASM_VECTOR_LEN;
|
|
193
|
+
const ret = wasm.booleanRegions2D(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
194
|
+
if (ret[2]) {
|
|
195
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
196
|
+
}
|
|
197
|
+
return OGOffsetRegionsResult.__wrap(ret[0]);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Exact line/arc region Boolean. The JSON rings contain analytic edges rather
|
|
202
|
+
* than vertices, and the result keeps arcs as arcs. As with booleanRegions2D,
|
|
203
|
+
* outer rings are CW in XZ and holes are CCW.
|
|
204
|
+
* @param {string} a_json
|
|
205
|
+
* @param {string} b_json
|
|
206
|
+
* @param {string} operation
|
|
194
207
|
* @returns {string}
|
|
195
208
|
*/
|
|
196
|
-
function
|
|
209
|
+
function booleanCurvedRegions2D$1(a_json, b_json, operation) {
|
|
197
210
|
let deferred5_0;
|
|
198
211
|
let deferred5_1;
|
|
199
212
|
try {
|
|
200
|
-
const ptr0 = passStringToWasm0(
|
|
213
|
+
const ptr0 = passStringToWasm0(a_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
201
214
|
const len0 = WASM_VECTOR_LEN;
|
|
202
|
-
const ptr1 =
|
|
215
|
+
const ptr1 = passStringToWasm0(b_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
203
216
|
const len1 = WASM_VECTOR_LEN;
|
|
204
|
-
const ptr2 = passStringToWasm0(
|
|
217
|
+
const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
205
218
|
const len2 = WASM_VECTOR_LEN;
|
|
206
|
-
const ret = wasm.
|
|
219
|
+
const ret = wasm.booleanCurvedRegions2D(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
207
220
|
var ptr4 = ret[0];
|
|
208
221
|
var len4 = ret[1];
|
|
209
222
|
if (ret[3]) {
|
|
@@ -218,60 +231,10 @@ function extrudeBrepFaceDirectional(local_brep_serialized, direction, extent_kin
|
|
|
218
231
|
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
219
232
|
}
|
|
220
233
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
* @param {Float64Array} flat_points
|
|
226
|
-
* @returns {string}
|
|
227
|
-
*/
|
|
228
|
-
function analyzeProfile(flat_points) {
|
|
229
|
-
let deferred3_0;
|
|
230
|
-
let deferred3_1;
|
|
231
|
-
try {
|
|
232
|
-
const ptr0 = passArrayF64ToWasm0(flat_points, wasm.__wbindgen_malloc);
|
|
233
|
-
const len0 = WASM_VECTOR_LEN;
|
|
234
|
-
const ret = wasm.analyzeProfile(ptr0, len0);
|
|
235
|
-
var ptr2 = ret[0];
|
|
236
|
-
var len2 = ret[1];
|
|
237
|
-
if (ret[3]) {
|
|
238
|
-
ptr2 = 0;
|
|
239
|
-
len2 = 0;
|
|
240
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
241
|
-
}
|
|
242
|
-
deferred3_0 = ptr2;
|
|
243
|
-
deferred3_1 = len2;
|
|
244
|
-
return getStringFromWasm0(ptr2, len2);
|
|
245
|
-
} finally {
|
|
246
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
function _assertClass(instance, klass) {
|
|
250
|
-
if (!(instance instanceof klass)) {
|
|
251
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
function isLikeNone(x) {
|
|
255
|
-
return x === undefined || x === null;
|
|
256
|
-
}
|
|
257
|
-
function getArrayF64FromWasm0(ptr, len) {
|
|
258
|
-
ptr = ptr >>> 0;
|
|
259
|
-
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
260
|
-
}
|
|
261
|
-
let cachedDataViewMemory0 = null;
|
|
262
|
-
function getDataViewMemory0() {
|
|
263
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
|
|
264
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
265
|
-
}
|
|
266
|
-
return cachedDataViewMemory0;
|
|
267
|
-
}
|
|
268
|
-
function passArrayJsValueToWasm0(array, malloc) {
|
|
269
|
-
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
270
|
-
for (let i = 0; i < array.length; i++) {
|
|
271
|
-
const add = addToExternrefTable0(array[i]);
|
|
272
|
-
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
273
|
-
}
|
|
274
|
-
WASM_VECTOR_LEN = array.length;
|
|
234
|
+
function passArrayF64ToWasm0(arg, malloc) {
|
|
235
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
236
|
+
getFloat64ArrayMemory0().set(arg, ptr / 8);
|
|
237
|
+
WASM_VECTOR_LEN = arg.length;
|
|
275
238
|
return ptr;
|
|
276
239
|
}
|
|
277
240
|
/**
|
|
@@ -298,7 +261,7 @@ function offsetPolylineRegions$1(centreline_flat, width, closed, miter_limit) {
|
|
|
298
261
|
* Wasm entry point: merge a GROUP of separate polylines (a crossing T / X / L
|
|
299
262
|
* overlap) into one clean stroked region by nonzero-winding union of their mitered
|
|
300
263
|
* bands. `polylines_json` is `[{centreline:[x,y,z,…], width, closed}, …]`. Returns
|
|
301
|
-
* CW-outer / CCW-hole regions (one or more); empty when
|
|
264
|
+
* CW-outer / CCW-hole regions (one or more); empty when no region remains.
|
|
302
265
|
* @param {string} polylines_json
|
|
303
266
|
* @returns {OGOffsetRegionsResult}
|
|
304
267
|
*/
|
|
@@ -344,6 +307,109 @@ function offsetRingVariable$1(ring_flat, distances, holes_json) {
|
|
|
344
307
|
return OGOffsetRegionsResult.__wrap(ret[0]);
|
|
345
308
|
}
|
|
346
309
|
|
|
310
|
+
/**
|
|
311
|
+
* @param {string} local_brep_serialized
|
|
312
|
+
* @param {number} height
|
|
313
|
+
* @returns {string}
|
|
314
|
+
*/
|
|
315
|
+
function extrudeBrepFace$1(local_brep_serialized, height) {
|
|
316
|
+
let deferred3_0;
|
|
317
|
+
let deferred3_1;
|
|
318
|
+
try {
|
|
319
|
+
const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
320
|
+
const len0 = WASM_VECTOR_LEN;
|
|
321
|
+
const ret = wasm.extrudeBrepFace(ptr0, len0, height);
|
|
322
|
+
var ptr2 = ret[0];
|
|
323
|
+
var len2 = ret[1];
|
|
324
|
+
if (ret[3]) {
|
|
325
|
+
ptr2 = 0;
|
|
326
|
+
len2 = 0;
|
|
327
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
328
|
+
}
|
|
329
|
+
deferred3_0 = ptr2;
|
|
330
|
+
deferred3_1 = len2;
|
|
331
|
+
return getStringFromWasm0(ptr2, len2);
|
|
332
|
+
} finally {
|
|
333
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Wasm entry point for general extrude. `direction` is `[x,y,z]`; `extent_kind`
|
|
339
|
+
* is `"one_sided" | "symmetric" | "two_sided"`; `d_plus`/`d_minus` are the
|
|
340
|
+
* extent distances (`d_minus` ignored unless two-sided, `d_plus` is the
|
|
341
|
+
* distance for one-sided/symmetric).
|
|
342
|
+
* @param {string} local_brep_serialized
|
|
343
|
+
* @param {Float64Array} direction
|
|
344
|
+
* @param {string} extent_kind
|
|
345
|
+
* @param {number} d_plus
|
|
346
|
+
* @param {number} d_minus
|
|
347
|
+
* @returns {string}
|
|
348
|
+
*/
|
|
349
|
+
function extrudeBrepFaceDirectional(local_brep_serialized, direction, extent_kind, d_plus, d_minus) {
|
|
350
|
+
let deferred5_0;
|
|
351
|
+
let deferred5_1;
|
|
352
|
+
try {
|
|
353
|
+
const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
354
|
+
const len0 = WASM_VECTOR_LEN;
|
|
355
|
+
const ptr1 = passArrayF64ToWasm0(direction, wasm.__wbindgen_malloc);
|
|
356
|
+
const len1 = WASM_VECTOR_LEN;
|
|
357
|
+
const ptr2 = passStringToWasm0(extent_kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
358
|
+
const len2 = WASM_VECTOR_LEN;
|
|
359
|
+
const ret = wasm.extrudeBrepFaceDirectional(ptr0, len0, ptr1, len1, ptr2, len2, d_plus, d_minus);
|
|
360
|
+
var ptr4 = ret[0];
|
|
361
|
+
var len4 = ret[1];
|
|
362
|
+
if (ret[3]) {
|
|
363
|
+
ptr4 = 0;
|
|
364
|
+
len4 = 0;
|
|
365
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
366
|
+
}
|
|
367
|
+
deferred5_0 = ptr4;
|
|
368
|
+
deferred5_1 = len4;
|
|
369
|
+
return getStringFromWasm0(ptr4, len4);
|
|
370
|
+
} finally {
|
|
371
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Wasm entry point: analyze a flat `[x0,y0,z0,…]` loop, returning the report as
|
|
377
|
+
* JSON (the corrected points are not returned here; use the kernel API).
|
|
378
|
+
* @param {Float64Array} flat_points
|
|
379
|
+
* @returns {string}
|
|
380
|
+
*/
|
|
381
|
+
function analyzeProfile(flat_points) {
|
|
382
|
+
let deferred3_0;
|
|
383
|
+
let deferred3_1;
|
|
384
|
+
try {
|
|
385
|
+
const ptr0 = passArrayF64ToWasm0(flat_points, wasm.__wbindgen_malloc);
|
|
386
|
+
const len0 = WASM_VECTOR_LEN;
|
|
387
|
+
const ret = wasm.analyzeProfile(ptr0, len0);
|
|
388
|
+
var ptr2 = ret[0];
|
|
389
|
+
var len2 = ret[1];
|
|
390
|
+
if (ret[3]) {
|
|
391
|
+
ptr2 = 0;
|
|
392
|
+
len2 = 0;
|
|
393
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
394
|
+
}
|
|
395
|
+
deferred3_0 = ptr2;
|
|
396
|
+
deferred3_1 = len2;
|
|
397
|
+
return getStringFromWasm0(ptr2, len2);
|
|
398
|
+
} finally {
|
|
399
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
403
|
+
ptr = ptr >>> 0;
|
|
404
|
+
const mem = getDataViewMemory0();
|
|
405
|
+
const result = [];
|
|
406
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
407
|
+
result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
|
|
408
|
+
}
|
|
409
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
410
|
+
return result;
|
|
411
|
+
}
|
|
412
|
+
|
|
347
413
|
/**
|
|
348
414
|
* @param {string} serialized
|
|
349
415
|
* @returns {string}
|
|
@@ -409,16 +475,6 @@ function getArrayU32FromWasm0(ptr, len) {
|
|
|
409
475
|
ptr = ptr >>> 0;
|
|
410
476
|
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
411
477
|
}
|
|
412
|
-
function getArrayJsValueFromWasm0(ptr, len) {
|
|
413
|
-
ptr = ptr >>> 0;
|
|
414
|
-
const mem = getDataViewMemory0();
|
|
415
|
-
const result = [];
|
|
416
|
-
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
417
|
-
result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
|
|
418
|
-
}
|
|
419
|
-
wasm.__externref_drop_slice(ptr, len);
|
|
420
|
-
return result;
|
|
421
|
-
}
|
|
422
478
|
typeof FinalizationRegistry === 'undefined' ? {
|
|
423
479
|
} : new FinalizationRegistry(ptr => wasm.__wbg_matrix3_free(ptr >>> 0, 1));
|
|
424
480
|
const Matrix4Finalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
@@ -856,6 +912,22 @@ class OGAnalyticBrep {
|
|
|
856
912
|
}
|
|
857
913
|
return OGAnalyticBrep.__wrap(ret[0]);
|
|
858
914
|
}
|
|
915
|
+
/**
|
|
916
|
+
* @param {string} cutters_json
|
|
917
|
+
* @param {string} id
|
|
918
|
+
* @returns {OGAnalyticBrep}
|
|
919
|
+
*/
|
|
920
|
+
subtract_planar_cutters(cutters_json, id) {
|
|
921
|
+
const ptr0 = passStringToWasm0(cutters_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
922
|
+
const len0 = WASM_VECTOR_LEN;
|
|
923
|
+
const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
924
|
+
const len1 = WASM_VECTOR_LEN;
|
|
925
|
+
const ret = wasm.oganalyticbrep_subtract_planar_cutters(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
926
|
+
if (ret[2]) {
|
|
927
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
928
|
+
}
|
|
929
|
+
return OGAnalyticBrep.__wrap(ret[0]);
|
|
930
|
+
}
|
|
859
931
|
/**
|
|
860
932
|
* @param {number} thickness
|
|
861
933
|
* @param {string} id
|
|
@@ -5007,7 +5079,7 @@ class OGSphere {
|
|
|
5007
5079
|
* @returns {Vector3}
|
|
5008
5080
|
*/
|
|
5009
5081
|
get_anchor() {
|
|
5010
|
-
const ret = wasm.
|
|
5082
|
+
const ret = wasm.ogcurve_get_anchor(this.__wbg_ptr);
|
|
5011
5083
|
return Vector3.__wrap(ret);
|
|
5012
5084
|
}
|
|
5013
5085
|
}
|
|
@@ -5389,7 +5461,7 @@ class OGSweep {
|
|
|
5389
5461
|
* @returns {Vector3}
|
|
5390
5462
|
*/
|
|
5391
5463
|
get_anchor() {
|
|
5392
|
-
const ret = wasm.
|
|
5464
|
+
const ret = wasm.ogsweep_get_anchor(this.__wbg_ptr);
|
|
5393
5465
|
return Vector3.__wrap(ret);
|
|
5394
5466
|
}
|
|
5395
5467
|
/**
|
|
@@ -5670,7 +5742,7 @@ class OGWedge {
|
|
|
5670
5742
|
* @returns {Vector3}
|
|
5671
5743
|
*/
|
|
5672
5744
|
get_anchor() {
|
|
5673
|
-
const ret = wasm.
|
|
5745
|
+
const ret = wasm.ogwedge_get_anchor(this.__wbg_ptr);
|
|
5674
5746
|
return Vector3.__wrap(ret);
|
|
5675
5747
|
}
|
|
5676
5748
|
}
|
|
@@ -6046,7 +6118,7 @@ class WorkPlane {
|
|
|
6046
6118
|
* @returns {Vector3}
|
|
6047
6119
|
*/
|
|
6048
6120
|
get origin() {
|
|
6049
|
-
const ret = wasm.
|
|
6121
|
+
const ret = wasm.workplane_origin(this.__wbg_ptr);
|
|
6050
6122
|
return Vector3.__wrap(ret);
|
|
6051
6123
|
}
|
|
6052
6124
|
/**
|
|
@@ -6833,16 +6905,58 @@ class AnalyticSolid extends THREE.Group {
|
|
|
6833
6905
|
return this.boolean(other, "intersection", options);
|
|
6834
6906
|
}
|
|
6835
6907
|
subtract(cutters, options = {}) {
|
|
6908
|
+
var _a, _b, _c, _d;
|
|
6836
6909
|
if (!Array.isArray(cutters) || cutters.length === 0 || cutters.some((cutter) => !(cutter instanceof AnalyticSolid))) {
|
|
6837
6910
|
throw new Error("Analytic subtraction requires a nonempty AnalyticSolid array");
|
|
6838
6911
|
}
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
const
|
|
6842
|
-
result
|
|
6843
|
-
|
|
6912
|
+
if (cutters.length > 1) {
|
|
6913
|
+
const host = this.worldKernel();
|
|
6914
|
+
const cutterKernels = [];
|
|
6915
|
+
let result;
|
|
6916
|
+
try {
|
|
6917
|
+
for (const cutter of cutters)
|
|
6918
|
+
cutterKernels.push(cutter.worldKernel());
|
|
6919
|
+
const payload = `[${cutterKernels.map((cutter) => cutter.get_brep_serialized()).join(",")}]`;
|
|
6920
|
+
result = host.subtract_planar_cutters(payload, getUUID());
|
|
6921
|
+
const report = result.get_boolean_report_serialized();
|
|
6922
|
+
const solid = AnalyticSolid.fromBrep(result.get_brep_serialized(), {
|
|
6923
|
+
deflection: (_a = options.deflection) !== null && _a !== void 0 ? _a : this.lastDeflection,
|
|
6924
|
+
color: (_b = options.color) !== null && _b !== void 0 ? _b : this.surface.material.color,
|
|
6925
|
+
});
|
|
6926
|
+
solid.booleanReport = report ? JSON.parse(report) : undefined;
|
|
6927
|
+
solid.name = this.name;
|
|
6928
|
+
solid.userData = Object.assign({}, this.userData);
|
|
6929
|
+
solid.outline = this.outline;
|
|
6930
|
+
return solid;
|
|
6931
|
+
}
|
|
6932
|
+
catch (error) {
|
|
6933
|
+
const parsed = parseAnalyticGeometryError(error);
|
|
6934
|
+
// The native mixed-cutter path already chose a safe cutter order and
|
|
6935
|
+
// checked spatial overlap. A serial fallback may drop an earlier
|
|
6936
|
+
// cylindrical void or accept an invalid arched profile.
|
|
6937
|
+
if (parsed.code !== "coverage_gap"
|
|
6938
|
+
|| ((_d = (_c = parsed.families) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.includes("mixed cutter batch")))
|
|
6939
|
+
throw parsed;
|
|
6940
|
+
}
|
|
6941
|
+
finally {
|
|
6942
|
+
result === null || result === void 0 ? void 0 : result.free();
|
|
6943
|
+
cutterKernels.forEach((cutter) => cutter.free());
|
|
6944
|
+
host.free();
|
|
6945
|
+
}
|
|
6946
|
+
}
|
|
6947
|
+
let result;
|
|
6948
|
+
try {
|
|
6949
|
+
for (const cutter of cutters) {
|
|
6950
|
+
const next = (result !== null && result !== void 0 ? result : this).boolean(cutter, "subtraction", options);
|
|
6951
|
+
result === null || result === void 0 ? void 0 : result.dispose();
|
|
6952
|
+
result = next;
|
|
6953
|
+
}
|
|
6954
|
+
return result;
|
|
6955
|
+
}
|
|
6956
|
+
catch (error) {
|
|
6957
|
+
result === null || result === void 0 ? void 0 : result.dispose();
|
|
6958
|
+
throw error;
|
|
6844
6959
|
}
|
|
6845
|
-
return result;
|
|
6846
6960
|
}
|
|
6847
6961
|
shell(thickness, options = {}) {
|
|
6848
6962
|
var _a, _b;
|
|
@@ -7196,13 +7310,17 @@ class AnalyticSolid extends THREE.Group {
|
|
|
7196
7310
|
}
|
|
7197
7311
|
}
|
|
7198
7312
|
function createPrimitiveKernel(options, ogid) {
|
|
7199
|
-
var _a, _b, _c;
|
|
7313
|
+
var _a, _b, _c, _d, _e;
|
|
7200
7314
|
const frame = (_a = options.frame) !== null && _a !== void 0 ? _a : (options.kind === "planarPolyhedron" || options.kind === "polygonLoft"
|
|
7201
7315
|
? { origin: [0, 0, 0], x: [1, 0, 0], y: [0, 1, 0], z: [0, 0, 1] }
|
|
7202
7316
|
: { origin: [0, 0, 0], x: [1, 0, 0], y: [0, 0, -1], z: [0, 1, 0] });
|
|
7203
7317
|
const profileExtent = options.kind === "linearExtrusion"
|
|
7204
7318
|
? [options.outer, ...options.holes].reduce((extent, loop) => (loop.reduce((loopExtent, point) => Math.max(loopExtent, Math.abs(point[0]), Math.abs(point[1])), extent)), 0)
|
|
7205
|
-
:
|
|
7319
|
+
: options.kind === "arcEdgedExtrusion"
|
|
7320
|
+
? [options.outer, ...((_b = options.holes) !== null && _b !== void 0 ? _b : [])].reduce((extent, ring) => ring.reduce((loopExtent, edge) => edge.kind === "line"
|
|
7321
|
+
? Math.max(loopExtent, ...edge.from.map(Math.abs), ...edge.to.map(Math.abs))
|
|
7322
|
+
: Math.max(loopExtent, Math.abs(edge.center[0]) + edge.radius, Math.abs(edge.center[1]) + edge.radius), extent), 0)
|
|
7323
|
+
: 0;
|
|
7206
7324
|
const loftExtent = options.kind === "polygonLoft"
|
|
7207
7325
|
? [...options.lower, ...options.upper].reduce((extent, point) => Math.max(extent, ...point.map(Math.abs)), 0)
|
|
7208
7326
|
: 0;
|
|
@@ -7217,17 +7335,17 @@ function createPrimitiveKernel(options, ogid) {
|
|
|
7217
7335
|
? Math.max(2 * options.outerRadius, options.height)
|
|
7218
7336
|
: options.kind === "chamferedCuboid"
|
|
7219
7337
|
? Math.max(options.width, options.depth, options.height)
|
|
7220
|
-
: options.kind === "linearExtrusion"
|
|
7338
|
+
: options.kind === "linearExtrusion" || options.kind === "arcEdgedExtrusion"
|
|
7221
7339
|
? Math.max(options.height, profileExtent)
|
|
7222
7340
|
: options.kind === "polygonLoft"
|
|
7223
7341
|
? loftExtent
|
|
7224
|
-
: options.kind === "
|
|
7342
|
+
: options.kind === "boxWithArchedOpening"
|
|
7225
7343
|
? Math.max(options.width, options.depth, options.height)
|
|
7226
7344
|
: options.kind === "planarPolyhedron"
|
|
7227
7345
|
? polyhedronExtent
|
|
7228
7346
|
: options.kind === "frustum"
|
|
7229
7347
|
? Math.max(2 * options.lowerRadius, 2 * options.upperRadius, options.height)
|
|
7230
|
-
: options.kind === "
|
|
7348
|
+
: options.kind === "annularSectorExtrusion" || options.kind === "annularSectorExtrusionWithOpenings" || options.kind === "annularSectorExtrusionWithArchedOpening"
|
|
7231
7349
|
? Math.max(2 * options.radius + options.thickness, options.height)
|
|
7232
7350
|
: options.kind === "cuboid"
|
|
7233
7351
|
? Math.max(options.width, options.depth, options.height)
|
|
@@ -7236,7 +7354,7 @@ function createPrimitiveKernel(options, ogid) {
|
|
|
7236
7354
|
: Math.max(2 * options.radius, options.height);
|
|
7237
7355
|
const coordinateFloor = Math.max(...frame.origin.map(Math.abs)) * 64 * Number.EPSILON;
|
|
7238
7356
|
const geometric = Math.max(1e-9, size * 1e-8, coordinateFloor);
|
|
7239
|
-
const accuracy = (
|
|
7357
|
+
const accuracy = (_c = options.accuracy) !== null && _c !== void 0 ? _c : {
|
|
7240
7358
|
geometric, intersection: geometric / 4, tessellation: 0.001, exchange: 0.00001,
|
|
7241
7359
|
};
|
|
7242
7360
|
const dimensions = options.kind === "torus"
|
|
@@ -7251,38 +7369,46 @@ function createPrimitiveKernel(options, ogid) {
|
|
|
7251
7369
|
? { radius: options.radius, height: options.height, fillet_radius: options.filletRadius }
|
|
7252
7370
|
: options.kind === "linearExtrusion"
|
|
7253
7371
|
? { outer: options.outer, holes: options.holes, height: options.height }
|
|
7254
|
-
: options.kind === "
|
|
7255
|
-
? {
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
:
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7372
|
+
: options.kind === "arcEdgedExtrusion"
|
|
7373
|
+
? { outer: options.outer.map((edge) => edge.kind === "line" ? edge : {
|
|
7374
|
+
kind: "arc", center: edge.center, radius: edge.radius,
|
|
7375
|
+
start_angle: edge.startAngle, sweep_angle: edge.sweepAngle,
|
|
7376
|
+
}), holes: ((_d = options.holes) !== null && _d !== void 0 ? _d : []).map((ring) => ring.map((edge) => edge.kind === "line" ? edge : {
|
|
7377
|
+
kind: "arc", center: edge.center, radius: edge.radius,
|
|
7378
|
+
start_angle: edge.startAngle, sweep_angle: edge.sweepAngle,
|
|
7379
|
+
})), height: options.height }
|
|
7380
|
+
: options.kind === "polygonLoft"
|
|
7381
|
+
? {
|
|
7382
|
+
lower: options.lower,
|
|
7383
|
+
upper: options.upper,
|
|
7384
|
+
alignment: options.alignment === undefined || options.alignment === "auto"
|
|
7385
|
+
? { kind: "auto" }
|
|
7386
|
+
: {
|
|
7387
|
+
kind: "indexed",
|
|
7388
|
+
upper_start: options.alignment.upperStartIndex,
|
|
7389
|
+
reverse_upper: (_e = options.alignment.reverseUpper) !== null && _e !== void 0 ? _e : false,
|
|
7390
|
+
},
|
|
7391
|
+
}
|
|
7392
|
+
: options.kind === "boxWithArchedOpening"
|
|
7393
|
+
? { width: options.width, depth: options.depth, height: options.height, opening: options.opening }
|
|
7394
|
+
: options.kind === "planarPolyhedron"
|
|
7395
|
+
? { vertices: options.vertices, faces: options.faces }
|
|
7396
|
+
: options.kind === "frustum"
|
|
7397
|
+
? { lower_radius: options.lowerRadius, upper_radius: options.upperRadius, height: options.height }
|
|
7398
|
+
: options.kind === "annularSectorExtrusion" || options.kind === "annularSectorExtrusionWithOpenings" || options.kind === "annularSectorExtrusionWithArchedOpening"
|
|
7399
|
+
? Object.assign({ radius: options.radius, thickness: options.thickness, height: options.height, start_angle: options.startAngle, sweep_angle: options.sweepAngle }, (options.kind === "annularSectorExtrusionWithOpenings" ? { openings: options.openings.map((opening) => ({ id: opening.id, angle: opening.angle, width: opening.width, bottom: opening.bottom, height: opening.height })) } : options.kind === "annularSectorExtrusionWithArchedOpening" ? { opening: { id: options.opening.id, angle: options.opening.angle, width: options.opening.width, bottom: options.opening.bottom, height: options.opening.height } } : {})) : options.kind === "cylinderSector"
|
|
7400
|
+
? { radius: options.radius, height: options.height, start_angle: options.startAngle, sweep_angle: options.sweepAngle }
|
|
7401
|
+
: options.kind === "cuboid"
|
|
7402
|
+
? { size: [options.width, options.depth, options.height] }
|
|
7403
|
+
: options.kind === "sphere"
|
|
7404
|
+
? { radius: options.radius }
|
|
7405
|
+
: { radius: options.radius, height: options.height };
|
|
7406
|
+
return OGAnalyticBrep.from_primitive(JSON.stringify(Object.assign({ kind: options.kind === "annularSectorExtrusion"
|
|
7407
|
+
? "annular_sector_extrusion"
|
|
7408
|
+
: options.kind === "annularSectorExtrusionWithOpenings"
|
|
7409
|
+
? "annular_sector_extrusion_with_openings"
|
|
7410
|
+
: options.kind === "annularSectorExtrusionWithArchedOpening"
|
|
7411
|
+
? "annular_sector_extrusion_with_arched_opening"
|
|
7286
7412
|
: options.kind === "coaxialCircleLoft"
|
|
7287
7413
|
? "coaxial_circle_loft"
|
|
7288
7414
|
: options.kind === "revolvedRectangle"
|
|
@@ -7293,15 +7419,17 @@ function createPrimitiveKernel(options, ogid) {
|
|
|
7293
7419
|
? "filleted_cylinder"
|
|
7294
7420
|
: options.kind === "linearExtrusion"
|
|
7295
7421
|
? "linear_extrusion"
|
|
7296
|
-
: options.kind === "
|
|
7297
|
-
? "
|
|
7298
|
-
: options.kind === "
|
|
7299
|
-
? "
|
|
7300
|
-
: options.kind === "
|
|
7301
|
-
? "
|
|
7302
|
-
: options.kind === "
|
|
7303
|
-
? "
|
|
7304
|
-
: options.kind
|
|
7422
|
+
: options.kind === "arcEdgedExtrusion"
|
|
7423
|
+
? "arc_edged_extrusion"
|
|
7424
|
+
: options.kind === "polygonLoft"
|
|
7425
|
+
? "polygon_loft"
|
|
7426
|
+
: options.kind === "boxWithArchedOpening"
|
|
7427
|
+
? "box_with_arched_opening"
|
|
7428
|
+
: options.kind === "planarPolyhedron"
|
|
7429
|
+
? "planar_polyhedron"
|
|
7430
|
+
: options.kind === "cylinderSector"
|
|
7431
|
+
? "cylinder_sector"
|
|
7432
|
+
: options.kind, id: ogid, frame, accuracy }, dimensions)));
|
|
7305
7433
|
}
|
|
7306
7434
|
|
|
7307
7435
|
function finiteMatrix(matrix) {
|
|
@@ -10858,7 +10986,7 @@ function createOffsetExample(scene) {
|
|
|
10858
10986
|
* trims, and nonzero-winding resolution of reflex / closed loops. NO boolean union
|
|
10859
10987
|
* (so it is deterministic, unlike the 3D-mesh CSG path). A simple centreline returns
|
|
10860
10988
|
* one region; a self-crossing closed centreline (e.g. a figure-8) returns one per
|
|
10861
|
-
* simple sub-loop. Returns an EMPTY array for a
|
|
10989
|
+
* simple sub-loop. Returns an EMPTY array for a collapsed input (does
|
|
10862
10990
|
* not throw, so it never looks like a kernel crash). Rings are CW-outer / CCW-holes.
|
|
10863
10991
|
*
|
|
10864
10992
|
* @param centrelineFlat centreline points as `[x,y,z, …]`.
|
|
@@ -10877,17 +11005,17 @@ function offsetPolylineRegions(centrelineFlat, width, closed, miterLimit = 4) {
|
|
|
10877
11005
|
/**
|
|
10878
11006
|
* Inset a CLOSED ring inward with one distance per edge (edge i =
|
|
10879
11007
|
* `ring[i] → ring[i+1]`; an explicit closing duplicate point is accepted and
|
|
10880
|
-
* stripped, the distance count stays one per unique edge).
|
|
10881
|
-
*
|
|
10882
|
-
*
|
|
10883
|
-
*
|
|
10884
|
-
*
|
|
11008
|
+
* stripped, the distance count stays one per unique edge). The result is a
|
|
11009
|
+
* clearance-exact inset region: the ring's interior minus every point within
|
|
11010
|
+
* `distances[i]` of edge i's segment. Distant boundary segments remain
|
|
11011
|
+
* effective across notches; different distances produce circumscribed
|
|
11012
|
+
* clearance arcs. There is no
|
|
10885
11013
|
* `miterLimit` parameter, deliberately: miters and bevels only approximate the
|
|
10886
11014
|
* clearance arc, and a bevel would claim points inside the required distance.
|
|
10887
11015
|
*
|
|
10888
11016
|
* `holes` are excluded interior rings, each grown outward by its own per-edge
|
|
10889
11017
|
* distances — the region keeps clear of a hole's edges exactly as it keeps
|
|
10890
|
-
* clear of the
|
|
11018
|
+
* clear of the outer boundary, so a hole can split the region or swallow it.
|
|
10891
11019
|
*
|
|
10892
11020
|
* Returns CW-outer / CCW-hole regions (canonical start vertex), possibly
|
|
10893
11021
|
* SEVERAL when a deep inset (or a hole) splits a waisted ring into disjoint
|
|
@@ -10899,7 +11027,7 @@ function offsetPolylineRegions(centrelineFlat, width, closed, miterLimit = 4) {
|
|
|
10899
11027
|
*
|
|
10900
11028
|
* @param ring closed ring points as `[x,y,z, …]` (Y is carried through).
|
|
10901
11029
|
* @param distances inward inset distance per edge, metres, each >= 0
|
|
10902
|
-
* (0
|
|
11030
|
+
* (0 keeps that boundary edge in place).
|
|
10903
11031
|
* @param holes excluded interior rings with their own per-edge distances.
|
|
10904
11032
|
*/
|
|
10905
11033
|
function offsetRingVariable(ring, distances, holes = []) {
|
|
@@ -10917,7 +11045,7 @@ function offsetRingVariable(ring, distances, holes = []) {
|
|
|
10917
11045
|
* Merge a GROUP of separate polylines (a crossing T / X / L overlap) into one clean
|
|
10918
11046
|
* region by nonzero-winding union of their mitered bands — the overlapping strokes
|
|
10919
11047
|
* merge into a single region with mitered/bevelled corners, no internal edges.
|
|
10920
|
-
* Returns CW-outer / CCW-hole regions (one or more); empty if
|
|
11048
|
+
* Returns CW-outer / CCW-hole regions (one or more); empty if no region remains.
|
|
10921
11049
|
* No CSG. Used to render/extrude an overlapping crossing as one joined mass.
|
|
10922
11050
|
*/
|
|
10923
11051
|
function offsetPolylineGroupRegions(polylines) {
|
|
@@ -10992,7 +11120,7 @@ function areClose(a, b) {
|
|
|
10992
11120
|
const dz = a.z - b.z;
|
|
10993
11121
|
return (dx * dx + dy * dy + dz * dz) <= EPSILON * EPSILON;
|
|
10994
11122
|
}
|
|
10995
|
-
function
|
|
11123
|
+
function buildRibbonOutline(left, right) {
|
|
10996
11124
|
if (left.length === 0 || right.length === 0) {
|
|
10997
11125
|
return [];
|
|
10998
11126
|
}
|
|
@@ -11007,7 +11135,7 @@ function buildWallOutline(left, right) {
|
|
|
11007
11135
|
function midpoint(a, b) {
|
|
11008
11136
|
return new Vector3((a.x + b.x) * 0.5, (a.y + b.y) * 0.5, (a.z + b.z) * 0.5);
|
|
11009
11137
|
}
|
|
11010
|
-
function buildThroughSlot(centerlinePoints,
|
|
11138
|
+
function buildThroughSlot(centerlinePoints, ribbonThickness, height, width) {
|
|
11011
11139
|
const a = centerlinePoints[2];
|
|
11012
11140
|
const b = centerlinePoints[3];
|
|
11013
11141
|
const mid = midpoint(a, b);
|
|
@@ -11015,7 +11143,7 @@ function buildThroughSlot(centerlinePoints, wallThickness, height, width) {
|
|
|
11015
11143
|
const tangent = [(b.x - a.x) / length, (b.z - a.z) / length];
|
|
11016
11144
|
const normal = [-tangent[1], tangent[0]];
|
|
11017
11145
|
const halfWidth = width * 0.5;
|
|
11018
|
-
const halfDepth =
|
|
11146
|
+
const halfDepth = ribbonThickness * 0.5 + 0.1;
|
|
11019
11147
|
const point = (along, across) => [
|
|
11020
11148
|
mid.x + tangent[0] * along + normal[0] * across,
|
|
11021
11149
|
-(mid.z + tangent[1] * along + normal[1] * across),
|
|
@@ -11039,13 +11167,13 @@ function buildThroughSlot(centerlinePoints, wallThickness, height, width) {
|
|
|
11039
11167
|
* other thrown value). Used by the example HTML to surface kernel failures
|
|
11040
11168
|
* in a status panel without losing the structured payload.
|
|
11041
11169
|
*/
|
|
11042
|
-
function
|
|
11170
|
+
function describeRibbonSubtractError(error) {
|
|
11043
11171
|
if (error instanceof Error) {
|
|
11044
11172
|
return error.message;
|
|
11045
11173
|
}
|
|
11046
11174
|
return String(error);
|
|
11047
11175
|
}
|
|
11048
|
-
function
|
|
11176
|
+
function createRibbonFromOffsetsExample(scene, options = {}) {
|
|
11049
11177
|
var _a, _b, _c;
|
|
11050
11178
|
const centerline = new Polyline({
|
|
11051
11179
|
points: [
|
|
@@ -11058,11 +11186,11 @@ function createWallFromOffsetsExample(scene, options = {}) {
|
|
|
11058
11186
|
],
|
|
11059
11187
|
color: 0x1f2937,
|
|
11060
11188
|
});
|
|
11061
|
-
const
|
|
11062
|
-
const half =
|
|
11189
|
+
const ribbonThickness = 0.45;
|
|
11190
|
+
const half = ribbonThickness * 0.5;
|
|
11063
11191
|
const acuteThreshold = 35.0;
|
|
11064
11192
|
const bevel = true;
|
|
11065
|
-
const
|
|
11193
|
+
const ribbonHeight = (_a = options.height) !== null && _a !== void 0 ? _a : 2.6;
|
|
11066
11194
|
const leftOffset = centerline.getOffset(half, acuteThreshold, bevel);
|
|
11067
11195
|
const rightOffset = centerline.getOffset(-0.225, acuteThreshold, bevel);
|
|
11068
11196
|
const leftOffsetPolyline = new Polyline({
|
|
@@ -11073,27 +11201,27 @@ function createWallFromOffsetsExample(scene, options = {}) {
|
|
|
11073
11201
|
points: rightOffset.points,
|
|
11074
11202
|
color: 0xf97316,
|
|
11075
11203
|
});
|
|
11076
|
-
const
|
|
11077
|
-
if (
|
|
11078
|
-
throw new Error("Failed to create
|
|
11204
|
+
const ribbonOutline = buildRibbonOutline(leftOffset.points, rightOffset.points);
|
|
11205
|
+
if (ribbonOutline.length < 3) {
|
|
11206
|
+
throw new Error("Failed to create ribbon polygon from offsets.");
|
|
11079
11207
|
}
|
|
11080
|
-
const
|
|
11081
|
-
vertices:
|
|
11208
|
+
const ribbonPolygon = new Polygon({
|
|
11209
|
+
vertices: ribbonOutline,
|
|
11082
11210
|
color: 0x3b82f6,
|
|
11083
11211
|
});
|
|
11084
|
-
|
|
11212
|
+
ribbonPolygon.position.y = 0.01;
|
|
11085
11213
|
scene.add(centerline);
|
|
11086
11214
|
scene.add(leftOffsetPolyline);
|
|
11087
11215
|
scene.add(rightOffsetPolyline);
|
|
11088
|
-
scene.add(
|
|
11216
|
+
scene.add(ribbonPolygon);
|
|
11089
11217
|
let cutResult = null;
|
|
11090
11218
|
let cutError = null;
|
|
11091
11219
|
if ((_b = options.cutThroughSlot) !== null && _b !== void 0 ? _b : false) {
|
|
11092
|
-
const
|
|
11220
|
+
const ribbonSolid = new AnalyticSolid({
|
|
11093
11221
|
kind: "linearExtrusion",
|
|
11094
|
-
outer:
|
|
11222
|
+
outer: ribbonOutline.map((point) => [point.x, -point.z]),
|
|
11095
11223
|
holes: [],
|
|
11096
|
-
height:
|
|
11224
|
+
height: ribbonHeight,
|
|
11097
11225
|
color: 0x3b82f6,
|
|
11098
11226
|
deflection: 0.01,
|
|
11099
11227
|
});
|
|
@@ -11104,24 +11232,24 @@ function createWallFromOffsetsExample(scene, options = {}) {
|
|
|
11104
11232
|
new Vector3(0.6, 0.0, 0.2),
|
|
11105
11233
|
new Vector3(0.1, 0.0, 1.0),
|
|
11106
11234
|
new Vector3(2.6, 0.0, 2.0),
|
|
11107
|
-
],
|
|
11235
|
+
], ribbonThickness, ribbonHeight, (_c = options.slotWidth) !== null && _c !== void 0 ? _c : 0.6);
|
|
11108
11236
|
const cutters = [cutter];
|
|
11109
11237
|
try {
|
|
11110
|
-
const
|
|
11111
|
-
scene.add(
|
|
11112
|
-
cutResult = {
|
|
11238
|
+
const cutRibbon = ribbonSolid.subtract(cutters, { color: 0x3b82f6 });
|
|
11239
|
+
scene.add(cutRibbon);
|
|
11240
|
+
cutResult = { ribbon: cutRibbon, cutters };
|
|
11113
11241
|
}
|
|
11114
11242
|
catch (error) {
|
|
11115
11243
|
cutError = error;
|
|
11116
|
-
scene.add(
|
|
11117
|
-
cutResult = {
|
|
11244
|
+
scene.add(ribbonSolid);
|
|
11245
|
+
cutResult = { ribbon: ribbonSolid, cutters };
|
|
11118
11246
|
}
|
|
11119
11247
|
}
|
|
11120
11248
|
return {
|
|
11121
11249
|
centerline,
|
|
11122
11250
|
leftOffsetPolyline,
|
|
11123
11251
|
rightOffsetPolyline,
|
|
11124
|
-
|
|
11252
|
+
ribbonPolygon,
|
|
11125
11253
|
leftOffset,
|
|
11126
11254
|
rightOffset,
|
|
11127
11255
|
cutResult,
|
|
@@ -11319,7 +11447,7 @@ function createPolygonPreset(operation, options) {
|
|
|
11319
11447
|
function createExtrudedPreset(operation, options) {
|
|
11320
11448
|
var _a, _b, _c;
|
|
11321
11449
|
const extrudedOffset = (_a = options.extrudedOffset) !== null && _a !== void 0 ? _a : new Vector3(0.0, 0.0, 0.0);
|
|
11322
|
-
const
|
|
11450
|
+
const host = new AnalyticSolid({
|
|
11323
11451
|
kind: "linearExtrusion",
|
|
11324
11452
|
outer: [[-2.2, -0.18], [2.2, -0.18], [2.2, 0.18], [-2.2, 0.18]],
|
|
11325
11453
|
holes: [],
|
|
@@ -11327,7 +11455,7 @@ function createExtrudedPreset(operation, options) {
|
|
|
11327
11455
|
color: 0x60a5fa,
|
|
11328
11456
|
deflection: 0.01,
|
|
11329
11457
|
});
|
|
11330
|
-
const
|
|
11458
|
+
const cutter = new AnalyticSolid({
|
|
11331
11459
|
kind: "linearExtrusion",
|
|
11332
11460
|
outer: [[-0.7, -0.34], [0.9, -0.34], [0.9, 0.34], [-0.7, 0.34]],
|
|
11333
11461
|
holes: [],
|
|
@@ -11335,16 +11463,16 @@ function createExtrudedPreset(operation, options) {
|
|
|
11335
11463
|
color: 0xf97316,
|
|
11336
11464
|
deflection: 0.01,
|
|
11337
11465
|
});
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11466
|
+
cutter.position.set(extrudedOffset.x, 0, extrudedOffset.z);
|
|
11467
|
+
host.outline = (_b = options.outline) !== null && _b !== void 0 ? _b : true;
|
|
11468
|
+
cutter.outline = (_c = options.outline) !== null && _c !== void 0 ? _c : true;
|
|
11341
11469
|
return {
|
|
11342
11470
|
title: `${capitalize(operation)} Extruded Solid`,
|
|
11343
11471
|
description: "Two coextensive authoritative line-profile extrusions use the in-house planar arrangement.",
|
|
11344
|
-
lhsOperand:
|
|
11345
|
-
rhsOperand:
|
|
11346
|
-
lhsVisual:
|
|
11347
|
-
rhsVisual:
|
|
11472
|
+
lhsOperand: host,
|
|
11473
|
+
rhsOperand: cutter,
|
|
11474
|
+
lhsVisual: host,
|
|
11475
|
+
rhsVisual: cutter,
|
|
11348
11476
|
};
|
|
11349
11477
|
}
|
|
11350
11478
|
/**
|
|
@@ -11458,6 +11586,33 @@ function createEditorModesExample(scene) {
|
|
|
11458
11586
|
};
|
|
11459
11587
|
}
|
|
11460
11588
|
|
|
11589
|
+
function booleanRegions2D(a, b, operation) {
|
|
11590
|
+
const kernelExport = booleanRegions2D$1;
|
|
11591
|
+
if (typeof kernelExport !== "function") {
|
|
11592
|
+
throw new Error("booleanRegions2D is unavailable in the loaded WASM package");
|
|
11593
|
+
}
|
|
11594
|
+
const point = (value) => [
|
|
11595
|
+
value.x,
|
|
11596
|
+
value.y,
|
|
11597
|
+
value.z,
|
|
11598
|
+
];
|
|
11599
|
+
const encode = (regions) => JSON.stringify(regions.map((region) => ({
|
|
11600
|
+
outer: region.outer.map(point),
|
|
11601
|
+
holes: region.holes.map((hole) => hole.map(point)),
|
|
11602
|
+
})));
|
|
11603
|
+
const result = kernelExport(encode(a), encode(b), operation);
|
|
11604
|
+
return JSON.parse(result.regionsSerialized);
|
|
11605
|
+
}
|
|
11606
|
+
/** Analytic line/arc region Boolean; output arcs retain their exact circles. */
|
|
11607
|
+
function booleanCurvedRegions2D(a, b, operation) {
|
|
11608
|
+
const kernelExport = booleanCurvedRegions2D$1;
|
|
11609
|
+
if (typeof kernelExport !== "function") {
|
|
11610
|
+
throw new Error("booleanCurvedRegions2D is unavailable in the loaded WASM package");
|
|
11611
|
+
}
|
|
11612
|
+
const result = kernelExport(JSON.stringify(a), JSON.stringify(b), operation);
|
|
11613
|
+
return JSON.parse(result);
|
|
11614
|
+
}
|
|
11615
|
+
|
|
11461
11616
|
/**
|
|
11462
11617
|
* Shared runtime entrypoint used to initialize the OpenGeometry wasm module.
|
|
11463
11618
|
*/
|
|
@@ -11522,5 +11677,5 @@ class OpenGeometry {
|
|
|
11522
11677
|
OpenGeometry.version = OPEN_GEOMETRY_THREE_VERSION;
|
|
11523
11678
|
OpenGeometry.instance = null;
|
|
11524
11679
|
|
|
11525
|
-
export { AnalyticCurve, AnalyticGeometryError, AnalyticLodController, AnalyticPattern, AnalyticSolid, AnalyticTessellationWorker, Arc, Cuboid, Curve, Cylinder, EllipticalArc, FreeformEditor, FreeformGeometry, Line, OGAnalyticBrep, OGAnalyticTessellation, OGSceneManager, OpenGeometry, Opening, Polygon, Polyline, Rectangle, Solid, Sphere, SpotLabel, Sweep, Vector3, Wedge, WorkPlane, analyticIfcText, analyzeProfile, booleanIntersection, booleanSubtraction, booleanUnion, circularPattern, clonePlacement, createBooleanExample, createEditorModesExample, createFreeformEditor, createFreeformGeometry, createOffsetExample, createOffsetRingVariableExample, createParametricEditCapabilities, createPrimitivesExample, createShapesExample, createSweepExample,
|
|
11680
|
+
export { AnalyticCurve, AnalyticGeometryError, AnalyticLodController, AnalyticPattern, AnalyticSolid, AnalyticTessellationWorker, Arc, Cuboid, Curve, Cylinder, EllipticalArc, FreeformEditor, FreeformGeometry, Line, OGAnalyticBrep, OGAnalyticTessellation, OGSceneManager, OpenGeometry, Opening, Polygon, Polyline, Rectangle, Solid, Sphere, SpotLabel, Sweep, Vector3, Wedge, WorkPlane, analyticIfcText, analyzeProfile, booleanCurvedRegions2D, booleanIntersection, booleanRegions2D, booleanSubtraction, booleanUnion, circularPattern, clonePlacement, createBooleanExample, createEditorModesExample, createFreeformEditor, createFreeformGeometry, createOffsetExample, createOffsetRingVariableExample, createParametricEditCapabilities, createPrimitivesExample, createRibbonFromOffsetsExample, createShapesExample, createSweepExample, deflectionBucket, describeRibbonSubtractError, executeBooleanSubtractionMany, extrudeBrepFace, extrudeBrepFaceDirectional, linearPattern, loftPolygonSections, offsetPolylineGroupRegions, offsetPolylineRegions, offsetRingVariable, parseAnalyticGeometryError, rectangularPattern, tessellateFacetedBrep, tessellate_brep, toObjectTransformation$1 as toObjectTransformation, uniformScale, validateAnalyticBrep, worldUnitsPerPixel };
|
|
11526
11681
|
//# sourceMappingURL=index.js.map
|