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.
@@ -168,43 +168,18 @@ function getStringFromWasm0(ptr, len) {
168
168
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
169
169
  }
170
170
 
171
- function takeFromExternrefTable0(idx) {
172
- const value = wasm.__wbindgen_export_2.get(idx);
173
- wasm.__externref_table_dealloc(idx);
174
- return value;
175
- }
176
- /**
177
- * @param {string} local_brep_serialized
178
- * @param {number} height
179
- * @returns {string}
180
- */
181
- export function extrudeBrepFace(local_brep_serialized, height) {
182
- let deferred3_0;
183
- let deferred3_1;
184
- try {
185
- const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
186
- const len0 = WASM_VECTOR_LEN;
187
- const ret = wasm.extrudeBrepFace(ptr0, len0, height);
188
- var ptr2 = ret[0];
189
- var len2 = ret[1];
190
- if (ret[3]) {
191
- ptr2 = 0; len2 = 0;
192
- throw takeFromExternrefTable0(ret[2]);
193
- }
194
- deferred3_0 = ptr2;
195
- deferred3_1 = len2;
196
- return getStringFromWasm0(ptr2, len2);
197
- } finally {
198
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
199
- }
200
- }
201
-
202
171
  function _assertClass(instance, klass) {
203
172
  if (!(instance instanceof klass)) {
204
173
  throw new Error(`expected instance of ${klass.name}`);
205
174
  }
206
175
  }
207
176
 
177
+ function takeFromExternrefTable0(idx) {
178
+ const value = wasm.__wbindgen_export_2.get(idx);
179
+ wasm.__externref_table_dealloc(idx);
180
+ return value;
181
+ }
182
+
208
183
  let cachedFloat64ArrayMemory0 = null;
209
184
 
210
185
  function getFloat64ArrayMemory0() {
@@ -229,6 +204,13 @@ function passArrayJsValueToWasm0(array, malloc) {
229
204
  return ptr;
230
205
  }
231
206
 
207
+ function passArrayF64ToWasm0(arg, malloc) {
208
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
209
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
210
+ WASM_VECTOR_LEN = arg.length;
211
+ return ptr;
212
+ }
213
+
232
214
  function getArrayJsValueFromWasm0(ptr, len) {
233
215
  ptr = ptr >>> 0;
234
216
  const mem = getDataViewMemory0();
@@ -243,13 +225,88 @@ function getArrayJsValueFromWasm0(ptr, len) {
243
225
  function isLikeNone(x) {
244
226
  return x === undefined || x === null;
245
227
  }
228
+ /**
229
+ * Wasm entry point: analyze a flat `[x0,y0,z0,…]` loop, returning the report as
230
+ * JSON (the corrected points are not returned here; use the kernel API).
231
+ * @param {Float64Array} flat_points
232
+ * @returns {string}
233
+ */
234
+ export function analyzeProfile(flat_points) {
235
+ let deferred3_0;
236
+ let deferred3_1;
237
+ try {
238
+ const ptr0 = passArrayF64ToWasm0(flat_points, wasm.__wbindgen_malloc);
239
+ const len0 = WASM_VECTOR_LEN;
240
+ const ret = wasm.analyzeProfile(ptr0, len0);
241
+ var ptr2 = ret[0];
242
+ var len2 = ret[1];
243
+ if (ret[3]) {
244
+ ptr2 = 0; len2 = 0;
245
+ throw takeFromExternrefTable0(ret[2]);
246
+ }
247
+ deferred3_0 = ptr2;
248
+ deferred3_1 = len2;
249
+ return getStringFromWasm0(ptr2, len2);
250
+ } finally {
251
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
252
+ }
253
+ }
246
254
 
247
- function passArrayF64ToWasm0(arg, malloc) {
248
- const ptr = malloc(arg.length * 8, 8) >>> 0;
249
- getFloat64ArrayMemory0().set(arg, ptr / 8);
250
- WASM_VECTOR_LEN = arg.length;
251
- return ptr;
255
+ /**
256
+ * Wasm entry point: check a serialized B-rep's geometric validity, returning
257
+ * the [`ValidityReport`] as JSON.
258
+ * @param {string} brep_json
259
+ * @returns {string}
260
+ */
261
+ export function checkBrepValidity(brep_json) {
262
+ let deferred3_0;
263
+ let deferred3_1;
264
+ try {
265
+ const ptr0 = passStringToWasm0(brep_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
266
+ const len0 = WASM_VECTOR_LEN;
267
+ const ret = wasm.checkBrepValidity(ptr0, len0);
268
+ var ptr2 = ret[0];
269
+ var len2 = ret[1];
270
+ if (ret[3]) {
271
+ ptr2 = 0; len2 = 0;
272
+ throw takeFromExternrefTable0(ret[2]);
273
+ }
274
+ deferred3_0 = ptr2;
275
+ deferred3_1 = len2;
276
+ return getStringFromWasm0(ptr2, len2);
277
+ } finally {
278
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
279
+ }
280
+ }
281
+
282
+ /**
283
+ * Wasm entry point: heal a serialized B-rep, returning JSON
284
+ * `{ "brep": <healed brep>, "report": <heal report> }`.
285
+ * @param {string} brep_json
286
+ * @param {number} tolerance
287
+ * @returns {string}
288
+ */
289
+ export function healBrep(brep_json, tolerance) {
290
+ let deferred3_0;
291
+ let deferred3_1;
292
+ try {
293
+ const ptr0 = passStringToWasm0(brep_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
294
+ const len0 = WASM_VECTOR_LEN;
295
+ const ret = wasm.healBrep(ptr0, len0, tolerance);
296
+ var ptr2 = ret[0];
297
+ var len2 = ret[1];
298
+ if (ret[3]) {
299
+ ptr2 = 0; len2 = 0;
300
+ throw takeFromExternrefTable0(ret[2]);
301
+ }
302
+ deferred3_0 = ptr2;
303
+ deferred3_1 = len2;
304
+ return getStringFromWasm0(ptr2, len2);
305
+ } finally {
306
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
307
+ }
252
308
  }
309
+
253
310
  /**
254
311
  * Wasm entry point: offset a centreline by `width` into stroked regions via the
255
312
  * deterministic analytic offset. `centreline_flat` is `[x0,y0,z0, …]`. Returns
@@ -288,6 +345,101 @@ export function offsetPolylineGroupRegions(polylines_json) {
288
345
  return OGOffsetRegionsResult.__wrap(ret[0]);
289
346
  }
290
347
 
348
+ /**
349
+ * Wasm entry point: inset a CLOSED ring inward with one distance per edge
350
+ * (edge i = ring[i] → ring[i+1]). `ring_flat` is `[x0,y0,z0, …]`;
351
+ * `holes_json` is `[{ring:[x,y,z,…], distances:[…]}, …]` (`"[]"` = none) —
352
+ * excluded interior rings, each grown outward by its own per-edge distances.
353
+ * Returns CW-outer / CCW-hole regions, canonicalised; possibly several when a
354
+ * deep inset (or a hole) splits the ring, and empty (does NOT throw) when the
355
+ * inset collapses or the outer ring is degenerate. THROWS on malformed
356
+ * arguments: a distance count that does not match an edge count, a negative /
357
+ * non-finite distance, a degenerate hole, or unparsable `holes_json`. Corners
358
+ * where distances differ are circumscribed clearance arcs (conservative), so
359
+ * no output point is ever closer to an edge than that edge's distance —
360
+ * there is no miter-limit knob because there are no miters.
361
+ * @param {Float64Array} ring_flat
362
+ * @param {Float64Array} distances
363
+ * @param {string} holes_json
364
+ * @returns {OGOffsetRegionsResult}
365
+ */
366
+ export function offsetRingVariable(ring_flat, distances, holes_json) {
367
+ const ptr0 = passArrayF64ToWasm0(ring_flat, wasm.__wbindgen_malloc);
368
+ const len0 = WASM_VECTOR_LEN;
369
+ const ptr1 = passArrayF64ToWasm0(distances, wasm.__wbindgen_malloc);
370
+ const len1 = WASM_VECTOR_LEN;
371
+ const ptr2 = passStringToWasm0(holes_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
372
+ const len2 = WASM_VECTOR_LEN;
373
+ const ret = wasm.offsetRingVariable(ptr0, len0, ptr1, len1, ptr2, len2);
374
+ if (ret[2]) {
375
+ throw takeFromExternrefTable0(ret[1]);
376
+ }
377
+ return OGOffsetRegionsResult.__wrap(ret[0]);
378
+ }
379
+
380
+ /**
381
+ * @param {string} local_brep_serialized
382
+ * @param {number} height
383
+ * @returns {string}
384
+ */
385
+ export function extrudeBrepFace(local_brep_serialized, height) {
386
+ let deferred3_0;
387
+ let deferred3_1;
388
+ try {
389
+ const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
390
+ const len0 = WASM_VECTOR_LEN;
391
+ const ret = wasm.extrudeBrepFace(ptr0, len0, height);
392
+ var ptr2 = ret[0];
393
+ var len2 = ret[1];
394
+ if (ret[3]) {
395
+ ptr2 = 0; len2 = 0;
396
+ throw takeFromExternrefTable0(ret[2]);
397
+ }
398
+ deferred3_0 = ptr2;
399
+ deferred3_1 = len2;
400
+ return getStringFromWasm0(ptr2, len2);
401
+ } finally {
402
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
403
+ }
404
+ }
405
+
406
+ /**
407
+ * Wasm entry point for general extrude. `direction` is `[x,y,z]`; `extent_kind`
408
+ * is `"one_sided" | "symmetric" | "two_sided"`; `d_plus`/`d_minus` are the
409
+ * extent distances (`d_minus` ignored unless two-sided, `d_plus` is the
410
+ * distance for one-sided/symmetric).
411
+ * @param {string} local_brep_serialized
412
+ * @param {Float64Array} direction
413
+ * @param {string} extent_kind
414
+ * @param {number} d_plus
415
+ * @param {number} d_minus
416
+ * @returns {string}
417
+ */
418
+ export function extrudeBrepFaceDirectional(local_brep_serialized, direction, extent_kind, d_plus, d_minus) {
419
+ let deferred5_0;
420
+ let deferred5_1;
421
+ try {
422
+ const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
423
+ const len0 = WASM_VECTOR_LEN;
424
+ const ptr1 = passArrayF64ToWasm0(direction, wasm.__wbindgen_malloc);
425
+ const len1 = WASM_VECTOR_LEN;
426
+ const ptr2 = passStringToWasm0(extent_kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
427
+ const len2 = WASM_VECTOR_LEN;
428
+ const ret = wasm.extrudeBrepFaceDirectional(ptr0, len0, ptr1, len1, ptr2, len2, d_plus, d_minus);
429
+ var ptr4 = ret[0];
430
+ var len4 = ret[1];
431
+ if (ret[3]) {
432
+ ptr4 = 0; len4 = 0;
433
+ throw takeFromExternrefTable0(ret[2]);
434
+ }
435
+ deferred5_0 = ptr4;
436
+ deferred5_1 = len4;
437
+ return getStringFromWasm0(ptr4, len4);
438
+ } finally {
439
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
440
+ }
441
+ }
442
+
291
443
  /**
292
444
  * Wasm entry point for union.
293
445
  * @param {string} lhs_brep_serialized
@@ -1782,6 +1934,224 @@ export class OGCylinder {
1782
1934
  }
1783
1935
  }
1784
1936
 
1937
+ const OGEllipticalArcFinalization = (typeof FinalizationRegistry === 'undefined')
1938
+ ? { register: () => {}, unregister: () => {} }
1939
+ : new FinalizationRegistry(ptr => wasm.__wbg_ogellipticalarc_free(ptr >>> 0, 1));
1940
+
1941
+ export class OGEllipticalArc {
1942
+
1943
+ __destroy_into_raw() {
1944
+ const ptr = this.__wbg_ptr;
1945
+ this.__wbg_ptr = 0;
1946
+ OGEllipticalArcFinalization.unregister(this);
1947
+ return ptr;
1948
+ }
1949
+
1950
+ free() {
1951
+ const ptr = this.__destroy_into_raw();
1952
+ wasm.__wbg_ogellipticalarc_free(ptr, 0);
1953
+ }
1954
+ /**
1955
+ * @param {string} id
1956
+ */
1957
+ set id(id) {
1958
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1959
+ const len0 = WASM_VECTOR_LEN;
1960
+ wasm.ogellipticalarc_set_id(this.__wbg_ptr, ptr0, len0);
1961
+ }
1962
+ /**
1963
+ * @returns {string}
1964
+ */
1965
+ get id() {
1966
+ let deferred1_0;
1967
+ let deferred1_1;
1968
+ try {
1969
+ const ret = wasm.ogellipticalarc_id(this.__wbg_ptr);
1970
+ deferred1_0 = ret[0];
1971
+ deferred1_1 = ret[1];
1972
+ return getStringFromWasm0(ret[0], ret[1]);
1973
+ } finally {
1974
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1975
+ }
1976
+ }
1977
+ /**
1978
+ * @param {string} id
1979
+ */
1980
+ constructor(id) {
1981
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1982
+ const len0 = WASM_VECTOR_LEN;
1983
+ const ret = wasm.ogellipticalarc_new(ptr0, len0);
1984
+ this.__wbg_ptr = ret >>> 0;
1985
+ OGEllipticalArcFinalization.register(this, this.__wbg_ptr, this);
1986
+ return this;
1987
+ }
1988
+ /**
1989
+ * @param {Vector3} center
1990
+ * @param {number} radius_x
1991
+ * @param {number} radius_z
1992
+ * @param {number} start_angle
1993
+ * @param {number} end_angle
1994
+ * @param {number} segments
1995
+ */
1996
+ set_config(center, radius_x, radius_z, start_angle, end_angle, segments) {
1997
+ _assertClass(center, Vector3);
1998
+ var ptr0 = center.__destroy_into_raw();
1999
+ const ret = wasm.ogellipticalarc_set_config(this.__wbg_ptr, ptr0, radius_x, radius_z, start_angle, end_angle, segments);
2000
+ if (ret[1]) {
2001
+ throw takeFromExternrefTable0(ret[0]);
2002
+ }
2003
+ }
2004
+ /**
2005
+ * @param {Vector3} center
2006
+ */
2007
+ set_center(center) {
2008
+ _assertClass(center, Vector3);
2009
+ var ptr0 = center.__destroy_into_raw();
2010
+ wasm.ogellipticalarc_set_center(this.__wbg_ptr, ptr0);
2011
+ }
2012
+ /**
2013
+ * @param {Vector3} position
2014
+ * @param {Vector3} rotation
2015
+ * @param {Vector3} scale
2016
+ */
2017
+ set_transform(position, rotation, scale) {
2018
+ _assertClass(position, Vector3);
2019
+ var ptr0 = position.__destroy_into_raw();
2020
+ _assertClass(rotation, Vector3);
2021
+ var ptr1 = rotation.__destroy_into_raw();
2022
+ _assertClass(scale, Vector3);
2023
+ var ptr2 = scale.__destroy_into_raw();
2024
+ const ret = wasm.ogellipticalarc_set_transform(this.__wbg_ptr, ptr0, ptr1, ptr2);
2025
+ if (ret[1]) {
2026
+ throw takeFromExternrefTable0(ret[0]);
2027
+ }
2028
+ }
2029
+ /**
2030
+ * @param {Vector3} translation
2031
+ */
2032
+ set_translation(translation) {
2033
+ _assertClass(translation, Vector3);
2034
+ var ptr0 = translation.__destroy_into_raw();
2035
+ wasm.ogellipticalarc_set_translation(this.__wbg_ptr, ptr0);
2036
+ }
2037
+ /**
2038
+ * @param {Vector3} rotation
2039
+ */
2040
+ set_rotation(rotation) {
2041
+ _assertClass(rotation, Vector3);
2042
+ var ptr0 = rotation.__destroy_into_raw();
2043
+ wasm.ogellipticalarc_set_rotation(this.__wbg_ptr, ptr0);
2044
+ }
2045
+ /**
2046
+ * @param {Vector3} scale
2047
+ */
2048
+ set_scale(scale) {
2049
+ _assertClass(scale, Vector3);
2050
+ var ptr0 = scale.__destroy_into_raw();
2051
+ const ret = wasm.ogellipticalarc_set_scale(this.__wbg_ptr, ptr0);
2052
+ if (ret[1]) {
2053
+ throw takeFromExternrefTable0(ret[0]);
2054
+ }
2055
+ }
2056
+ generate_geometry() {
2057
+ const ret = wasm.ogellipticalarc_generate_geometry(this.__wbg_ptr);
2058
+ if (ret[1]) {
2059
+ throw takeFromExternrefTable0(ret[0]);
2060
+ }
2061
+ }
2062
+ dispose_points() {
2063
+ wasm.ogellipticalarc_dispose_points(this.__wbg_ptr);
2064
+ }
2065
+ destroy() {
2066
+ wasm.ogellipticalarc_destroy(this.__wbg_ptr);
2067
+ }
2068
+ /**
2069
+ * @returns {string}
2070
+ */
2071
+ get_brep_serialized() {
2072
+ let deferred1_0;
2073
+ let deferred1_1;
2074
+ try {
2075
+ const ret = wasm.ogellipticalarc_get_brep_serialized(this.__wbg_ptr);
2076
+ deferred1_0 = ret[0];
2077
+ deferred1_1 = ret[1];
2078
+ return getStringFromWasm0(ret[0], ret[1]);
2079
+ } finally {
2080
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2081
+ }
2082
+ }
2083
+ /**
2084
+ * @returns {string}
2085
+ */
2086
+ get_local_brep_serialized() {
2087
+ let deferred1_0;
2088
+ let deferred1_1;
2089
+ try {
2090
+ const ret = wasm.ogellipticalarc_get_local_brep_serialized(this.__wbg_ptr);
2091
+ deferred1_0 = ret[0];
2092
+ deferred1_1 = ret[1];
2093
+ return getStringFromWasm0(ret[0], ret[1]);
2094
+ } finally {
2095
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2096
+ }
2097
+ }
2098
+ /**
2099
+ * @returns {string}
2100
+ */
2101
+ get_geometry_serialized() {
2102
+ let deferred1_0;
2103
+ let deferred1_1;
2104
+ try {
2105
+ const ret = wasm.ogellipticalarc_get_geometry_serialized(this.__wbg_ptr);
2106
+ deferred1_0 = ret[0];
2107
+ deferred1_1 = ret[1];
2108
+ return getStringFromWasm0(ret[0], ret[1]);
2109
+ } finally {
2110
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2111
+ }
2112
+ }
2113
+ /**
2114
+ * @returns {string}
2115
+ */
2116
+ get_local_geometry_serialized() {
2117
+ let deferred1_0;
2118
+ let deferred1_1;
2119
+ try {
2120
+ const ret = wasm.ogellipticalarc_get_local_geometry_serialized(this.__wbg_ptr);
2121
+ deferred1_0 = ret[0];
2122
+ deferred1_1 = ret[1];
2123
+ return getStringFromWasm0(ret[0], ret[1]);
2124
+ } finally {
2125
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2126
+ }
2127
+ }
2128
+ /**
2129
+ * @returns {Float64Array}
2130
+ */
2131
+ get_geometry_buffer() {
2132
+ const ret = wasm.ogellipticalarc_get_geometry_buffer(this.__wbg_ptr);
2133
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2134
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2135
+ return v1;
2136
+ }
2137
+ /**
2138
+ * @returns {Float64Array}
2139
+ */
2140
+ get_local_geometry_buffer() {
2141
+ const ret = wasm.ogellipticalarc_get_local_geometry_buffer(this.__wbg_ptr);
2142
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2143
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2144
+ return v1;
2145
+ }
2146
+ /**
2147
+ * @returns {Vector3}
2148
+ */
2149
+ get_anchor() {
2150
+ const ret = wasm.ogellipticalarc_get_anchor(this.__wbg_ptr);
2151
+ return Vector3.__wrap(ret);
2152
+ }
2153
+ }
2154
+
1785
2155
  const OGEntityRegistryFinalization = (typeof FinalizationRegistry === 'undefined')
1786
2156
  ? { register: () => {}, unregister: () => {} }
1787
2157
  : new FinalizationRegistry(ptr => wasm.__wbg_ogentityregistry_free(ptr >>> 0, 1));
@@ -3544,7 +3914,7 @@ export class OGPolyline {
3544
3914
  * @returns {Vector3}
3545
3915
  */
3546
3916
  get_anchor() {
3547
- const ret = wasm.ogpolyline_get_anchor(this.__wbg_ptr);
3917
+ const ret = wasm.ogline_get_anchor(this.__wbg_ptr);
3548
3918
  return Vector3.__wrap(ret);
3549
3919
  }
3550
3920
  /**
@@ -4873,7 +5243,7 @@ export class OGSphere {
4873
5243
  * @returns {Vector3}
4874
5244
  */
4875
5245
  get_anchor() {
4876
- const ret = wasm.ogsphere_get_anchor(this.__wbg_ptr);
5246
+ const ret = wasm.ogline_get_anchor(this.__wbg_ptr);
4877
5247
  return Vector3.__wrap(ret);
4878
5248
  }
4879
5249
  }
@@ -5266,7 +5636,7 @@ export class OGSweep {
5266
5636
  * @returns {Vector3}
5267
5637
  */
5268
5638
  get_anchor() {
5269
- const ret = wasm.ogsweep_get_anchor(this.__wbg_ptr);
5639
+ const ret = wasm.ogellipticalarc_get_anchor(this.__wbg_ptr);
5270
5640
  return Vector3.__wrap(ret);
5271
5641
  }
5272
5642
  /**
@@ -5550,7 +5920,7 @@ export class OGWedge {
5550
5920
  * @returns {Vector3}
5551
5921
  */
5552
5922
  get_anchor() {
5553
- const ret = wasm.ogarc_get_anchor(this.__wbg_ptr);
5923
+ const ret = wasm.ogwedge_get_anchor(this.__wbg_ptr);
5554
5924
  return Vector3.__wrap(ret);
5555
5925
  }
5556
5926
  }
@@ -5849,6 +6219,104 @@ export class Vector3 {
5849
6219
  }
5850
6220
  }
5851
6221
 
6222
+ const WorkPlaneFinalization = (typeof FinalizationRegistry === 'undefined')
6223
+ ? { register: () => {}, unregister: () => {} }
6224
+ : new FinalizationRegistry(ptr => wasm.__wbg_workplane_free(ptr >>> 0, 1));
6225
+
6226
+ export class WorkPlane {
6227
+
6228
+ static __wrap(ptr) {
6229
+ ptr = ptr >>> 0;
6230
+ const obj = Object.create(WorkPlane.prototype);
6231
+ obj.__wbg_ptr = ptr;
6232
+ WorkPlaneFinalization.register(obj, obj.__wbg_ptr, obj);
6233
+ return obj;
6234
+ }
6235
+
6236
+ __destroy_into_raw() {
6237
+ const ptr = this.__wbg_ptr;
6238
+ this.__wbg_ptr = 0;
6239
+ WorkPlaneFinalization.unregister(this);
6240
+ return ptr;
6241
+ }
6242
+
6243
+ free() {
6244
+ const ptr = this.__destroy_into_raw();
6245
+ wasm.__wbg_workplane_free(ptr, 0);
6246
+ }
6247
+ /**
6248
+ * Builds a work plane from an origin and normal, choosing a stable in-plane
6249
+ * `u` axis automatically (`v = normal × u`).
6250
+ * @param {Vector3} origin
6251
+ * @param {Vector3} normal
6252
+ * @returns {WorkPlane}
6253
+ */
6254
+ static fromOriginNormal(origin, normal) {
6255
+ _assertClass(origin, Vector3);
6256
+ var ptr0 = origin.__destroy_into_raw();
6257
+ _assertClass(normal, Vector3);
6258
+ var ptr1 = normal.__destroy_into_raw();
6259
+ const ret = wasm.workplane_fromOriginNormal(ptr0, ptr1);
6260
+ return WorkPlane.__wrap(ret);
6261
+ }
6262
+ /**
6263
+ * Builds a work plane from an origin, normal, and a preferred `u` axis. The
6264
+ * `u` axis is projected onto the plane and orthonormalized; `v = normal × u`.
6265
+ * @param {Vector3} origin
6266
+ * @param {Vector3} normal
6267
+ * @param {Vector3} u_hint
6268
+ */
6269
+ constructor(origin, normal, u_hint) {
6270
+ _assertClass(origin, Vector3);
6271
+ var ptr0 = origin.__destroy_into_raw();
6272
+ _assertClass(normal, Vector3);
6273
+ var ptr1 = normal.__destroy_into_raw();
6274
+ _assertClass(u_hint, Vector3);
6275
+ var ptr2 = u_hint.__destroy_into_raw();
6276
+ const ret = wasm.workplane_new(ptr0, ptr1, ptr2);
6277
+ this.__wbg_ptr = ret >>> 0;
6278
+ WorkPlaneFinalization.register(this, this.__wbg_ptr, this);
6279
+ return this;
6280
+ }
6281
+ /**
6282
+ * Lifts a single 2D in-plane coordinate to 3D world space.
6283
+ * @param {number} u
6284
+ * @param {number} v
6285
+ * @returns {Vector3}
6286
+ */
6287
+ liftPoint(u, v) {
6288
+ const ret = wasm.workplane_liftPoint(this.__wbg_ptr, u, v);
6289
+ return Vector3.__wrap(ret);
6290
+ }
6291
+ /**
6292
+ * Lifts a flat `[u0,v0,u1,v1,…]` buffer to a flat `[x0,y0,z0,…]` world buffer.
6293
+ * @param {Float64Array} uv
6294
+ * @returns {Float64Array}
6295
+ */
6296
+ liftPoints(uv) {
6297
+ const ptr0 = passArrayF64ToWasm0(uv, wasm.__wbindgen_malloc);
6298
+ const len0 = WASM_VECTOR_LEN;
6299
+ const ret = wasm.workplane_liftPoints(this.__wbg_ptr, ptr0, len0);
6300
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
6301
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
6302
+ return v2;
6303
+ }
6304
+ /**
6305
+ * @returns {Vector3}
6306
+ */
6307
+ get origin() {
6308
+ const ret = wasm.workplane_origin(this.__wbg_ptr);
6309
+ return Vector3.__wrap(ret);
6310
+ }
6311
+ /**
6312
+ * @returns {Vector3}
6313
+ */
6314
+ get normal() {
6315
+ const ret = wasm.workplane_normal(this.__wbg_ptr);
6316
+ return Vector3.__wrap(ret);
6317
+ }
6318
+ }
6319
+
5852
6320
  async function __wbg_load(module, imports) {
5853
6321
  if (typeof Response === 'function' && module instanceof Response) {
5854
6322
  if (typeof WebAssembly.instantiateStreaming === 'function') {