opengeometry 2.0.11 → 2.0.13
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/index.js +978 -203
- package/index.js.map +1 -1
- package/opengeometry/pkg/opengeometry.d.ts +311 -198
- package/opengeometry/pkg/opengeometry.js +508 -40
- package/opengeometry/pkg/opengeometry_bg.wasm +0 -0
- package/opengeometry/pkg/opengeometry_bg.wasm.d.ts +229 -197
- package/opengeometry_bg.wasm +0 -0
- package/opengeometry_bg.wasm.d.ts +229 -197
- package/package.json +1 -1
- package/src/editor/types.d.ts +1 -1
- package/src/examples/index.d.ts +1 -0
- package/src/examples/offset-ring-variable.d.ts +13 -0
- package/src/operations/index.d.ts +0 -3
- package/src/operations/offset-regions.d.ts +36 -0
- package/src/primitives/elliptical_arc.d.ts +66 -0
- package/src/primitives/index.d.ts +1 -0
- package/src/toolkit/index.d.ts +0 -4
- package/src/toolkit/wall.d.ts +0 -40
package/index.js
CHANGED
|
@@ -209,42 +209,16 @@ function getStringFromWasm0(ptr, len) {
|
|
|
209
209
|
ptr = ptr >>> 0;
|
|
210
210
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
211
211
|
}
|
|
212
|
-
function takeFromExternrefTable0(idx) {
|
|
213
|
-
const value = wasm.__wbindgen_export_2.get(idx);
|
|
214
|
-
wasm.__externref_table_dealloc(idx);
|
|
215
|
-
return value;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* @param {string} local_brep_serialized
|
|
219
|
-
* @param {number} height
|
|
220
|
-
* @returns {string}
|
|
221
|
-
*/
|
|
222
|
-
function extrudeBrepFace$1(local_brep_serialized, height) {
|
|
223
|
-
let deferred3_0;
|
|
224
|
-
let deferred3_1;
|
|
225
|
-
try {
|
|
226
|
-
const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
227
|
-
const len0 = WASM_VECTOR_LEN;
|
|
228
|
-
const ret = wasm.extrudeBrepFace(ptr0, len0, height);
|
|
229
|
-
var ptr2 = ret[0];
|
|
230
|
-
var len2 = ret[1];
|
|
231
|
-
if (ret[3]) {
|
|
232
|
-
ptr2 = 0;
|
|
233
|
-
len2 = 0;
|
|
234
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
235
|
-
}
|
|
236
|
-
deferred3_0 = ptr2;
|
|
237
|
-
deferred3_1 = len2;
|
|
238
|
-
return getStringFromWasm0(ptr2, len2);
|
|
239
|
-
} finally {
|
|
240
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
212
|
function _assertClass(instance, klass) {
|
|
244
213
|
if (!(instance instanceof klass)) {
|
|
245
214
|
throw new Error(`expected instance of ${klass.name}`);
|
|
246
215
|
}
|
|
247
216
|
}
|
|
217
|
+
function takeFromExternrefTable0(idx) {
|
|
218
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
219
|
+
wasm.__externref_table_dealloc(idx);
|
|
220
|
+
return value;
|
|
221
|
+
}
|
|
248
222
|
let cachedFloat64ArrayMemory0 = null;
|
|
249
223
|
function getFloat64ArrayMemory0() {
|
|
250
224
|
if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
|
|
@@ -265,6 +239,12 @@ function passArrayJsValueToWasm0(array, malloc) {
|
|
|
265
239
|
WASM_VECTOR_LEN = array.length;
|
|
266
240
|
return ptr;
|
|
267
241
|
}
|
|
242
|
+
function passArrayF64ToWasm0(arg, malloc) {
|
|
243
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
244
|
+
getFloat64ArrayMemory0().set(arg, ptr / 8);
|
|
245
|
+
WASM_VECTOR_LEN = arg.length;
|
|
246
|
+
return ptr;
|
|
247
|
+
}
|
|
268
248
|
function getArrayJsValueFromWasm0(ptr, len) {
|
|
269
249
|
ptr = ptr >>> 0;
|
|
270
250
|
const mem = getDataViewMemory0();
|
|
@@ -278,12 +258,91 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
278
258
|
function isLikeNone(x) {
|
|
279
259
|
return x === undefined || x === null;
|
|
280
260
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
261
|
+
/**
|
|
262
|
+
* Wasm entry point: analyze a flat `[x0,y0,z0,…]` loop, returning the report as
|
|
263
|
+
* JSON (the corrected points are not returned here; use the kernel API).
|
|
264
|
+
* @param {Float64Array} flat_points
|
|
265
|
+
* @returns {string}
|
|
266
|
+
*/
|
|
267
|
+
function analyzeProfile(flat_points) {
|
|
268
|
+
let deferred3_0;
|
|
269
|
+
let deferred3_1;
|
|
270
|
+
try {
|
|
271
|
+
const ptr0 = passArrayF64ToWasm0(flat_points, wasm.__wbindgen_malloc);
|
|
272
|
+
const len0 = WASM_VECTOR_LEN;
|
|
273
|
+
const ret = wasm.analyzeProfile(ptr0, len0);
|
|
274
|
+
var ptr2 = ret[0];
|
|
275
|
+
var len2 = ret[1];
|
|
276
|
+
if (ret[3]) {
|
|
277
|
+
ptr2 = 0;
|
|
278
|
+
len2 = 0;
|
|
279
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
280
|
+
}
|
|
281
|
+
deferred3_0 = ptr2;
|
|
282
|
+
deferred3_1 = len2;
|
|
283
|
+
return getStringFromWasm0(ptr2, len2);
|
|
284
|
+
} finally {
|
|
285
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Wasm entry point: check a serialized B-rep's geometric validity, returning
|
|
291
|
+
* the [`ValidityReport`] as JSON.
|
|
292
|
+
* @param {string} brep_json
|
|
293
|
+
* @returns {string}
|
|
294
|
+
*/
|
|
295
|
+
function checkBrepValidity(brep_json) {
|
|
296
|
+
let deferred3_0;
|
|
297
|
+
let deferred3_1;
|
|
298
|
+
try {
|
|
299
|
+
const ptr0 = passStringToWasm0(brep_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
300
|
+
const len0 = WASM_VECTOR_LEN;
|
|
301
|
+
const ret = wasm.checkBrepValidity(ptr0, len0);
|
|
302
|
+
var ptr2 = ret[0];
|
|
303
|
+
var len2 = ret[1];
|
|
304
|
+
if (ret[3]) {
|
|
305
|
+
ptr2 = 0;
|
|
306
|
+
len2 = 0;
|
|
307
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
308
|
+
}
|
|
309
|
+
deferred3_0 = ptr2;
|
|
310
|
+
deferred3_1 = len2;
|
|
311
|
+
return getStringFromWasm0(ptr2, len2);
|
|
312
|
+
} finally {
|
|
313
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Wasm entry point: heal a serialized B-rep, returning JSON
|
|
319
|
+
* `{ "brep": <healed brep>, "report": <heal report> }`.
|
|
320
|
+
* @param {string} brep_json
|
|
321
|
+
* @param {number} tolerance
|
|
322
|
+
* @returns {string}
|
|
323
|
+
*/
|
|
324
|
+
function healBrep(brep_json, tolerance) {
|
|
325
|
+
let deferred3_0;
|
|
326
|
+
let deferred3_1;
|
|
327
|
+
try {
|
|
328
|
+
const ptr0 = passStringToWasm0(brep_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
329
|
+
const len0 = WASM_VECTOR_LEN;
|
|
330
|
+
const ret = wasm.healBrep(ptr0, len0, tolerance);
|
|
331
|
+
var ptr2 = ret[0];
|
|
332
|
+
var len2 = ret[1];
|
|
333
|
+
if (ret[3]) {
|
|
334
|
+
ptr2 = 0;
|
|
335
|
+
len2 = 0;
|
|
336
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
337
|
+
}
|
|
338
|
+
deferred3_0 = ptr2;
|
|
339
|
+
deferred3_1 = len2;
|
|
340
|
+
return getStringFromWasm0(ptr2, len2);
|
|
341
|
+
} finally {
|
|
342
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
343
|
+
}
|
|
286
344
|
}
|
|
345
|
+
|
|
287
346
|
/**
|
|
288
347
|
* Wasm entry point: offset a centreline by `width` into stroked regions via the
|
|
289
348
|
* deterministic analytic offset. `centreline_flat` is `[x0,y0,z0, …]`. Returns
|
|
@@ -322,6 +381,103 @@ function offsetPolylineGroupRegions$1(polylines_json) {
|
|
|
322
381
|
return OGOffsetRegionsResult.__wrap(ret[0]);
|
|
323
382
|
}
|
|
324
383
|
|
|
384
|
+
/**
|
|
385
|
+
* Wasm entry point: inset a CLOSED ring inward with one distance per edge
|
|
386
|
+
* (edge i = ring[i] → ring[i+1]). `ring_flat` is `[x0,y0,z0, …]`;
|
|
387
|
+
* `holes_json` is `[{ring:[x,y,z,…], distances:[…]}, …]` (`"[]"` = none) —
|
|
388
|
+
* excluded interior rings, each grown outward by its own per-edge distances.
|
|
389
|
+
* Returns CW-outer / CCW-hole regions, canonicalised; possibly several when a
|
|
390
|
+
* deep inset (or a hole) splits the ring, and empty (does NOT throw) when the
|
|
391
|
+
* inset collapses or the outer ring is degenerate. THROWS on malformed
|
|
392
|
+
* arguments: a distance count that does not match an edge count, a negative /
|
|
393
|
+
* non-finite distance, a degenerate hole, or unparsable `holes_json`. Corners
|
|
394
|
+
* where distances differ are circumscribed clearance arcs (conservative), so
|
|
395
|
+
* no output point is ever closer to an edge than that edge's distance —
|
|
396
|
+
* there is no miter-limit knob because there are no miters.
|
|
397
|
+
* @param {Float64Array} ring_flat
|
|
398
|
+
* @param {Float64Array} distances
|
|
399
|
+
* @param {string} holes_json
|
|
400
|
+
* @returns {OGOffsetRegionsResult}
|
|
401
|
+
*/
|
|
402
|
+
function offsetRingVariable$1(ring_flat, distances, holes_json) {
|
|
403
|
+
const ptr0 = passArrayF64ToWasm0(ring_flat, wasm.__wbindgen_malloc);
|
|
404
|
+
const len0 = WASM_VECTOR_LEN;
|
|
405
|
+
const ptr1 = passArrayF64ToWasm0(distances, wasm.__wbindgen_malloc);
|
|
406
|
+
const len1 = WASM_VECTOR_LEN;
|
|
407
|
+
const ptr2 = passStringToWasm0(holes_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
408
|
+
const len2 = WASM_VECTOR_LEN;
|
|
409
|
+
const ret = wasm.offsetRingVariable(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
410
|
+
if (ret[2]) {
|
|
411
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
412
|
+
}
|
|
413
|
+
return OGOffsetRegionsResult.__wrap(ret[0]);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* @param {string} local_brep_serialized
|
|
418
|
+
* @param {number} height
|
|
419
|
+
* @returns {string}
|
|
420
|
+
*/
|
|
421
|
+
function extrudeBrepFace$1(local_brep_serialized, height) {
|
|
422
|
+
let deferred3_0;
|
|
423
|
+
let deferred3_1;
|
|
424
|
+
try {
|
|
425
|
+
const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
426
|
+
const len0 = WASM_VECTOR_LEN;
|
|
427
|
+
const ret = wasm.extrudeBrepFace(ptr0, len0, height);
|
|
428
|
+
var ptr2 = ret[0];
|
|
429
|
+
var len2 = ret[1];
|
|
430
|
+
if (ret[3]) {
|
|
431
|
+
ptr2 = 0;
|
|
432
|
+
len2 = 0;
|
|
433
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
434
|
+
}
|
|
435
|
+
deferred3_0 = ptr2;
|
|
436
|
+
deferred3_1 = len2;
|
|
437
|
+
return getStringFromWasm0(ptr2, len2);
|
|
438
|
+
} finally {
|
|
439
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Wasm entry point for general extrude. `direction` is `[x,y,z]`; `extent_kind`
|
|
445
|
+
* is `"one_sided" | "symmetric" | "two_sided"`; `d_plus`/`d_minus` are the
|
|
446
|
+
* extent distances (`d_minus` ignored unless two-sided, `d_plus` is the
|
|
447
|
+
* distance for one-sided/symmetric).
|
|
448
|
+
* @param {string} local_brep_serialized
|
|
449
|
+
* @param {Float64Array} direction
|
|
450
|
+
* @param {string} extent_kind
|
|
451
|
+
* @param {number} d_plus
|
|
452
|
+
* @param {number} d_minus
|
|
453
|
+
* @returns {string}
|
|
454
|
+
*/
|
|
455
|
+
function extrudeBrepFaceDirectional(local_brep_serialized, direction, extent_kind, d_plus, d_minus) {
|
|
456
|
+
let deferred5_0;
|
|
457
|
+
let deferred5_1;
|
|
458
|
+
try {
|
|
459
|
+
const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
460
|
+
const len0 = WASM_VECTOR_LEN;
|
|
461
|
+
const ptr1 = passArrayF64ToWasm0(direction, wasm.__wbindgen_malloc);
|
|
462
|
+
const len1 = WASM_VECTOR_LEN;
|
|
463
|
+
const ptr2 = passStringToWasm0(extent_kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
464
|
+
const len2 = WASM_VECTOR_LEN;
|
|
465
|
+
const ret = wasm.extrudeBrepFaceDirectional(ptr0, len0, ptr1, len1, ptr2, len2, d_plus, d_minus);
|
|
466
|
+
var ptr4 = ret[0];
|
|
467
|
+
var len4 = ret[1];
|
|
468
|
+
if (ret[3]) {
|
|
469
|
+
ptr4 = 0;
|
|
470
|
+
len4 = 0;
|
|
471
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
472
|
+
}
|
|
473
|
+
deferred5_0 = ptr4;
|
|
474
|
+
deferred5_1 = len4;
|
|
475
|
+
return getStringFromWasm0(ptr4, len4);
|
|
476
|
+
} finally {
|
|
477
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
325
481
|
/**
|
|
326
482
|
* Wasm entry point for union.
|
|
327
483
|
* @param {string} lhs_brep_serialized
|
|
@@ -1639,25 +1795,288 @@ class OGCylinder {
|
|
|
1639
1795
|
set_scale(scale) {
|
|
1640
1796
|
_assertClass(scale, Vector3);
|
|
1641
1797
|
var ptr0 = scale.__destroy_into_raw();
|
|
1642
|
-
const ret = wasm.ogcylinder_set_scale(this.__wbg_ptr, ptr0);
|
|
1798
|
+
const ret = wasm.ogcylinder_set_scale(this.__wbg_ptr, ptr0);
|
|
1799
|
+
if (ret[1]) {
|
|
1800
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
generate_brep() {
|
|
1804
|
+
const ret = wasm.ogcylinder_generate_brep(this.__wbg_ptr);
|
|
1805
|
+
if (ret[1]) {
|
|
1806
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
clean_geometry() {
|
|
1810
|
+
wasm.ogcylinder_clean_geometry(this.__wbg_ptr);
|
|
1811
|
+
}
|
|
1812
|
+
generate_geometry() {
|
|
1813
|
+
const ret = wasm.ogcylinder_generate_geometry(this.__wbg_ptr);
|
|
1814
|
+
if (ret[1]) {
|
|
1815
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* @returns {string}
|
|
1820
|
+
*/
|
|
1821
|
+
get_brep_serialized() {
|
|
1822
|
+
let deferred1_0;
|
|
1823
|
+
let deferred1_1;
|
|
1824
|
+
try {
|
|
1825
|
+
const ret = wasm.ogcylinder_get_brep_serialized(this.__wbg_ptr);
|
|
1826
|
+
deferred1_0 = ret[0];
|
|
1827
|
+
deferred1_1 = ret[1];
|
|
1828
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1829
|
+
} finally {
|
|
1830
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
/**
|
|
1834
|
+
* @returns {string}
|
|
1835
|
+
*/
|
|
1836
|
+
get_local_brep_serialized() {
|
|
1837
|
+
let deferred1_0;
|
|
1838
|
+
let deferred1_1;
|
|
1839
|
+
try {
|
|
1840
|
+
const ret = wasm.ogcylinder_get_local_brep_serialized(this.__wbg_ptr);
|
|
1841
|
+
deferred1_0 = ret[0];
|
|
1842
|
+
deferred1_1 = ret[1];
|
|
1843
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1844
|
+
} finally {
|
|
1845
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
/**
|
|
1849
|
+
* @returns {string}
|
|
1850
|
+
*/
|
|
1851
|
+
get_geometry_serialized() {
|
|
1852
|
+
let deferred1_0;
|
|
1853
|
+
let deferred1_1;
|
|
1854
|
+
try {
|
|
1855
|
+
const ret = wasm.ogcylinder_get_geometry_serialized(this.__wbg_ptr);
|
|
1856
|
+
deferred1_0 = ret[0];
|
|
1857
|
+
deferred1_1 = ret[1];
|
|
1858
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1859
|
+
} finally {
|
|
1860
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
/**
|
|
1864
|
+
* @returns {string}
|
|
1865
|
+
*/
|
|
1866
|
+
get_local_geometry_serialized() {
|
|
1867
|
+
let deferred1_0;
|
|
1868
|
+
let deferred1_1;
|
|
1869
|
+
try {
|
|
1870
|
+
const ret = wasm.ogcylinder_get_local_geometry_serialized(this.__wbg_ptr);
|
|
1871
|
+
deferred1_0 = ret[0];
|
|
1872
|
+
deferred1_1 = ret[1];
|
|
1873
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1874
|
+
} finally {
|
|
1875
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
/**
|
|
1879
|
+
* @returns {Float64Array}
|
|
1880
|
+
*/
|
|
1881
|
+
get_geometry_buffer() {
|
|
1882
|
+
const ret = wasm.ogcylinder_get_geometry_buffer(this.__wbg_ptr);
|
|
1883
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1884
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1885
|
+
return v1;
|
|
1886
|
+
}
|
|
1887
|
+
/**
|
|
1888
|
+
* @returns {Float64Array}
|
|
1889
|
+
*/
|
|
1890
|
+
get_local_geometry_buffer() {
|
|
1891
|
+
const ret = wasm.ogcylinder_get_local_geometry_buffer(this.__wbg_ptr);
|
|
1892
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1893
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1894
|
+
return v1;
|
|
1895
|
+
}
|
|
1896
|
+
/**
|
|
1897
|
+
* @returns {string}
|
|
1898
|
+
*/
|
|
1899
|
+
get_outline_geometry_serialized() {
|
|
1900
|
+
let deferred1_0;
|
|
1901
|
+
let deferred1_1;
|
|
1902
|
+
try {
|
|
1903
|
+
const ret = wasm.ogcylinder_get_outline_geometry_serialized(this.__wbg_ptr);
|
|
1904
|
+
deferred1_0 = ret[0];
|
|
1905
|
+
deferred1_1 = ret[1];
|
|
1906
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1907
|
+
} finally {
|
|
1908
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
/**
|
|
1912
|
+
* @returns {string}
|
|
1913
|
+
*/
|
|
1914
|
+
get_local_outline_geometry_serialized() {
|
|
1915
|
+
let deferred1_0;
|
|
1916
|
+
let deferred1_1;
|
|
1917
|
+
try {
|
|
1918
|
+
const ret = wasm.ogcylinder_get_local_outline_geometry_serialized(this.__wbg_ptr);
|
|
1919
|
+
deferred1_0 = ret[0];
|
|
1920
|
+
deferred1_1 = ret[1];
|
|
1921
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1922
|
+
} finally {
|
|
1923
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
/**
|
|
1927
|
+
* @returns {Float64Array}
|
|
1928
|
+
*/
|
|
1929
|
+
get_outline_geometry_buffer() {
|
|
1930
|
+
const ret = wasm.ogcylinder_get_outline_geometry_buffer(this.__wbg_ptr);
|
|
1931
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1932
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1933
|
+
return v1;
|
|
1934
|
+
}
|
|
1935
|
+
/**
|
|
1936
|
+
* @returns {Float64Array}
|
|
1937
|
+
*/
|
|
1938
|
+
get_local_outline_geometry_buffer() {
|
|
1939
|
+
const ret = wasm.ogcylinder_get_local_outline_geometry_buffer(this.__wbg_ptr);
|
|
1940
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1941
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1942
|
+
return v1;
|
|
1943
|
+
}
|
|
1944
|
+
/**
|
|
1945
|
+
* @returns {Vector3}
|
|
1946
|
+
*/
|
|
1947
|
+
get_anchor() {
|
|
1948
|
+
const ret = wasm.ogcylinder_get_anchor(this.__wbg_ptr);
|
|
1949
|
+
return Vector3.__wrap(ret);
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
const OGEllipticalArcFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
1953
|
+
register: () => {},
|
|
1954
|
+
unregister: () => {}
|
|
1955
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_ogellipticalarc_free(ptr >>> 0, 1));
|
|
1956
|
+
class OGEllipticalArc {
|
|
1957
|
+
__destroy_into_raw() {
|
|
1958
|
+
const ptr = this.__wbg_ptr;
|
|
1959
|
+
this.__wbg_ptr = 0;
|
|
1960
|
+
OGEllipticalArcFinalization.unregister(this);
|
|
1961
|
+
return ptr;
|
|
1962
|
+
}
|
|
1963
|
+
free() {
|
|
1964
|
+
const ptr = this.__destroy_into_raw();
|
|
1965
|
+
wasm.__wbg_ogellipticalarc_free(ptr, 0);
|
|
1966
|
+
}
|
|
1967
|
+
/**
|
|
1968
|
+
* @param {string} id
|
|
1969
|
+
*/
|
|
1970
|
+
set id(id) {
|
|
1971
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1972
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1973
|
+
wasm.ogellipticalarc_set_id(this.__wbg_ptr, ptr0, len0);
|
|
1974
|
+
}
|
|
1975
|
+
/**
|
|
1976
|
+
* @returns {string}
|
|
1977
|
+
*/
|
|
1978
|
+
get id() {
|
|
1979
|
+
let deferred1_0;
|
|
1980
|
+
let deferred1_1;
|
|
1981
|
+
try {
|
|
1982
|
+
const ret = wasm.ogellipticalarc_id(this.__wbg_ptr);
|
|
1983
|
+
deferred1_0 = ret[0];
|
|
1984
|
+
deferred1_1 = ret[1];
|
|
1985
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1986
|
+
} finally {
|
|
1987
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
/**
|
|
1991
|
+
* @param {string} id
|
|
1992
|
+
*/
|
|
1993
|
+
constructor(id) {
|
|
1994
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1995
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1996
|
+
const ret = wasm.ogellipticalarc_new(ptr0, len0);
|
|
1997
|
+
this.__wbg_ptr = ret >>> 0;
|
|
1998
|
+
OGEllipticalArcFinalization.register(this, this.__wbg_ptr, this);
|
|
1999
|
+
return this;
|
|
2000
|
+
}
|
|
2001
|
+
/**
|
|
2002
|
+
* @param {Vector3} center
|
|
2003
|
+
* @param {number} radius_x
|
|
2004
|
+
* @param {number} radius_z
|
|
2005
|
+
* @param {number} start_angle
|
|
2006
|
+
* @param {number} end_angle
|
|
2007
|
+
* @param {number} segments
|
|
2008
|
+
*/
|
|
2009
|
+
set_config(center, radius_x, radius_z, start_angle, end_angle, segments) {
|
|
2010
|
+
_assertClass(center, Vector3);
|
|
2011
|
+
var ptr0 = center.__destroy_into_raw();
|
|
2012
|
+
const ret = wasm.ogellipticalarc_set_config(this.__wbg_ptr, ptr0, radius_x, radius_z, start_angle, end_angle, segments);
|
|
2013
|
+
if (ret[1]) {
|
|
2014
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
/**
|
|
2018
|
+
* @param {Vector3} center
|
|
2019
|
+
*/
|
|
2020
|
+
set_center(center) {
|
|
2021
|
+
_assertClass(center, Vector3);
|
|
2022
|
+
var ptr0 = center.__destroy_into_raw();
|
|
2023
|
+
wasm.ogellipticalarc_set_center(this.__wbg_ptr, ptr0);
|
|
2024
|
+
}
|
|
2025
|
+
/**
|
|
2026
|
+
* @param {Vector3} position
|
|
2027
|
+
* @param {Vector3} rotation
|
|
2028
|
+
* @param {Vector3} scale
|
|
2029
|
+
*/
|
|
2030
|
+
set_transform(position, rotation, scale) {
|
|
2031
|
+
_assertClass(position, Vector3);
|
|
2032
|
+
var ptr0 = position.__destroy_into_raw();
|
|
2033
|
+
_assertClass(rotation, Vector3);
|
|
2034
|
+
var ptr1 = rotation.__destroy_into_raw();
|
|
2035
|
+
_assertClass(scale, Vector3);
|
|
2036
|
+
var ptr2 = scale.__destroy_into_raw();
|
|
2037
|
+
const ret = wasm.ogellipticalarc_set_transform(this.__wbg_ptr, ptr0, ptr1, ptr2);
|
|
2038
|
+
if (ret[1]) {
|
|
2039
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
/**
|
|
2043
|
+
* @param {Vector3} translation
|
|
2044
|
+
*/
|
|
2045
|
+
set_translation(translation) {
|
|
2046
|
+
_assertClass(translation, Vector3);
|
|
2047
|
+
var ptr0 = translation.__destroy_into_raw();
|
|
2048
|
+
wasm.ogellipticalarc_set_translation(this.__wbg_ptr, ptr0);
|
|
2049
|
+
}
|
|
2050
|
+
/**
|
|
2051
|
+
* @param {Vector3} rotation
|
|
2052
|
+
*/
|
|
2053
|
+
set_rotation(rotation) {
|
|
2054
|
+
_assertClass(rotation, Vector3);
|
|
2055
|
+
var ptr0 = rotation.__destroy_into_raw();
|
|
2056
|
+
wasm.ogellipticalarc_set_rotation(this.__wbg_ptr, ptr0);
|
|
2057
|
+
}
|
|
2058
|
+
/**
|
|
2059
|
+
* @param {Vector3} scale
|
|
2060
|
+
*/
|
|
2061
|
+
set_scale(scale) {
|
|
2062
|
+
_assertClass(scale, Vector3);
|
|
2063
|
+
var ptr0 = scale.__destroy_into_raw();
|
|
2064
|
+
const ret = wasm.ogellipticalarc_set_scale(this.__wbg_ptr, ptr0);
|
|
1643
2065
|
if (ret[1]) {
|
|
1644
2066
|
throw takeFromExternrefTable0(ret[0]);
|
|
1645
2067
|
}
|
|
1646
2068
|
}
|
|
1647
|
-
|
|
1648
|
-
const ret = wasm.
|
|
2069
|
+
generate_geometry() {
|
|
2070
|
+
const ret = wasm.ogellipticalarc_generate_geometry(this.__wbg_ptr);
|
|
1649
2071
|
if (ret[1]) {
|
|
1650
2072
|
throw takeFromExternrefTable0(ret[0]);
|
|
1651
2073
|
}
|
|
1652
2074
|
}
|
|
1653
|
-
|
|
1654
|
-
wasm.
|
|
2075
|
+
dispose_points() {
|
|
2076
|
+
wasm.ogellipticalarc_dispose_points(this.__wbg_ptr);
|
|
1655
2077
|
}
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
if (ret[1]) {
|
|
1659
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
1660
|
-
}
|
|
2078
|
+
destroy() {
|
|
2079
|
+
wasm.ogellipticalarc_destroy(this.__wbg_ptr);
|
|
1661
2080
|
}
|
|
1662
2081
|
/**
|
|
1663
2082
|
* @returns {string}
|
|
@@ -1666,7 +2085,7 @@ class OGCylinder {
|
|
|
1666
2085
|
let deferred1_0;
|
|
1667
2086
|
let deferred1_1;
|
|
1668
2087
|
try {
|
|
1669
|
-
const ret = wasm.
|
|
2088
|
+
const ret = wasm.ogellipticalarc_get_brep_serialized(this.__wbg_ptr);
|
|
1670
2089
|
deferred1_0 = ret[0];
|
|
1671
2090
|
deferred1_1 = ret[1];
|
|
1672
2091
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -1681,7 +2100,7 @@ class OGCylinder {
|
|
|
1681
2100
|
let deferred1_0;
|
|
1682
2101
|
let deferred1_1;
|
|
1683
2102
|
try {
|
|
1684
|
-
const ret = wasm.
|
|
2103
|
+
const ret = wasm.ogellipticalarc_get_local_brep_serialized(this.__wbg_ptr);
|
|
1685
2104
|
deferred1_0 = ret[0];
|
|
1686
2105
|
deferred1_1 = ret[1];
|
|
1687
2106
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -1696,7 +2115,7 @@ class OGCylinder {
|
|
|
1696
2115
|
let deferred1_0;
|
|
1697
2116
|
let deferred1_1;
|
|
1698
2117
|
try {
|
|
1699
|
-
const ret = wasm.
|
|
2118
|
+
const ret = wasm.ogellipticalarc_get_geometry_serialized(this.__wbg_ptr);
|
|
1700
2119
|
deferred1_0 = ret[0];
|
|
1701
2120
|
deferred1_1 = ret[1];
|
|
1702
2121
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -1711,7 +2130,7 @@ class OGCylinder {
|
|
|
1711
2130
|
let deferred1_0;
|
|
1712
2131
|
let deferred1_1;
|
|
1713
2132
|
try {
|
|
1714
|
-
const ret = wasm.
|
|
2133
|
+
const ret = wasm.ogellipticalarc_get_local_geometry_serialized(this.__wbg_ptr);
|
|
1715
2134
|
deferred1_0 = ret[0];
|
|
1716
2135
|
deferred1_1 = ret[1];
|
|
1717
2136
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -1723,7 +2142,7 @@ class OGCylinder {
|
|
|
1723
2142
|
* @returns {Float64Array}
|
|
1724
2143
|
*/
|
|
1725
2144
|
get_geometry_buffer() {
|
|
1726
|
-
const ret = wasm.
|
|
2145
|
+
const ret = wasm.ogellipticalarc_get_geometry_buffer(this.__wbg_ptr);
|
|
1727
2146
|
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1728
2147
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1729
2148
|
return v1;
|
|
@@ -1732,55 +2151,7 @@ class OGCylinder {
|
|
|
1732
2151
|
* @returns {Float64Array}
|
|
1733
2152
|
*/
|
|
1734
2153
|
get_local_geometry_buffer() {
|
|
1735
|
-
const ret = wasm.
|
|
1736
|
-
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1737
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1738
|
-
return v1;
|
|
1739
|
-
}
|
|
1740
|
-
/**
|
|
1741
|
-
* @returns {string}
|
|
1742
|
-
*/
|
|
1743
|
-
get_outline_geometry_serialized() {
|
|
1744
|
-
let deferred1_0;
|
|
1745
|
-
let deferred1_1;
|
|
1746
|
-
try {
|
|
1747
|
-
const ret = wasm.ogcylinder_get_outline_geometry_serialized(this.__wbg_ptr);
|
|
1748
|
-
deferred1_0 = ret[0];
|
|
1749
|
-
deferred1_1 = ret[1];
|
|
1750
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
1751
|
-
} finally {
|
|
1752
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1753
|
-
}
|
|
1754
|
-
}
|
|
1755
|
-
/**
|
|
1756
|
-
* @returns {string}
|
|
1757
|
-
*/
|
|
1758
|
-
get_local_outline_geometry_serialized() {
|
|
1759
|
-
let deferred1_0;
|
|
1760
|
-
let deferred1_1;
|
|
1761
|
-
try {
|
|
1762
|
-
const ret = wasm.ogcylinder_get_local_outline_geometry_serialized(this.__wbg_ptr);
|
|
1763
|
-
deferred1_0 = ret[0];
|
|
1764
|
-
deferred1_1 = ret[1];
|
|
1765
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
1766
|
-
} finally {
|
|
1767
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1768
|
-
}
|
|
1769
|
-
}
|
|
1770
|
-
/**
|
|
1771
|
-
* @returns {Float64Array}
|
|
1772
|
-
*/
|
|
1773
|
-
get_outline_geometry_buffer() {
|
|
1774
|
-
const ret = wasm.ogcylinder_get_outline_geometry_buffer(this.__wbg_ptr);
|
|
1775
|
-
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1776
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1777
|
-
return v1;
|
|
1778
|
-
}
|
|
1779
|
-
/**
|
|
1780
|
-
* @returns {Float64Array}
|
|
1781
|
-
*/
|
|
1782
|
-
get_local_outline_geometry_buffer() {
|
|
1783
|
-
const ret = wasm.ogcylinder_get_local_outline_geometry_buffer(this.__wbg_ptr);
|
|
2154
|
+
const ret = wasm.ogellipticalarc_get_local_geometry_buffer(this.__wbg_ptr);
|
|
1784
2155
|
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1785
2156
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1786
2157
|
return v1;
|
|
@@ -1789,7 +2160,7 @@ class OGCylinder {
|
|
|
1789
2160
|
* @returns {Vector3}
|
|
1790
2161
|
*/
|
|
1791
2162
|
get_anchor() {
|
|
1792
|
-
const ret = wasm.
|
|
2163
|
+
const ret = wasm.ogellipticalarc_get_anchor(this.__wbg_ptr);
|
|
1793
2164
|
return Vector3.__wrap(ret);
|
|
1794
2165
|
}
|
|
1795
2166
|
}
|
|
@@ -3550,7 +3921,7 @@ class OGPolyline {
|
|
|
3550
3921
|
* @returns {Vector3}
|
|
3551
3922
|
*/
|
|
3552
3923
|
get_anchor() {
|
|
3553
|
-
const ret = wasm.
|
|
3924
|
+
const ret = wasm.ogline_get_anchor(this.__wbg_ptr);
|
|
3554
3925
|
return Vector3.__wrap(ret);
|
|
3555
3926
|
}
|
|
3556
3927
|
/**
|
|
@@ -4878,7 +5249,7 @@ class OGSphere {
|
|
|
4878
5249
|
* @returns {Vector3}
|
|
4879
5250
|
*/
|
|
4880
5251
|
get_anchor() {
|
|
4881
|
-
const ret = wasm.
|
|
5252
|
+
const ret = wasm.ogline_get_anchor(this.__wbg_ptr);
|
|
4882
5253
|
return Vector3.__wrap(ret);
|
|
4883
5254
|
}
|
|
4884
5255
|
}
|
|
@@ -5260,7 +5631,7 @@ class OGSweep {
|
|
|
5260
5631
|
* @returns {Vector3}
|
|
5261
5632
|
*/
|
|
5262
5633
|
get_anchor() {
|
|
5263
|
-
const ret = wasm.
|
|
5634
|
+
const ret = wasm.ogellipticalarc_get_anchor(this.__wbg_ptr);
|
|
5264
5635
|
return Vector3.__wrap(ret);
|
|
5265
5636
|
}
|
|
5266
5637
|
/**
|
|
@@ -5541,7 +5912,7 @@ class OGWedge {
|
|
|
5541
5912
|
* @returns {Vector3}
|
|
5542
5913
|
*/
|
|
5543
5914
|
get_anchor() {
|
|
5544
|
-
const ret = wasm.
|
|
5915
|
+
const ret = wasm.ogwedge_get_anchor(this.__wbg_ptr);
|
|
5545
5916
|
return Vector3.__wrap(ret);
|
|
5546
5917
|
}
|
|
5547
5918
|
}
|
|
@@ -5834,6 +6205,100 @@ class Vector3 {
|
|
|
5834
6205
|
wasm.vector3_apply_matrix4(this.__wbg_ptr, ptr0);
|
|
5835
6206
|
}
|
|
5836
6207
|
}
|
|
6208
|
+
const WorkPlaneFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
6209
|
+
register: () => {},
|
|
6210
|
+
unregister: () => {}
|
|
6211
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_workplane_free(ptr >>> 0, 1));
|
|
6212
|
+
class WorkPlane {
|
|
6213
|
+
static __wrap(ptr) {
|
|
6214
|
+
ptr = ptr >>> 0;
|
|
6215
|
+
const obj = Object.create(WorkPlane.prototype);
|
|
6216
|
+
obj.__wbg_ptr = ptr;
|
|
6217
|
+
WorkPlaneFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
6218
|
+
return obj;
|
|
6219
|
+
}
|
|
6220
|
+
__destroy_into_raw() {
|
|
6221
|
+
const ptr = this.__wbg_ptr;
|
|
6222
|
+
this.__wbg_ptr = 0;
|
|
6223
|
+
WorkPlaneFinalization.unregister(this);
|
|
6224
|
+
return ptr;
|
|
6225
|
+
}
|
|
6226
|
+
free() {
|
|
6227
|
+
const ptr = this.__destroy_into_raw();
|
|
6228
|
+
wasm.__wbg_workplane_free(ptr, 0);
|
|
6229
|
+
}
|
|
6230
|
+
/**
|
|
6231
|
+
* Builds a work plane from an origin and normal, choosing a stable in-plane
|
|
6232
|
+
* `u` axis automatically (`v = normal × u`).
|
|
6233
|
+
* @param {Vector3} origin
|
|
6234
|
+
* @param {Vector3} normal
|
|
6235
|
+
* @returns {WorkPlane}
|
|
6236
|
+
*/
|
|
6237
|
+
static fromOriginNormal(origin, normal) {
|
|
6238
|
+
_assertClass(origin, Vector3);
|
|
6239
|
+
var ptr0 = origin.__destroy_into_raw();
|
|
6240
|
+
_assertClass(normal, Vector3);
|
|
6241
|
+
var ptr1 = normal.__destroy_into_raw();
|
|
6242
|
+
const ret = wasm.workplane_fromOriginNormal(ptr0, ptr1);
|
|
6243
|
+
return WorkPlane.__wrap(ret);
|
|
6244
|
+
}
|
|
6245
|
+
/**
|
|
6246
|
+
* Builds a work plane from an origin, normal, and a preferred `u` axis. The
|
|
6247
|
+
* `u` axis is projected onto the plane and orthonormalized; `v = normal × u`.
|
|
6248
|
+
* @param {Vector3} origin
|
|
6249
|
+
* @param {Vector3} normal
|
|
6250
|
+
* @param {Vector3} u_hint
|
|
6251
|
+
*/
|
|
6252
|
+
constructor(origin, normal, u_hint) {
|
|
6253
|
+
_assertClass(origin, Vector3);
|
|
6254
|
+
var ptr0 = origin.__destroy_into_raw();
|
|
6255
|
+
_assertClass(normal, Vector3);
|
|
6256
|
+
var ptr1 = normal.__destroy_into_raw();
|
|
6257
|
+
_assertClass(u_hint, Vector3);
|
|
6258
|
+
var ptr2 = u_hint.__destroy_into_raw();
|
|
6259
|
+
const ret = wasm.workplane_new(ptr0, ptr1, ptr2);
|
|
6260
|
+
this.__wbg_ptr = ret >>> 0;
|
|
6261
|
+
WorkPlaneFinalization.register(this, this.__wbg_ptr, this);
|
|
6262
|
+
return this;
|
|
6263
|
+
}
|
|
6264
|
+
/**
|
|
6265
|
+
* Lifts a single 2D in-plane coordinate to 3D world space.
|
|
6266
|
+
* @param {number} u
|
|
6267
|
+
* @param {number} v
|
|
6268
|
+
* @returns {Vector3}
|
|
6269
|
+
*/
|
|
6270
|
+
liftPoint(u, v) {
|
|
6271
|
+
const ret = wasm.workplane_liftPoint(this.__wbg_ptr, u, v);
|
|
6272
|
+
return Vector3.__wrap(ret);
|
|
6273
|
+
}
|
|
6274
|
+
/**
|
|
6275
|
+
* Lifts a flat `[u0,v0,u1,v1,…]` buffer to a flat `[x0,y0,z0,…]` world buffer.
|
|
6276
|
+
* @param {Float64Array} uv
|
|
6277
|
+
* @returns {Float64Array}
|
|
6278
|
+
*/
|
|
6279
|
+
liftPoints(uv) {
|
|
6280
|
+
const ptr0 = passArrayF64ToWasm0(uv, wasm.__wbindgen_malloc);
|
|
6281
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6282
|
+
const ret = wasm.workplane_liftPoints(this.__wbg_ptr, ptr0, len0);
|
|
6283
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
6284
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
6285
|
+
return v2;
|
|
6286
|
+
}
|
|
6287
|
+
/**
|
|
6288
|
+
* @returns {Vector3}
|
|
6289
|
+
*/
|
|
6290
|
+
get origin() {
|
|
6291
|
+
const ret = wasm.workplane_origin(this.__wbg_ptr);
|
|
6292
|
+
return Vector3.__wrap(ret);
|
|
6293
|
+
}
|
|
6294
|
+
/**
|
|
6295
|
+
* @returns {Vector3}
|
|
6296
|
+
*/
|
|
6297
|
+
get normal() {
|
|
6298
|
+
const ret = wasm.workplane_normal(this.__wbg_ptr);
|
|
6299
|
+
return Vector3.__wrap(ret);
|
|
6300
|
+
}
|
|
6301
|
+
}
|
|
5837
6302
|
async function __wbg_load(module, imports) {
|
|
5838
6303
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
5839
6304
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
@@ -5963,6 +6428,7 @@ var OGKernel = /*#__PURE__*/Object.freeze({
|
|
|
5963
6428
|
OGCuboid: OGCuboid,
|
|
5964
6429
|
OGCurve: OGCurve,
|
|
5965
6430
|
OGCylinder: OGCylinder,
|
|
6431
|
+
OGEllipticalArc: OGEllipticalArc,
|
|
5966
6432
|
OGEntityRegistry: OGEntityRegistry,
|
|
5967
6433
|
OGFreeformEditor: OGFreeformEditor,
|
|
5968
6434
|
OGFreeformGeometry: OGFreeformGeometry,
|
|
@@ -5979,16 +6445,22 @@ var OGKernel = /*#__PURE__*/Object.freeze({
|
|
|
5979
6445
|
OGSweep: OGSweep,
|
|
5980
6446
|
OGWedge: OGWedge,
|
|
5981
6447
|
Vector3: Vector3,
|
|
6448
|
+
WorkPlane: WorkPlane,
|
|
6449
|
+
analyzeProfile: analyzeProfile,
|
|
5982
6450
|
batchUnion: batchUnion,
|
|
5983
6451
|
booleanIntersection: booleanIntersection$1,
|
|
5984
6452
|
booleanSubtraction: booleanSubtraction$1,
|
|
5985
6453
|
booleanSubtractionMany: booleanSubtractionMany,
|
|
5986
6454
|
booleanUnion: booleanUnion$1,
|
|
6455
|
+
checkBrepValidity: checkBrepValidity,
|
|
5987
6456
|
default: __wbg_init,
|
|
5988
6457
|
extrudeBrepFace: extrudeBrepFace$1,
|
|
6458
|
+
extrudeBrepFaceDirectional: extrudeBrepFaceDirectional,
|
|
6459
|
+
healBrep: healBrep,
|
|
5989
6460
|
initSync: initSync,
|
|
5990
6461
|
offsetPolylineGroupRegions: offsetPolylineGroupRegions$1,
|
|
5991
|
-
offsetPolylineRegions: offsetPolylineRegions$1
|
|
6462
|
+
offsetPolylineRegions: offsetPolylineRegions$1,
|
|
6463
|
+
offsetRingVariable: offsetRingVariable$1
|
|
5992
6464
|
});
|
|
5993
6465
|
|
|
5994
6466
|
function spotLabelElement() {
|
|
@@ -7368,7 +7840,173 @@ class Rectangle extends THREE.Line {
|
|
|
7368
7840
|
}
|
|
7369
7841
|
}
|
|
7370
7842
|
generateGeometry() {
|
|
7371
|
-
const bufferData = Array.from(this.polyLineRectangle.get_geometry_buffer());
|
|
7843
|
+
const bufferData = Array.from(this.polyLineRectangle.get_geometry_buffer());
|
|
7844
|
+
this.writePositionsToGeometry(this.geometry, bufferData);
|
|
7845
|
+
this.geometry.computeBoundingBox();
|
|
7846
|
+
this.geometry.computeBoundingSphere();
|
|
7847
|
+
if (this.material instanceof THREE.LineBasicMaterial) {
|
|
7848
|
+
this.material.color.set(this.options.color);
|
|
7849
|
+
}
|
|
7850
|
+
else {
|
|
7851
|
+
if (Array.isArray(this.material)) {
|
|
7852
|
+
this.material.forEach((material) => material.dispose());
|
|
7853
|
+
}
|
|
7854
|
+
else {
|
|
7855
|
+
this.material.dispose();
|
|
7856
|
+
}
|
|
7857
|
+
this.material = new THREE.LineBasicMaterial({ color: this.options.color });
|
|
7858
|
+
}
|
|
7859
|
+
this.updateRenderStyle(bufferData);
|
|
7860
|
+
}
|
|
7861
|
+
getBrep() {
|
|
7862
|
+
const brepData = this.polyLineRectangle.get_brep_serialized();
|
|
7863
|
+
if (!brepData) {
|
|
7864
|
+
throw new Error("Brep data is not available for Rectangle");
|
|
7865
|
+
}
|
|
7866
|
+
return JSON.parse(brepData);
|
|
7867
|
+
}
|
|
7868
|
+
getOffset(distance, acuteThresholdDegrees = 35.0, bevel = true) {
|
|
7869
|
+
var _a;
|
|
7870
|
+
const kernel = this.polyLineRectangle;
|
|
7871
|
+
if (typeof kernel.get_offset_serialized !== "function") {
|
|
7872
|
+
throw new Error("Offset API is not available in OGRectangle. Rebuild opengeometry wasm bindings.");
|
|
7873
|
+
}
|
|
7874
|
+
const serialized = kernel.get_offset_serialized(distance, acuteThresholdDegrees, bevel);
|
|
7875
|
+
const parsed = JSON.parse(serialized);
|
|
7876
|
+
return {
|
|
7877
|
+
points: parsed.points.map((point) => new Vector3(point.x, point.y, point.z)),
|
|
7878
|
+
beveledVertexIndices: (_a = parsed.beveled_vertex_indices) !== null && _a !== void 0 ? _a : [],
|
|
7879
|
+
isClosed: Boolean(parsed.is_closed),
|
|
7880
|
+
};
|
|
7881
|
+
}
|
|
7882
|
+
discardGeometry() {
|
|
7883
|
+
this.geometry.dispose();
|
|
7884
|
+
}
|
|
7885
|
+
writePositionsToGeometry(geometry, positions) {
|
|
7886
|
+
const existing = geometry.getAttribute("position");
|
|
7887
|
+
if (!(existing instanceof THREE.BufferAttribute) ||
|
|
7888
|
+
existing.itemSize !== 3 ||
|
|
7889
|
+
existing.count !== positions.length / 3) {
|
|
7890
|
+
geometry.setAttribute("position", new THREE.Float32BufferAttribute(positions, 3));
|
|
7891
|
+
return;
|
|
7892
|
+
}
|
|
7893
|
+
const array = existing.array;
|
|
7894
|
+
array.set(positions);
|
|
7895
|
+
existing.needsUpdate = true;
|
|
7896
|
+
}
|
|
7897
|
+
}
|
|
7898
|
+
|
|
7899
|
+
/**
|
|
7900
|
+
* Curve wrapper backed by the kernel OGCurve primitive.
|
|
7901
|
+
*/
|
|
7902
|
+
class Curve extends THREE.Line {
|
|
7903
|
+
set color(color) {
|
|
7904
|
+
this.options.color = color;
|
|
7905
|
+
if (this.material instanceof THREE.LineBasicMaterial) {
|
|
7906
|
+
this.material.color.set(color);
|
|
7907
|
+
}
|
|
7908
|
+
}
|
|
7909
|
+
constructor(options) {
|
|
7910
|
+
var _a, _b, _c, _d;
|
|
7911
|
+
super();
|
|
7912
|
+
this.options = {
|
|
7913
|
+
controlPoints: [],
|
|
7914
|
+
color: 0x00aa55,
|
|
7915
|
+
translation: new Vector3(0, 0, 0),
|
|
7916
|
+
rotation: new Vector3(0, 0, 0),
|
|
7917
|
+
scale: new Vector3(1, 1, 1),
|
|
7918
|
+
};
|
|
7919
|
+
this.ogid = (_a = options === null || options === void 0 ? void 0 : options.ogid) !== null && _a !== void 0 ? _a : getUUID();
|
|
7920
|
+
this.curve = new OGCurve(this.ogid);
|
|
7921
|
+
this.options = Object.assign(Object.assign({}, this.options), options);
|
|
7922
|
+
this.options.ogid = this.ogid;
|
|
7923
|
+
this.setConfig({
|
|
7924
|
+
controlPoints: this.options.controlPoints.map((point) => point.clone()),
|
|
7925
|
+
color: this.options.color,
|
|
7926
|
+
});
|
|
7927
|
+
this.setPlacement({
|
|
7928
|
+
translation: (_b = this.options.translation) === null || _b === void 0 ? void 0 : _b.clone(),
|
|
7929
|
+
rotation: (_c = this.options.rotation) === null || _c === void 0 ? void 0 : _c.clone(),
|
|
7930
|
+
scale: (_d = this.options.scale) === null || _d === void 0 ? void 0 : _d.clone(),
|
|
7931
|
+
});
|
|
7932
|
+
}
|
|
7933
|
+
setConfig(options) {
|
|
7934
|
+
const nextOptions = Object.assign(Object.assign({}, this.options), options);
|
|
7935
|
+
const geometryChanged = "controlPoints" in options;
|
|
7936
|
+
const colorChanged = "color" in options;
|
|
7937
|
+
this.options = nextOptions;
|
|
7938
|
+
if (geometryChanged) {
|
|
7939
|
+
this.curve.set_config(nextOptions.controlPoints.map((point) => point.clone()));
|
|
7940
|
+
this.generateGeometry();
|
|
7941
|
+
return;
|
|
7942
|
+
}
|
|
7943
|
+
if (colorChanged && this.material instanceof THREE.LineBasicMaterial) {
|
|
7944
|
+
this.material.color.set(this.options.color);
|
|
7945
|
+
}
|
|
7946
|
+
}
|
|
7947
|
+
getConfig() {
|
|
7948
|
+
return this.options;
|
|
7949
|
+
}
|
|
7950
|
+
getAnchor() {
|
|
7951
|
+
const anchor = this.curve.get_anchor();
|
|
7952
|
+
return new Vector3(anchor.x, anchor.y, anchor.z);
|
|
7953
|
+
}
|
|
7954
|
+
setAnchor(anchor) {
|
|
7955
|
+
this.curve.set_anchor(anchor.clone());
|
|
7956
|
+
this.generateGeometry();
|
|
7957
|
+
}
|
|
7958
|
+
resetAnchor() {
|
|
7959
|
+
this.curve.reset_anchor();
|
|
7960
|
+
this.generateGeometry();
|
|
7961
|
+
}
|
|
7962
|
+
setPlacement(placement) {
|
|
7963
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
7964
|
+
this.options.translation = (_b = (_a = placement.translation) === null || _a === void 0 ? void 0 : _a.clone()) !== null && _b !== void 0 ? _b : this.options.translation;
|
|
7965
|
+
this.options.rotation = (_d = (_c = placement.rotation) === null || _c === void 0 ? void 0 : _c.clone()) !== null && _d !== void 0 ? _d : this.options.rotation;
|
|
7966
|
+
this.options.scale = (_f = (_e = placement.scale) === null || _e === void 0 ? void 0 : _e.clone()) !== null && _f !== void 0 ? _f : this.options.scale;
|
|
7967
|
+
this.curve.set_transform((_h = (_g = this.options.translation) === null || _g === void 0 ? void 0 : _g.clone()) !== null && _h !== void 0 ? _h : new Vector3(0, 0, 0), (_k = (_j = this.options.rotation) === null || _j === void 0 ? void 0 : _j.clone()) !== null && _k !== void 0 ? _k : new Vector3(0, 0, 0), (_m = (_l = this.options.scale) === null || _l === void 0 ? void 0 : _l.clone()) !== null && _m !== void 0 ? _m : new Vector3(1, 1, 1));
|
|
7968
|
+
this.generateGeometry();
|
|
7969
|
+
}
|
|
7970
|
+
setTransform(translation, rotation, scale) {
|
|
7971
|
+
this.setPlacement({
|
|
7972
|
+
translation,
|
|
7973
|
+
rotation,
|
|
7974
|
+
scale,
|
|
7975
|
+
});
|
|
7976
|
+
}
|
|
7977
|
+
setTranslation(translation) {
|
|
7978
|
+
this.setPlacement({ translation });
|
|
7979
|
+
}
|
|
7980
|
+
setRotation(rotation) {
|
|
7981
|
+
this.setPlacement({ rotation });
|
|
7982
|
+
}
|
|
7983
|
+
setScale(scale) {
|
|
7984
|
+
this.setPlacement({ scale });
|
|
7985
|
+
}
|
|
7986
|
+
getPlacement() {
|
|
7987
|
+
return clonePlacement({
|
|
7988
|
+
translation: this.options.translation,
|
|
7989
|
+
rotation: this.options.rotation,
|
|
7990
|
+
scale: this.options.scale,
|
|
7991
|
+
});
|
|
7992
|
+
}
|
|
7993
|
+
getEditCapabilities() {
|
|
7994
|
+
return createParametricEditCapabilities("curve", "curve");
|
|
7995
|
+
}
|
|
7996
|
+
canConvertToFreeform() {
|
|
7997
|
+
return true;
|
|
7998
|
+
}
|
|
7999
|
+
toFreeform(id = this.ogid) {
|
|
8000
|
+
if (!this.canConvertToFreeform()) {
|
|
8001
|
+
throw new Error("This entity cannot be converted to freeform.");
|
|
8002
|
+
}
|
|
8003
|
+
return createFreeformGeometry(this.curve.get_local_brep_serialized(), {
|
|
8004
|
+
id,
|
|
8005
|
+
placement: this.getPlacement(),
|
|
8006
|
+
});
|
|
8007
|
+
}
|
|
8008
|
+
generateGeometry() {
|
|
8009
|
+
const bufferData = Array.from(this.curve.get_geometry_buffer());
|
|
7372
8010
|
this.writePositionsToGeometry(this.geometry, bufferData);
|
|
7373
8011
|
this.geometry.computeBoundingBox();
|
|
7374
8012
|
this.geometry.computeBoundingSphere();
|
|
@@ -7384,20 +8022,12 @@ class Rectangle extends THREE.Line {
|
|
|
7384
8022
|
}
|
|
7385
8023
|
this.material = new THREE.LineBasicMaterial({ color: this.options.color });
|
|
7386
8024
|
}
|
|
7387
|
-
this.updateRenderStyle(bufferData);
|
|
7388
|
-
}
|
|
7389
|
-
getBrep() {
|
|
7390
|
-
const brepData = this.polyLineRectangle.get_brep_serialized();
|
|
7391
|
-
if (!brepData) {
|
|
7392
|
-
throw new Error("Brep data is not available for Rectangle");
|
|
7393
|
-
}
|
|
7394
|
-
return JSON.parse(brepData);
|
|
7395
8025
|
}
|
|
7396
8026
|
getOffset(distance, acuteThresholdDegrees = 35.0, bevel = true) {
|
|
7397
8027
|
var _a;
|
|
7398
|
-
const kernel = this.
|
|
8028
|
+
const kernel = this.curve;
|
|
7399
8029
|
if (typeof kernel.get_offset_serialized !== "function") {
|
|
7400
|
-
throw new Error("Offset API is not available in
|
|
8030
|
+
throw new Error("Offset API is not available in OGCurve. Rebuild opengeometry wasm bindings.");
|
|
7401
8031
|
}
|
|
7402
8032
|
const serialized = kernel.get_offset_serialized(distance, acuteThresholdDegrees, bevel);
|
|
7403
8033
|
const parsed = JSON.parse(serialized);
|
|
@@ -7407,9 +8037,6 @@ class Rectangle extends THREE.Line {
|
|
|
7407
8037
|
isClosed: Boolean(parsed.is_closed),
|
|
7408
8038
|
};
|
|
7409
8039
|
}
|
|
7410
|
-
discardGeometry() {
|
|
7411
|
-
this.geometry.dispose();
|
|
7412
|
-
}
|
|
7413
8040
|
writePositionsToGeometry(geometry, positions) {
|
|
7414
8041
|
const existing = geometry.getAttribute("position");
|
|
7415
8042
|
if (!(existing instanceof THREE.BufferAttribute) ||
|
|
@@ -7425,32 +8052,50 @@ class Rectangle extends THREE.Line {
|
|
|
7425
8052
|
}
|
|
7426
8053
|
|
|
7427
8054
|
/**
|
|
7428
|
-
*
|
|
8055
|
+
* EllipticalArc wrapper backed by the kernel OGEllipticalArc primitive.
|
|
7429
8056
|
*/
|
|
7430
|
-
class
|
|
8057
|
+
class EllipticalArc extends THREE.Line {
|
|
7431
8058
|
set color(color) {
|
|
7432
8059
|
this.options.color = color;
|
|
7433
8060
|
if (this.material instanceof THREE.LineBasicMaterial) {
|
|
7434
8061
|
this.material.color.set(color);
|
|
7435
8062
|
}
|
|
8063
|
+
if (this.fatLine && this.fatLine.material instanceof LineMaterial) {
|
|
8064
|
+
this.fatLine.material.color.set(color);
|
|
8065
|
+
}
|
|
7436
8066
|
}
|
|
7437
8067
|
constructor(options) {
|
|
7438
8068
|
var _a, _b, _c, _d;
|
|
7439
8069
|
super();
|
|
7440
8070
|
this.options = {
|
|
7441
|
-
|
|
7442
|
-
|
|
8071
|
+
center: new Vector3(0, 0, 0),
|
|
8072
|
+
radiusX: 1.0,
|
|
8073
|
+
radiusZ: 0.5,
|
|
8074
|
+
startAngle: 0,
|
|
8075
|
+
endAngle: Math.PI * 2,
|
|
8076
|
+
segments: 32,
|
|
8077
|
+
color: 0x00ff00,
|
|
8078
|
+
fatLines: false,
|
|
8079
|
+
width: 20,
|
|
7443
8080
|
translation: new Vector3(0, 0, 0),
|
|
7444
8081
|
rotation: new Vector3(0, 0, 0),
|
|
7445
8082
|
scale: new Vector3(1, 1, 1),
|
|
7446
8083
|
};
|
|
8084
|
+
this.fatLine = null;
|
|
7447
8085
|
this.ogid = (_a = options === null || options === void 0 ? void 0 : options.ogid) !== null && _a !== void 0 ? _a : getUUID();
|
|
7448
|
-
this.
|
|
8086
|
+
this.ellipticalArc = new OGEllipticalArc(this.ogid);
|
|
7449
8087
|
this.options = Object.assign(Object.assign({}, this.options), options);
|
|
7450
8088
|
this.options.ogid = this.ogid;
|
|
7451
8089
|
this.setConfig({
|
|
7452
|
-
|
|
8090
|
+
center: this.options.center.clone(),
|
|
8091
|
+
radiusX: this.options.radiusX,
|
|
8092
|
+
radiusZ: this.options.radiusZ,
|
|
8093
|
+
startAngle: this.options.startAngle,
|
|
8094
|
+
endAngle: this.options.endAngle,
|
|
8095
|
+
segments: this.options.segments,
|
|
7453
8096
|
color: this.options.color,
|
|
8097
|
+
fatLines: this.options.fatLines,
|
|
8098
|
+
width: this.options.width,
|
|
7454
8099
|
});
|
|
7455
8100
|
this.setPlacement({
|
|
7456
8101
|
translation: (_b = this.options.translation) === null || _b === void 0 ? void 0 : _b.clone(),
|
|
@@ -7458,49 +8103,47 @@ class Curve extends THREE.Line {
|
|
|
7458
8103
|
scale: (_d = this.options.scale) === null || _d === void 0 ? void 0 : _d.clone(),
|
|
7459
8104
|
});
|
|
7460
8105
|
}
|
|
8106
|
+
validateOptions() {
|
|
8107
|
+
if (!this.options) {
|
|
8108
|
+
throw new Error("Options are not defined for EllipticalArc");
|
|
8109
|
+
}
|
|
8110
|
+
}
|
|
7461
8111
|
setConfig(options) {
|
|
8112
|
+
this.validateOptions();
|
|
7462
8113
|
const nextOptions = Object.assign(Object.assign({}, this.options), options);
|
|
7463
|
-
const geometryChanged = "
|
|
7464
|
-
|
|
8114
|
+
const geometryChanged = "center" in options ||
|
|
8115
|
+
"radiusX" in options ||
|
|
8116
|
+
"radiusZ" in options ||
|
|
8117
|
+
"segments" in options ||
|
|
8118
|
+
"startAngle" in options ||
|
|
8119
|
+
"endAngle" in options;
|
|
8120
|
+
const renderChanged = "color" in options ||
|
|
8121
|
+
"fatLines" in options ||
|
|
8122
|
+
"width" in options;
|
|
7465
8123
|
this.options = nextOptions;
|
|
7466
8124
|
if (geometryChanged) {
|
|
7467
|
-
this.
|
|
8125
|
+
this.ellipticalArc.set_config(nextOptions.center.clone(), nextOptions.radiusX, nextOptions.radiusZ, nextOptions.startAngle, nextOptions.endAngle, nextOptions.segments);
|
|
7468
8126
|
this.generateGeometry();
|
|
7469
8127
|
return;
|
|
7470
8128
|
}
|
|
7471
|
-
if (
|
|
7472
|
-
this.
|
|
8129
|
+
if (renderChanged) {
|
|
8130
|
+
this.updateRenderStyle();
|
|
7473
8131
|
}
|
|
7474
8132
|
}
|
|
7475
|
-
getConfig() {
|
|
7476
|
-
return this.options;
|
|
7477
|
-
}
|
|
7478
8133
|
getAnchor() {
|
|
7479
|
-
const anchor = this.
|
|
8134
|
+
const anchor = this.ellipticalArc.get_anchor();
|
|
7480
8135
|
return new Vector3(anchor.x, anchor.y, anchor.z);
|
|
7481
8136
|
}
|
|
7482
|
-
setAnchor(anchor) {
|
|
7483
|
-
this.curve.set_anchor(anchor.clone());
|
|
7484
|
-
this.generateGeometry();
|
|
7485
|
-
}
|
|
7486
|
-
resetAnchor() {
|
|
7487
|
-
this.curve.reset_anchor();
|
|
7488
|
-
this.generateGeometry();
|
|
7489
|
-
}
|
|
7490
8137
|
setPlacement(placement) {
|
|
7491
8138
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
7492
8139
|
this.options.translation = (_b = (_a = placement.translation) === null || _a === void 0 ? void 0 : _a.clone()) !== null && _b !== void 0 ? _b : this.options.translation;
|
|
7493
8140
|
this.options.rotation = (_d = (_c = placement.rotation) === null || _c === void 0 ? void 0 : _c.clone()) !== null && _d !== void 0 ? _d : this.options.rotation;
|
|
7494
8141
|
this.options.scale = (_f = (_e = placement.scale) === null || _e === void 0 ? void 0 : _e.clone()) !== null && _f !== void 0 ? _f : this.options.scale;
|
|
7495
|
-
this.
|
|
8142
|
+
this.ellipticalArc.set_transform((_h = (_g = this.options.translation) === null || _g === void 0 ? void 0 : _g.clone()) !== null && _h !== void 0 ? _h : new Vector3(0, 0, 0), (_k = (_j = this.options.rotation) === null || _j === void 0 ? void 0 : _j.clone()) !== null && _k !== void 0 ? _k : new Vector3(0, 0, 0), (_m = (_l = this.options.scale) === null || _l === void 0 ? void 0 : _l.clone()) !== null && _m !== void 0 ? _m : new Vector3(1, 1, 1));
|
|
7496
8143
|
this.generateGeometry();
|
|
7497
8144
|
}
|
|
7498
8145
|
setTransform(translation, rotation, scale) {
|
|
7499
|
-
this.setPlacement({
|
|
7500
|
-
translation,
|
|
7501
|
-
rotation,
|
|
7502
|
-
scale,
|
|
7503
|
-
});
|
|
8146
|
+
this.setPlacement({ translation, rotation, scale });
|
|
7504
8147
|
}
|
|
7505
8148
|
setTranslation(translation) {
|
|
7506
8149
|
this.setPlacement({ translation });
|
|
@@ -7511,6 +8154,9 @@ class Curve extends THREE.Line {
|
|
|
7511
8154
|
setScale(scale) {
|
|
7512
8155
|
this.setPlacement({ scale });
|
|
7513
8156
|
}
|
|
8157
|
+
getConfig() {
|
|
8158
|
+
return this.options;
|
|
8159
|
+
}
|
|
7514
8160
|
getPlacement() {
|
|
7515
8161
|
return clonePlacement({
|
|
7516
8162
|
translation: this.options.translation,
|
|
@@ -7519,7 +8165,7 @@ class Curve extends THREE.Line {
|
|
|
7519
8165
|
});
|
|
7520
8166
|
}
|
|
7521
8167
|
getEditCapabilities() {
|
|
7522
|
-
return createParametricEditCapabilities("
|
|
8168
|
+
return createParametricEditCapabilities("elliptical_arc", "curve");
|
|
7523
8169
|
}
|
|
7524
8170
|
canConvertToFreeform() {
|
|
7525
8171
|
return true;
|
|
@@ -7528,13 +8174,50 @@ class Curve extends THREE.Line {
|
|
|
7528
8174
|
if (!this.canConvertToFreeform()) {
|
|
7529
8175
|
throw new Error("This entity cannot be converted to freeform.");
|
|
7530
8176
|
}
|
|
7531
|
-
return createFreeformGeometry(this.
|
|
8177
|
+
return createFreeformGeometry(this.ellipticalArc.get_local_brep_serialized(), {
|
|
7532
8178
|
id,
|
|
7533
8179
|
placement: this.getPlacement(),
|
|
7534
8180
|
});
|
|
7535
8181
|
}
|
|
8182
|
+
getCurrentPositions() {
|
|
8183
|
+
const attribute = this.geometry.getAttribute("position");
|
|
8184
|
+
if (!attribute || attribute.itemSize !== 3) {
|
|
8185
|
+
return [];
|
|
8186
|
+
}
|
|
8187
|
+
const positions = [];
|
|
8188
|
+
for (let index = 0; index < attribute.count; index += 1) {
|
|
8189
|
+
positions.push(attribute.getX(index), attribute.getY(index), attribute.getZ(index));
|
|
8190
|
+
}
|
|
8191
|
+
return positions;
|
|
8192
|
+
}
|
|
8193
|
+
updateRenderStyle(bufferData) {
|
|
8194
|
+
var _a;
|
|
8195
|
+
const positions = bufferData !== null && bufferData !== void 0 ? bufferData : this.getCurrentPositions();
|
|
8196
|
+
if (this.options.fatLines) {
|
|
8197
|
+
if (!this.fatLine) {
|
|
8198
|
+
this.fatLine = new Line2(new LineGeometry(), new LineMaterial({
|
|
8199
|
+
color: this.options.color,
|
|
8200
|
+
linewidth: this.options.width,
|
|
8201
|
+
resolution: new THREE.Vector2(window.innerWidth, window.innerHeight),
|
|
8202
|
+
}));
|
|
8203
|
+
this.add(this.fatLine);
|
|
8204
|
+
}
|
|
8205
|
+
this.fatLine.geometry.setPositions(positions);
|
|
8206
|
+
this.fatLine.material.color.set(this.options.color);
|
|
8207
|
+
this.fatLine.material.linewidth = (_a = this.options.width) !== null && _a !== void 0 ? _a : 5;
|
|
8208
|
+
this.fatLine.material.resolution.set(window.innerWidth, window.innerHeight);
|
|
8209
|
+
this.fatLine.visible = true;
|
|
8210
|
+
}
|
|
8211
|
+
else if (this.fatLine) {
|
|
8212
|
+
this.fatLine.visible = false;
|
|
8213
|
+
}
|
|
8214
|
+
if (this.material instanceof THREE.LineBasicMaterial) {
|
|
8215
|
+
this.material.color.set(this.options.color);
|
|
8216
|
+
this.material.visible = !this.options.fatLines;
|
|
8217
|
+
}
|
|
8218
|
+
}
|
|
7536
8219
|
generateGeometry() {
|
|
7537
|
-
const bufferData = Array.from(this.
|
|
8220
|
+
const bufferData = Array.from(this.ellipticalArc.get_geometry_buffer());
|
|
7538
8221
|
this.writePositionsToGeometry(this.geometry, bufferData);
|
|
7539
8222
|
this.geometry.computeBoundingBox();
|
|
7540
8223
|
this.geometry.computeBoundingSphere();
|
|
@@ -7550,20 +8233,17 @@ class Curve extends THREE.Line {
|
|
|
7550
8233
|
}
|
|
7551
8234
|
this.material = new THREE.LineBasicMaterial({ color: this.options.color });
|
|
7552
8235
|
}
|
|
8236
|
+
this.updateRenderStyle(bufferData);
|
|
7553
8237
|
}
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
throw new Error("Offset API is not available in OGCurve. Rebuild opengeometry wasm bindings.");
|
|
8238
|
+
getBrep() {
|
|
8239
|
+
const brepData = this.ellipticalArc.get_brep_serialized();
|
|
8240
|
+
if (!brepData) {
|
|
8241
|
+
throw new Error("Brep data is not available for EllipticalArc");
|
|
7559
8242
|
}
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
beveledVertexIndices: (_a = parsed.beveled_vertex_indices) !== null && _a !== void 0 ? _a : [],
|
|
7565
|
-
isClosed: Boolean(parsed.is_closed),
|
|
7566
|
-
};
|
|
8243
|
+
return JSON.parse(brepData);
|
|
8244
|
+
}
|
|
8245
|
+
discardGeometry() {
|
|
8246
|
+
this.geometry.dispose();
|
|
7567
8247
|
}
|
|
7568
8248
|
writePositionsToGeometry(geometry, positions) {
|
|
7569
8249
|
const existing = geometry.getAttribute("position");
|
|
@@ -10807,6 +11487,139 @@ function createOffsetExample(scene) {
|
|
|
10807
11487
|
};
|
|
10808
11488
|
}
|
|
10809
11489
|
|
|
11490
|
+
/**
|
|
11491
|
+
* Offset a centreline by ±half-width into one or more filled REGIONS, via the
|
|
11492
|
+
* deterministic analytic offset — miters / flat bevels at `miterLimit`, concave
|
|
11493
|
+
* trims, and nonzero-winding resolution of reflex / closed loops. NO boolean union
|
|
11494
|
+
* (so it is deterministic, unlike the 3D-mesh CSG path). A simple centreline returns
|
|
11495
|
+
* one region; a self-crossing closed centreline (e.g. a figure-8) returns one per
|
|
11496
|
+
* simple sub-loop. Returns an EMPTY array for a genuinely unbuildable input (does
|
|
11497
|
+
* not throw, so it never looks like a kernel crash). Rings are CW-outer / CCW-holes.
|
|
11498
|
+
*
|
|
11499
|
+
* @param centrelineFlat centreline points as `[x,y,z, …]`.
|
|
11500
|
+
* @param width full stroke width (offset ±width/2 on each side).
|
|
11501
|
+
* @param miterLimit SVG stroke-miterlimit; corners sharper than this bevel. Default 4.
|
|
11502
|
+
*/
|
|
11503
|
+
function offsetPolylineRegions(centrelineFlat, width, closed, miterLimit = 4) {
|
|
11504
|
+
const buildExport = offsetPolylineRegions$1;
|
|
11505
|
+
if (typeof buildExport !== "function") {
|
|
11506
|
+
throw new Error("offsetPolylineRegions is not available in the loaded wasm package. Rebuild opengeometry wasm bindings.");
|
|
11507
|
+
}
|
|
11508
|
+
const flat = centrelineFlat instanceof Float64Array ? centrelineFlat : new Float64Array(centrelineFlat);
|
|
11509
|
+
const result = buildExport(flat, width, closed, miterLimit);
|
|
11510
|
+
return JSON.parse(result.regionsSerialized);
|
|
11511
|
+
}
|
|
11512
|
+
/**
|
|
11513
|
+
* Inset a CLOSED ring inward with one distance per edge (edge i =
|
|
11514
|
+
* `ring[i] → ring[i+1]`; an explicit closing duplicate point is accepted and
|
|
11515
|
+
* stripped, the distance count stays one per unique edge). Built for setback
|
|
11516
|
+
* envelopes: the result is the CLEARANCE-EXACT buildable region — the ring's
|
|
11517
|
+
* interior minus every point within `distances[i]` of edge i's SEGMENT, so
|
|
11518
|
+
* distant lot lines are honoured across notches and corners where distances
|
|
11519
|
+
* differ become circumscribed clearance arcs (conservative). There is no
|
|
11520
|
+
* `miterLimit` parameter, deliberately: miters and bevels only approximate the
|
|
11521
|
+
* clearance arc, and a bevel would claim points inside the required distance.
|
|
11522
|
+
*
|
|
11523
|
+
* `holes` are excluded interior rings, each grown outward by its own per-edge
|
|
11524
|
+
* distances — the region keeps clear of a hole's edges exactly as it keeps
|
|
11525
|
+
* clear of the lot lines, so a hole can split the region or swallow it.
|
|
11526
|
+
*
|
|
11527
|
+
* Returns CW-outer / CCW-hole regions (canonical start vertex), possibly
|
|
11528
|
+
* SEVERAL when a deep inset (or a hole) splits a waisted ring into disjoint
|
|
11529
|
+
* lobes, and an EMPTY array when the inset collapses or the outer ring is
|
|
11530
|
+
* degenerate (< 3 unique points, zero area, self-intersecting). THROWS on
|
|
11531
|
+
* malformed arguments: a distance count that does not match an edge count, a
|
|
11532
|
+
* negative / non-finite distance, or a degenerate hole — those are caller
|
|
11533
|
+
* bugs, not geometry.
|
|
11534
|
+
*
|
|
11535
|
+
* @param ring closed ring points as `[x,y,z, …]` (Y is carried through).
|
|
11536
|
+
* @param distances inward inset distance per edge, metres, each >= 0
|
|
11537
|
+
* (0 = the edge stays in place, e.g. lot-line construction).
|
|
11538
|
+
* @param holes excluded interior rings with their own per-edge distances.
|
|
11539
|
+
*/
|
|
11540
|
+
function offsetRingVariable(ring, distances, holes = []) {
|
|
11541
|
+
const buildExport = offsetRingVariable$1;
|
|
11542
|
+
if (typeof buildExport !== "function") {
|
|
11543
|
+
throw new Error("offsetRingVariable is not available in the loaded wasm package. It requires opengeometry >= 2.0.12 — rebuild or upgrade the opengeometry wasm bindings.");
|
|
11544
|
+
}
|
|
11545
|
+
const flatRing = ring instanceof Float64Array ? ring : new Float64Array(ring);
|
|
11546
|
+
const flatDistances = distances instanceof Float64Array ? distances : new Float64Array(distances);
|
|
11547
|
+
const holesJson = JSON.stringify(holes.map((hole) => ({ ring: Array.from(hole.ring), distances: Array.from(hole.distances) })));
|
|
11548
|
+
const result = buildExport(flatRing, flatDistances, holesJson);
|
|
11549
|
+
return JSON.parse(result.regionsSerialized);
|
|
11550
|
+
}
|
|
11551
|
+
/**
|
|
11552
|
+
* Merge a GROUP of separate polylines (a crossing T / X / L overlap) into one clean
|
|
11553
|
+
* region by nonzero-winding union of their mitered bands — the overlapping strokes
|
|
11554
|
+
* merge into a single region with mitered/bevelled corners, no internal edges.
|
|
11555
|
+
* Returns CW-outer / CCW-hole regions (one or more); empty if nothing is buildable.
|
|
11556
|
+
* No CSG. Used to render/extrude an overlapping crossing as one joined mass.
|
|
11557
|
+
*/
|
|
11558
|
+
function offsetPolylineGroupRegions(polylines) {
|
|
11559
|
+
const buildExport = offsetPolylineGroupRegions$1;
|
|
11560
|
+
if (typeof buildExport !== "function") {
|
|
11561
|
+
throw new Error("offsetPolylineGroupRegions is not available in the loaded wasm package. Rebuild opengeometry wasm bindings.");
|
|
11562
|
+
}
|
|
11563
|
+
const result = buildExport(JSON.stringify(polylines));
|
|
11564
|
+
return JSON.parse(result.regionsSerialized);
|
|
11565
|
+
}
|
|
11566
|
+
|
|
11567
|
+
/** Close a kernel ring for Polyline rendering (repeat the first point). */
|
|
11568
|
+
function closedRingPoints(ring) {
|
|
11569
|
+
const points = ring.map((point) => new Vector3(point.x, point.y, point.z));
|
|
11570
|
+
if (points.length > 0) {
|
|
11571
|
+
const first = ring[0];
|
|
11572
|
+
points.push(new Vector3(first.x, first.y, first.z));
|
|
11573
|
+
}
|
|
11574
|
+
return points;
|
|
11575
|
+
}
|
|
11576
|
+
/**
|
|
11577
|
+
* Variable (per-edge) ring inset: a rectangular "parcel" inset by front 6 /
|
|
11578
|
+
* side 1.5 / rear 3 setbacks, and a waisted (dumbbell) parcel whose uniform
|
|
11579
|
+
* 3 m inset SPLITS into two disjoint buildable envelopes — the case a uniform
|
|
11580
|
+
* offset cannot express.
|
|
11581
|
+
*/
|
|
11582
|
+
function createOffsetRingVariableExample(scene) {
|
|
11583
|
+
const scale = 0.2; // metres → scene units, keeps both parcels in frame
|
|
11584
|
+
const parcel = [0, 0, 0, 20, 0, 0, 20, 0, 30, 0, 0, 30].map((v) => v * scale);
|
|
11585
|
+
const parcelSetbacks = [6, 1.5, 3, 1.5].map((v) => v * scale);
|
|
11586
|
+
const dumbbell = [
|
|
11587
|
+
0, 0, 0, 20, 0, 0, 20, 0, 14, 12, 0, 14, 12, 0, 26, 20, 0, 26, 20, 0, 40, 0, 0, 40, 0, 0, 26,
|
|
11588
|
+
8, 0, 26, 8, 0, 14, 0, 0, 14,
|
|
11589
|
+
].map((v, index) => (index % 3 === 0 ? v * scale + 6 : v * scale)); // shifted +x
|
|
11590
|
+
const dumbbellSetbacks = new Array(12).fill(3 * scale);
|
|
11591
|
+
const parcelOutline = new Polyline({
|
|
11592
|
+
points: closedRingPoints(Array.from({ length: parcel.length / 3 }, (_, i) => ({
|
|
11593
|
+
x: parcel[i * 3],
|
|
11594
|
+
y: parcel[i * 3 + 1],
|
|
11595
|
+
z: parcel[i * 3 + 2],
|
|
11596
|
+
}))),
|
|
11597
|
+
color: 0x1f2937,
|
|
11598
|
+
});
|
|
11599
|
+
scene.add(parcelOutline);
|
|
11600
|
+
const dumbbellOutline = new Polyline({
|
|
11601
|
+
points: closedRingPoints(Array.from({ length: dumbbell.length / 3 }, (_, i) => ({
|
|
11602
|
+
x: dumbbell[i * 3],
|
|
11603
|
+
y: dumbbell[i * 3 + 1],
|
|
11604
|
+
z: dumbbell[i * 3 + 2],
|
|
11605
|
+
}))),
|
|
11606
|
+
color: 0x1f2937,
|
|
11607
|
+
});
|
|
11608
|
+
scene.add(dumbbellOutline);
|
|
11609
|
+
const envelopes = [];
|
|
11610
|
+
for (const region of offsetRingVariable(parcel, parcelSetbacks)) {
|
|
11611
|
+
const envelope = new Polyline({ points: closedRingPoints(region.outer), color: 0x16a34a });
|
|
11612
|
+
envelopes.push(envelope);
|
|
11613
|
+
scene.add(envelope);
|
|
11614
|
+
}
|
|
11615
|
+
for (const region of offsetRingVariable(dumbbell, dumbbellSetbacks)) {
|
|
11616
|
+
const envelope = new Polyline({ points: closedRingPoints(region.outer), color: 0xdc2626 });
|
|
11617
|
+
envelopes.push(envelope);
|
|
11618
|
+
scene.add(envelope);
|
|
11619
|
+
}
|
|
11620
|
+
return { parcelOutline, dumbbellOutline, envelopes };
|
|
11621
|
+
}
|
|
11622
|
+
|
|
10810
11623
|
const EPSILON = 1.0e-9;
|
|
10811
11624
|
function areClose(a, b) {
|
|
10812
11625
|
const dx = a.x - b.x;
|
|
@@ -11255,44 +12068,6 @@ function createEditorModesExample(scene) {
|
|
|
11255
12068
|
};
|
|
11256
12069
|
}
|
|
11257
12070
|
|
|
11258
|
-
/**
|
|
11259
|
-
* Offset a centreline by ±half-width into one or more filled REGIONS, via the
|
|
11260
|
-
* deterministic analytic offset — miters / flat bevels at `miterLimit`, concave
|
|
11261
|
-
* trims, and nonzero-winding resolution of reflex / closed loops. NO boolean union
|
|
11262
|
-
* (so it is deterministic, unlike the 3D-mesh CSG path). A simple centreline returns
|
|
11263
|
-
* one region; a self-crossing closed centreline (e.g. a figure-8) returns one per
|
|
11264
|
-
* simple sub-loop. Returns an EMPTY array for a genuinely unbuildable input (does
|
|
11265
|
-
* not throw, so it never looks like a kernel crash). Rings are CW-outer / CCW-holes.
|
|
11266
|
-
*
|
|
11267
|
-
* @param centrelineFlat centreline points as `[x,y,z, …]`.
|
|
11268
|
-
* @param width full stroke width (offset ±width/2 on each side).
|
|
11269
|
-
* @param miterLimit SVG stroke-miterlimit; corners sharper than this bevel. Default 4.
|
|
11270
|
-
*/
|
|
11271
|
-
function offsetPolylineRegions(centrelineFlat, width, closed, miterLimit = 4) {
|
|
11272
|
-
const buildExport = offsetPolylineRegions$1;
|
|
11273
|
-
if (typeof buildExport !== "function") {
|
|
11274
|
-
throw new Error("offsetPolylineRegions is not available in the loaded wasm package. Rebuild opengeometry wasm bindings.");
|
|
11275
|
-
}
|
|
11276
|
-
const flat = centrelineFlat instanceof Float64Array ? centrelineFlat : new Float64Array(centrelineFlat);
|
|
11277
|
-
const result = buildExport(flat, width, closed, miterLimit);
|
|
11278
|
-
return JSON.parse(result.regionsSerialized);
|
|
11279
|
-
}
|
|
11280
|
-
/**
|
|
11281
|
-
* Merge a GROUP of separate polylines (a crossing T / X / L overlap) into one clean
|
|
11282
|
-
* region by nonzero-winding union of their mitered bands — the overlapping strokes
|
|
11283
|
-
* merge into a single region with mitered/bevelled corners, no internal edges.
|
|
11284
|
-
* Returns CW-outer / CCW-hole regions (one or more); empty if nothing is buildable.
|
|
11285
|
-
* No CSG. Used to render/extrude an overlapping crossing as one joined mass.
|
|
11286
|
-
*/
|
|
11287
|
-
function offsetPolylineGroupRegions(polylines) {
|
|
11288
|
-
const buildExport = offsetPolylineGroupRegions$1;
|
|
11289
|
-
if (typeof buildExport !== "function") {
|
|
11290
|
-
throw new Error("offsetPolylineGroupRegions is not available in the loaded wasm package. Rebuild opengeometry wasm bindings.");
|
|
11291
|
-
}
|
|
11292
|
-
const result = buildExport(JSON.stringify(polylines));
|
|
11293
|
-
return JSON.parse(result.regionsSerialized);
|
|
11294
|
-
}
|
|
11295
|
-
|
|
11296
12071
|
/**
|
|
11297
12072
|
* Shared runtime entrypoint used to initialize the OpenGeometry wasm module.
|
|
11298
12073
|
*/
|
|
@@ -11357,5 +12132,5 @@ class OpenGeometry {
|
|
|
11357
12132
|
OpenGeometry.version = OPEN_GEOMETRY_THREE_VERSION;
|
|
11358
12133
|
OpenGeometry.instance = null;
|
|
11359
12134
|
|
|
11360
|
-
export { Arc, BooleanError, BooleanResult, CoincidentFacesError, Cuboid, Curve, CutterExceedsHostError, Cylinder, FreeformEditor, FreeformGeometry, Line, NonManifoldOutputError, OGSceneManager, OpenGeometry, Opening, OverlappingCuttersError, Polygon, Polyline, Rectangle, Solid, Sphere, SpotLabel, Sweep, Vector3, Wedge, booleanIntersection, booleanSubtraction, booleanUnion, clonePlacement, createBooleanExample, createEditorModesExample, createFreeformEditor, createFreeformGeometry, createOffsetExample, createParametricEditCapabilities, createPrimitivesExample, createShapesExample, createSweepExample, createWallFromOffsetsExample, describeWallSubtractError, executeBooleanSubtractionMany, extrudeBrepFace, offsetPolylineGroupRegions, offsetPolylineRegions, parseBooleanError, toObjectTransformation$1 as toObjectTransformation };
|
|
12135
|
+
export { Arc, BooleanError, BooleanResult, CoincidentFacesError, Cuboid, Curve, CutterExceedsHostError, Cylinder, EllipticalArc, FreeformEditor, FreeformGeometry, Line, NonManifoldOutputError, OGSceneManager, OpenGeometry, Opening, OverlappingCuttersError, Polygon, Polyline, Rectangle, Solid, Sphere, SpotLabel, Sweep, Vector3, Wedge, booleanIntersection, booleanSubtraction, booleanUnion, clonePlacement, createBooleanExample, createEditorModesExample, createFreeformEditor, createFreeformGeometry, createOffsetExample, createOffsetRingVariableExample, createParametricEditCapabilities, createPrimitivesExample, createShapesExample, createSweepExample, createWallFromOffsetsExample, describeWallSubtractError, executeBooleanSubtractionMany, extrudeBrepFace, offsetPolylineGroupRegions, offsetPolylineRegions, offsetRingVariable, parseBooleanError, toObjectTransformation$1 as toObjectTransformation };
|
|
11361
12136
|
//# sourceMappingURL=index.js.map
|