opengeometry 0.0.3 → 0.0.5
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.d.ts +53 -29
- package/index.js +2084 -1505
- package/index.js.map +1 -1
- package/opengeometry_bg.wasm +0 -0
- package/opengeometry_bg.wasm.d.ts +219 -211
- package/package.json +9 -3
- package/src/base-types.d.ts +7 -6
- package/src/pencil.d.ts +15 -3
- package/src/primitives/arc.d.ts +22 -0
- package/src/primitives/base-line-primitive.d.ts +14 -0
- package/src/primitives/index.d.ts +3 -3
- package/src/primitives/line.d.ts +20 -0
- package/src/primitives/polyline.d.ts +26 -0
- package/src/primitives/rectangle.d.ts +9 -14
- package/src/shapes/cube.d.ts +22 -0
- package/src/shapes/cylinder.d.ts +3 -4
- package/src/shapes/cylinderOld.d.ts +23 -0
- package/src/shapes/index.d.ts +3 -1
- package/src/shapes/polygon.d.ts +20 -14
- package/src/primitives/circle.d.ts +0 -15
- package/src/primitives/poly-line.d.ts +0 -17
- package/src/primitives/simple-line.d.ts +0 -13
package/index.js
CHANGED
|
@@ -44,6 +44,30 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
let wasm;
|
|
47
|
+
let cachedUint8ArrayMemory0 = null;
|
|
48
|
+
function getUint8ArrayMemory0() {
|
|
49
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
50
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
51
|
+
}
|
|
52
|
+
return cachedUint8ArrayMemory0;
|
|
53
|
+
}
|
|
54
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
55
|
+
ptr = ptr >>> 0;
|
|
56
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
57
|
+
}
|
|
58
|
+
function addToExternrefTable0(obj) {
|
|
59
|
+
const idx = wasm.__externref_table_alloc();
|
|
60
|
+
wasm.__wbindgen_export_2.set(idx, obj);
|
|
61
|
+
return idx;
|
|
62
|
+
}
|
|
63
|
+
function handleError(f, args) {
|
|
64
|
+
try {
|
|
65
|
+
return f.apply(this, args);
|
|
66
|
+
} catch (e) {
|
|
67
|
+
const idx = addToExternrefTable0(e);
|
|
68
|
+
wasm.__wbindgen_exn_store(idx);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
47
71
|
const cachedTextDecoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', {
|
|
48
72
|
ignoreBOM: true,
|
|
49
73
|
fatal: true
|
|
@@ -55,32 +79,14 @@ const cachedTextDecoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('
|
|
|
55
79
|
if (typeof TextDecoder !== 'undefined') {
|
|
56
80
|
cachedTextDecoder.decode();
|
|
57
81
|
}
|
|
58
|
-
let cachedUint8ArrayMemory0 = null;
|
|
59
|
-
function getUint8ArrayMemory0() {
|
|
60
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
61
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
62
|
-
}
|
|
63
|
-
return cachedUint8ArrayMemory0;
|
|
64
|
-
}
|
|
65
82
|
function getStringFromWasm0(ptr, len) {
|
|
66
83
|
ptr = ptr >>> 0;
|
|
67
84
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
68
85
|
}
|
|
69
|
-
const heap = new Array(128).fill(undefined);
|
|
70
|
-
heap.push(undefined, null, true, false);
|
|
71
|
-
let heap_next = heap.length;
|
|
72
|
-
function addHeapObject(obj) {
|
|
73
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
74
|
-
const idx = heap_next;
|
|
75
|
-
heap_next = heap[idx];
|
|
76
|
-
heap[idx] = obj;
|
|
77
|
-
return idx;
|
|
78
|
-
}
|
|
79
86
|
function _assertClass(instance, klass) {
|
|
80
87
|
if (!(instance instanceof klass)) {
|
|
81
88
|
throw new Error(`expected instance of ${klass.name}`);
|
|
82
89
|
}
|
|
83
|
-
return instance.ptr;
|
|
84
90
|
}
|
|
85
91
|
let WASM_VECTOR_LEN = 0;
|
|
86
92
|
const cachedTextEncoder = typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : {
|
|
@@ -137,41 +143,44 @@ function getDataViewMemory0() {
|
|
|
137
143
|
}
|
|
138
144
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
139
145
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
140
|
-
const mem = getDataViewMemory0();
|
|
141
146
|
for (let i = 0; i < array.length; i++) {
|
|
142
|
-
|
|
147
|
+
const add = addToExternrefTable0(array[i]);
|
|
148
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
143
149
|
}
|
|
144
150
|
WASM_VECTOR_LEN = array.length;
|
|
145
151
|
return ptr;
|
|
146
152
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
heap_next = idx;
|
|
153
|
+
let cachedFloat64ArrayMemory0 = null;
|
|
154
|
+
function getFloat64ArrayMemory0() {
|
|
155
|
+
if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
|
|
156
|
+
cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
|
|
157
|
+
}
|
|
158
|
+
return cachedFloat64ArrayMemory0;
|
|
154
159
|
}
|
|
155
|
-
function
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
160
|
+
function passArrayF64ToWasm0(arg, malloc) {
|
|
161
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
162
|
+
getFloat64ArrayMemory0().set(arg, ptr / 8);
|
|
163
|
+
WASM_VECTOR_LEN = arg.length;
|
|
164
|
+
return ptr;
|
|
159
165
|
}
|
|
160
166
|
function getArrayJsValueFromWasm0(ptr, len) {
|
|
161
167
|
ptr = ptr >>> 0;
|
|
162
168
|
const mem = getDataViewMemory0();
|
|
163
169
|
const result = [];
|
|
164
170
|
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
165
|
-
result.push(
|
|
171
|
+
result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
|
|
166
172
|
}
|
|
173
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
167
174
|
return result;
|
|
168
175
|
}
|
|
176
|
+
function getArrayF64FromWasm0(ptr, len) {
|
|
177
|
+
ptr = ptr >>> 0;
|
|
178
|
+
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
179
|
+
}
|
|
169
180
|
const BaseFlatMeshFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
170
181
|
register: () => {},
|
|
171
182
|
unregister: () => {}
|
|
172
183
|
} : new FinalizationRegistry(ptr => wasm.__wbg_baseflatmesh_free(ptr >>> 0, 1));
|
|
173
|
-
/**
|
|
174
|
-
*/
|
|
175
184
|
class BaseFlatMesh {
|
|
176
185
|
__destroy_into_raw() {
|
|
177
186
|
const ptr = this.__wbg_ptr;
|
|
@@ -184,106 +193,102 @@ class BaseFlatMesh {
|
|
|
184
193
|
wasm.__wbg_baseflatmesh_free(ptr, 0);
|
|
185
194
|
}
|
|
186
195
|
/**
|
|
187
|
-
|
|
188
|
-
|
|
196
|
+
* @returns {boolean}
|
|
197
|
+
*/
|
|
189
198
|
get extruded() {
|
|
190
199
|
const ret = wasm.__wbg_get_baseflatmesh_extruded(this.__wbg_ptr);
|
|
191
200
|
return ret !== 0;
|
|
192
201
|
}
|
|
193
202
|
/**
|
|
194
|
-
|
|
195
|
-
|
|
203
|
+
* @param {boolean} arg0
|
|
204
|
+
*/
|
|
196
205
|
set extruded(arg0) {
|
|
197
206
|
wasm.__wbg_set_baseflatmesh_extruded(this.__wbg_ptr, arg0);
|
|
198
207
|
}
|
|
199
208
|
/**
|
|
200
|
-
|
|
201
|
-
|
|
209
|
+
* @returns {boolean}
|
|
210
|
+
*/
|
|
202
211
|
get is_mesh() {
|
|
203
212
|
const ret = wasm.__wbg_get_baseflatmesh_is_mesh(this.__wbg_ptr);
|
|
204
213
|
return ret !== 0;
|
|
205
214
|
}
|
|
206
215
|
/**
|
|
207
|
-
|
|
208
|
-
|
|
216
|
+
* @param {boolean} arg0
|
|
217
|
+
*/
|
|
209
218
|
set is_mesh(arg0) {
|
|
210
219
|
wasm.__wbg_set_baseflatmesh_is_mesh(this.__wbg_ptr, arg0);
|
|
211
220
|
}
|
|
212
221
|
/**
|
|
213
|
-
|
|
214
|
-
|
|
222
|
+
* @returns {Vector3}
|
|
223
|
+
*/
|
|
215
224
|
get position() {
|
|
216
225
|
const ret = wasm.__wbg_get_baseflatmesh_position(this.__wbg_ptr);
|
|
217
|
-
return
|
|
226
|
+
return Vector3$1.__wrap(ret);
|
|
218
227
|
}
|
|
219
228
|
/**
|
|
220
|
-
|
|
221
|
-
|
|
229
|
+
* @param {Vector3} arg0
|
|
230
|
+
*/
|
|
222
231
|
set position(arg0) {
|
|
223
|
-
_assertClass(arg0,
|
|
232
|
+
_assertClass(arg0, Vector3$1);
|
|
224
233
|
var ptr0 = arg0.__destroy_into_raw();
|
|
225
234
|
wasm.__wbg_set_baseflatmesh_position(this.__wbg_ptr, ptr0);
|
|
226
235
|
}
|
|
227
236
|
/**
|
|
228
|
-
|
|
229
|
-
|
|
237
|
+
* @returns {Vector3}
|
|
238
|
+
*/
|
|
230
239
|
get rotation() {
|
|
231
240
|
const ret = wasm.__wbg_get_baseflatmesh_rotation(this.__wbg_ptr);
|
|
232
|
-
return
|
|
241
|
+
return Vector3$1.__wrap(ret);
|
|
233
242
|
}
|
|
234
243
|
/**
|
|
235
|
-
|
|
236
|
-
|
|
244
|
+
* @param {Vector3} arg0
|
|
245
|
+
*/
|
|
237
246
|
set rotation(arg0) {
|
|
238
|
-
_assertClass(arg0,
|
|
247
|
+
_assertClass(arg0, Vector3$1);
|
|
239
248
|
var ptr0 = arg0.__destroy_into_raw();
|
|
240
249
|
wasm.__wbg_set_baseflatmesh_rotation(this.__wbg_ptr, ptr0);
|
|
241
250
|
}
|
|
242
251
|
/**
|
|
243
|
-
|
|
244
|
-
|
|
252
|
+
* @returns {Vector3}
|
|
253
|
+
*/
|
|
245
254
|
get scale() {
|
|
246
255
|
const ret = wasm.__wbg_get_baseflatmesh_scale(this.__wbg_ptr);
|
|
247
|
-
return
|
|
256
|
+
return Vector3$1.__wrap(ret);
|
|
248
257
|
}
|
|
249
258
|
/**
|
|
250
|
-
|
|
251
|
-
|
|
259
|
+
* @param {Vector3} arg0
|
|
260
|
+
*/
|
|
252
261
|
set scale(arg0) {
|
|
253
|
-
_assertClass(arg0,
|
|
262
|
+
_assertClass(arg0, Vector3$1);
|
|
254
263
|
var ptr0 = arg0.__destroy_into_raw();
|
|
255
264
|
wasm.__wbg_set_baseflatmesh_scale(this.__wbg_ptr, ptr0);
|
|
256
265
|
}
|
|
257
266
|
/**
|
|
258
|
-
|
|
259
|
-
|
|
267
|
+
* @param {string} id
|
|
268
|
+
*/
|
|
260
269
|
set id(id) {
|
|
261
270
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
262
271
|
const len0 = WASM_VECTOR_LEN;
|
|
263
272
|
wasm.baseflatmesh_set_id(this.__wbg_ptr, ptr0, len0);
|
|
264
273
|
}
|
|
265
274
|
/**
|
|
266
|
-
|
|
267
|
-
|
|
275
|
+
* @returns {string}
|
|
276
|
+
*/
|
|
268
277
|
get id() {
|
|
269
278
|
let deferred1_0;
|
|
270
279
|
let deferred1_1;
|
|
271
280
|
try {
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
deferred1_0 = r0;
|
|
277
|
-
deferred1_1 = r1;
|
|
278
|
-
return getStringFromWasm0(r0, r1);
|
|
281
|
+
const ret = wasm.baseflatmesh_id(this.__wbg_ptr);
|
|
282
|
+
deferred1_0 = ret[0];
|
|
283
|
+
deferred1_1 = ret[1];
|
|
284
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
279
285
|
} finally {
|
|
280
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
281
286
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
282
287
|
}
|
|
283
288
|
}
|
|
284
289
|
/**
|
|
285
|
-
|
|
286
|
-
|
|
290
|
+
* @param {string} id
|
|
291
|
+
*/
|
|
287
292
|
constructor(id) {
|
|
288
293
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
289
294
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -293,61 +298,51 @@ class BaseFlatMesh {
|
|
|
293
298
|
return this;
|
|
294
299
|
}
|
|
295
300
|
/**
|
|
296
|
-
|
|
297
|
-
|
|
301
|
+
* @param {Vector3[]} vertices
|
|
302
|
+
*/
|
|
298
303
|
add_vertices(vertices) {
|
|
299
304
|
const ptr0 = passArrayJsValueToWasm0(vertices, wasm.__wbindgen_malloc);
|
|
300
305
|
const len0 = WASM_VECTOR_LEN;
|
|
301
306
|
wasm.baseflatmesh_add_vertices(this.__wbg_ptr, ptr0, len0);
|
|
302
307
|
}
|
|
303
308
|
/**
|
|
304
|
-
|
|
305
|
-
|
|
309
|
+
* @param {Vector3} vertex
|
|
310
|
+
*/
|
|
306
311
|
add_vertex(vertex) {
|
|
307
|
-
_assertClass(vertex,
|
|
312
|
+
_assertClass(vertex, Vector3$1);
|
|
308
313
|
var ptr0 = vertex.__destroy_into_raw();
|
|
309
314
|
wasm.baseflatmesh_add_vertex(this.__wbg_ptr, ptr0);
|
|
310
315
|
}
|
|
311
316
|
/**
|
|
312
|
-
|
|
313
|
-
|
|
317
|
+
* @returns {string}
|
|
318
|
+
*/
|
|
314
319
|
triangulate() {
|
|
315
320
|
let deferred1_0;
|
|
316
321
|
let deferred1_1;
|
|
317
322
|
try {
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
deferred1_0 = r0;
|
|
323
|
-
deferred1_1 = r1;
|
|
324
|
-
return getStringFromWasm0(r0, r1);
|
|
323
|
+
const ret = wasm.baseflatmesh_triangulate(this.__wbg_ptr);
|
|
324
|
+
deferred1_0 = ret[0];
|
|
325
|
+
deferred1_1 = ret[1];
|
|
326
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
325
327
|
} finally {
|
|
326
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
327
328
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
328
329
|
}
|
|
329
330
|
}
|
|
330
331
|
/**
|
|
331
|
-
|
|
332
|
-
|
|
332
|
+
* @returns {string}
|
|
333
|
+
*/
|
|
333
334
|
get_buffer_flush() {
|
|
334
335
|
let deferred1_0;
|
|
335
336
|
let deferred1_1;
|
|
336
337
|
try {
|
|
337
|
-
const
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
deferred1_0 = r0;
|
|
342
|
-
deferred1_1 = r1;
|
|
343
|
-
return getStringFromWasm0(r0, r1);
|
|
338
|
+
const ret = wasm.baseflatmesh_get_buffer_flush(this.__wbg_ptr);
|
|
339
|
+
deferred1_0 = ret[0];
|
|
340
|
+
deferred1_1 = ret[1];
|
|
341
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
344
342
|
} finally {
|
|
345
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
346
343
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
347
344
|
}
|
|
348
345
|
}
|
|
349
|
-
/**
|
|
350
|
-
*/
|
|
351
346
|
reset_mesh() {
|
|
352
347
|
wasm.baseflatmesh_reset_mesh(this.__wbg_ptr);
|
|
353
348
|
}
|
|
@@ -358,16 +353,7 @@ const BasePolygonFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
|
358
353
|
register: () => {},
|
|
359
354
|
unregister: () => {}
|
|
360
355
|
} : new FinalizationRegistry(ptr => wasm.__wbg_basepolygon_free(ptr >>> 0, 1));
|
|
361
|
-
/**
|
|
362
|
-
*/
|
|
363
356
|
class BasePolygon {
|
|
364
|
-
static __wrap(ptr) {
|
|
365
|
-
ptr = ptr >>> 0;
|
|
366
|
-
const obj = Object.create(BasePolygon.prototype);
|
|
367
|
-
obj.__wbg_ptr = ptr;
|
|
368
|
-
BasePolygonFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
369
|
-
return obj;
|
|
370
|
-
}
|
|
371
357
|
__destroy_into_raw() {
|
|
372
358
|
const ptr = this.__wbg_ptr;
|
|
373
359
|
this.__wbg_ptr = 0;
|
|
@@ -379,119 +365,115 @@ class BasePolygon {
|
|
|
379
365
|
wasm.__wbg_basepolygon_free(ptr, 0);
|
|
380
366
|
}
|
|
381
367
|
/**
|
|
382
|
-
|
|
383
|
-
|
|
368
|
+
* @returns {boolean}
|
|
369
|
+
*/
|
|
384
370
|
get extruded() {
|
|
385
371
|
const ret = wasm.__wbg_get_basepolygon_extruded(this.__wbg_ptr);
|
|
386
372
|
return ret !== 0;
|
|
387
373
|
}
|
|
388
374
|
/**
|
|
389
|
-
|
|
390
|
-
|
|
375
|
+
* @param {boolean} arg0
|
|
376
|
+
*/
|
|
391
377
|
set extruded(arg0) {
|
|
392
378
|
wasm.__wbg_set_basepolygon_extruded(this.__wbg_ptr, arg0);
|
|
393
379
|
}
|
|
394
380
|
/**
|
|
395
|
-
|
|
396
|
-
|
|
381
|
+
* @returns {number}
|
|
382
|
+
*/
|
|
397
383
|
get extruded_height() {
|
|
398
384
|
const ret = wasm.__wbg_get_basepolygon_extruded_height(this.__wbg_ptr);
|
|
399
385
|
return ret;
|
|
400
386
|
}
|
|
401
387
|
/**
|
|
402
|
-
|
|
403
|
-
|
|
388
|
+
* @param {number} arg0
|
|
389
|
+
*/
|
|
404
390
|
set extruded_height(arg0) {
|
|
405
391
|
wasm.__wbg_set_basepolygon_extruded_height(this.__wbg_ptr, arg0);
|
|
406
392
|
}
|
|
407
393
|
/**
|
|
408
|
-
|
|
409
|
-
|
|
394
|
+
* @returns {boolean}
|
|
395
|
+
*/
|
|
410
396
|
get is_polygon() {
|
|
411
397
|
const ret = wasm.__wbg_get_basepolygon_is_polygon(this.__wbg_ptr);
|
|
412
398
|
return ret !== 0;
|
|
413
399
|
}
|
|
414
400
|
/**
|
|
415
|
-
|
|
416
|
-
|
|
401
|
+
* @param {boolean} arg0
|
|
402
|
+
*/
|
|
417
403
|
set is_polygon(arg0) {
|
|
418
404
|
wasm.__wbg_set_basepolygon_is_polygon(this.__wbg_ptr, arg0);
|
|
419
405
|
}
|
|
420
406
|
/**
|
|
421
|
-
|
|
422
|
-
|
|
407
|
+
* @returns {Vector3}
|
|
408
|
+
*/
|
|
423
409
|
get position() {
|
|
424
410
|
const ret = wasm.__wbg_get_basepolygon_position(this.__wbg_ptr);
|
|
425
|
-
return
|
|
411
|
+
return Vector3$1.__wrap(ret);
|
|
426
412
|
}
|
|
427
413
|
/**
|
|
428
|
-
|
|
429
|
-
|
|
414
|
+
* @param {Vector3} arg0
|
|
415
|
+
*/
|
|
430
416
|
set position(arg0) {
|
|
431
|
-
_assertClass(arg0,
|
|
417
|
+
_assertClass(arg0, Vector3$1);
|
|
432
418
|
var ptr0 = arg0.__destroy_into_raw();
|
|
433
419
|
wasm.__wbg_set_basepolygon_position(this.__wbg_ptr, ptr0);
|
|
434
420
|
}
|
|
435
421
|
/**
|
|
436
|
-
|
|
437
|
-
|
|
422
|
+
* @returns {Vector3}
|
|
423
|
+
*/
|
|
438
424
|
get rotation() {
|
|
439
425
|
const ret = wasm.__wbg_get_basepolygon_rotation(this.__wbg_ptr);
|
|
440
|
-
return
|
|
426
|
+
return Vector3$1.__wrap(ret);
|
|
441
427
|
}
|
|
442
428
|
/**
|
|
443
|
-
|
|
444
|
-
|
|
429
|
+
* @param {Vector3} arg0
|
|
430
|
+
*/
|
|
445
431
|
set rotation(arg0) {
|
|
446
|
-
_assertClass(arg0,
|
|
432
|
+
_assertClass(arg0, Vector3$1);
|
|
447
433
|
var ptr0 = arg0.__destroy_into_raw();
|
|
448
434
|
wasm.__wbg_set_basepolygon_rotation(this.__wbg_ptr, ptr0);
|
|
449
435
|
}
|
|
450
436
|
/**
|
|
451
|
-
|
|
452
|
-
|
|
437
|
+
* @returns {Vector3}
|
|
438
|
+
*/
|
|
453
439
|
get scale() {
|
|
454
440
|
const ret = wasm.__wbg_get_basepolygon_scale(this.__wbg_ptr);
|
|
455
|
-
return
|
|
441
|
+
return Vector3$1.__wrap(ret);
|
|
456
442
|
}
|
|
457
443
|
/**
|
|
458
|
-
|
|
459
|
-
|
|
444
|
+
* @param {Vector3} arg0
|
|
445
|
+
*/
|
|
460
446
|
set scale(arg0) {
|
|
461
|
-
_assertClass(arg0,
|
|
447
|
+
_assertClass(arg0, Vector3$1);
|
|
462
448
|
var ptr0 = arg0.__destroy_into_raw();
|
|
463
449
|
wasm.__wbg_set_basepolygon_scale(this.__wbg_ptr, ptr0);
|
|
464
450
|
}
|
|
465
451
|
/**
|
|
466
|
-
|
|
467
|
-
|
|
452
|
+
* @param {string} id
|
|
453
|
+
*/
|
|
468
454
|
set id(id) {
|
|
469
455
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
470
456
|
const len0 = WASM_VECTOR_LEN;
|
|
471
457
|
wasm.basepolygon_set_id(this.__wbg_ptr, ptr0, len0);
|
|
472
458
|
}
|
|
473
459
|
/**
|
|
474
|
-
|
|
475
|
-
|
|
460
|
+
* @returns {string}
|
|
461
|
+
*/
|
|
476
462
|
get id() {
|
|
477
463
|
let deferred1_0;
|
|
478
464
|
let deferred1_1;
|
|
479
465
|
try {
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
deferred1_0 = r0;
|
|
485
|
-
deferred1_1 = r1;
|
|
486
|
-
return getStringFromWasm0(r0, r1);
|
|
466
|
+
const ret = wasm.basepolygon_id(this.__wbg_ptr);
|
|
467
|
+
deferred1_0 = ret[0];
|
|
468
|
+
deferred1_1 = ret[1];
|
|
469
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
487
470
|
} finally {
|
|
488
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
489
471
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
490
472
|
}
|
|
491
473
|
}
|
|
492
474
|
/**
|
|
493
|
-
|
|
494
|
-
|
|
475
|
+
* @param {string} id
|
|
476
|
+
*/
|
|
495
477
|
constructor(id) {
|
|
496
478
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
497
479
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -501,1291 +483,1285 @@ class BasePolygon {
|
|
|
501
483
|
return this;
|
|
502
484
|
}
|
|
503
485
|
/**
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
*/
|
|
507
|
-
static new_with_circle(circle_arc) {
|
|
508
|
-
_assertClass(circle_arc, CircleArc);
|
|
509
|
-
var ptr0 = circle_arc.__destroy_into_raw();
|
|
510
|
-
const ret = wasm.basepolygon_new_with_circle(ptr0);
|
|
511
|
-
return BasePolygon.__wrap(ret);
|
|
512
|
-
}
|
|
513
|
-
/**
|
|
514
|
-
* @param {OGRectangle} rectangle
|
|
515
|
-
* @returns {BasePolygon}
|
|
516
|
-
*/
|
|
517
|
-
static new_with_rectangle(rectangle) {
|
|
518
|
-
_assertClass(rectangle, OGRectangle);
|
|
519
|
-
var ptr0 = rectangle.__destroy_into_raw();
|
|
520
|
-
const ret = wasm.basepolygon_new_with_rectangle(ptr0);
|
|
521
|
-
return BasePolygon.__wrap(ret);
|
|
522
|
-
}
|
|
523
|
-
/**
|
|
524
|
-
* @param {(Vector3D)[]} vertices
|
|
525
|
-
*/
|
|
486
|
+
* @param {Vector3[]} vertices
|
|
487
|
+
*/
|
|
526
488
|
add_vertices(vertices) {
|
|
527
489
|
const ptr0 = passArrayJsValueToWasm0(vertices, wasm.__wbindgen_malloc);
|
|
528
490
|
const len0 = WASM_VECTOR_LEN;
|
|
529
491
|
wasm.basepolygon_add_vertices(this.__wbg_ptr, ptr0, len0);
|
|
530
492
|
}
|
|
531
493
|
/**
|
|
532
|
-
|
|
533
|
-
|
|
494
|
+
* @param {Vector3} vertex
|
|
495
|
+
*/
|
|
534
496
|
add_vertex(vertex) {
|
|
535
|
-
_assertClass(vertex,
|
|
497
|
+
_assertClass(vertex, Vector3$1);
|
|
536
498
|
var ptr0 = vertex.__destroy_into_raw();
|
|
537
499
|
wasm.basepolygon_add_vertex(this.__wbg_ptr, ptr0);
|
|
538
500
|
}
|
|
539
501
|
/**
|
|
540
|
-
|
|
541
|
-
|
|
502
|
+
* @param {Vector3[]} holes
|
|
503
|
+
*/
|
|
542
504
|
add_holes(holes) {
|
|
543
505
|
const ptr0 = passArrayJsValueToWasm0(holes, wasm.__wbindgen_malloc);
|
|
544
506
|
const len0 = WASM_VECTOR_LEN;
|
|
545
507
|
wasm.basepolygon_add_holes(this.__wbg_ptr, ptr0, len0);
|
|
546
508
|
}
|
|
547
509
|
/**
|
|
548
|
-
|
|
549
|
-
|
|
510
|
+
* @returns {string}
|
|
511
|
+
*/
|
|
550
512
|
triangulate() {
|
|
551
513
|
let deferred1_0;
|
|
552
514
|
let deferred1_1;
|
|
553
515
|
try {
|
|
554
|
-
const
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
deferred1_0 = r0;
|
|
559
|
-
deferred1_1 = r1;
|
|
560
|
-
return getStringFromWasm0(r0, r1);
|
|
516
|
+
const ret = wasm.basepolygon_triangulate(this.__wbg_ptr);
|
|
517
|
+
deferred1_0 = ret[0];
|
|
518
|
+
deferred1_1 = ret[1];
|
|
519
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
561
520
|
} finally {
|
|
562
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
563
521
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
564
522
|
}
|
|
565
523
|
}
|
|
566
524
|
/**
|
|
567
|
-
|
|
568
|
-
|
|
525
|
+
* @returns {string}
|
|
526
|
+
*/
|
|
569
527
|
new_triangulate() {
|
|
570
528
|
let deferred1_0;
|
|
571
529
|
let deferred1_1;
|
|
572
530
|
try {
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
deferred1_0 = r0;
|
|
578
|
-
deferred1_1 = r1;
|
|
579
|
-
return getStringFromWasm0(r0, r1);
|
|
531
|
+
const ret = wasm.basepolygon_new_triangulate(this.__wbg_ptr);
|
|
532
|
+
deferred1_0 = ret[0];
|
|
533
|
+
deferred1_1 = ret[1];
|
|
534
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
580
535
|
} finally {
|
|
581
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
582
536
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
583
537
|
}
|
|
584
538
|
}
|
|
585
539
|
/**
|
|
586
|
-
|
|
587
|
-
|
|
540
|
+
* @returns {string}
|
|
541
|
+
*/
|
|
588
542
|
get_buffer_flush() {
|
|
589
543
|
let deferred1_0;
|
|
590
544
|
let deferred1_1;
|
|
591
545
|
try {
|
|
592
|
-
const
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
deferred1_0 = r0;
|
|
597
|
-
deferred1_1 = r1;
|
|
598
|
-
return getStringFromWasm0(r0, r1);
|
|
546
|
+
const ret = wasm.basepolygon_get_buffer_flush(this.__wbg_ptr);
|
|
547
|
+
deferred1_0 = ret[0];
|
|
548
|
+
deferred1_1 = ret[1];
|
|
549
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
599
550
|
} finally {
|
|
600
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
601
551
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
602
552
|
}
|
|
603
553
|
}
|
|
604
|
-
/**
|
|
605
|
-
*/
|
|
606
554
|
clear_vertices() {
|
|
607
555
|
wasm.basepolygon_clear_vertices(this.__wbg_ptr);
|
|
608
556
|
}
|
|
609
|
-
/**
|
|
610
|
-
*/
|
|
611
557
|
reset_polygon() {
|
|
612
558
|
wasm.basepolygon_reset_polygon(this.__wbg_ptr);
|
|
613
559
|
}
|
|
614
560
|
/**
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
561
|
+
* @param {number} height
|
|
562
|
+
* @returns {string}
|
|
563
|
+
*/
|
|
618
564
|
extrude_by_height(height) {
|
|
619
565
|
let deferred1_0;
|
|
620
566
|
let deferred1_1;
|
|
621
567
|
try {
|
|
622
|
-
const
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
deferred1_0 = r0;
|
|
627
|
-
deferred1_1 = r1;
|
|
628
|
-
return getStringFromWasm0(r0, r1);
|
|
568
|
+
const ret = wasm.basepolygon_extrude_by_height(this.__wbg_ptr, height);
|
|
569
|
+
deferred1_0 = ret[0];
|
|
570
|
+
deferred1_1 = ret[1];
|
|
571
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
629
572
|
} finally {
|
|
630
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
631
573
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
632
574
|
}
|
|
633
575
|
}
|
|
634
576
|
/**
|
|
635
|
-
|
|
636
|
-
|
|
577
|
+
* @returns {string}
|
|
578
|
+
*/
|
|
637
579
|
get_outlines() {
|
|
638
580
|
let deferred1_0;
|
|
639
581
|
let deferred1_1;
|
|
640
582
|
try {
|
|
641
|
-
const
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
deferred1_0 = r0;
|
|
646
|
-
deferred1_1 = r1;
|
|
647
|
-
return getStringFromWasm0(r0, r1);
|
|
583
|
+
const ret = wasm.basepolygon_get_outlines(this.__wbg_ptr);
|
|
584
|
+
deferred1_0 = ret[0];
|
|
585
|
+
deferred1_1 = ret[1];
|
|
586
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
648
587
|
} finally {
|
|
649
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
650
588
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
651
589
|
}
|
|
652
590
|
}
|
|
653
591
|
/**
|
|
654
|
-
|
|
655
|
-
|
|
592
|
+
* @returns {string}
|
|
593
|
+
*/
|
|
656
594
|
get_geometry() {
|
|
657
595
|
let deferred1_0;
|
|
658
596
|
let deferred1_1;
|
|
659
597
|
try {
|
|
660
|
-
const
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
deferred1_0 = r0;
|
|
665
|
-
deferred1_1 = r1;
|
|
666
|
-
return getStringFromWasm0(r0, r1);
|
|
598
|
+
const ret = wasm.basepolygon_get_geometry(this.__wbg_ptr);
|
|
599
|
+
deferred1_0 = ret[0];
|
|
600
|
+
deferred1_1 = ret[1];
|
|
601
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
667
602
|
} finally {
|
|
668
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
669
603
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
670
604
|
}
|
|
671
605
|
}
|
|
672
606
|
}
|
|
673
|
-
|
|
607
|
+
typeof FinalizationRegistry === 'undefined' ? {
|
|
608
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_color_free(ptr >>> 0, 1));
|
|
609
|
+
typeof FinalizationRegistry === 'undefined' ? {
|
|
610
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_colorrgb_free(ptr >>> 0, 1));
|
|
611
|
+
typeof FinalizationRegistry === 'undefined' ? {
|
|
612
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_matrix3_free(ptr >>> 0, 1));
|
|
613
|
+
const Matrix4Finalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
674
614
|
register: () => {},
|
|
675
615
|
unregister: () => {}
|
|
676
|
-
} : new FinalizationRegistry(ptr => wasm.
|
|
616
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_matrix4_free(ptr >>> 0, 1));
|
|
677
617
|
/**
|
|
678
|
-
|
|
679
|
-
|
|
618
|
+
*
|
|
619
|
+
* * Matrix4 Module
|
|
620
|
+
* * 2D Representation of a 4x4 Matrix
|
|
621
|
+
* * It's a row-major matrix.
|
|
622
|
+
*
|
|
623
|
+
*/
|
|
624
|
+
let Matrix4$1 = class Matrix4 {
|
|
680
625
|
static __wrap(ptr) {
|
|
681
626
|
ptr = ptr >>> 0;
|
|
682
|
-
const obj = Object.create(
|
|
627
|
+
const obj = Object.create(Matrix4.prototype);
|
|
683
628
|
obj.__wbg_ptr = ptr;
|
|
684
|
-
|
|
629
|
+
Matrix4Finalization.register(obj, obj.__wbg_ptr, obj);
|
|
685
630
|
return obj;
|
|
686
631
|
}
|
|
687
632
|
__destroy_into_raw() {
|
|
688
633
|
const ptr = this.__wbg_ptr;
|
|
689
634
|
this.__wbg_ptr = 0;
|
|
690
|
-
|
|
635
|
+
Matrix4Finalization.unregister(this);
|
|
636
|
+
return ptr;
|
|
637
|
+
}
|
|
638
|
+
free() {
|
|
639
|
+
const ptr = this.__destroy_into_raw();
|
|
640
|
+
wasm.__wbg_matrix4_free(ptr, 0);
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* @returns {Float64Array}
|
|
644
|
+
*/
|
|
645
|
+
get elements() {
|
|
646
|
+
const ret = wasm.matrix4_elements(this.__wbg_ptr);
|
|
647
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
648
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
649
|
+
return v1;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
*
|
|
653
|
+
* * Create a new Matrix4 with identity elements.
|
|
654
|
+
*
|
|
655
|
+
*/
|
|
656
|
+
constructor() {
|
|
657
|
+
const ret = wasm.matrix4_new();
|
|
658
|
+
this.__wbg_ptr = ret >>> 0;
|
|
659
|
+
Matrix4Finalization.register(this, this.__wbg_ptr, this);
|
|
660
|
+
return this;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* @param {number} m0
|
|
664
|
+
* @param {number} m1
|
|
665
|
+
* @param {number} m2
|
|
666
|
+
* @param {number} m3
|
|
667
|
+
* @param {number} m4
|
|
668
|
+
* @param {number} m5
|
|
669
|
+
* @param {number} m6
|
|
670
|
+
* @param {number} m7
|
|
671
|
+
* @param {number} m8
|
|
672
|
+
* @param {number} m9
|
|
673
|
+
* @param {number} m10
|
|
674
|
+
* @param {number} m11
|
|
675
|
+
* @param {number} m12
|
|
676
|
+
* @param {number} m13
|
|
677
|
+
* @param {number} m14
|
|
678
|
+
* @param {number} m15
|
|
679
|
+
* @returns {Matrix4}
|
|
680
|
+
*/
|
|
681
|
+
static set(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15) {
|
|
682
|
+
const ret = wasm.matrix4_set(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15);
|
|
683
|
+
return Matrix4.__wrap(ret);
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
*
|
|
687
|
+
* * Clone the Matrix4 instance and return a new one.
|
|
688
|
+
*
|
|
689
|
+
* @returns {Matrix4}
|
|
690
|
+
*/
|
|
691
|
+
clone() {
|
|
692
|
+
const ret = wasm.matrix4_clone(this.__wbg_ptr);
|
|
693
|
+
return Matrix4.__wrap(ret);
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
*
|
|
697
|
+
* * Sets the matrix element to create an identity matrix.
|
|
698
|
+
*
|
|
699
|
+
*/
|
|
700
|
+
identity() {
|
|
701
|
+
wasm.matrix4_identity(this.__wbg_ptr);
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
*
|
|
705
|
+
* * Determinant for a 4x4 matrix.
|
|
706
|
+
* * https://en.wikipedia.org/wiki/Determinant
|
|
707
|
+
*
|
|
708
|
+
* @returns {number}
|
|
709
|
+
*/
|
|
710
|
+
determinant() {
|
|
711
|
+
const ret = wasm.matrix4_determinant(this.__wbg_ptr);
|
|
712
|
+
return ret;
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* @returns {Matrix4}
|
|
716
|
+
*/
|
|
717
|
+
adjucate() {
|
|
718
|
+
const ret = wasm.matrix4_adjucate(this.__wbg_ptr);
|
|
719
|
+
return Matrix4.__wrap(ret);
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
*
|
|
723
|
+
* * Inverse of a matrix
|
|
724
|
+
* * Returns a new Matrix4 instance.
|
|
725
|
+
* * If the determinant is zero, it returns a zero matrix.
|
|
726
|
+
* * It can be checked with is_zero() method.
|
|
727
|
+
*
|
|
728
|
+
* @returns {Matrix4}
|
|
729
|
+
*/
|
|
730
|
+
inverse() {
|
|
731
|
+
const ret = wasm.matrix4_inverse(this.__wbg_ptr);
|
|
732
|
+
return Matrix4.__wrap(ret);
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
*
|
|
736
|
+
* * Multiply this matrix with another Matrix4
|
|
737
|
+
* * Returns a new Matrix4 instance
|
|
738
|
+
*
|
|
739
|
+
* @param {Matrix4} other
|
|
740
|
+
* @returns {Matrix4}
|
|
741
|
+
*/
|
|
742
|
+
multiply(other) {
|
|
743
|
+
_assertClass(other, Matrix4);
|
|
744
|
+
const ret = wasm.matrix4_multiply(this.__wbg_ptr, other.__wbg_ptr);
|
|
745
|
+
return Matrix4.__wrap(ret);
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
*
|
|
749
|
+
* * Add another Matrix4 to this one.
|
|
750
|
+
* * Returns a new Matrix4 instance with the result.
|
|
751
|
+
*
|
|
752
|
+
* @param {Matrix4} incoming
|
|
753
|
+
* @returns {Matrix4}
|
|
754
|
+
*/
|
|
755
|
+
add(incoming) {
|
|
756
|
+
_assertClass(incoming, Matrix4);
|
|
757
|
+
const ret = wasm.matrix4_add(this.__wbg_ptr, incoming.__wbg_ptr);
|
|
758
|
+
return Matrix4.__wrap(ret);
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
*
|
|
762
|
+
* * Subtract another Matrix4 from this one.
|
|
763
|
+
* * Returns a new Matrix4 instance with the result.
|
|
764
|
+
*
|
|
765
|
+
* @param {Matrix4} incoming
|
|
766
|
+
* @returns {Matrix4}
|
|
767
|
+
*/
|
|
768
|
+
subtract(incoming) {
|
|
769
|
+
_assertClass(incoming, Matrix4);
|
|
770
|
+
const ret = wasm.matrix4_subtract(this.__wbg_ptr, incoming.__wbg_ptr);
|
|
771
|
+
return Matrix4.__wrap(ret);
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
*
|
|
775
|
+
* * Flatten the matrix into a vector of f64.
|
|
776
|
+
*
|
|
777
|
+
* @returns {Float64Array}
|
|
778
|
+
*/
|
|
779
|
+
flatten() {
|
|
780
|
+
const ret = wasm.matrix4_flatten(this.__wbg_ptr);
|
|
781
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
782
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
783
|
+
return v1;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
*
|
|
787
|
+
* * Get the element at a specific index in the flattened matrix.
|
|
788
|
+
*
|
|
789
|
+
* @param {number} index
|
|
790
|
+
* @returns {number | undefined}
|
|
791
|
+
*/
|
|
792
|
+
get_element_at(index) {
|
|
793
|
+
const ret = wasm.matrix4_get_element_at(this.__wbg_ptr, index);
|
|
794
|
+
return ret[0] === 0 ? undefined : ret[1];
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
*
|
|
798
|
+
* * Check if the matrix is a zero matrix.
|
|
799
|
+
*
|
|
800
|
+
* @returns {boolean}
|
|
801
|
+
*/
|
|
802
|
+
is_zero() {
|
|
803
|
+
const ret = wasm.matrix4_is_zero(this.__wbg_ptr);
|
|
804
|
+
return ret !== 0;
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
*
|
|
808
|
+
* * Check if the matrix is an identity matrix.
|
|
809
|
+
*
|
|
810
|
+
* @returns {boolean}
|
|
811
|
+
*/
|
|
812
|
+
is_identity() {
|
|
813
|
+
const ret = wasm.matrix4_is_identity(this.__wbg_ptr);
|
|
814
|
+
return ret !== 0;
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
*
|
|
818
|
+
* * Create a Transpose of the matrix.
|
|
819
|
+
* * Returns a new Matrix4 instance.
|
|
820
|
+
*
|
|
821
|
+
* @returns {Matrix4}
|
|
822
|
+
*/
|
|
823
|
+
transpose() {
|
|
824
|
+
const ret = wasm.matrix4_transpose(this.__wbg_ptr);
|
|
825
|
+
return Matrix4.__wrap(ret);
|
|
826
|
+
}
|
|
827
|
+
};
|
|
828
|
+
const OGArcFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
829
|
+
register: () => {},
|
|
830
|
+
unregister: () => {}
|
|
831
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_ogarc_free(ptr >>> 0, 1));
|
|
832
|
+
class OGArc {
|
|
833
|
+
__destroy_into_raw() {
|
|
834
|
+
const ptr = this.__wbg_ptr;
|
|
835
|
+
this.__wbg_ptr = 0;
|
|
836
|
+
OGArcFinalization.unregister(this);
|
|
691
837
|
return ptr;
|
|
692
838
|
}
|
|
693
839
|
free() {
|
|
694
840
|
const ptr = this.__destroy_into_raw();
|
|
695
|
-
wasm.
|
|
841
|
+
wasm.__wbg_ogarc_free(ptr, 0);
|
|
696
842
|
}
|
|
697
843
|
/**
|
|
698
|
-
|
|
699
|
-
|
|
844
|
+
* @param {string} id
|
|
845
|
+
*/
|
|
700
846
|
set id(id) {
|
|
701
847
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
702
848
|
const len0 = WASM_VECTOR_LEN;
|
|
703
|
-
wasm.
|
|
849
|
+
wasm.ogarc_set_id(this.__wbg_ptr, ptr0, len0);
|
|
704
850
|
}
|
|
705
851
|
/**
|
|
706
|
-
|
|
707
|
-
|
|
852
|
+
* @returns {string}
|
|
853
|
+
*/
|
|
708
854
|
get id() {
|
|
709
855
|
let deferred1_0;
|
|
710
856
|
let deferred1_1;
|
|
711
857
|
try {
|
|
712
|
-
const
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
deferred1_0 = r0;
|
|
717
|
-
deferred1_1 = r1;
|
|
718
|
-
return getStringFromWasm0(r0, r1);
|
|
858
|
+
const ret = wasm.ogarc_id(this.__wbg_ptr);
|
|
859
|
+
deferred1_0 = ret[0];
|
|
860
|
+
deferred1_1 = ret[1];
|
|
861
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
719
862
|
} finally {
|
|
720
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
721
863
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
722
864
|
}
|
|
723
865
|
}
|
|
724
866
|
/**
|
|
725
|
-
|
|
726
|
-
|
|
867
|
+
* @param {string} id
|
|
868
|
+
*/
|
|
727
869
|
constructor(id) {
|
|
728
870
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
729
871
|
const len0 = WASM_VECTOR_LEN;
|
|
730
|
-
const ret = wasm.
|
|
872
|
+
const ret = wasm.ogarc_new(ptr0, len0);
|
|
731
873
|
this.__wbg_ptr = ret >>> 0;
|
|
732
|
-
|
|
874
|
+
OGArcFinalization.register(this, this.__wbg_ptr, this);
|
|
733
875
|
return this;
|
|
734
876
|
}
|
|
735
877
|
/**
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
/**
|
|
743
|
-
* @param {Vector3D} center
|
|
744
|
-
* @param {number} radius
|
|
745
|
-
* @param {number} start_angle
|
|
746
|
-
* @param {number} end_angle
|
|
747
|
-
* @param {number} segments
|
|
748
|
-
*/
|
|
878
|
+
* @param {Vector3} center
|
|
879
|
+
* @param {number} radius
|
|
880
|
+
* @param {number} start_angle
|
|
881
|
+
* @param {number} end_angle
|
|
882
|
+
* @param {number} segments
|
|
883
|
+
*/
|
|
749
884
|
set_config(center, radius, start_angle, end_angle, segments) {
|
|
750
|
-
_assertClass(center,
|
|
885
|
+
_assertClass(center, Vector3$1);
|
|
751
886
|
var ptr0 = center.__destroy_into_raw();
|
|
752
|
-
wasm.
|
|
753
|
-
}
|
|
754
|
-
/**
|
|
755
|
-
*/
|
|
756
|
-
generate_points() {
|
|
757
|
-
wasm.circlearc_generate_points(this.__wbg_ptr);
|
|
887
|
+
wasm.ogarc_set_config(this.__wbg_ptr, ptr0, radius, start_angle, end_angle, segments);
|
|
758
888
|
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
*/
|
|
762
|
-
update_radius(radius) {
|
|
763
|
-
wasm.circlearc_update_radius(this.__wbg_ptr, radius);
|
|
764
|
-
}
|
|
765
|
-
/**
|
|
766
|
-
* @param {Vector3D} center
|
|
767
|
-
*/
|
|
768
|
-
update_center(center) {
|
|
769
|
-
_assertClass(center, Vector3D);
|
|
770
|
-
var ptr0 = center.__destroy_into_raw();
|
|
771
|
-
wasm.circlearc_update_center(this.__wbg_ptr, ptr0);
|
|
889
|
+
generate_geometry() {
|
|
890
|
+
wasm.ogarc_generate_geometry(this.__wbg_ptr);
|
|
772
891
|
}
|
|
773
|
-
/**
|
|
774
|
-
*/
|
|
775
892
|
dispose_points() {
|
|
776
|
-
wasm.
|
|
893
|
+
wasm.ogarc_dispose_points(this.__wbg_ptr);
|
|
777
894
|
}
|
|
778
|
-
/**
|
|
779
|
-
*/
|
|
780
895
|
destroy() {
|
|
781
|
-
wasm.
|
|
896
|
+
wasm.ogarc_destroy(this.__wbg_ptr);
|
|
782
897
|
}
|
|
783
898
|
/**
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
899
|
+
* @returns {string}
|
|
900
|
+
*/
|
|
901
|
+
get_brep_serialized() {
|
|
787
902
|
let deferred1_0;
|
|
788
903
|
let deferred1_1;
|
|
789
904
|
try {
|
|
790
|
-
const
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
deferred1_0 = r0;
|
|
795
|
-
deferred1_1 = r1;
|
|
796
|
-
return getStringFromWasm0(r0, r1);
|
|
905
|
+
const ret = wasm.ogarc_get_brep_serialized(this.__wbg_ptr);
|
|
906
|
+
deferred1_0 = ret[0];
|
|
907
|
+
deferred1_1 = ret[1];
|
|
908
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
797
909
|
} finally {
|
|
798
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
799
910
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
800
911
|
}
|
|
801
912
|
}
|
|
802
913
|
/**
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
914
|
+
* @returns {string}
|
|
915
|
+
*/
|
|
916
|
+
get_geometry_serialized() {
|
|
917
|
+
let deferred1_0;
|
|
918
|
+
let deferred1_1;
|
|
806
919
|
try {
|
|
807
|
-
const
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
812
|
-
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
813
|
-
return v1;
|
|
920
|
+
const ret = wasm.ogarc_get_geometry_serialized(this.__wbg_ptr);
|
|
921
|
+
deferred1_0 = ret[0];
|
|
922
|
+
deferred1_1 = ret[1];
|
|
923
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
814
924
|
} finally {
|
|
815
|
-
wasm.
|
|
925
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
816
926
|
}
|
|
817
927
|
}
|
|
818
928
|
}
|
|
819
|
-
typeof FinalizationRegistry === 'undefined' ? {
|
|
820
|
-
} : new FinalizationRegistry(ptr => wasm.__wbg_color_free(ptr >>> 0, 1));
|
|
821
|
-
typeof FinalizationRegistry === 'undefined' ? {
|
|
822
|
-
} : new FinalizationRegistry(ptr => wasm.__wbg_colorrgb_free(ptr >>> 0, 1));
|
|
823
|
-
typeof FinalizationRegistry === 'undefined' ? {
|
|
824
|
-
} : new FinalizationRegistry(ptr => wasm.__wbg_matrix3d_free(ptr >>> 0, 1));
|
|
825
|
-
const OGCylinderFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
929
|
+
const OGCubeFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
826
930
|
register: () => {},
|
|
827
931
|
unregister: () => {}
|
|
828
|
-
} : new FinalizationRegistry(ptr => wasm.
|
|
932
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_ogcube_free(ptr >>> 0, 1));
|
|
829
933
|
/**
|
|
830
|
-
|
|
831
|
-
|
|
934
|
+
*
|
|
935
|
+
* * Copyright (c) 2025, OpenGeometry. All rights reserved.
|
|
936
|
+
* * Box primitive for OpenGeometry.
|
|
937
|
+
* *
|
|
938
|
+
* * Base created by default on XZ plane and extruded along Y axis.
|
|
939
|
+
* *
|
|
940
|
+
* * There are two ways to create a box:
|
|
941
|
+
* * 1. By creating a box with a rectangle face, create a Rectangle Poly Face and then extrude by a given height
|
|
942
|
+
* * 2. By creating a box primitive with given width, height, and depth
|
|
943
|
+
* *
|
|
944
|
+
* * This class is used to create a box primitive(2) using width, height, and depth.
|
|
945
|
+
*
|
|
946
|
+
*/
|
|
947
|
+
class OGCube {
|
|
832
948
|
__destroy_into_raw() {
|
|
833
949
|
const ptr = this.__wbg_ptr;
|
|
834
950
|
this.__wbg_ptr = 0;
|
|
835
|
-
|
|
951
|
+
OGCubeFinalization.unregister(this);
|
|
836
952
|
return ptr;
|
|
837
953
|
}
|
|
838
954
|
free() {
|
|
839
955
|
const ptr = this.__destroy_into_raw();
|
|
840
|
-
wasm.
|
|
956
|
+
wasm.__wbg_ogcube_free(ptr, 0);
|
|
841
957
|
}
|
|
842
958
|
/**
|
|
843
|
-
|
|
844
|
-
|
|
959
|
+
* @param {string} id
|
|
960
|
+
*/
|
|
845
961
|
set id(id) {
|
|
846
962
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
847
963
|
const len0 = WASM_VECTOR_LEN;
|
|
848
|
-
wasm.
|
|
964
|
+
wasm.ogcube_set_id(this.__wbg_ptr, ptr0, len0);
|
|
849
965
|
}
|
|
850
966
|
/**
|
|
851
|
-
|
|
852
|
-
|
|
967
|
+
* @returns {string}
|
|
968
|
+
*/
|
|
853
969
|
get id() {
|
|
854
970
|
let deferred1_0;
|
|
855
971
|
let deferred1_1;
|
|
856
972
|
try {
|
|
857
|
-
const
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
deferred1_0 = r0;
|
|
862
|
-
deferred1_1 = r1;
|
|
863
|
-
return getStringFromWasm0(r0, r1);
|
|
973
|
+
const ret = wasm.ogcube_id(this.__wbg_ptr);
|
|
974
|
+
deferred1_0 = ret[0];
|
|
975
|
+
deferred1_1 = ret[1];
|
|
976
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
864
977
|
} finally {
|
|
865
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
866
978
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
867
979
|
}
|
|
868
980
|
}
|
|
869
981
|
/**
|
|
870
|
-
|
|
871
|
-
|
|
982
|
+
* @param {string} id
|
|
983
|
+
*/
|
|
872
984
|
constructor(id) {
|
|
873
985
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
874
986
|
const len0 = WASM_VECTOR_LEN;
|
|
875
|
-
const ret = wasm.
|
|
987
|
+
const ret = wasm.ogcube_new(ptr0, len0);
|
|
876
988
|
this.__wbg_ptr = ret >>> 0;
|
|
877
|
-
|
|
989
|
+
OGCubeFinalization.register(this, this.__wbg_ptr, this);
|
|
878
990
|
return this;
|
|
879
991
|
}
|
|
992
|
+
clean_geometry() {
|
|
993
|
+
wasm.ogcube_clean_geometry(this.__wbg_ptr);
|
|
994
|
+
}
|
|
880
995
|
/**
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
_assertClass(center, Vector3D);
|
|
996
|
+
* @param {Vector3} center
|
|
997
|
+
* @param {number} width
|
|
998
|
+
* @param {number} height
|
|
999
|
+
* @param {number} depth
|
|
1000
|
+
*/
|
|
1001
|
+
set_config(center, width, height, depth) {
|
|
1002
|
+
_assertClass(center, Vector3$1);
|
|
889
1003
|
var ptr0 = center.__destroy_into_raw();
|
|
890
|
-
wasm.
|
|
1004
|
+
wasm.ogcube_set_config(this.__wbg_ptr, ptr0, width, height, depth);
|
|
891
1005
|
}
|
|
892
|
-
/**
|
|
893
|
-
*/
|
|
894
1006
|
generate_geometry() {
|
|
895
|
-
wasm.
|
|
1007
|
+
wasm.ogcube_generate_geometry(this.__wbg_ptr);
|
|
896
1008
|
}
|
|
897
1009
|
/**
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
1010
|
+
* @returns {string}
|
|
1011
|
+
*/
|
|
1012
|
+
get_brep_dump() {
|
|
901
1013
|
let deferred1_0;
|
|
902
1014
|
let deferred1_1;
|
|
903
1015
|
try {
|
|
904
|
-
const
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
deferred1_0 = r0;
|
|
909
|
-
deferred1_1 = r1;
|
|
910
|
-
return getStringFromWasm0(r0, r1);
|
|
1016
|
+
const ret = wasm.ogcube_get_brep_dump(this.__wbg_ptr);
|
|
1017
|
+
deferred1_0 = ret[0];
|
|
1018
|
+
deferred1_1 = ret[1];
|
|
1019
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
911
1020
|
} finally {
|
|
912
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
913
1021
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
914
1022
|
}
|
|
915
1023
|
}
|
|
916
1024
|
/**
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
}
|
|
921
|
-
/**
|
|
922
|
-
* @returns {string}
|
|
923
|
-
*/
|
|
924
|
-
outline_edges() {
|
|
1025
|
+
* @returns {string}
|
|
1026
|
+
*/
|
|
1027
|
+
get_geometry_serialized() {
|
|
925
1028
|
let deferred1_0;
|
|
926
1029
|
let deferred1_1;
|
|
927
1030
|
try {
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
deferred1_0 = r0;
|
|
933
|
-
deferred1_1 = r1;
|
|
934
|
-
return getStringFromWasm0(r0, r1);
|
|
1031
|
+
const ret = wasm.ogcube_get_geometry_serialized(this.__wbg_ptr);
|
|
1032
|
+
deferred1_0 = ret[0];
|
|
1033
|
+
deferred1_1 = ret[1];
|
|
1034
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
935
1035
|
} finally {
|
|
936
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
937
1036
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
938
1037
|
}
|
|
939
1038
|
}
|
|
940
1039
|
/**
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
1040
|
+
* @returns {string}
|
|
1041
|
+
*/
|
|
1042
|
+
get_outline_geometry_serialized() {
|
|
944
1043
|
let deferred1_0;
|
|
945
1044
|
let deferred1_1;
|
|
946
1045
|
try {
|
|
947
|
-
const
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
deferred1_0 = r0;
|
|
952
|
-
deferred1_1 = r1;
|
|
953
|
-
return getStringFromWasm0(r0, r1);
|
|
1046
|
+
const ret = wasm.ogcube_get_outline_geometry_serialized(this.__wbg_ptr);
|
|
1047
|
+
deferred1_0 = ret[0];
|
|
1048
|
+
deferred1_1 = ret[1];
|
|
1049
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
954
1050
|
} finally {
|
|
955
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
956
1051
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
957
1052
|
}
|
|
958
1053
|
}
|
|
959
1054
|
}
|
|
960
|
-
const
|
|
1055
|
+
const OGCylinderFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
961
1056
|
register: () => {},
|
|
962
1057
|
unregister: () => {}
|
|
963
|
-
} : new FinalizationRegistry(ptr => wasm.
|
|
964
|
-
|
|
965
|
-
*/
|
|
966
|
-
class OGPolyLine {
|
|
967
|
-
static __wrap(ptr) {
|
|
968
|
-
ptr = ptr >>> 0;
|
|
969
|
-
const obj = Object.create(OGPolyLine.prototype);
|
|
970
|
-
obj.__wbg_ptr = ptr;
|
|
971
|
-
OGPolyLineFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
972
|
-
return obj;
|
|
973
|
-
}
|
|
1058
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_ogcylinder_free(ptr >>> 0, 1));
|
|
1059
|
+
class OGCylinder {
|
|
974
1060
|
__destroy_into_raw() {
|
|
975
1061
|
const ptr = this.__wbg_ptr;
|
|
976
1062
|
this.__wbg_ptr = 0;
|
|
977
|
-
|
|
1063
|
+
OGCylinderFinalization.unregister(this);
|
|
978
1064
|
return ptr;
|
|
979
1065
|
}
|
|
980
1066
|
free() {
|
|
981
1067
|
const ptr = this.__destroy_into_raw();
|
|
982
|
-
wasm.
|
|
1068
|
+
wasm.__wbg_ogcylinder_free(ptr, 0);
|
|
983
1069
|
}
|
|
984
1070
|
/**
|
|
985
|
-
|
|
986
|
-
|
|
1071
|
+
* @param {string} id
|
|
1072
|
+
*/
|
|
987
1073
|
set id(id) {
|
|
988
1074
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
989
1075
|
const len0 = WASM_VECTOR_LEN;
|
|
990
|
-
wasm.
|
|
1076
|
+
wasm.ogcylinder_set_id(this.__wbg_ptr, ptr0, len0);
|
|
991
1077
|
}
|
|
992
1078
|
/**
|
|
993
|
-
|
|
994
|
-
|
|
1079
|
+
* @returns {string}
|
|
1080
|
+
*/
|
|
995
1081
|
get id() {
|
|
996
1082
|
let deferred1_0;
|
|
997
1083
|
let deferred1_1;
|
|
998
1084
|
try {
|
|
999
|
-
const
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
deferred1_0 = r0;
|
|
1004
|
-
deferred1_1 = r1;
|
|
1005
|
-
return getStringFromWasm0(r0, r1);
|
|
1085
|
+
const ret = wasm.ogcylinder_id(this.__wbg_ptr);
|
|
1086
|
+
deferred1_0 = ret[0];
|
|
1087
|
+
deferred1_1 = ret[1];
|
|
1088
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1006
1089
|
} finally {
|
|
1007
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1008
1090
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1009
1091
|
}
|
|
1010
1092
|
}
|
|
1011
1093
|
/**
|
|
1012
|
-
|
|
1013
|
-
|
|
1094
|
+
* @param {string} id
|
|
1095
|
+
*/
|
|
1014
1096
|
constructor(id) {
|
|
1015
1097
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1016
1098
|
const len0 = WASM_VECTOR_LEN;
|
|
1017
|
-
const ret = wasm.
|
|
1099
|
+
const ret = wasm.ogcylinder_new(ptr0, len0);
|
|
1018
1100
|
this.__wbg_ptr = ret >>> 0;
|
|
1019
|
-
|
|
1101
|
+
OGCylinderFinalization.register(this, this.__wbg_ptr, this);
|
|
1020
1102
|
return this;
|
|
1021
1103
|
}
|
|
1022
1104
|
/**
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
const ptr0 = passArrayJsValueToWasm0(points, wasm.__wbindgen_malloc);
|
|
1034
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1035
|
-
wasm.ogpolyline_set_config(this.__wbg_ptr, ptr0, len0);
|
|
1036
|
-
}
|
|
1037
|
-
/**
|
|
1038
|
-
* @param {Vector3D} point
|
|
1039
|
-
*/
|
|
1040
|
-
add_point(point) {
|
|
1041
|
-
_assertClass(point, Vector3D);
|
|
1042
|
-
var ptr0 = point.__destroy_into_raw();
|
|
1043
|
-
wasm.ogpolyline_add_point(this.__wbg_ptr, ptr0);
|
|
1044
|
-
}
|
|
1045
|
-
/**
|
|
1046
|
-
*/
|
|
1047
|
-
dispose_points() {
|
|
1048
|
-
wasm.ogpolyline_destroy(this.__wbg_ptr);
|
|
1105
|
+
* @param {Vector3} center
|
|
1106
|
+
* @param {number} radius
|
|
1107
|
+
* @param {number} height
|
|
1108
|
+
* @param {number} angle
|
|
1109
|
+
* @param {number} segments
|
|
1110
|
+
*/
|
|
1111
|
+
set_config(center, radius, height, angle, segments) {
|
|
1112
|
+
_assertClass(center, Vector3$1);
|
|
1113
|
+
var ptr0 = center.__destroy_into_raw();
|
|
1114
|
+
wasm.ogcylinder_set_config(this.__wbg_ptr, ptr0, radius, height, angle, segments);
|
|
1049
1115
|
}
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
destroy() {
|
|
1053
|
-
wasm.ogpolyline_destroy(this.__wbg_ptr);
|
|
1116
|
+
generate_geometry() {
|
|
1117
|
+
wasm.ogcylinder_generate_geometry(this.__wbg_ptr);
|
|
1054
1118
|
}
|
|
1055
1119
|
/**
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1120
|
+
* @returns {string}
|
|
1121
|
+
*/
|
|
1122
|
+
get_brep_serialized() {
|
|
1059
1123
|
let deferred1_0;
|
|
1060
1124
|
let deferred1_1;
|
|
1061
1125
|
try {
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
deferred1_0 = r0;
|
|
1067
|
-
deferred1_1 = r1;
|
|
1068
|
-
return getStringFromWasm0(r0, r1);
|
|
1126
|
+
const ret = wasm.ogcylinder_get_brep_serialized(this.__wbg_ptr);
|
|
1127
|
+
deferred1_0 = ret[0];
|
|
1128
|
+
deferred1_1 = ret[1];
|
|
1129
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1069
1130
|
} finally {
|
|
1070
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1071
1131
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1072
1132
|
}
|
|
1073
1133
|
}
|
|
1074
1134
|
/**
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1135
|
+
* @returns {string}
|
|
1136
|
+
*/
|
|
1137
|
+
get_geometry_serialized() {
|
|
1138
|
+
let deferred1_0;
|
|
1139
|
+
let deferred1_1;
|
|
1078
1140
|
try {
|
|
1079
|
-
const
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1084
|
-
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
1085
|
-
return v1;
|
|
1141
|
+
const ret = wasm.ogcylinder_get_geometry_serialized(this.__wbg_ptr);
|
|
1142
|
+
deferred1_0 = ret[0];
|
|
1143
|
+
deferred1_1 = ret[1];
|
|
1144
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1086
1145
|
} finally {
|
|
1087
|
-
wasm.
|
|
1146
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1088
1147
|
}
|
|
1089
1148
|
}
|
|
1090
1149
|
/**
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1150
|
+
* @returns {string}
|
|
1151
|
+
*/
|
|
1152
|
+
get_outline_geometry_serialized() {
|
|
1153
|
+
let deferred1_0;
|
|
1154
|
+
let deferred1_1;
|
|
1155
|
+
try {
|
|
1156
|
+
const ret = wasm.ogcylinder_get_outline_geometry_serialized(this.__wbg_ptr);
|
|
1157
|
+
deferred1_0 = ret[0];
|
|
1158
|
+
deferred1_1 = ret[1];
|
|
1159
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1160
|
+
} finally {
|
|
1161
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1162
|
+
}
|
|
1101
1163
|
}
|
|
1102
1164
|
}
|
|
1103
|
-
const
|
|
1165
|
+
const OGCylinderOldFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
1104
1166
|
register: () => {},
|
|
1105
1167
|
unregister: () => {}
|
|
1106
|
-
} : new FinalizationRegistry(ptr => wasm.
|
|
1107
|
-
|
|
1108
|
-
*/
|
|
1109
|
-
class OGPolygon {
|
|
1110
|
-
static __wrap(ptr) {
|
|
1111
|
-
ptr = ptr >>> 0;
|
|
1112
|
-
const obj = Object.create(OGPolygon.prototype);
|
|
1113
|
-
obj.__wbg_ptr = ptr;
|
|
1114
|
-
OGPolygonFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1115
|
-
return obj;
|
|
1116
|
-
}
|
|
1168
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_ogcylinderold_free(ptr >>> 0, 1));
|
|
1169
|
+
class OGCylinderOld {
|
|
1117
1170
|
__destroy_into_raw() {
|
|
1118
1171
|
const ptr = this.__wbg_ptr;
|
|
1119
1172
|
this.__wbg_ptr = 0;
|
|
1120
|
-
|
|
1173
|
+
OGCylinderOldFinalization.unregister(this);
|
|
1121
1174
|
return ptr;
|
|
1122
1175
|
}
|
|
1123
1176
|
free() {
|
|
1124
1177
|
const ptr = this.__destroy_into_raw();
|
|
1125
|
-
wasm.
|
|
1126
|
-
}
|
|
1127
|
-
/**
|
|
1128
|
-
* @returns {boolean}
|
|
1129
|
-
*/
|
|
1130
|
-
get extruded() {
|
|
1131
|
-
const ret = wasm.__wbg_get_ogpolygon_extruded(this.__wbg_ptr);
|
|
1132
|
-
return ret !== 0;
|
|
1133
|
-
}
|
|
1134
|
-
/**
|
|
1135
|
-
* @param {boolean} arg0
|
|
1136
|
-
*/
|
|
1137
|
-
set extruded(arg0) {
|
|
1138
|
-
wasm.__wbg_set_ogpolygon_extruded(this.__wbg_ptr, arg0);
|
|
1139
|
-
}
|
|
1140
|
-
/**
|
|
1141
|
-
* @returns {number}
|
|
1142
|
-
*/
|
|
1143
|
-
get extruded_height() {
|
|
1144
|
-
const ret = wasm.__wbg_get_ogpolygon_extruded_height(this.__wbg_ptr);
|
|
1145
|
-
return ret;
|
|
1146
|
-
}
|
|
1147
|
-
/**
|
|
1148
|
-
* @param {number} arg0
|
|
1149
|
-
*/
|
|
1150
|
-
set extruded_height(arg0) {
|
|
1151
|
-
wasm.__wbg_set_ogpolygon_extruded_height(this.__wbg_ptr, arg0);
|
|
1152
|
-
}
|
|
1153
|
-
/**
|
|
1154
|
-
* @returns {boolean}
|
|
1155
|
-
*/
|
|
1156
|
-
get is_polygon() {
|
|
1157
|
-
const ret = wasm.__wbg_get_ogpolygon_is_polygon(this.__wbg_ptr);
|
|
1158
|
-
return ret !== 0;
|
|
1159
|
-
}
|
|
1160
|
-
/**
|
|
1161
|
-
* @param {boolean} arg0
|
|
1162
|
-
*/
|
|
1163
|
-
set is_polygon(arg0) {
|
|
1164
|
-
wasm.__wbg_set_ogpolygon_is_polygon(this.__wbg_ptr, arg0);
|
|
1165
|
-
}
|
|
1166
|
-
/**
|
|
1167
|
-
* @returns {Vector3D}
|
|
1168
|
-
*/
|
|
1169
|
-
get position() {
|
|
1170
|
-
const ret = wasm.__wbg_get_ogpolygon_position(this.__wbg_ptr);
|
|
1171
|
-
return Vector3D.__wrap(ret);
|
|
1172
|
-
}
|
|
1173
|
-
/**
|
|
1174
|
-
* @param {Vector3D} arg0
|
|
1175
|
-
*/
|
|
1176
|
-
set position(arg0) {
|
|
1177
|
-
_assertClass(arg0, Vector3D);
|
|
1178
|
-
var ptr0 = arg0.__destroy_into_raw();
|
|
1179
|
-
wasm.__wbg_set_ogpolygon_position(this.__wbg_ptr, ptr0);
|
|
1180
|
-
}
|
|
1181
|
-
/**
|
|
1182
|
-
* @returns {Vector3D}
|
|
1183
|
-
*/
|
|
1184
|
-
get rotation() {
|
|
1185
|
-
const ret = wasm.__wbg_get_ogpolygon_rotation(this.__wbg_ptr);
|
|
1186
|
-
return Vector3D.__wrap(ret);
|
|
1187
|
-
}
|
|
1188
|
-
/**
|
|
1189
|
-
* @param {Vector3D} arg0
|
|
1190
|
-
*/
|
|
1191
|
-
set rotation(arg0) {
|
|
1192
|
-
_assertClass(arg0, Vector3D);
|
|
1193
|
-
var ptr0 = arg0.__destroy_into_raw();
|
|
1194
|
-
wasm.__wbg_set_ogpolygon_rotation(this.__wbg_ptr, ptr0);
|
|
1195
|
-
}
|
|
1196
|
-
/**
|
|
1197
|
-
* @returns {Vector3D}
|
|
1198
|
-
*/
|
|
1199
|
-
get scale() {
|
|
1200
|
-
const ret = wasm.__wbg_get_ogpolygon_scale(this.__wbg_ptr);
|
|
1201
|
-
return Vector3D.__wrap(ret);
|
|
1178
|
+
wasm.__wbg_ogcylinderold_free(ptr, 0);
|
|
1202
1179
|
}
|
|
1203
1180
|
/**
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
set scale(arg0) {
|
|
1207
|
-
_assertClass(arg0, Vector3D);
|
|
1208
|
-
var ptr0 = arg0.__destroy_into_raw();
|
|
1209
|
-
wasm.__wbg_set_ogpolygon_scale(this.__wbg_ptr, ptr0);
|
|
1210
|
-
}
|
|
1211
|
-
/**
|
|
1212
|
-
* @param {string} id
|
|
1213
|
-
*/
|
|
1181
|
+
* @param {string} id
|
|
1182
|
+
*/
|
|
1214
1183
|
set id(id) {
|
|
1215
1184
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1216
1185
|
const len0 = WASM_VECTOR_LEN;
|
|
1217
|
-
wasm.
|
|
1186
|
+
wasm.ogcylinderold_set_id(this.__wbg_ptr, ptr0, len0);
|
|
1218
1187
|
}
|
|
1219
1188
|
/**
|
|
1220
|
-
|
|
1221
|
-
|
|
1189
|
+
* @returns {string}
|
|
1190
|
+
*/
|
|
1222
1191
|
get id() {
|
|
1223
1192
|
let deferred1_0;
|
|
1224
1193
|
let deferred1_1;
|
|
1225
1194
|
try {
|
|
1226
|
-
const
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
deferred1_0 = r0;
|
|
1231
|
-
deferred1_1 = r1;
|
|
1232
|
-
return getStringFromWasm0(r0, r1);
|
|
1195
|
+
const ret = wasm.ogcylinderold_id(this.__wbg_ptr);
|
|
1196
|
+
deferred1_0 = ret[0];
|
|
1197
|
+
deferred1_1 = ret[1];
|
|
1198
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1233
1199
|
} finally {
|
|
1234
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1235
1200
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1236
1201
|
}
|
|
1237
1202
|
}
|
|
1238
1203
|
/**
|
|
1239
|
-
|
|
1240
|
-
|
|
1204
|
+
* @param {string} id
|
|
1205
|
+
*/
|
|
1241
1206
|
constructor(id) {
|
|
1242
1207
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1243
1208
|
const len0 = WASM_VECTOR_LEN;
|
|
1244
|
-
const ret = wasm.
|
|
1209
|
+
const ret = wasm.ogcylinderold_new(ptr0, len0);
|
|
1245
1210
|
this.__wbg_ptr = ret >>> 0;
|
|
1246
|
-
|
|
1211
|
+
OGCylinderOldFinalization.register(this, this.__wbg_ptr, this);
|
|
1247
1212
|
return this;
|
|
1248
1213
|
}
|
|
1249
1214
|
/**
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1215
|
+
* @param {Vector3} center
|
|
1216
|
+
* @param {number} radius
|
|
1217
|
+
* @param {number} height
|
|
1218
|
+
* @param {number} angle
|
|
1219
|
+
* @param {number} segments
|
|
1220
|
+
*/
|
|
1221
|
+
set_config(center, radius, height, angle, segments) {
|
|
1222
|
+
_assertClass(center, Vector3$1);
|
|
1223
|
+
var ptr0 = center.__destroy_into_raw();
|
|
1224
|
+
wasm.ogcylinderold_set_config(this.__wbg_ptr, ptr0, radius, height, angle, segments);
|
|
1258
1225
|
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
* @returns {OGPolygon}
|
|
1262
|
-
*/
|
|
1263
|
-
static new_with_rectangle(rectangle) {
|
|
1264
|
-
_assertClass(rectangle, OGRectangle);
|
|
1265
|
-
var ptr0 = rectangle.__destroy_into_raw();
|
|
1266
|
-
const ret = wasm.ogpolygon_new_with_rectangle(ptr0);
|
|
1267
|
-
return OGPolygon.__wrap(ret);
|
|
1226
|
+
generate_geometry() {
|
|
1227
|
+
wasm.ogcylinderold_generate_geometry(this.__wbg_ptr);
|
|
1268
1228
|
}
|
|
1269
1229
|
/**
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1230
|
+
* @returns {string}
|
|
1231
|
+
*/
|
|
1232
|
+
get_geometry() {
|
|
1233
|
+
let deferred1_0;
|
|
1234
|
+
let deferred1_1;
|
|
1235
|
+
try {
|
|
1236
|
+
const ret = wasm.ogcylinderold_get_geometry(this.__wbg_ptr);
|
|
1237
|
+
deferred1_0 = ret[0];
|
|
1238
|
+
deferred1_1 = ret[1];
|
|
1239
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1240
|
+
} finally {
|
|
1241
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
discard_geometry() {
|
|
1245
|
+
wasm.ogcylinderold_discard_geometry(this.__wbg_ptr);
|
|
1276
1246
|
}
|
|
1277
1247
|
/**
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
_assertClass(vertex, Vector3D);
|
|
1282
|
-
var ptr0 = vertex.__destroy_into_raw();
|
|
1283
|
-
wasm.ogpolygon_add_vertex(this.__wbg_ptr, ptr0);
|
|
1284
|
-
}
|
|
1285
|
-
/**
|
|
1286
|
-
* @param {(Vector3D)[]} holes
|
|
1287
|
-
*/
|
|
1288
|
-
add_holes(holes) {
|
|
1289
|
-
const ptr0 = passArrayJsValueToWasm0(holes, wasm.__wbindgen_malloc);
|
|
1290
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1291
|
-
wasm.ogpolygon_add_holes(this.__wbg_ptr, ptr0, len0);
|
|
1292
|
-
}
|
|
1293
|
-
/**
|
|
1294
|
-
* @returns {string}
|
|
1295
|
-
*/
|
|
1296
|
-
triangulate() {
|
|
1248
|
+
* @returns {string}
|
|
1249
|
+
*/
|
|
1250
|
+
outline_edges() {
|
|
1297
1251
|
let deferred1_0;
|
|
1298
1252
|
let deferred1_1;
|
|
1299
1253
|
try {
|
|
1300
|
-
const
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
deferred1_0 = r0;
|
|
1305
|
-
deferred1_1 = r1;
|
|
1306
|
-
return getStringFromWasm0(r0, r1);
|
|
1254
|
+
const ret = wasm.ogcylinderold_outline_edges(this.__wbg_ptr);
|
|
1255
|
+
deferred1_0 = ret[0];
|
|
1256
|
+
deferred1_1 = ret[1];
|
|
1257
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1307
1258
|
} finally {
|
|
1308
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1309
1259
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1310
1260
|
}
|
|
1311
1261
|
}
|
|
1312
1262
|
/**
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
triangulate_with_holes_variable_geometry(is_ccw) {
|
|
1263
|
+
* @returns {string}
|
|
1264
|
+
*/
|
|
1265
|
+
get_brep_dump() {
|
|
1317
1266
|
let deferred1_0;
|
|
1318
1267
|
let deferred1_1;
|
|
1319
1268
|
try {
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
deferred1_0 = r0;
|
|
1325
|
-
deferred1_1 = r1;
|
|
1326
|
-
return getStringFromWasm0(r0, r1);
|
|
1269
|
+
const ret = wasm.ogcylinderold_get_brep_dump(this.__wbg_ptr);
|
|
1270
|
+
deferred1_0 = ret[0];
|
|
1271
|
+
deferred1_1 = ret[1];
|
|
1272
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1327
1273
|
} finally {
|
|
1328
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1329
1274
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1330
1275
|
}
|
|
1331
1276
|
}
|
|
1277
|
+
}
|
|
1278
|
+
const OGLineFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
1279
|
+
register: () => {},
|
|
1280
|
+
unregister: () => {}
|
|
1281
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_ogline_free(ptr >>> 0, 1));
|
|
1282
|
+
class OGLine {
|
|
1283
|
+
__destroy_into_raw() {
|
|
1284
|
+
const ptr = this.__wbg_ptr;
|
|
1285
|
+
this.__wbg_ptr = 0;
|
|
1286
|
+
OGLineFinalization.unregister(this);
|
|
1287
|
+
return ptr;
|
|
1288
|
+
}
|
|
1289
|
+
free() {
|
|
1290
|
+
const ptr = this.__destroy_into_raw();
|
|
1291
|
+
wasm.__wbg_ogline_free(ptr, 0);
|
|
1292
|
+
}
|
|
1332
1293
|
/**
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1340
|
-
wasm.ogpolygon_triangulate_with_holes(retptr, this.__wbg_ptr);
|
|
1341
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1342
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1343
|
-
deferred1_0 = r0;
|
|
1344
|
-
deferred1_1 = r1;
|
|
1345
|
-
return getStringFromWasm0(r0, r1);
|
|
1346
|
-
} finally {
|
|
1347
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1348
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1349
|
-
}
|
|
1294
|
+
* @param {string} id
|
|
1295
|
+
*/
|
|
1296
|
+
set id(id) {
|
|
1297
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1298
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1299
|
+
wasm.ogline_set_id(this.__wbg_ptr, ptr0, len0);
|
|
1350
1300
|
}
|
|
1351
1301
|
/**
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1302
|
+
* @returns {string}
|
|
1303
|
+
*/
|
|
1304
|
+
get id() {
|
|
1355
1305
|
let deferred1_0;
|
|
1356
1306
|
let deferred1_1;
|
|
1357
1307
|
try {
|
|
1358
|
-
const
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
deferred1_0 = r0;
|
|
1363
|
-
deferred1_1 = r1;
|
|
1364
|
-
return getStringFromWasm0(r0, r1);
|
|
1308
|
+
const ret = wasm.ogline_id(this.__wbg_ptr);
|
|
1309
|
+
deferred1_0 = ret[0];
|
|
1310
|
+
deferred1_1 = ret[1];
|
|
1311
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1365
1312
|
} finally {
|
|
1366
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1367
1313
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1368
1314
|
}
|
|
1369
1315
|
}
|
|
1370
1316
|
/**
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1317
|
+
* @param {string} id
|
|
1318
|
+
*/
|
|
1319
|
+
constructor(id) {
|
|
1320
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1321
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1322
|
+
const ret = wasm.ogline_new(ptr0, len0);
|
|
1323
|
+
this.__wbg_ptr = ret >>> 0;
|
|
1324
|
+
OGLineFinalization.register(this, this.__wbg_ptr, this);
|
|
1325
|
+
return this;
|
|
1374
1326
|
}
|
|
1375
1327
|
/**
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1328
|
+
* @param {Vector3} start
|
|
1329
|
+
* @param {Vector3} end
|
|
1330
|
+
*/
|
|
1331
|
+
set_config(start, end) {
|
|
1332
|
+
_assertClass(start, Vector3$1);
|
|
1333
|
+
var ptr0 = start.__destroy_into_raw();
|
|
1334
|
+
_assertClass(end, Vector3$1);
|
|
1335
|
+
var ptr1 = end.__destroy_into_raw();
|
|
1336
|
+
wasm.ogline_set_config(this.__wbg_ptr, ptr0, ptr1);
|
|
1337
|
+
}
|
|
1338
|
+
generate_geometry() {
|
|
1339
|
+
wasm.ogline_generate_geometry(this.__wbg_ptr);
|
|
1340
|
+
}
|
|
1341
|
+
dispose_points() {
|
|
1342
|
+
wasm.ogline_dispose_points(this.__wbg_ptr);
|
|
1343
|
+
}
|
|
1344
|
+
destroy() {
|
|
1345
|
+
wasm.ogline_destroy(this.__wbg_ptr);
|
|
1379
1346
|
}
|
|
1380
1347
|
/**
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
extrude_by_height_with_holes(height) {
|
|
1348
|
+
* @returns {string}
|
|
1349
|
+
*/
|
|
1350
|
+
get_brep_serialized() {
|
|
1385
1351
|
let deferred1_0;
|
|
1386
1352
|
let deferred1_1;
|
|
1387
1353
|
try {
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
deferred1_0 = r0;
|
|
1393
|
-
deferred1_1 = r1;
|
|
1394
|
-
return getStringFromWasm0(r0, r1);
|
|
1354
|
+
const ret = wasm.ogline_get_brep_serialized(this.__wbg_ptr);
|
|
1355
|
+
deferred1_0 = ret[0];
|
|
1356
|
+
deferred1_1 = ret[1];
|
|
1357
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1395
1358
|
} finally {
|
|
1396
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1397
1359
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1398
1360
|
}
|
|
1399
1361
|
}
|
|
1400
1362
|
/**
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
extrude_by_height(height) {
|
|
1363
|
+
* @returns {string}
|
|
1364
|
+
*/
|
|
1365
|
+
get_geometry_serialized() {
|
|
1405
1366
|
let deferred1_0;
|
|
1406
1367
|
let deferred1_1;
|
|
1407
1368
|
try {
|
|
1408
|
-
const
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
deferred1_0 = r0;
|
|
1413
|
-
deferred1_1 = r1;
|
|
1414
|
-
return getStringFromWasm0(r0, r1);
|
|
1369
|
+
const ret = wasm.ogline_get_geometry_serialized(this.__wbg_ptr);
|
|
1370
|
+
deferred1_0 = ret[0];
|
|
1371
|
+
deferred1_1 = ret[1];
|
|
1372
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1415
1373
|
} finally {
|
|
1416
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1417
1374
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1418
1375
|
}
|
|
1419
1376
|
}
|
|
1377
|
+
}
|
|
1378
|
+
const OGPolygonFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
1379
|
+
register: () => {},
|
|
1380
|
+
unregister: () => {}
|
|
1381
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_ogpolygon_free(ptr >>> 0, 1));
|
|
1382
|
+
class OGPolygon {
|
|
1383
|
+
__destroy_into_raw() {
|
|
1384
|
+
const ptr = this.__wbg_ptr;
|
|
1385
|
+
this.__wbg_ptr = 0;
|
|
1386
|
+
OGPolygonFinalization.unregister(this);
|
|
1387
|
+
return ptr;
|
|
1388
|
+
}
|
|
1389
|
+
free() {
|
|
1390
|
+
const ptr = this.__destroy_into_raw();
|
|
1391
|
+
wasm.__wbg_ogpolygon_free(ptr, 0);
|
|
1392
|
+
}
|
|
1420
1393
|
/**
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1394
|
+
* @param {string} id
|
|
1395
|
+
*/
|
|
1396
|
+
set id(id) {
|
|
1397
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1398
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1399
|
+
wasm.ogpolygon_set_id(this.__wbg_ptr, ptr0, len0);
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* @returns {string}
|
|
1403
|
+
*/
|
|
1404
|
+
get id() {
|
|
1424
1405
|
let deferred1_0;
|
|
1425
1406
|
let deferred1_1;
|
|
1426
1407
|
try {
|
|
1427
|
-
const
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
deferred1_0 = r0;
|
|
1432
|
-
deferred1_1 = r1;
|
|
1433
|
-
return getStringFromWasm0(r0, r1);
|
|
1408
|
+
const ret = wasm.ogpolygon_id(this.__wbg_ptr);
|
|
1409
|
+
deferred1_0 = ret[0];
|
|
1410
|
+
deferred1_1 = ret[1];
|
|
1411
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1434
1412
|
} finally {
|
|
1435
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1436
1413
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1437
1414
|
}
|
|
1438
1415
|
}
|
|
1439
1416
|
/**
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1417
|
+
* @param {string} id
|
|
1418
|
+
*/
|
|
1419
|
+
constructor(id) {
|
|
1420
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1421
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1422
|
+
const ret = wasm.ogpolygon_new(ptr0, len0);
|
|
1423
|
+
this.__wbg_ptr = ret >>> 0;
|
|
1424
|
+
OGPolygonFinalization.register(this, this.__wbg_ptr, this);
|
|
1425
|
+
return this;
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* @param {Vector3[]} points
|
|
1429
|
+
*/
|
|
1430
|
+
set_config(points) {
|
|
1431
|
+
const ptr0 = passArrayJsValueToWasm0(points, wasm.__wbindgen_malloc);
|
|
1432
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1433
|
+
wasm.ogpolygon_set_config(this.__wbg_ptr, ptr0, len0);
|
|
1434
|
+
}
|
|
1435
|
+
/**
|
|
1436
|
+
* @param {Float64Array} transformation
|
|
1437
|
+
*/
|
|
1438
|
+
set_transformation(transformation) {
|
|
1439
|
+
const ptr0 = passArrayF64ToWasm0(transformation, wasm.__wbindgen_malloc);
|
|
1440
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1441
|
+
wasm.ogpolygon_set_transformation(this.__wbg_ptr, ptr0, len0);
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* @param {Vector3[]} vertices
|
|
1445
|
+
*/
|
|
1446
|
+
add_vertices(vertices) {
|
|
1447
|
+
const ptr0 = passArrayJsValueToWasm0(vertices, wasm.__wbindgen_malloc);
|
|
1448
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1449
|
+
wasm.ogpolygon_add_vertices(this.__wbg_ptr, ptr0, len0);
|
|
1450
|
+
}
|
|
1451
|
+
clean_geometry() {
|
|
1452
|
+
wasm.ogpolygon_clean_geometry(this.__wbg_ptr);
|
|
1453
|
+
}
|
|
1454
|
+
generate_geometry() {
|
|
1455
|
+
wasm.ogpolygon_generate_geometry(this.__wbg_ptr);
|
|
1456
|
+
}
|
|
1457
|
+
/**
|
|
1458
|
+
* @returns {string}
|
|
1459
|
+
*/
|
|
1460
|
+
get_brep_serialized() {
|
|
1443
1461
|
let deferred1_0;
|
|
1444
1462
|
let deferred1_1;
|
|
1445
1463
|
try {
|
|
1446
|
-
const
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
deferred1_0 = r0;
|
|
1451
|
-
deferred1_1 = r1;
|
|
1452
|
-
return getStringFromWasm0(r0, r1);
|
|
1464
|
+
const ret = wasm.ogpolygon_get_brep_serialized(this.__wbg_ptr);
|
|
1465
|
+
deferred1_0 = ret[0];
|
|
1466
|
+
deferred1_1 = ret[1];
|
|
1467
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1453
1468
|
} finally {
|
|
1454
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1455
1469
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1456
1470
|
}
|
|
1457
1471
|
}
|
|
1458
1472
|
/**
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1473
|
+
* @returns {string}
|
|
1474
|
+
*/
|
|
1475
|
+
get_geometry_serialized() {
|
|
1462
1476
|
let deferred1_0;
|
|
1463
1477
|
let deferred1_1;
|
|
1464
1478
|
try {
|
|
1465
|
-
const
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
deferred1_0 = r0;
|
|
1470
|
-
deferred1_1 = r1;
|
|
1471
|
-
return getStringFromWasm0(r0, r1);
|
|
1479
|
+
const ret = wasm.ogpolygon_get_geometry_serialized(this.__wbg_ptr);
|
|
1480
|
+
deferred1_0 = ret[0];
|
|
1481
|
+
deferred1_1 = ret[1];
|
|
1482
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1472
1483
|
} finally {
|
|
1473
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1474
1484
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1475
1485
|
}
|
|
1476
1486
|
}
|
|
1477
1487
|
/**
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1488
|
+
* @returns {string}
|
|
1489
|
+
*/
|
|
1490
|
+
get_outline_geometry_serialized() {
|
|
1481
1491
|
let deferred1_0;
|
|
1482
1492
|
let deferred1_1;
|
|
1483
1493
|
try {
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
deferred1_0 = r0;
|
|
1489
|
-
deferred1_1 = r1;
|
|
1490
|
-
return getStringFromWasm0(r0, r1);
|
|
1494
|
+
const ret = wasm.ogpolygon_get_outline_geometry_serialized(this.__wbg_ptr);
|
|
1495
|
+
deferred1_0 = ret[0];
|
|
1496
|
+
deferred1_1 = ret[1];
|
|
1497
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1491
1498
|
} finally {
|
|
1492
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1493
1499
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1494
1500
|
}
|
|
1495
1501
|
}
|
|
1496
1502
|
}
|
|
1497
|
-
const
|
|
1503
|
+
const OGPolylineFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
1498
1504
|
register: () => {},
|
|
1499
1505
|
unregister: () => {}
|
|
1500
|
-
} : new FinalizationRegistry(ptr => wasm.
|
|
1501
|
-
|
|
1502
|
-
*/
|
|
1503
|
-
class OGRectangle {
|
|
1506
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_ogpolyline_free(ptr >>> 0, 1));
|
|
1507
|
+
class OGPolyline {
|
|
1504
1508
|
static __wrap(ptr) {
|
|
1505
1509
|
ptr = ptr >>> 0;
|
|
1506
|
-
const obj = Object.create(
|
|
1510
|
+
const obj = Object.create(OGPolyline.prototype);
|
|
1507
1511
|
obj.__wbg_ptr = ptr;
|
|
1508
|
-
|
|
1512
|
+
OGPolylineFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1509
1513
|
return obj;
|
|
1510
1514
|
}
|
|
1511
1515
|
__destroy_into_raw() {
|
|
1512
1516
|
const ptr = this.__wbg_ptr;
|
|
1513
1517
|
this.__wbg_ptr = 0;
|
|
1514
|
-
|
|
1518
|
+
OGPolylineFinalization.unregister(this);
|
|
1515
1519
|
return ptr;
|
|
1516
1520
|
}
|
|
1517
1521
|
free() {
|
|
1518
1522
|
const ptr = this.__destroy_into_raw();
|
|
1519
|
-
wasm.
|
|
1523
|
+
wasm.__wbg_ogpolyline_free(ptr, 0);
|
|
1520
1524
|
}
|
|
1521
1525
|
/**
|
|
1522
|
-
|
|
1523
|
-
|
|
1526
|
+
* @param {string} id
|
|
1527
|
+
*/
|
|
1524
1528
|
set id(id) {
|
|
1525
1529
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1526
1530
|
const len0 = WASM_VECTOR_LEN;
|
|
1527
|
-
wasm.
|
|
1531
|
+
wasm.ogpolyline_set_id(this.__wbg_ptr, ptr0, len0);
|
|
1528
1532
|
}
|
|
1529
1533
|
/**
|
|
1530
|
-
|
|
1531
|
-
|
|
1534
|
+
* @returns {string}
|
|
1535
|
+
*/
|
|
1532
1536
|
get id() {
|
|
1533
1537
|
let deferred1_0;
|
|
1534
1538
|
let deferred1_1;
|
|
1535
1539
|
try {
|
|
1536
|
-
const
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
deferred1_0 = r0;
|
|
1541
|
-
deferred1_1 = r1;
|
|
1542
|
-
return getStringFromWasm0(r0, r1);
|
|
1540
|
+
const ret = wasm.ogpolyline_id(this.__wbg_ptr);
|
|
1541
|
+
deferred1_0 = ret[0];
|
|
1542
|
+
deferred1_1 = ret[1];
|
|
1543
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1543
1544
|
} finally {
|
|
1544
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1545
1545
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1546
1546
|
}
|
|
1547
1547
|
}
|
|
1548
1548
|
/**
|
|
1549
|
-
|
|
1550
|
-
|
|
1549
|
+
* @param {string} id
|
|
1550
|
+
*/
|
|
1551
1551
|
constructor(id) {
|
|
1552
1552
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1553
1553
|
const len0 = WASM_VECTOR_LEN;
|
|
1554
|
-
const ret = wasm.
|
|
1554
|
+
const ret = wasm.ogpolyline_new(ptr0, len0);
|
|
1555
1555
|
this.__wbg_ptr = ret >>> 0;
|
|
1556
|
-
|
|
1556
|
+
OGPolylineFinalization.register(this, this.__wbg_ptr, this);
|
|
1557
1557
|
return this;
|
|
1558
1558
|
}
|
|
1559
1559
|
/**
|
|
1560
|
-
|
|
1561
|
-
|
|
1560
|
+
* @returns {OGPolyline}
|
|
1561
|
+
*/
|
|
1562
1562
|
clone() {
|
|
1563
|
-
const ret = wasm.
|
|
1564
|
-
return
|
|
1563
|
+
const ret = wasm.ogpolyline_clone(this.__wbg_ptr);
|
|
1564
|
+
return OGPolyline.__wrap(ret);
|
|
1565
1565
|
}
|
|
1566
1566
|
/**
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
var ptr0 = center.__destroy_into_raw();
|
|
1574
|
-
wasm.ogrectangle_set_config(this.__wbg_ptr, ptr0, width, breadth);
|
|
1567
|
+
* @param {Vector3[]} points
|
|
1568
|
+
*/
|
|
1569
|
+
set_config(points) {
|
|
1570
|
+
const ptr0 = passArrayJsValueToWasm0(points, wasm.__wbindgen_malloc);
|
|
1571
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1572
|
+
wasm.ogpolyline_set_config(this.__wbg_ptr, ptr0, len0);
|
|
1575
1573
|
}
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
generate_points() {
|
|
1579
|
-
wasm.ogrectangle_generate_points(this.__wbg_ptr);
|
|
1574
|
+
generate_geometry() {
|
|
1575
|
+
wasm.ogpolyline_generate_geometry(this.__wbg_ptr);
|
|
1580
1576
|
}
|
|
1581
1577
|
/**
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1578
|
+
* @param {Vector3[]} points
|
|
1579
|
+
*/
|
|
1580
|
+
add_multiple_points(points) {
|
|
1581
|
+
const ptr0 = passArrayJsValueToWasm0(points, wasm.__wbindgen_malloc);
|
|
1582
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1583
|
+
wasm.ogpolyline_add_multiple_points(this.__wbg_ptr, ptr0, len0);
|
|
1586
1584
|
}
|
|
1587
1585
|
/**
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1586
|
+
* @param {Vector3} point
|
|
1587
|
+
*/
|
|
1588
|
+
add_point(point) {
|
|
1589
|
+
_assertClass(point, Vector3$1);
|
|
1590
|
+
var ptr0 = point.__destroy_into_raw();
|
|
1591
|
+
wasm.ogpolyline_add_point(this.__wbg_ptr, ptr0);
|
|
1592
1592
|
}
|
|
1593
1593
|
/**
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1594
|
+
* @returns {string}
|
|
1595
|
+
*/
|
|
1596
|
+
get_points() {
|
|
1597
|
+
let deferred1_0;
|
|
1598
|
+
let deferred1_1;
|
|
1599
|
+
try {
|
|
1600
|
+
const ret = wasm.ogpolyline_get_points(this.__wbg_ptr);
|
|
1601
|
+
deferred1_0 = ret[0];
|
|
1602
|
+
deferred1_1 = ret[1];
|
|
1603
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1604
|
+
} finally {
|
|
1605
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1606
|
+
}
|
|
1600
1607
|
}
|
|
1601
1608
|
/**
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1609
|
+
* @returns {Vector3[]}
|
|
1610
|
+
*/
|
|
1611
|
+
get_raw_points() {
|
|
1612
|
+
const ret = wasm.ogpolyline_get_raw_points(this.__wbg_ptr);
|
|
1613
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1614
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1615
|
+
return v1;
|
|
1605
1616
|
}
|
|
1606
1617
|
/**
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1618
|
+
* @returns {boolean}
|
|
1619
|
+
*/
|
|
1620
|
+
is_closed() {
|
|
1621
|
+
const ret = wasm.ogpolyline_is_closed(this.__wbg_ptr);
|
|
1622
|
+
return ret !== 0;
|
|
1623
|
+
}
|
|
1624
|
+
check_closed_test() {
|
|
1625
|
+
wasm.ogpolyline_check_closed_test(this.__wbg_ptr);
|
|
1610
1626
|
}
|
|
1611
1627
|
/**
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1628
|
+
* @returns {string}
|
|
1629
|
+
*/
|
|
1630
|
+
get_brep_serialized() {
|
|
1615
1631
|
let deferred1_0;
|
|
1616
1632
|
let deferred1_1;
|
|
1617
1633
|
try {
|
|
1618
|
-
const
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
deferred1_0 = r0;
|
|
1623
|
-
deferred1_1 = r1;
|
|
1624
|
-
return getStringFromWasm0(r0, r1);
|
|
1634
|
+
const ret = wasm.ogpolyline_get_brep_serialized(this.__wbg_ptr);
|
|
1635
|
+
deferred1_0 = ret[0];
|
|
1636
|
+
deferred1_1 = ret[1];
|
|
1637
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1625
1638
|
} finally {
|
|
1626
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1627
1639
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1628
1640
|
}
|
|
1629
1641
|
}
|
|
1630
1642
|
/**
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1643
|
+
* @returns {string}
|
|
1644
|
+
*/
|
|
1645
|
+
get_geometry_serialized() {
|
|
1646
|
+
let deferred1_0;
|
|
1647
|
+
let deferred1_1;
|
|
1634
1648
|
try {
|
|
1635
|
-
const
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1640
|
-
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
1641
|
-
return v1;
|
|
1649
|
+
const ret = wasm.ogpolyline_get_geometry_serialized(this.__wbg_ptr);
|
|
1650
|
+
deferred1_0 = ret[0];
|
|
1651
|
+
deferred1_1 = ret[1];
|
|
1652
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1642
1653
|
} finally {
|
|
1643
|
-
wasm.
|
|
1654
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1644
1655
|
}
|
|
1645
1656
|
}
|
|
1646
1657
|
}
|
|
1647
|
-
const
|
|
1658
|
+
const OGRectangleFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
1648
1659
|
register: () => {},
|
|
1649
1660
|
unregister: () => {}
|
|
1650
|
-
} : new FinalizationRegistry(ptr => wasm.
|
|
1651
|
-
|
|
1652
|
-
*/
|
|
1653
|
-
class OGSimpleLine {
|
|
1654
|
-
static __wrap(ptr) {
|
|
1655
|
-
ptr = ptr >>> 0;
|
|
1656
|
-
const obj = Object.create(OGSimpleLine.prototype);
|
|
1657
|
-
obj.__wbg_ptr = ptr;
|
|
1658
|
-
OGSimpleLineFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1659
|
-
return obj;
|
|
1660
|
-
}
|
|
1661
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_ogrectangle_free(ptr >>> 0, 1));
|
|
1662
|
+
class OGRectangle {
|
|
1661
1663
|
__destroy_into_raw() {
|
|
1662
1664
|
const ptr = this.__wbg_ptr;
|
|
1663
1665
|
this.__wbg_ptr = 0;
|
|
1664
|
-
|
|
1666
|
+
OGRectangleFinalization.unregister(this);
|
|
1665
1667
|
return ptr;
|
|
1666
1668
|
}
|
|
1667
1669
|
free() {
|
|
1668
1670
|
const ptr = this.__destroy_into_raw();
|
|
1669
|
-
wasm.
|
|
1671
|
+
wasm.__wbg_ogrectangle_free(ptr, 0);
|
|
1670
1672
|
}
|
|
1671
1673
|
/**
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
+
* @param {string} id
|
|
1675
|
+
*/
|
|
1674
1676
|
set id(id) {
|
|
1675
1677
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1676
1678
|
const len0 = WASM_VECTOR_LEN;
|
|
1677
|
-
wasm.
|
|
1679
|
+
wasm.ogrectangle_set_id(this.__wbg_ptr, ptr0, len0);
|
|
1678
1680
|
}
|
|
1679
1681
|
/**
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
+
* @returns {string}
|
|
1683
|
+
*/
|
|
1682
1684
|
get id() {
|
|
1683
1685
|
let deferred1_0;
|
|
1684
1686
|
let deferred1_1;
|
|
1685
1687
|
try {
|
|
1686
|
-
const
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
deferred1_0 = r0;
|
|
1691
|
-
deferred1_1 = r1;
|
|
1692
|
-
return getStringFromWasm0(r0, r1);
|
|
1688
|
+
const ret = wasm.ogrectangle_id(this.__wbg_ptr);
|
|
1689
|
+
deferred1_0 = ret[0];
|
|
1690
|
+
deferred1_1 = ret[1];
|
|
1691
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1693
1692
|
} finally {
|
|
1694
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1695
1693
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1696
1694
|
}
|
|
1697
1695
|
}
|
|
1698
1696
|
/**
|
|
1699
|
-
|
|
1700
|
-
|
|
1697
|
+
* @param {string} id
|
|
1698
|
+
*/
|
|
1701
1699
|
constructor(id) {
|
|
1702
1700
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1703
1701
|
const len0 = WASM_VECTOR_LEN;
|
|
1704
|
-
const ret = wasm.
|
|
1702
|
+
const ret = wasm.ogrectangle_new(ptr0, len0);
|
|
1705
1703
|
this.__wbg_ptr = ret >>> 0;
|
|
1706
|
-
|
|
1704
|
+
OGRectangleFinalization.register(this, this.__wbg_ptr, this);
|
|
1707
1705
|
return this;
|
|
1708
1706
|
}
|
|
1709
1707
|
/**
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
* @param {Vector3D} end
|
|
1719
|
-
*/
|
|
1720
|
-
set_config(start, end) {
|
|
1721
|
-
_assertClass(start, Vector3D);
|
|
1722
|
-
var ptr0 = start.__destroy_into_raw();
|
|
1723
|
-
_assertClass(end, Vector3D);
|
|
1724
|
-
var ptr1 = end.__destroy_into_raw();
|
|
1725
|
-
wasm.ogsimpleline_set_config(this.__wbg_ptr, ptr0, ptr1);
|
|
1726
|
-
}
|
|
1727
|
-
/**
|
|
1728
|
-
*/
|
|
1729
|
-
dispose_points() {
|
|
1730
|
-
wasm.ogsimpleline_destroy(this.__wbg_ptr);
|
|
1708
|
+
* @param {Vector3} center
|
|
1709
|
+
* @param {number} width
|
|
1710
|
+
* @param {number} breadth
|
|
1711
|
+
*/
|
|
1712
|
+
set_config(center, width, breadth) {
|
|
1713
|
+
_assertClass(center, Vector3$1);
|
|
1714
|
+
var ptr0 = center.__destroy_into_raw();
|
|
1715
|
+
wasm.ogrectangle_set_config(this.__wbg_ptr, ptr0, width, breadth);
|
|
1731
1716
|
}
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
destroy() {
|
|
1735
|
-
wasm.ogsimpleline_destroy(this.__wbg_ptr);
|
|
1717
|
+
generate_geometry() {
|
|
1718
|
+
wasm.ogrectangle_generate_geometry(this.__wbg_ptr);
|
|
1736
1719
|
}
|
|
1737
1720
|
/**
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1721
|
+
* @returns {string}
|
|
1722
|
+
*/
|
|
1723
|
+
get_brep_serialized() {
|
|
1741
1724
|
let deferred1_0;
|
|
1742
1725
|
let deferred1_1;
|
|
1743
1726
|
try {
|
|
1744
|
-
const
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
deferred1_0 = r0;
|
|
1749
|
-
deferred1_1 = r1;
|
|
1750
|
-
return getStringFromWasm0(r0, r1);
|
|
1727
|
+
const ret = wasm.ogrectangle_get_brep_serialized(this.__wbg_ptr);
|
|
1728
|
+
deferred1_0 = ret[0];
|
|
1729
|
+
deferred1_1 = ret[1];
|
|
1730
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1751
1731
|
} finally {
|
|
1752
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1753
1732
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1754
1733
|
}
|
|
1755
1734
|
}
|
|
1756
1735
|
/**
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1736
|
+
* @returns {string}
|
|
1737
|
+
*/
|
|
1738
|
+
get_geometry_serialized() {
|
|
1739
|
+
let deferred1_0;
|
|
1740
|
+
let deferred1_1;
|
|
1760
1741
|
try {
|
|
1761
|
-
const
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1766
|
-
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
1767
|
-
return v1;
|
|
1742
|
+
const ret = wasm.ogrectangle_get_geometry_serialized(this.__wbg_ptr);
|
|
1743
|
+
deferred1_0 = ret[0];
|
|
1744
|
+
deferred1_1 = ret[1];
|
|
1745
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1768
1746
|
} finally {
|
|
1769
|
-
wasm.
|
|
1747
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1770
1748
|
}
|
|
1771
1749
|
}
|
|
1772
1750
|
}
|
|
1773
|
-
const
|
|
1751
|
+
const Vector3Finalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
1774
1752
|
register: () => {},
|
|
1775
1753
|
unregister: () => {}
|
|
1776
|
-
} : new FinalizationRegistry(ptr => wasm.
|
|
1777
|
-
|
|
1778
|
-
*/
|
|
1779
|
-
class Vector3D {
|
|
1754
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_vector3_free(ptr >>> 0, 1));
|
|
1755
|
+
let Vector3$1 = class Vector3 {
|
|
1780
1756
|
static __wrap(ptr) {
|
|
1781
1757
|
ptr = ptr >>> 0;
|
|
1782
|
-
const obj = Object.create(
|
|
1758
|
+
const obj = Object.create(Vector3.prototype);
|
|
1783
1759
|
obj.__wbg_ptr = ptr;
|
|
1784
|
-
|
|
1760
|
+
Vector3Finalization.register(obj, obj.__wbg_ptr, obj);
|
|
1785
1761
|
return obj;
|
|
1786
1762
|
}
|
|
1787
1763
|
static __unwrap(jsValue) {
|
|
1788
|
-
if (!(jsValue instanceof
|
|
1764
|
+
if (!(jsValue instanceof Vector3)) {
|
|
1789
1765
|
return 0;
|
|
1790
1766
|
}
|
|
1791
1767
|
return jsValue.__destroy_into_raw();
|
|
@@ -1793,142 +1769,274 @@ class Vector3D {
|
|
|
1793
1769
|
__destroy_into_raw() {
|
|
1794
1770
|
const ptr = this.__wbg_ptr;
|
|
1795
1771
|
this.__wbg_ptr = 0;
|
|
1796
|
-
|
|
1772
|
+
Vector3Finalization.unregister(this);
|
|
1797
1773
|
return ptr;
|
|
1798
1774
|
}
|
|
1799
1775
|
free() {
|
|
1800
1776
|
const ptr = this.__destroy_into_raw();
|
|
1801
|
-
wasm.
|
|
1777
|
+
wasm.__wbg_vector3_free(ptr, 0);
|
|
1802
1778
|
}
|
|
1803
1779
|
/**
|
|
1804
|
-
|
|
1805
|
-
|
|
1780
|
+
* @returns {number}
|
|
1781
|
+
*/
|
|
1806
1782
|
get x() {
|
|
1807
|
-
const ret = wasm.
|
|
1783
|
+
const ret = wasm.__wbg_get_vector3_x(this.__wbg_ptr);
|
|
1808
1784
|
return ret;
|
|
1809
1785
|
}
|
|
1810
1786
|
/**
|
|
1811
|
-
|
|
1812
|
-
|
|
1787
|
+
* @param {number} arg0
|
|
1788
|
+
*/
|
|
1813
1789
|
set x(arg0) {
|
|
1814
|
-
wasm.
|
|
1790
|
+
wasm.__wbg_set_vector3_x(this.__wbg_ptr, arg0);
|
|
1815
1791
|
}
|
|
1816
1792
|
/**
|
|
1817
|
-
|
|
1818
|
-
|
|
1793
|
+
* @returns {number}
|
|
1794
|
+
*/
|
|
1819
1795
|
get y() {
|
|
1820
|
-
const ret = wasm.
|
|
1796
|
+
const ret = wasm.__wbg_get_vector3_y(this.__wbg_ptr);
|
|
1821
1797
|
return ret;
|
|
1822
1798
|
}
|
|
1823
1799
|
/**
|
|
1824
|
-
|
|
1825
|
-
|
|
1800
|
+
* @param {number} arg0
|
|
1801
|
+
*/
|
|
1826
1802
|
set y(arg0) {
|
|
1827
|
-
wasm.
|
|
1803
|
+
wasm.__wbg_set_vector3_y(this.__wbg_ptr, arg0);
|
|
1828
1804
|
}
|
|
1829
1805
|
/**
|
|
1830
|
-
|
|
1831
|
-
|
|
1806
|
+
* @returns {number}
|
|
1807
|
+
*/
|
|
1832
1808
|
get z() {
|
|
1833
|
-
const ret = wasm.
|
|
1809
|
+
const ret = wasm.__wbg_get_vector3_z(this.__wbg_ptr);
|
|
1834
1810
|
return ret;
|
|
1835
1811
|
}
|
|
1836
1812
|
/**
|
|
1837
|
-
|
|
1838
|
-
|
|
1813
|
+
* @param {number} arg0
|
|
1814
|
+
*/
|
|
1839
1815
|
set z(arg0) {
|
|
1840
|
-
wasm.
|
|
1816
|
+
wasm.__wbg_set_vector3_z(this.__wbg_ptr, arg0);
|
|
1841
1817
|
}
|
|
1842
1818
|
/**
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1819
|
+
* @param {number} x
|
|
1820
|
+
* @param {number} y
|
|
1821
|
+
* @param {number} z
|
|
1822
|
+
*/
|
|
1847
1823
|
constructor(x, y, z) {
|
|
1848
|
-
const ret = wasm.
|
|
1824
|
+
const ret = wasm.vector3_new(x, y, z);
|
|
1849
1825
|
this.__wbg_ptr = ret >>> 0;
|
|
1850
|
-
|
|
1826
|
+
Vector3Finalization.register(this, this.__wbg_ptr, this);
|
|
1851
1827
|
return this;
|
|
1852
1828
|
}
|
|
1853
1829
|
/**
|
|
1854
|
-
|
|
1855
|
-
*
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1830
|
+
*
|
|
1831
|
+
* * Add the elements of another vector to this one.
|
|
1832
|
+
*
|
|
1833
|
+
* @param {Vector3} other
|
|
1834
|
+
* @returns {Vector3}
|
|
1835
|
+
*/
|
|
1836
|
+
add(other) {
|
|
1837
|
+
_assertClass(other, Vector3);
|
|
1838
|
+
const ret = wasm.vector3_add(this.__wbg_ptr, other.__wbg_ptr);
|
|
1839
|
+
return Vector3.__wrap(ret);
|
|
1860
1840
|
}
|
|
1861
1841
|
/**
|
|
1862
|
-
|
|
1863
|
-
*
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1842
|
+
*
|
|
1843
|
+
* * Add a scalar value to each element of the vector.
|
|
1844
|
+
*
|
|
1845
|
+
* @param {number} scalar
|
|
1846
|
+
* @returns {Vector3}
|
|
1847
|
+
*/
|
|
1848
|
+
add_scalar(scalar) {
|
|
1849
|
+
const ret = wasm.vector3_add_scalar(this.__wbg_ptr, scalar);
|
|
1850
|
+
return Vector3.__wrap(ret);
|
|
1869
1851
|
}
|
|
1870
1852
|
/**
|
|
1871
|
-
|
|
1872
|
-
*
|
|
1873
|
-
|
|
1853
|
+
*
|
|
1854
|
+
* * Subtract the elements of another vector from this one.
|
|
1855
|
+
*
|
|
1856
|
+
* @param {Vector3} other
|
|
1857
|
+
* @returns {Vector3}
|
|
1858
|
+
*/
|
|
1874
1859
|
subtract(other) {
|
|
1875
|
-
_assertClass(other,
|
|
1876
|
-
const ret = wasm.
|
|
1877
|
-
return
|
|
1860
|
+
_assertClass(other, Vector3);
|
|
1861
|
+
const ret = wasm.vector3_subtract(this.__wbg_ptr, other.__wbg_ptr);
|
|
1862
|
+
return Vector3.__wrap(ret);
|
|
1878
1863
|
}
|
|
1879
1864
|
/**
|
|
1880
|
-
|
|
1881
|
-
*
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1865
|
+
*
|
|
1866
|
+
* * Subtract a scalar value from each element of the vector.
|
|
1867
|
+
*
|
|
1868
|
+
* @param {number} scalar
|
|
1869
|
+
* @returns {Vector3}
|
|
1870
|
+
*/
|
|
1871
|
+
subtract_scalar(scalar) {
|
|
1872
|
+
const ret = wasm.vector3_subtract_scalar(this.__wbg_ptr, scalar);
|
|
1873
|
+
return Vector3.__wrap(ret);
|
|
1886
1874
|
}
|
|
1887
1875
|
/**
|
|
1888
|
-
|
|
1889
|
-
*
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1876
|
+
*
|
|
1877
|
+
* * Clone the Vector3 instance and return a new one.
|
|
1878
|
+
*
|
|
1879
|
+
* @returns {Vector3}
|
|
1880
|
+
*/
|
|
1881
|
+
clone() {
|
|
1882
|
+
const ret = wasm.vector3_clone(this.__wbg_ptr);
|
|
1883
|
+
return Vector3.__wrap(ret);
|
|
1884
|
+
}
|
|
1885
|
+
/**
|
|
1886
|
+
*
|
|
1887
|
+
* * Set the current vector elements to zero.
|
|
1888
|
+
*
|
|
1889
|
+
*/
|
|
1890
|
+
zero() {
|
|
1891
|
+
wasm.vector3_zero(this.__wbg_ptr);
|
|
1892
|
+
}
|
|
1893
|
+
/**
|
|
1894
|
+
*
|
|
1895
|
+
* * Copy the elements from another Vector3 instance.
|
|
1896
|
+
*
|
|
1897
|
+
* @param {Vector3} other
|
|
1898
|
+
*/
|
|
1899
|
+
copy(other) {
|
|
1900
|
+
_assertClass(other, Vector3);
|
|
1901
|
+
wasm.vector3_copy(this.__wbg_ptr, other.__wbg_ptr);
|
|
1902
|
+
}
|
|
1903
|
+
/**
|
|
1904
|
+
*
|
|
1905
|
+
* * Multiply the vector by a scalar value.
|
|
1906
|
+
*
|
|
1907
|
+
* @param {number} scalar
|
|
1908
|
+
* @returns {Vector3}
|
|
1909
|
+
*/
|
|
1910
|
+
multiply_scalar(scalar) {
|
|
1911
|
+
const ret = wasm.vector3_multiply_scalar(this.__wbg_ptr, scalar);
|
|
1912
|
+
return Vector3.__wrap(ret);
|
|
1913
|
+
}
|
|
1914
|
+
/**
|
|
1915
|
+
*
|
|
1916
|
+
* * Multiply the vector by another Vector3 instance element-wise.
|
|
1917
|
+
*
|
|
1918
|
+
* @param {Vector3} other
|
|
1919
|
+
* @returns {Vector3}
|
|
1920
|
+
*/
|
|
1921
|
+
multiply(other) {
|
|
1922
|
+
_assertClass(other, Vector3);
|
|
1923
|
+
const ret = wasm.vector3_multiply(this.__wbg_ptr, other.__wbg_ptr);
|
|
1924
|
+
return Vector3.__wrap(ret);
|
|
1925
|
+
}
|
|
1926
|
+
/**
|
|
1927
|
+
*
|
|
1928
|
+
* * Divide the vector by another Vector3 instance element-wise.
|
|
1929
|
+
*
|
|
1930
|
+
* @param {Vector3} other
|
|
1931
|
+
* @returns {Vector3}
|
|
1932
|
+
*/
|
|
1933
|
+
divide(other) {
|
|
1934
|
+
_assertClass(other, Vector3);
|
|
1935
|
+
const ret = wasm.vector3_divide(this.__wbg_ptr, other.__wbg_ptr);
|
|
1936
|
+
return Vector3.__wrap(ret);
|
|
1937
|
+
}
|
|
1938
|
+
/**
|
|
1939
|
+
*
|
|
1940
|
+
* * Divide the vector by a scalar value.
|
|
1941
|
+
*
|
|
1942
|
+
* @param {number} scalar
|
|
1943
|
+
* @returns {Vector3}
|
|
1944
|
+
*/
|
|
1945
|
+
divide_scalar(scalar) {
|
|
1946
|
+
const ret = wasm.vector3_divide_scalar(this.__wbg_ptr, scalar);
|
|
1947
|
+
return Vector3.__wrap(ret);
|
|
1948
|
+
}
|
|
1949
|
+
/**
|
|
1950
|
+
*
|
|
1951
|
+
* * Invert the vector by negating the vector elements.
|
|
1952
|
+
*
|
|
1953
|
+
* @returns {Vector3}
|
|
1954
|
+
*/
|
|
1955
|
+
negate() {
|
|
1956
|
+
const ret = wasm.vector3_negate(this.__wbg_ptr);
|
|
1957
|
+
return Vector3.__wrap(ret);
|
|
1958
|
+
}
|
|
1959
|
+
/**
|
|
1960
|
+
*
|
|
1961
|
+
* * Calculate the dot product of this vector with another Vector3 instance.
|
|
1962
|
+
*
|
|
1963
|
+
* @param {Vector3} other
|
|
1964
|
+
* @returns {number}
|
|
1965
|
+
*/
|
|
1966
|
+
dot(other) {
|
|
1967
|
+
_assertClass(other, Vector3);
|
|
1968
|
+
const ret = wasm.vector3_dot(this.__wbg_ptr, other.__wbg_ptr);
|
|
1969
|
+
return ret;
|
|
1894
1970
|
}
|
|
1895
1971
|
/**
|
|
1896
|
-
|
|
1897
|
-
*
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
return Vector3D.__wrap(ret);
|
|
1972
|
+
*
|
|
1973
|
+
* * Calculate the magnitude (length) of the vector.
|
|
1974
|
+
*
|
|
1975
|
+
* @returns {number}
|
|
1976
|
+
*/
|
|
1977
|
+
magnitude() {
|
|
1978
|
+
const ret = wasm.vector3_magnitude(this.__wbg_ptr);
|
|
1979
|
+
return ret;
|
|
1905
1980
|
}
|
|
1906
1981
|
/**
|
|
1907
|
-
|
|
1908
|
-
*
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1982
|
+
*
|
|
1983
|
+
* * Calculate the length of the vector.
|
|
1984
|
+
* * Since length is equivalent to magnitude, this method is an alias.
|
|
1985
|
+
*
|
|
1986
|
+
* @returns {number}
|
|
1987
|
+
*/
|
|
1988
|
+
length() {
|
|
1989
|
+
const ret = wasm.vector3_length(this.__wbg_ptr);
|
|
1990
|
+
return ret;
|
|
1914
1991
|
}
|
|
1915
1992
|
/**
|
|
1916
|
-
|
|
1917
|
-
*
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1993
|
+
*
|
|
1994
|
+
* * Normalize the vector
|
|
1995
|
+
*
|
|
1996
|
+
* @returns {Vector3}
|
|
1997
|
+
*/
|
|
1998
|
+
normalize() {
|
|
1999
|
+
const ret = wasm.vector3_normalize(this.__wbg_ptr);
|
|
2000
|
+
return Vector3.__wrap(ret);
|
|
2001
|
+
}
|
|
2002
|
+
/**
|
|
2003
|
+
*
|
|
2004
|
+
* * Calculate the cross product and return the result as a new Vector3
|
|
2005
|
+
*
|
|
2006
|
+
* @param {Vector3} other
|
|
2007
|
+
* @returns {Vector3}
|
|
2008
|
+
*/
|
|
2009
|
+
cross(other) {
|
|
2010
|
+
_assertClass(other, Vector3);
|
|
2011
|
+
const ret = wasm.vector3_cross(this.__wbg_ptr, other.__wbg_ptr);
|
|
2012
|
+
return Vector3.__wrap(ret);
|
|
2013
|
+
}
|
|
2014
|
+
/**
|
|
2015
|
+
*
|
|
2016
|
+
* * Calculate the distance between this vector and another Vector3 instance.
|
|
2017
|
+
* * Return the distance as a f64 value in Euclidean space.
|
|
2018
|
+
*
|
|
2019
|
+
* @param {Vector3} other
|
|
2020
|
+
* @returns {number}
|
|
2021
|
+
*/
|
|
2022
|
+
distance(other) {
|
|
2023
|
+
_assertClass(other, Vector3);
|
|
2024
|
+
const ret = wasm.vector3_distance(this.__wbg_ptr, other.__wbg_ptr);
|
|
1922
2025
|
return ret;
|
|
1923
2026
|
}
|
|
1924
2027
|
/**
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
2028
|
+
*
|
|
2029
|
+
* * Apply a transformation matrix to the vector.
|
|
2030
|
+
* * This method assumes the transformation matrix is a 4x4 matrix.
|
|
2031
|
+
*
|
|
2032
|
+
* @param {Matrix4} matrix
|
|
2033
|
+
*/
|
|
2034
|
+
apply_matrix4(matrix) {
|
|
2035
|
+
_assertClass(matrix, Matrix4$1);
|
|
2036
|
+
var ptr0 = matrix.__destroy_into_raw();
|
|
2037
|
+
wasm.vector3_apply_matrix4(this.__wbg_ptr, ptr0);
|
|
1930
2038
|
}
|
|
1931
|
-
}
|
|
2039
|
+
};
|
|
1932
2040
|
async function __wbg_load(module, imports) {
|
|
1933
2041
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
1934
2042
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
@@ -1936,7 +2044,7 @@ async function __wbg_load(module, imports) {
|
|
|
1936
2044
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1937
2045
|
} catch (e) {
|
|
1938
2046
|
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
1939
|
-
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve
|
|
2047
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
1940
2048
|
} else {
|
|
1941
2049
|
throw e;
|
|
1942
2050
|
}
|
|
@@ -1959,17 +2067,34 @@ async function __wbg_load(module, imports) {
|
|
|
1959
2067
|
function __wbg_get_imports() {
|
|
1960
2068
|
const imports = {};
|
|
1961
2069
|
imports.wbg = {};
|
|
1962
|
-
imports.wbg.
|
|
1963
|
-
|
|
1964
|
-
|
|
2070
|
+
imports.wbg.__wbg_getRandomValues_38097e921c2494c3 = function () {
|
|
2071
|
+
return handleError(function (arg0, arg1) {
|
|
2072
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
2073
|
+
}, arguments);
|
|
2074
|
+
};
|
|
2075
|
+
imports.wbg.__wbg_log_0c7c294ecbc8af77 = function (arg0) {
|
|
2076
|
+
console.log(arg0);
|
|
1965
2077
|
};
|
|
1966
|
-
imports.wbg.
|
|
1967
|
-
const ret =
|
|
2078
|
+
imports.wbg.__wbg_vector3_new = function (arg0) {
|
|
2079
|
+
const ret = Vector3$1.__wrap(arg0);
|
|
1968
2080
|
return ret;
|
|
1969
2081
|
};
|
|
2082
|
+
imports.wbg.__wbg_vector3_unwrap = function (arg0) {
|
|
2083
|
+
const ret = Vector3$1.__unwrap(arg0);
|
|
2084
|
+
return ret;
|
|
2085
|
+
};
|
|
2086
|
+
imports.wbg.__wbindgen_init_externref_table = function () {
|
|
2087
|
+
const table = wasm.__wbindgen_export_2;
|
|
2088
|
+
const offset = table.grow(4);
|
|
2089
|
+
table.set(0, undefined);
|
|
2090
|
+
table.set(offset + 0, undefined);
|
|
2091
|
+
table.set(offset + 1, null);
|
|
2092
|
+
table.set(offset + 2, true);
|
|
2093
|
+
table.set(offset + 3, false);
|
|
2094
|
+
};
|
|
1970
2095
|
imports.wbg.__wbindgen_string_new = function (arg0, arg1) {
|
|
1971
2096
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
1972
|
-
return
|
|
2097
|
+
return ret;
|
|
1973
2098
|
};
|
|
1974
2099
|
imports.wbg.__wbindgen_throw = function (arg0, arg1) {
|
|
1975
2100
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
@@ -1980,14 +2105,22 @@ function __wbg_finalize_init(instance, module) {
|
|
|
1980
2105
|
wasm = instance.exports;
|
|
1981
2106
|
__wbg_init.__wbindgen_wasm_module = module;
|
|
1982
2107
|
cachedDataViewMemory0 = null;
|
|
2108
|
+
cachedFloat64ArrayMemory0 = null;
|
|
1983
2109
|
cachedUint8ArrayMemory0 = null;
|
|
2110
|
+
wasm.__wbindgen_start();
|
|
1984
2111
|
return wasm;
|
|
1985
2112
|
}
|
|
1986
2113
|
async function __wbg_init(module_or_path) {
|
|
1987
2114
|
if (wasm !== undefined) return wasm;
|
|
1988
|
-
if (typeof module_or_path !== 'undefined'
|
|
1989
|
-
module_or_path
|
|
1990
|
-
|
|
2115
|
+
if (typeof module_or_path !== 'undefined') {
|
|
2116
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
2117
|
+
({
|
|
2118
|
+
module_or_path
|
|
2119
|
+
} = module_or_path);
|
|
2120
|
+
} else {
|
|
2121
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead');
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
1991
2124
|
if (typeof module_or_path === 'undefined') {
|
|
1992
2125
|
module_or_path = new URL('opengeometry_bg.wasm', import.meta.url);
|
|
1993
2126
|
}
|
|
@@ -12374,7 +12507,7 @@ const _sphere$1 = /*@__PURE__*/ new Sphere();
|
|
|
12374
12507
|
const _intersectPointOnRay = /*@__PURE__*/ new Vector3();
|
|
12375
12508
|
const _intersectPointOnSegment = /*@__PURE__*/ new Vector3();
|
|
12376
12509
|
|
|
12377
|
-
class Line extends Object3D {
|
|
12510
|
+
let Line$1 = class Line extends Object3D {
|
|
12378
12511
|
|
|
12379
12512
|
constructor( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) {
|
|
12380
12513
|
|
|
@@ -12565,7 +12698,7 @@ class Line extends Object3D {
|
|
|
12565
12698
|
|
|
12566
12699
|
}
|
|
12567
12700
|
|
|
12568
|
-
}
|
|
12701
|
+
};
|
|
12569
12702
|
|
|
12570
12703
|
function checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {
|
|
12571
12704
|
|
|
@@ -12602,7 +12735,7 @@ function checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {
|
|
|
12602
12735
|
const _start = /*@__PURE__*/ new Vector3();
|
|
12603
12736
|
const _end = /*@__PURE__*/ new Vector3();
|
|
12604
12737
|
|
|
12605
|
-
class LineSegments extends Line {
|
|
12738
|
+
class LineSegments extends Line$1 {
|
|
12606
12739
|
|
|
12607
12740
|
constructor( geometry, material ) {
|
|
12608
12741
|
|
|
@@ -13359,6 +13492,7 @@ class Pencil {
|
|
|
13359
13492
|
this.onCursorMove = new Event();
|
|
13360
13493
|
this.onElementHover = new Event();
|
|
13361
13494
|
this.onElementSelected = new Event();
|
|
13495
|
+
this.onElementUnselected = new Event();
|
|
13362
13496
|
this.pencilMode = "cursor";
|
|
13363
13497
|
this.container = container;
|
|
13364
13498
|
this.scene = scene;
|
|
@@ -13382,12 +13516,14 @@ class Pencil {
|
|
|
13382
13516
|
// Raycaster
|
|
13383
13517
|
this.raycaster.params.Line.threshold = 0.1;
|
|
13384
13518
|
// A Dummy Ground Plane
|
|
13385
|
-
const geometry = new PlaneGeometry(
|
|
13519
|
+
const geometry = new PlaneGeometry(1000, 1000);
|
|
13520
|
+
// const material = new THREE.MeshBasicMaterial({ color: 0xffff00, side: THREE.DoubleSide, wireframe: true });
|
|
13386
13521
|
const material = new MeshBasicMaterial({ color: 0xffff00, side: DoubleSide, transparent: true, opacity: 0 });
|
|
13387
13522
|
const plane = new Mesh(geometry, material);
|
|
13388
13523
|
plane.name = "pencil-ground";
|
|
13389
13524
|
plane.rotation.x = Math.PI / 2;
|
|
13390
13525
|
this.scene.add(plane);
|
|
13526
|
+
// plane.visible = true;
|
|
13391
13527
|
plane.visible = false;
|
|
13392
13528
|
this.dummyPlane = plane;
|
|
13393
13529
|
}
|
|
@@ -13439,7 +13575,10 @@ class Pencil {
|
|
|
13439
13575
|
return;
|
|
13440
13576
|
}
|
|
13441
13577
|
const intersect = intersects[0];
|
|
13442
|
-
this.onElementHover.trigger(
|
|
13578
|
+
this.onElementHover.trigger({
|
|
13579
|
+
mesh: intersect.object,
|
|
13580
|
+
point: intersect.point
|
|
13581
|
+
});
|
|
13443
13582
|
}
|
|
13444
13583
|
});
|
|
13445
13584
|
this.container.addEventListener("mousedown", (event) => {
|
|
@@ -13456,10 +13595,51 @@ class Pencil {
|
|
|
13456
13595
|
else if (this.pencilMode === "select") {
|
|
13457
13596
|
const intersects = this.raycaster.intersectObjects(this.pencilMeshes);
|
|
13458
13597
|
const intersect = intersects[0];
|
|
13459
|
-
this.onElementSelected.trigger(
|
|
13598
|
+
this.onElementSelected.trigger({
|
|
13599
|
+
mesh: intersect.object,
|
|
13600
|
+
point: intersect.point
|
|
13601
|
+
});
|
|
13602
|
+
}
|
|
13603
|
+
});
|
|
13604
|
+
this.container.addEventListener("mouseup", (event) => {
|
|
13605
|
+
if (this.pencilMode === "select") {
|
|
13606
|
+
const rect = this.container.getBoundingClientRect();
|
|
13607
|
+
const x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
|
|
13608
|
+
const y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
|
|
13609
|
+
this.raycaster.setFromCamera(new Vector2(x, y), this.camera);
|
|
13610
|
+
const intersects = this.raycaster.intersectObjects(this.pencilMeshes);
|
|
13611
|
+
if (intersects.length > 0) {
|
|
13612
|
+
const intersect = intersects[0];
|
|
13613
|
+
this.onElementUnselected.trigger({
|
|
13614
|
+
mesh: intersect.object,
|
|
13615
|
+
point: intersect.point
|
|
13616
|
+
});
|
|
13617
|
+
}
|
|
13460
13618
|
}
|
|
13461
13619
|
});
|
|
13462
13620
|
}
|
|
13621
|
+
fireCursor(mouse) {
|
|
13622
|
+
const rect = this.container.getBoundingClientRect();
|
|
13623
|
+
const x = ((mouse.clientX - rect.left) / rect.width) * 2 - 1;
|
|
13624
|
+
const y = -((mouse.clientY - rect.top) / rect.height) * 2 + 1;
|
|
13625
|
+
this.raycaster.setFromCamera(new Vector2(x, y), this.camera);
|
|
13626
|
+
const intersects = this.raycaster.intersectObjects([this.dummyPlane]);
|
|
13627
|
+
if (intersects.length > 0) {
|
|
13628
|
+
const point = intersects[0].point;
|
|
13629
|
+
this.onCursorDown.trigger(point);
|
|
13630
|
+
}
|
|
13631
|
+
}
|
|
13632
|
+
fireCursorMove(mouse) {
|
|
13633
|
+
const rect = this.container.getBoundingClientRect();
|
|
13634
|
+
const x = ((mouse.clientX - rect.left) / rect.width) * 2 - 1;
|
|
13635
|
+
const y = -((mouse.clientY - rect.top) / rect.height) * 2 + 1;
|
|
13636
|
+
this.raycaster.setFromCamera(new Vector2(x, y), this.camera);
|
|
13637
|
+
const intersects = this.raycaster.intersectObjects([this.dummyPlane]);
|
|
13638
|
+
if (intersects.length > 0) {
|
|
13639
|
+
const point = intersects[0].point;
|
|
13640
|
+
this.onCursorMove.trigger(point);
|
|
13641
|
+
}
|
|
13642
|
+
}
|
|
13463
13643
|
}
|
|
13464
13644
|
|
|
13465
13645
|
function spotLabelElement() {
|
|
@@ -13485,88 +13665,126 @@ const OPEN_GEOMETRY_THREE_VERSION = '0.0.1';
|
|
|
13485
13665
|
/**
|
|
13486
13666
|
* Simple Line defined by Two Points
|
|
13487
13667
|
*/
|
|
13488
|
-
class
|
|
13668
|
+
class Line extends Line$1 {
|
|
13489
13669
|
set color(color) {
|
|
13490
13670
|
if (this.material instanceof LineBasicMaterial) {
|
|
13491
13671
|
this.material.color.set(color);
|
|
13492
13672
|
}
|
|
13493
13673
|
}
|
|
13494
|
-
constructor(
|
|
13674
|
+
constructor(options) {
|
|
13495
13675
|
super();
|
|
13496
|
-
this.points = [];
|
|
13497
13676
|
this.ogid = getUUID();
|
|
13498
|
-
this.
|
|
13499
|
-
this.
|
|
13677
|
+
this.options = options;
|
|
13678
|
+
this.line = new OGLine(this.ogid);
|
|
13679
|
+
this.setConfig();
|
|
13500
13680
|
this.generateGeometry();
|
|
13501
13681
|
}
|
|
13502
|
-
|
|
13503
|
-
this.
|
|
13504
|
-
|
|
13505
|
-
throw new Error("Simple Line can only have two points, clear points or use PolyLine");
|
|
13682
|
+
validateOptions() {
|
|
13683
|
+
if (!this.options) {
|
|
13684
|
+
throw new Error("Options are not defined for Line");
|
|
13506
13685
|
}
|
|
13507
|
-
|
|
13508
|
-
|
|
13509
|
-
this.
|
|
13686
|
+
}
|
|
13687
|
+
setConfig() {
|
|
13688
|
+
this.validateOptions();
|
|
13689
|
+
const { start, end } = this.options;
|
|
13690
|
+
this.line.set_config(start.clone(), end.clone());
|
|
13510
13691
|
}
|
|
13511
13692
|
generateGeometry() {
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
const
|
|
13515
|
-
const
|
|
13516
|
-
|
|
13517
|
-
|
|
13518
|
-
this.
|
|
13519
|
-
this.material = material;
|
|
13693
|
+
this.line.generate_geometry();
|
|
13694
|
+
const geometryData = this.line.get_geometry_serialized();
|
|
13695
|
+
const bufferData = JSON.parse(geometryData);
|
|
13696
|
+
const geometry = new BufferGeometry();
|
|
13697
|
+
geometry.setAttribute("position", new Float32BufferAttribute(bufferData, 3));
|
|
13698
|
+
this.geometry = geometry;
|
|
13699
|
+
this.material = new LineBasicMaterial({ color: 0x00ff00 });
|
|
13520
13700
|
}
|
|
13521
13701
|
}
|
|
13522
13702
|
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
*/
|
|
13526
|
-
class PolyLine extends Line {
|
|
13703
|
+
var _Polyline_color;
|
|
13704
|
+
class Polyline extends Line$1 {
|
|
13527
13705
|
set color(color) {
|
|
13706
|
+
__classPrivateFieldSet(this, _Polyline_color, color, "f");
|
|
13528
13707
|
if (this.material instanceof LineBasicMaterial) {
|
|
13529
13708
|
this.material.color.set(color);
|
|
13530
13709
|
}
|
|
13531
13710
|
}
|
|
13532
|
-
constructor(
|
|
13711
|
+
constructor(options) {
|
|
13533
13712
|
super();
|
|
13534
|
-
this.
|
|
13713
|
+
this.options = { points: [] };
|
|
13535
13714
|
this.isClosed = false;
|
|
13715
|
+
this.transformationMatrix = new Matrix4();
|
|
13716
|
+
// Properties that can be set externally but are not part of the constructor
|
|
13717
|
+
// TODO: Consider making these properties part of the constructor options
|
|
13718
|
+
_Polyline_color.set(this, 0x00ff00);
|
|
13536
13719
|
this.ogid = getUUID();
|
|
13537
|
-
this.
|
|
13538
|
-
|
|
13539
|
-
|
|
13540
|
-
|
|
13720
|
+
this.polyline = new OGPolyline(this.ogid);
|
|
13721
|
+
if (options) {
|
|
13722
|
+
this.options = options;
|
|
13723
|
+
this.setConfig();
|
|
13724
|
+
this.generateGeometry();
|
|
13725
|
+
}
|
|
13541
13726
|
}
|
|
13542
|
-
|
|
13543
|
-
if (this.
|
|
13544
|
-
|
|
13727
|
+
validateOptions() {
|
|
13728
|
+
if (!this.options) {
|
|
13729
|
+
throw new Error("Options are not defined for Polyline");
|
|
13730
|
+
}
|
|
13731
|
+
}
|
|
13732
|
+
setConfig() {
|
|
13733
|
+
this.validateOptions();
|
|
13734
|
+
const { points } = this.options;
|
|
13545
13735
|
this.polyline.set_config(points);
|
|
13546
13736
|
}
|
|
13737
|
+
// addMultiplePoints(points: Vector3[]) {
|
|
13738
|
+
// this.points = points;
|
|
13739
|
+
// if (!this.polyline) return;
|
|
13740
|
+
// this.polyline.add_multiple_points(points);
|
|
13741
|
+
// this.generateGeometry();
|
|
13742
|
+
// }
|
|
13743
|
+
// // TODO: This needs to be improved
|
|
13744
|
+
// translate(translation: Vector3) {
|
|
13745
|
+
// if (!this.polyline) return;
|
|
13746
|
+
// this.polyline.translate(translation);
|
|
13747
|
+
// this.generateGeometry();
|
|
13748
|
+
// }
|
|
13749
|
+
// set_position(position: Vector3) {
|
|
13750
|
+
// if (!this.polyline) return;
|
|
13751
|
+
// this.polyline.set_position(position);
|
|
13752
|
+
// }
|
|
13547
13753
|
addPoint(point) {
|
|
13548
|
-
this.
|
|
13549
|
-
this.polyline.add_point(point);
|
|
13550
|
-
if (this.points.length < 2)
|
|
13754
|
+
if (!this.polyline)
|
|
13551
13755
|
return;
|
|
13756
|
+
this.polyline.add_point(point);
|
|
13757
|
+
// if (this.points.length < 2) return;
|
|
13758
|
+
this.clearGeometry();
|
|
13552
13759
|
this.generateGeometry();
|
|
13553
13760
|
}
|
|
13761
|
+
/**
|
|
13762
|
+
* Every time there are property changes, geometry needs to be discarded and regenerated.
|
|
13763
|
+
* This is to ensure that the geometry is always up-to-date with the current state.
|
|
13764
|
+
*/
|
|
13554
13765
|
clearGeometry() {
|
|
13555
13766
|
this.geometry.dispose();
|
|
13556
13767
|
}
|
|
13768
|
+
saveTransformationToBREP() {
|
|
13769
|
+
if (!this.polyline)
|
|
13770
|
+
return;
|
|
13771
|
+
// this.polyline.set_transformation_matrix(this.transformationMatrix.toArray());
|
|
13772
|
+
}
|
|
13557
13773
|
generateGeometry() {
|
|
13558
|
-
this.
|
|
13559
|
-
const
|
|
13560
|
-
const
|
|
13561
|
-
const
|
|
13562
|
-
|
|
13563
|
-
this.geometry =
|
|
13564
|
-
this.material =
|
|
13774
|
+
this.polyline.generate_geometry();
|
|
13775
|
+
const geometryData = this.polyline.get_geometry_serialized();
|
|
13776
|
+
const bufferData = JSON.parse(geometryData);
|
|
13777
|
+
const geometry = new BufferGeometry();
|
|
13778
|
+
geometry.setAttribute("position", new Float32BufferAttribute(bufferData, 3));
|
|
13779
|
+
this.geometry = geometry;
|
|
13780
|
+
this.material = new LineBasicMaterial({ color: __classPrivateFieldGet(this, _Polyline_color, "f") });
|
|
13565
13781
|
this.isClosed = this.polyline.is_closed();
|
|
13566
13782
|
}
|
|
13567
13783
|
}
|
|
13784
|
+
_Polyline_color = new WeakMap();
|
|
13568
13785
|
|
|
13569
|
-
|
|
13786
|
+
var _Arc_color;
|
|
13787
|
+
class Arc extends Line$1 {
|
|
13570
13788
|
set color(color) {
|
|
13571
13789
|
if (this.material instanceof LineBasicMaterial) {
|
|
13572
13790
|
this.material.color.set(color);
|
|
@@ -13574,103 +13792,136 @@ class BaseCircle extends Line {
|
|
|
13574
13792
|
}
|
|
13575
13793
|
constructor(options) {
|
|
13576
13794
|
super();
|
|
13577
|
-
//
|
|
13578
|
-
this
|
|
13795
|
+
// TODO: Create local properties for all Primitive classes
|
|
13796
|
+
_Arc_color.set(this, 0x00ff00);
|
|
13579
13797
|
this.ogid = getUUID();
|
|
13580
13798
|
this.options = options;
|
|
13581
|
-
this.
|
|
13799
|
+
this.arc = new OGArc(this.ogid);
|
|
13582
13800
|
this.setConfig();
|
|
13583
13801
|
this.generateGeometry();
|
|
13584
13802
|
}
|
|
13803
|
+
validateOptions() {
|
|
13804
|
+
if (!this.options) {
|
|
13805
|
+
throw new Error("Options are not defined for Circle Arc");
|
|
13806
|
+
}
|
|
13807
|
+
}
|
|
13585
13808
|
setConfig() {
|
|
13586
|
-
|
|
13587
|
-
|
|
13809
|
+
this.validateOptions();
|
|
13810
|
+
const { center, radius, segments, startAngle, endAngle } = this.options;
|
|
13811
|
+
this.arc.set_config(center.clone(), radius, startAngle, endAngle, segments);
|
|
13588
13812
|
}
|
|
13589
13813
|
generateGeometry() {
|
|
13590
|
-
this.
|
|
13591
|
-
const
|
|
13592
|
-
const
|
|
13593
|
-
|
|
13594
|
-
|
|
13595
|
-
|
|
13596
|
-
this.
|
|
13597
|
-
this.material = material;
|
|
13814
|
+
this.arc.generate_geometry();
|
|
13815
|
+
const geometryData = this.arc.get_geometry_serialized();
|
|
13816
|
+
const bufferData = JSON.parse(geometryData);
|
|
13817
|
+
const geometry = new BufferGeometry();
|
|
13818
|
+
geometry.setAttribute("position", new Float32BufferAttribute(bufferData, 3));
|
|
13819
|
+
this.geometry = geometry;
|
|
13820
|
+
this.material = new LineBasicMaterial({ color: __classPrivateFieldGet(this, _Arc_color, "f") });
|
|
13598
13821
|
}
|
|
13599
13822
|
discardGeoemtry() {
|
|
13600
13823
|
this.geometry.dispose();
|
|
13601
13824
|
}
|
|
13602
|
-
set radius(radius) {
|
|
13603
|
-
this.options.radius = radius;
|
|
13604
|
-
this.circleArc.update_radius(radius);
|
|
13605
|
-
this.generateGeometry();
|
|
13606
|
-
// if (this.nodeChild) {
|
|
13607
|
-
// this.nodeChild.update();
|
|
13608
|
-
// }
|
|
13609
|
-
}
|
|
13610
13825
|
}
|
|
13826
|
+
_Arc_color = new WeakMap();
|
|
13611
13827
|
|
|
13612
|
-
var _Rectangle_color;
|
|
13613
13828
|
/**
|
|
13614
|
-
*
|
|
13829
|
+
* Base class for all line-based primitives in OpenGeometry.
|
|
13615
13830
|
*/
|
|
13616
|
-
class
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
13620
|
-
|
|
13621
|
-
|
|
13622
|
-
|
|
13623
|
-
|
|
13624
|
-
|
|
13625
|
-
|
|
13626
|
-
|
|
13831
|
+
class BaseLinePrimitive extends Line$1 {
|
|
13832
|
+
}
|
|
13833
|
+
|
|
13834
|
+
class Rectangle extends BaseLinePrimitive {
|
|
13835
|
+
// set width(width: number) {
|
|
13836
|
+
// this.options.width = width;
|
|
13837
|
+
// this.polyLineRectangle.update_width(width);
|
|
13838
|
+
// this.generateGeometry();
|
|
13839
|
+
// }
|
|
13840
|
+
// set breadth(breadth: number) {
|
|
13841
|
+
// this.options.breadth = breadth;
|
|
13842
|
+
// this.polyLineRectangle.update_breadth(breadth);
|
|
13843
|
+
// this.generateGeometry();
|
|
13844
|
+
// }
|
|
13845
|
+
// set center(center: Vector3) {
|
|
13846
|
+
// this.options.center = center;
|
|
13847
|
+
// this.polyLineRectangle.update_center(center);
|
|
13848
|
+
// this.generateGeometry();
|
|
13849
|
+
// }
|
|
13627
13850
|
set color(color) {
|
|
13851
|
+
this.options.color = color;
|
|
13628
13852
|
if (this.material instanceof LineBasicMaterial) {
|
|
13629
13853
|
this.material.color.set(color);
|
|
13630
|
-
__classPrivateFieldSet(this, _Rectangle_color, color, "f");
|
|
13631
13854
|
}
|
|
13632
13855
|
}
|
|
13856
|
+
// FINAL: This flow should be used for other primitives
|
|
13633
13857
|
constructor(options) {
|
|
13858
|
+
var _a;
|
|
13634
13859
|
super();
|
|
13635
|
-
|
|
13636
|
-
|
|
13637
|
-
|
|
13638
|
-
|
|
13639
|
-
|
|
13640
|
-
|
|
13860
|
+
this.options = {
|
|
13861
|
+
width: 1,
|
|
13862
|
+
breadth: 1,
|
|
13863
|
+
center: new Vector3$1(0, 0, 0),
|
|
13864
|
+
color: 0x00ff00,
|
|
13865
|
+
};
|
|
13866
|
+
const ogid = (_a = options === null || options === void 0 ? void 0 : options.ogid) !== null && _a !== void 0 ? _a : getUUID();
|
|
13867
|
+
this.polyLineRectangle = new OGRectangle(ogid);
|
|
13868
|
+
// const mergedOptions = { ...this.options, ...options, ogid };
|
|
13869
|
+
if (options) {
|
|
13870
|
+
this.options = Object.assign(Object.assign({}, this.options), options);
|
|
13871
|
+
this.ogid = options.ogid || getUUID();
|
|
13872
|
+
}
|
|
13873
|
+
else {
|
|
13874
|
+
this.ogid = getUUID();
|
|
13875
|
+
}
|
|
13641
13876
|
this.setConfig();
|
|
13642
13877
|
this.generateGeometry();
|
|
13643
13878
|
}
|
|
13879
|
+
validateOptions() {
|
|
13880
|
+
if (!this.options) {
|
|
13881
|
+
throw new Error("Options are not defined for Rectangle");
|
|
13882
|
+
}
|
|
13883
|
+
}
|
|
13644
13884
|
setConfig() {
|
|
13645
|
-
|
|
13646
|
-
|
|
13885
|
+
this.validateOptions();
|
|
13886
|
+
const { width, breadth, center, color } = this.options;
|
|
13887
|
+
this.polyLineRectangle.set_config(center.clone() || new Vector3$1(0, 0, 0), width, breadth);
|
|
13888
|
+
}
|
|
13889
|
+
getConfig() {
|
|
13890
|
+
return this.options;
|
|
13647
13891
|
}
|
|
13648
13892
|
generateGeometry() {
|
|
13649
|
-
this.polyLineRectangle.
|
|
13650
|
-
const
|
|
13651
|
-
const
|
|
13652
|
-
|
|
13653
|
-
const
|
|
13654
|
-
|
|
13655
|
-
this.
|
|
13893
|
+
this.polyLineRectangle.generate_geometry();
|
|
13894
|
+
const geometryData = this.polyLineRectangle.get_geometry_serialized();
|
|
13895
|
+
const bufferData = JSON.parse(geometryData);
|
|
13896
|
+
console.log(bufferData);
|
|
13897
|
+
const geometry = new BufferGeometry();
|
|
13898
|
+
geometry.setAttribute("position", new Float32BufferAttribute(bufferData, 3));
|
|
13899
|
+
this.geometry = geometry;
|
|
13900
|
+
this.material = new LineBasicMaterial({ color: 0x00ff00 });
|
|
13901
|
+
}
|
|
13902
|
+
getBrep() {
|
|
13903
|
+
const brepData = this.polyLineRectangle.get_brep_serialized();
|
|
13904
|
+
if (!brepData) {
|
|
13905
|
+
throw new Error("Brep data is not available for Rectangle");
|
|
13906
|
+
}
|
|
13907
|
+
return JSON.parse(brepData);
|
|
13656
13908
|
}
|
|
13657
13909
|
discardGeometry() {
|
|
13658
13910
|
this.geometry.dispose();
|
|
13659
13911
|
}
|
|
13660
13912
|
}
|
|
13661
|
-
_Rectangle_color = new WeakMap();
|
|
13662
13913
|
|
|
13663
|
-
var
|
|
13664
|
-
class
|
|
13914
|
+
var _CylinderOld_outlineMesh;
|
|
13915
|
+
class CylinderOld extends Mesh {
|
|
13665
13916
|
constructor(options) {
|
|
13666
13917
|
super();
|
|
13667
|
-
|
|
13918
|
+
_CylinderOld_outlineMesh.set(this, null);
|
|
13668
13919
|
// Store local center offset to align outlines
|
|
13669
13920
|
// TODO: Can this be moved to Engine? It can increase performance | Needs to be used in other shapes too
|
|
13670
13921
|
this._geometryCenterOffset = new Vector3();
|
|
13671
13922
|
this.ogid = getUUID();
|
|
13672
13923
|
this.options = options;
|
|
13673
|
-
this.cylinder = new
|
|
13924
|
+
this.cylinder = new OGCylinderOld(this.ogid);
|
|
13674
13925
|
this.setConfig();
|
|
13675
13926
|
this.generateGeometry();
|
|
13676
13927
|
}
|
|
@@ -13682,7 +13933,7 @@ class Cylinder extends Mesh {
|
|
|
13682
13933
|
setConfig() {
|
|
13683
13934
|
this.validateOptions();
|
|
13684
13935
|
const { radius, height, segments, angle, center } = this.options;
|
|
13685
|
-
this.cylinder.set_config((center === null || center === void 0 ? void 0 : center.clone()) || new
|
|
13936
|
+
this.cylinder.set_config((center === null || center === void 0 ? void 0 : center.clone()) || new Vector3$1(0, 0, 0), radius, height, angle, segments);
|
|
13686
13937
|
}
|
|
13687
13938
|
generateGeometry() {
|
|
13688
13939
|
var _a, _b, _c;
|
|
@@ -13709,20 +13960,20 @@ class Cylinder extends Mesh {
|
|
|
13709
13960
|
this.position.set(((_a = this.options.center) === null || _a === void 0 ? void 0 : _a.x) || 0, ((_b = this.options.center) === null || _b === void 0 ? void 0 : _b.y) || 0, ((_c = this.options.center) === null || _c === void 0 ? void 0 : _c.z) || 0);
|
|
13710
13961
|
}
|
|
13711
13962
|
set outline(enable) {
|
|
13712
|
-
if (enable && !__classPrivateFieldGet(this,
|
|
13963
|
+
if (enable && !__classPrivateFieldGet(this, _CylinderOld_outlineMesh, "f")) {
|
|
13713
13964
|
const outline_buff = this.cylinder.outline_edges();
|
|
13714
13965
|
const outline_buf = JSON.parse(outline_buff);
|
|
13715
13966
|
const outlineGeometry = new BufferGeometry();
|
|
13716
13967
|
outlineGeometry.setAttribute("position", new Float32BufferAttribute(outline_buf, 3));
|
|
13717
13968
|
outlineGeometry.translate(-this._geometryCenterOffset.x, -this._geometryCenterOffset.y, -this._geometryCenterOffset.z);
|
|
13718
13969
|
const outlineMaterial = new LineBasicMaterial({ color: 0x000000 });
|
|
13719
|
-
__classPrivateFieldSet(this,
|
|
13720
|
-
this.add(__classPrivateFieldGet(this,
|
|
13970
|
+
__classPrivateFieldSet(this, _CylinderOld_outlineMesh, new LineSegments(outlineGeometry, outlineMaterial), "f");
|
|
13971
|
+
this.add(__classPrivateFieldGet(this, _CylinderOld_outlineMesh, "f"));
|
|
13721
13972
|
}
|
|
13722
|
-
if (!enable && __classPrivateFieldGet(this,
|
|
13723
|
-
this.remove(__classPrivateFieldGet(this,
|
|
13724
|
-
__classPrivateFieldGet(this,
|
|
13725
|
-
__classPrivateFieldSet(this,
|
|
13973
|
+
if (!enable && __classPrivateFieldGet(this, _CylinderOld_outlineMesh, "f")) {
|
|
13974
|
+
this.remove(__classPrivateFieldGet(this, _CylinderOld_outlineMesh, "f"));
|
|
13975
|
+
__classPrivateFieldGet(this, _CylinderOld_outlineMesh, "f").geometry.dispose();
|
|
13976
|
+
__classPrivateFieldSet(this, _CylinderOld_outlineMesh, null, "f");
|
|
13726
13977
|
}
|
|
13727
13978
|
}
|
|
13728
13979
|
getBrepData() {
|
|
@@ -13731,32 +13982,37 @@ class Cylinder extends Mesh {
|
|
|
13731
13982
|
console.log(brepDataParsed);
|
|
13732
13983
|
}
|
|
13733
13984
|
}
|
|
13734
|
-
|
|
13985
|
+
_CylinderOld_outlineMesh = new WeakMap();
|
|
13735
13986
|
|
|
13736
|
-
var _Polygon_outlineMesh;
|
|
13987
|
+
var _Polygon_outlineMesh, _Polygon_color;
|
|
13737
13988
|
class Polygon extends Mesh {
|
|
13738
|
-
|
|
13739
|
-
|
|
13989
|
+
set color(color) {
|
|
13990
|
+
__classPrivateFieldSet(this, _Polygon_color, color, "f");
|
|
13991
|
+
if (this.material instanceof MeshStandardMaterial) {
|
|
13992
|
+
this.material.color.set(color);
|
|
13993
|
+
}
|
|
13994
|
+
}
|
|
13995
|
+
// TODO: Make Options Optional
|
|
13996
|
+
// constructor(vertices?: Vector3[]) // If no vertices are provided, it will be an empty polygon
|
|
13997
|
+
constructor(options) {
|
|
13740
13998
|
super();
|
|
13741
|
-
this.
|
|
13742
|
-
this.layerBackVertices = [];
|
|
13743
|
-
this.polygon = null;
|
|
13744
|
-
this.isTriangulated = false;
|
|
13999
|
+
this.options = { vertices: [] };
|
|
13745
14000
|
_Polygon_outlineMesh.set(this, null);
|
|
14001
|
+
_Polygon_color.set(this, 0x00ff00);
|
|
14002
|
+
this.transformationMatrix = new Matrix4();
|
|
14003
|
+
// private _placement: THREE.Vector3 = new THREE.Vector3(0, 0, 0);
|
|
14004
|
+
// private _yaw: number = 0;
|
|
14005
|
+
// Store local center offset to align outlines
|
|
14006
|
+
// TODO: Can this be moved to Engine? It can increase performance | Needs to be used in other shapes too
|
|
13746
14007
|
this._geometryCenterOffset = new Vector3();
|
|
13747
14008
|
this.ogid = getUUID();
|
|
13748
|
-
|
|
13749
|
-
|
|
13750
|
-
this.polygon.add_vertices(vertices);
|
|
13751
|
-
// Triangulate the polygon - WORKS
|
|
13752
|
-
(_a = this.polygon) === null || _a === void 0 ? void 0 : _a.triangulate();
|
|
13753
|
-
const bufFlush = (_b = this.polygon) === null || _b === void 0 ? void 0 : _b.get_buffer_flush();
|
|
13754
|
-
this.addFlushBufferToScene(bufFlush);
|
|
13755
|
-
// Testing New Triangulation - FAILING
|
|
13756
|
-
// const triResult = JSON.parse(this.polygon.new_triangulate());
|
|
13757
|
-
// console.log(triResult);
|
|
14009
|
+
if (options) {
|
|
14010
|
+
this.options = options;
|
|
13758
14011
|
}
|
|
13759
|
-
|
|
14012
|
+
this.polygon = new OGPolygon(this.ogid);
|
|
14013
|
+
this.setConfig();
|
|
14014
|
+
this.generateGeometry();
|
|
14015
|
+
// TODO: THIS MIGHT HELP WITH SHARING THE POSITION with KERNEL when something is changed
|
|
13760
14016
|
// const originalSet = this.position.set.bind(this.position);
|
|
13761
14017
|
// this.position.set = (x: number, y: number, z: number) => {
|
|
13762
14018
|
// console.log(`Position set to (${x}, ${y}, ${z})`);
|
|
@@ -13770,152 +14026,468 @@ class Polygon extends Mesh {
|
|
|
13770
14026
|
// return originalCopy(v);
|
|
13771
14027
|
// };
|
|
13772
14028
|
}
|
|
14029
|
+
validateOptions() {
|
|
14030
|
+
if (!this.options) {
|
|
14031
|
+
throw new Error("Options are not defined for Polygon");
|
|
14032
|
+
}
|
|
14033
|
+
}
|
|
14034
|
+
setConfig() {
|
|
14035
|
+
this.validateOptions();
|
|
14036
|
+
const { vertices } = this.options;
|
|
14037
|
+
this.polygon.set_config(vertices);
|
|
14038
|
+
}
|
|
14039
|
+
// /**
|
|
14040
|
+
// * Sets the placement of the polygon in 3D space.
|
|
14041
|
+
// * @param x X-coordinate
|
|
14042
|
+
// * @param y Y-coordinate
|
|
14043
|
+
// * @param z Z-coordinate
|
|
14044
|
+
// */
|
|
14045
|
+
// placement(x: number, y: number, z: number) {
|
|
14046
|
+
// this._placement.set(x, y, z);
|
|
14047
|
+
// // Do the recalculation of position based on the placement
|
|
14048
|
+
// const clonedObject = this.clone();
|
|
14049
|
+
// clonedObject.rotation.set(0, 0, 0);
|
|
14050
|
+
// clonedObject.geometry.computeBoundingBox();
|
|
14051
|
+
// if (!clonedObject.geometry.boundingBox) return;
|
|
14052
|
+
// const center = new THREE.Vector3();
|
|
14053
|
+
// clonedObject.geometry.boundingBox.getCenter(center);
|
|
14054
|
+
// const min = clonedObject.geometry.boundingBox.min;
|
|
14055
|
+
// this.position.set(
|
|
14056
|
+
// center.x + this._placement.x - min.x,
|
|
14057
|
+
// // this._placement.y,
|
|
14058
|
+
// 0.01, // Set Y to a small value to avoid z-fighting
|
|
14059
|
+
// center.z + this._placement.z - min.z
|
|
14060
|
+
// );
|
|
14061
|
+
// }
|
|
14062
|
+
// positionToPlacement() {
|
|
14063
|
+
// const clonedObject = this.clone();
|
|
14064
|
+
// clonedObject.rotation.set(0, 0, 0);
|
|
14065
|
+
// clonedObject.geometry.computeBoundingBox();
|
|
14066
|
+
// if (!clonedObject.geometry.boundingBox) return;
|
|
14067
|
+
// const min = clonedObject.geometry.boundingBox.min;
|
|
14068
|
+
// this._placement.set(
|
|
14069
|
+
// this.position.x + min.x,
|
|
14070
|
+
// this.position.y + min.y,
|
|
14071
|
+
// this.position.z + min.z
|
|
14072
|
+
// );
|
|
14073
|
+
// // console.log("Placement set to:", this._placement.x, this._placement.y, this._placement.z);
|
|
14074
|
+
// }
|
|
14075
|
+
// /**
|
|
14076
|
+
// * Rotates the polygon around the Y-axis.
|
|
14077
|
+
// * @param angle Rotation angle in Degrees
|
|
14078
|
+
// */
|
|
14079
|
+
// set yaw(angle: number) {
|
|
14080
|
+
// this._yaw = angle;
|
|
14081
|
+
// this.rotation.set(0, 0, 0);
|
|
14082
|
+
// this.rotation.y = THREE.MathUtils.degToRad(this._yaw);
|
|
14083
|
+
// }
|
|
14084
|
+
// get yaw() {
|
|
14085
|
+
// return this._yaw;
|
|
14086
|
+
// }
|
|
14087
|
+
generateGeometry() {
|
|
14088
|
+
// this.updateMatrix();
|
|
14089
|
+
// this.transformationMatrix.copy(this.matrix);
|
|
14090
|
+
// console.log("Transformation matrix set for polygon:", this.transformationMatrix.elements);
|
|
14091
|
+
this.polygon.generate_geometry();
|
|
14092
|
+
const geometryData = this.polygon.get_geometry_serialized();
|
|
14093
|
+
const bufferData = JSON.parse(geometryData);
|
|
14094
|
+
// TODO: If The Geometry is empty, no need to adjust position
|
|
14095
|
+
if (bufferData.length === 0) {
|
|
14096
|
+
console.warn("Geometry has no position attribute, skipping position adjustment.");
|
|
14097
|
+
return;
|
|
14098
|
+
}
|
|
14099
|
+
const geometry = new BufferGeometry();
|
|
14100
|
+
geometry.setAttribute("position", new Float32BufferAttribute(bufferData, 3));
|
|
14101
|
+
const material = new MeshStandardMaterial({
|
|
14102
|
+
color: __classPrivateFieldGet(this, _Polygon_color, "f"),
|
|
14103
|
+
transparent: true,
|
|
14104
|
+
opacity: 0.6,
|
|
14105
|
+
});
|
|
14106
|
+
geometry.computeVertexNormals();
|
|
14107
|
+
geometry.computeBoundingBox();
|
|
14108
|
+
this.geometry = geometry;
|
|
14109
|
+
this.material = material;
|
|
14110
|
+
// this.geometry.computeBoundingBox();
|
|
14111
|
+
// const originalCenter = new THREE.Vector3();
|
|
14112
|
+
// this.geometry.boundingBox?.getCenter(originalCenter);
|
|
14113
|
+
// console.log("Original Center:", originalCenter.x, originalCenter.y, originalCenter.z);
|
|
14114
|
+
// this.geometry.center();
|
|
14115
|
+
// this.geometry.computeBoundingBox();
|
|
14116
|
+
// const newCenter = new THREE.Vector3();
|
|
14117
|
+
// this.geometry.boundingBox?.getCenter(newCenter);
|
|
14118
|
+
// console.log("New Center after centering:", newCenter.x, newCenter.y, newCenter.z);
|
|
14119
|
+
// if (!this.geometry.boundingBox) return;
|
|
14120
|
+
// const min = this.geometry.boundingBox.min;
|
|
14121
|
+
// // console.log("Position before centering:", this.position.x, this.position.y, this.position.z);
|
|
14122
|
+
// console.log("Bounding Box Min:", min.x, min.y, min.z);
|
|
14123
|
+
// this.position.set(-min.x, 0, -min.z);
|
|
14124
|
+
// if (this._placement) {
|
|
14125
|
+
// this.placement(this._placement.x, this._placement.y, this._placement.z);
|
|
14126
|
+
// }
|
|
14127
|
+
// console.log("New Position after centering:", this.position.x, this.position.y, this.position.z);
|
|
14128
|
+
}
|
|
13773
14129
|
addVertices(vertices) {
|
|
13774
|
-
var _a, _b;
|
|
13775
14130
|
if (!this.polygon)
|
|
13776
14131
|
return;
|
|
14132
|
+
this.disposeGeometryMaterial();
|
|
13777
14133
|
this.polygon.add_vertices(vertices);
|
|
13778
|
-
|
|
13779
|
-
const bufFlush = (_b = this.polygon) === null || _b === void 0 ? void 0 : _b.get_buffer_flush();
|
|
13780
|
-
this.addFlushBufferToScene(bufFlush);
|
|
14134
|
+
this.generateGeometry();
|
|
13781
14135
|
}
|
|
13782
|
-
|
|
13783
|
-
var _a;
|
|
14136
|
+
saveTransformationToBREP() {
|
|
13784
14137
|
if (!this.polygon)
|
|
13785
14138
|
return;
|
|
13786
|
-
this.layerVertices = [];
|
|
13787
|
-
this.geometry.dispose();
|
|
13788
|
-
(_a = this.polygon) === null || _a === void 0 ? void 0 : _a.reset_polygon();
|
|
13789
|
-
this.isTriangulated = false;
|
|
13790
14139
|
}
|
|
13791
|
-
|
|
13792
|
-
|
|
13793
|
-
|
|
13794
|
-
|
|
14140
|
+
// /**
|
|
14141
|
+
// * Rotates the object around the Y-axis.
|
|
14142
|
+
// * @param angle Rotation angle in Degrees
|
|
14143
|
+
// * @returns
|
|
14144
|
+
// * @summary If rotation methods from threejs is used, it will rotate around the first vertex which might not be desired.
|
|
14145
|
+
// */
|
|
14146
|
+
// rotateOnYAxis(angle: number) {
|
|
14147
|
+
// if (!this.polygon) return;
|
|
14148
|
+
// }
|
|
14149
|
+
// resetVertices() {
|
|
14150
|
+
// if (!this.polygon) return;
|
|
14151
|
+
// this.layerVertices = [];
|
|
14152
|
+
// this.geometry.dispose();
|
|
14153
|
+
// this.polygon?.clear_vertices();
|
|
14154
|
+
// this.isTriangulated = false;
|
|
14155
|
+
// }
|
|
14156
|
+
// addVertex(threeVertex: Vector3) {
|
|
14157
|
+
// if (this.isTriangulated) {
|
|
14158
|
+
// this.layerVertices = [];
|
|
14159
|
+
// this.geometry.dispose();
|
|
14160
|
+
// this.polygon?.clear_vertices();
|
|
14161
|
+
// this.isTriangulated = false;
|
|
14162
|
+
// for (const vertex of this.layerBackVertices) {
|
|
14163
|
+
// this.layerVertices.push(vertex.clone());
|
|
14164
|
+
// }
|
|
14165
|
+
// };
|
|
14166
|
+
// const backupVertex = new Vector3(
|
|
14167
|
+
// parseFloat(threeVertex.x.toFixed(2)),
|
|
14168
|
+
// 0,
|
|
14169
|
+
// parseFloat(threeVertex.z.toFixed(2))
|
|
14170
|
+
// );
|
|
14171
|
+
// this.layerBackVertices.push(backupVertex);
|
|
14172
|
+
// const vertex = new Vector3(
|
|
14173
|
+
// parseFloat(threeVertex.x.toFixed(2)),
|
|
14174
|
+
// // when doing the parse operation getting -0 instead of 0
|
|
14175
|
+
// 0,
|
|
14176
|
+
// parseFloat(threeVertex.z.toFixed(2))
|
|
14177
|
+
// );
|
|
14178
|
+
// this.layerVertices.push(vertex);
|
|
14179
|
+
// if (this.layerVertices.length > 3) {
|
|
14180
|
+
// this.polygon?.add_vertices(this.layerVertices);
|
|
14181
|
+
// const bufFlush = this.polygon?.triangulate();
|
|
14182
|
+
// if (!bufFlush) {
|
|
14183
|
+
// return;
|
|
14184
|
+
// }
|
|
14185
|
+
// this.addFlushBufferToScene(bufFlush);
|
|
14186
|
+
// this.isTriangulated = true;
|
|
14187
|
+
// }
|
|
14188
|
+
// }
|
|
14189
|
+
// addHole(holeVertices: Vector3[]) {
|
|
14190
|
+
// if (!this.polygon) return;
|
|
14191
|
+
// this.polygon.add_holes(holeVertices);
|
|
14192
|
+
// const triResult = JSON.parse(this.polygon.triangulate_with_holes());
|
|
14193
|
+
// console.log(triResult);
|
|
14194
|
+
// const newBufferFlush = triResult.new_buffer;
|
|
14195
|
+
// const geometry = new THREE.BufferGeometry();
|
|
14196
|
+
// geometry.setAttribute("position", new THREE.BufferAttribute(new Float32Array(newBufferFlush), 3));
|
|
14197
|
+
// this.geometry = geometry;
|
|
14198
|
+
// // const bufFlush = this.polygon.get_buffer_flush();
|
|
14199
|
+
// // this.addFlushBufferToScene(bufFlush);
|
|
14200
|
+
// }
|
|
14201
|
+
// extrude(height: number) {
|
|
14202
|
+
// if (!this.polygon) return;
|
|
14203
|
+
// const extruded_buff = this.polygon.extrude_by_height(height);
|
|
14204
|
+
// console.log(extruded_buff);
|
|
14205
|
+
// this.generateExtrudedGeometry(extruded_buff);
|
|
14206
|
+
// }
|
|
14207
|
+
// generateExtrudedGeometry(extruded_buff: string) {
|
|
14208
|
+
// // THIS WORKS
|
|
14209
|
+
// const flushBuffer = JSON.parse(extruded_buff);
|
|
14210
|
+
// console.log(flushBuffer);
|
|
14211
|
+
// const geometry = new THREE.BufferGeometry();
|
|
14212
|
+
// geometry.setAttribute("position", new THREE.BufferAttribute(new Float32Array(flushBuffer), 3));
|
|
14213
|
+
// geometry.computeVertexNormals();
|
|
14214
|
+
// this.geometry = geometry;
|
|
14215
|
+
// const material = new THREE.MeshStandardMaterial({
|
|
14216
|
+
// color: 0x00ff00,
|
|
14217
|
+
// side: THREE.FrontSide,
|
|
14218
|
+
// transparent: true,
|
|
14219
|
+
// opacity: 0.5,
|
|
14220
|
+
// // wireframe: true
|
|
14221
|
+
// });
|
|
14222
|
+
// this.material = material;
|
|
14223
|
+
// }
|
|
14224
|
+
getBrepData() {
|
|
14225
|
+
if (!this.polygon)
|
|
14226
|
+
return null;
|
|
14227
|
+
const brepData = this.polygon.get_brep_serialized();
|
|
14228
|
+
return brepData;
|
|
14229
|
+
}
|
|
14230
|
+
set outlineColor(color) {
|
|
14231
|
+
if (__classPrivateFieldGet(this, _Polygon_outlineMesh, "f") && __classPrivateFieldGet(this, _Polygon_outlineMesh, "f").material instanceof LineBasicMaterial) {
|
|
14232
|
+
__classPrivateFieldGet(this, _Polygon_outlineMesh, "f").material.color.set(color);
|
|
14233
|
+
}
|
|
14234
|
+
}
|
|
14235
|
+
get outlineColor() {
|
|
14236
|
+
if (__classPrivateFieldGet(this, _Polygon_outlineMesh, "f") && __classPrivateFieldGet(this, _Polygon_outlineMesh, "f").material instanceof LineBasicMaterial) {
|
|
14237
|
+
return __classPrivateFieldGet(this, _Polygon_outlineMesh, "f").material.color.getHex();
|
|
14238
|
+
}
|
|
14239
|
+
return 0x000000; // Default color if outline mesh is not present
|
|
14240
|
+
}
|
|
14241
|
+
set outline(enable) {
|
|
14242
|
+
if (enable && !__classPrivateFieldGet(this, _Polygon_outlineMesh, "f")) {
|
|
14243
|
+
const outline_buff = this.polygon.get_outline_geometry_serialized();
|
|
14244
|
+
const outline_buf = JSON.parse(outline_buff);
|
|
14245
|
+
const outlineGeometry = new BufferGeometry();
|
|
14246
|
+
outlineGeometry.setAttribute("position", new Float32BufferAttribute(outline_buf, 3));
|
|
14247
|
+
const outlineMaterial = new LineBasicMaterial({ color: 0x000000 });
|
|
14248
|
+
__classPrivateFieldSet(this, _Polygon_outlineMesh, new LineSegments(outlineGeometry, outlineMaterial), "f");
|
|
14249
|
+
// this.#outlineMesh.geometry.center();
|
|
14250
|
+
// this.#outlineMesh.applyMatrix4(this.transformationMatrix);
|
|
14251
|
+
this.add(__classPrivateFieldGet(this, _Polygon_outlineMesh, "f"));
|
|
14252
|
+
}
|
|
14253
|
+
if (!enable && __classPrivateFieldGet(this, _Polygon_outlineMesh, "f")) {
|
|
14254
|
+
this.remove(__classPrivateFieldGet(this, _Polygon_outlineMesh, "f"));
|
|
14255
|
+
__classPrivateFieldGet(this, _Polygon_outlineMesh, "f").geometry.dispose();
|
|
14256
|
+
__classPrivateFieldSet(this, _Polygon_outlineMesh, null, "f");
|
|
14257
|
+
}
|
|
14258
|
+
}
|
|
14259
|
+
get outline() {
|
|
14260
|
+
if (__classPrivateFieldGet(this, _Polygon_outlineMesh, "f")) {
|
|
14261
|
+
return true;
|
|
14262
|
+
}
|
|
14263
|
+
return false;
|
|
14264
|
+
}
|
|
14265
|
+
// bTree() {
|
|
14266
|
+
// if (!this.polygon) return;
|
|
14267
|
+
// const bTree = this.polygon.binary_tree();
|
|
14268
|
+
// const parsedData = JSON.parse(bTree);
|
|
14269
|
+
// console.log(parsedData);
|
|
14270
|
+
// }
|
|
14271
|
+
disposeGeometryMaterial() {
|
|
14272
|
+
if (this.geometry) {
|
|
13795
14273
|
this.geometry.dispose();
|
|
13796
|
-
(_a = this.polygon) === null || _a === void 0 ? void 0 : _a.reset_polygon();
|
|
13797
|
-
this.isTriangulated = false;
|
|
13798
|
-
for (const vertex of this.layerBackVertices) {
|
|
13799
|
-
this.layerVertices.push(vertex.clone());
|
|
13800
|
-
}
|
|
13801
14274
|
}
|
|
13802
|
-
|
|
13803
|
-
|
|
13804
|
-
|
|
13805
|
-
|
|
13806
|
-
|
|
13807
|
-
|
|
13808
|
-
|
|
13809
|
-
(_b = this.polygon) === null || _b === void 0 ? void 0 : _b.add_vertices(this.layerVertices);
|
|
13810
|
-
const bufFlush = (_c = this.polygon) === null || _c === void 0 ? void 0 : _c.triangulate();
|
|
13811
|
-
if (!bufFlush) {
|
|
13812
|
-
return;
|
|
14275
|
+
if (this.material instanceof Material) {
|
|
14276
|
+
this.material.dispose();
|
|
14277
|
+
}
|
|
14278
|
+
if (__classPrivateFieldGet(this, _Polygon_outlineMesh, "f")) {
|
|
14279
|
+
__classPrivateFieldGet(this, _Polygon_outlineMesh, "f").geometry.dispose();
|
|
14280
|
+
if (__classPrivateFieldGet(this, _Polygon_outlineMesh, "f").material instanceof Material) {
|
|
14281
|
+
__classPrivateFieldGet(this, _Polygon_outlineMesh, "f").material.dispose();
|
|
13813
14282
|
}
|
|
13814
|
-
this.addFlushBufferToScene(bufFlush);
|
|
13815
|
-
this.isTriangulated = true;
|
|
13816
14283
|
}
|
|
13817
14284
|
}
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
this.
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
14285
|
+
dispose() {
|
|
14286
|
+
// // console.log("Disposing OG - Polygon");
|
|
14287
|
+
// this.geometry.dispose();
|
|
14288
|
+
// if (this.material instanceof THREE.Material) {
|
|
14289
|
+
// this.material.dispose();
|
|
14290
|
+
// }
|
|
14291
|
+
// if (this.#outlineMesh) {
|
|
14292
|
+
// this.#outlineMesh.geometry.dispose();
|
|
14293
|
+
// if (this.#outlineMesh.material instanceof THREE.Material) {
|
|
14294
|
+
// this.#outlineMesh.material.dispose();
|
|
14295
|
+
// }
|
|
14296
|
+
// }
|
|
14297
|
+
// this.polygon = null;
|
|
14298
|
+
// this.layerVertices = [];
|
|
14299
|
+
// this.layerBackVertices = [];
|
|
14300
|
+
}
|
|
14301
|
+
}
|
|
14302
|
+
_Polygon_outlineMesh = new WeakMap(), _Polygon_color = new WeakMap();
|
|
14303
|
+
|
|
14304
|
+
var _Cylinder_outlineMesh;
|
|
14305
|
+
class Cylinder extends Mesh {
|
|
14306
|
+
constructor(options) {
|
|
14307
|
+
super();
|
|
14308
|
+
_Cylinder_outlineMesh.set(this, null);
|
|
14309
|
+
this.ogid = getUUID();
|
|
14310
|
+
this.options = options;
|
|
14311
|
+
this.cylinder = new OGCylinder(this.ogid);
|
|
14312
|
+
this.setConfig();
|
|
14313
|
+
this.generateGeometry();
|
|
14314
|
+
}
|
|
14315
|
+
validateOptions() {
|
|
14316
|
+
if (!this.options) {
|
|
14317
|
+
throw new Error("Options are not defined for Cylinder");
|
|
14318
|
+
}
|
|
14319
|
+
}
|
|
14320
|
+
setConfig() {
|
|
14321
|
+
this.validateOptions();
|
|
14322
|
+
const { radius, height, segments, angle, center } = this.options;
|
|
14323
|
+
this.cylinder.set_config((center === null || center === void 0 ? void 0 : center.clone()) || new Vector3$1(0, 0, 0), radius, height, angle, segments);
|
|
14324
|
+
}
|
|
14325
|
+
generateGeometry() {
|
|
14326
|
+
this.cylinder.generate_geometry();
|
|
14327
|
+
const geometryData = this.cylinder.get_geometry_serialized();
|
|
14328
|
+
const bufferData = JSON.parse(geometryData);
|
|
13825
14329
|
const geometry = new BufferGeometry();
|
|
13826
|
-
geometry.setAttribute("position", new
|
|
14330
|
+
geometry.setAttribute("position", new Float32BufferAttribute(bufferData, 3));
|
|
14331
|
+
const material = new MeshStandardMaterial({
|
|
14332
|
+
color: 0x00ff00,
|
|
14333
|
+
transparent: true,
|
|
14334
|
+
opacity: 0.6,
|
|
14335
|
+
});
|
|
14336
|
+
geometry.computeVertexNormals();
|
|
14337
|
+
geometry.computeBoundingBox();
|
|
13827
14338
|
this.geometry = geometry;
|
|
13828
|
-
|
|
13829
|
-
// this.addFlushBufferToScene(bufFlush);
|
|
14339
|
+
this.material = material;
|
|
13830
14340
|
}
|
|
13831
|
-
|
|
13832
|
-
|
|
14341
|
+
set outline(enable) {
|
|
14342
|
+
if (enable && !__classPrivateFieldGet(this, _Cylinder_outlineMesh, "f")) {
|
|
14343
|
+
const outline_buff = this.cylinder.get_outline_geometry_serialized();
|
|
14344
|
+
const outline_buf = JSON.parse(outline_buff);
|
|
14345
|
+
const outlineGeometry = new BufferGeometry();
|
|
14346
|
+
outlineGeometry.setAttribute("position", new Float32BufferAttribute(outline_buf, 3));
|
|
14347
|
+
const outlineMaterial = new LineBasicMaterial({ color: 0x000000 });
|
|
14348
|
+
__classPrivateFieldSet(this, _Cylinder_outlineMesh, new LineSegments(outlineGeometry, outlineMaterial), "f");
|
|
14349
|
+
this.add(__classPrivateFieldGet(this, _Cylinder_outlineMesh, "f"));
|
|
14350
|
+
}
|
|
14351
|
+
if (!enable && __classPrivateFieldGet(this, _Cylinder_outlineMesh, "f")) {
|
|
14352
|
+
this.remove(__classPrivateFieldGet(this, _Cylinder_outlineMesh, "f"));
|
|
14353
|
+
__classPrivateFieldGet(this, _Cylinder_outlineMesh, "f").geometry.dispose();
|
|
14354
|
+
__classPrivateFieldSet(this, _Cylinder_outlineMesh, null, "f");
|
|
14355
|
+
}
|
|
14356
|
+
}
|
|
14357
|
+
getBrep() {
|
|
14358
|
+
const brepData = this.cylinder.get_brep_serialized();
|
|
14359
|
+
if (!brepData) {
|
|
14360
|
+
throw new Error("Brep data is not available for this cylinder.");
|
|
14361
|
+
}
|
|
14362
|
+
return JSON.parse(brepData);
|
|
14363
|
+
}
|
|
14364
|
+
}
|
|
14365
|
+
_Cylinder_outlineMesh = new WeakMap();
|
|
14366
|
+
|
|
14367
|
+
var _Cube_outlineMesh;
|
|
14368
|
+
class Cube extends Mesh {
|
|
14369
|
+
constructor(options) {
|
|
14370
|
+
super();
|
|
14371
|
+
_Cube_outlineMesh.set(this, null);
|
|
14372
|
+
// Store local center offset to align outlines
|
|
14373
|
+
// TODO: Can this be moved to Engine? It can increase performance | Needs to be used in other shapes too
|
|
14374
|
+
this._geometryCenterOffset = new Vector3();
|
|
14375
|
+
this.ogid = getUUID();
|
|
14376
|
+
this.options = options;
|
|
14377
|
+
this.cube = new OGCube(this.ogid);
|
|
14378
|
+
this.setConfig();
|
|
14379
|
+
this.generateGeometry();
|
|
14380
|
+
}
|
|
14381
|
+
validateOptions() {
|
|
14382
|
+
if (!this.options) {
|
|
14383
|
+
throw new Error("Options are not defined for Cylinder");
|
|
14384
|
+
}
|
|
14385
|
+
}
|
|
14386
|
+
setConfig() {
|
|
14387
|
+
this.validateOptions();
|
|
14388
|
+
const { width, height, depth, center } = this.options;
|
|
14389
|
+
this.cube.set_config((center === null || center === void 0 ? void 0 : center.clone()) || new Vector3$1(0, 0, 0), width, height, depth);
|
|
14390
|
+
}
|
|
14391
|
+
generateGeometry() {
|
|
14392
|
+
this.cube.generate_geometry();
|
|
14393
|
+
const geometryData = this.cube.get_geometry_serialized();
|
|
14394
|
+
const bufferData = JSON.parse(geometryData);
|
|
14395
|
+
console.log(bufferData);
|
|
13833
14396
|
const geometry = new BufferGeometry();
|
|
13834
|
-
geometry.setAttribute("position", new
|
|
13835
|
-
geometry.computeVertexNormals();
|
|
14397
|
+
geometry.setAttribute("position", new Float32BufferAttribute(bufferData, 3));
|
|
13836
14398
|
const material = new MeshStandardMaterial({
|
|
13837
14399
|
color: 0x00ff00,
|
|
13838
|
-
// side: THREE.DoubleSide,
|
|
13839
14400
|
transparent: true,
|
|
13840
|
-
opacity: 0.
|
|
13841
|
-
// wireframe: true
|
|
14401
|
+
opacity: 0.6,
|
|
13842
14402
|
});
|
|
13843
|
-
this.geometry = geometry;
|
|
13844
|
-
this.material = material;
|
|
13845
|
-
}
|
|
13846
|
-
extrude(height) {
|
|
13847
|
-
if (!this.polygon)
|
|
13848
|
-
return;
|
|
13849
|
-
const extruded_buff = this.polygon.extrude_by_height(height);
|
|
13850
|
-
console.log(extruded_buff);
|
|
13851
|
-
this.generateExtrudedGeometry(extruded_buff);
|
|
13852
|
-
}
|
|
13853
|
-
generateExtrudedGeometry(extruded_buff) {
|
|
13854
|
-
// THIS WORKS
|
|
13855
|
-
const flushBuffer = JSON.parse(extruded_buff);
|
|
13856
|
-
console.log(flushBuffer);
|
|
13857
|
-
const geometry = new BufferGeometry();
|
|
13858
|
-
geometry.setAttribute("position", new BufferAttribute(new Float32Array(flushBuffer), 3));
|
|
13859
14403
|
geometry.computeVertexNormals();
|
|
14404
|
+
geometry.computeBoundingBox();
|
|
13860
14405
|
this.geometry = geometry;
|
|
13861
|
-
|
|
13862
|
-
// color: 0x3a86ff,
|
|
13863
|
-
// });
|
|
13864
|
-
// // material.side = THREE.DoubleSide;
|
|
13865
|
-
// this.material = material;
|
|
13866
|
-
}
|
|
13867
|
-
getBrepData() {
|
|
13868
|
-
if (!this.polygon)
|
|
13869
|
-
return;
|
|
13870
|
-
const brepData = this.polygon.get_brep_data();
|
|
13871
|
-
const parsedData = JSON.parse(brepData);
|
|
13872
|
-
console.log(parsedData);
|
|
14406
|
+
this.material = material;
|
|
13873
14407
|
}
|
|
13874
14408
|
set outline(enable) {
|
|
13875
|
-
if (enable && !__classPrivateFieldGet(this,
|
|
13876
|
-
const outline_buff = this.
|
|
14409
|
+
if (enable && !__classPrivateFieldGet(this, _Cube_outlineMesh, "f")) {
|
|
14410
|
+
const outline_buff = this.cube.get_outline_geometry_serialized();
|
|
13877
14411
|
const outline_buf = JSON.parse(outline_buff);
|
|
13878
14412
|
const outlineGeometry = new BufferGeometry();
|
|
13879
14413
|
outlineGeometry.setAttribute("position", new Float32BufferAttribute(outline_buf, 3));
|
|
13880
|
-
// TODO: Fix the outline position
|
|
13881
|
-
// outlineGeometry.translate(
|
|
13882
|
-
// -this._geometryCenterOffset.x,
|
|
13883
|
-
// -this._geometryCenterOffset.y,
|
|
13884
|
-
// -this._geometryCenterOffset.z
|
|
13885
|
-
// );
|
|
13886
14414
|
const outlineMaterial = new LineBasicMaterial({ color: 0x000000 });
|
|
13887
|
-
__classPrivateFieldSet(this,
|
|
13888
|
-
this.add(__classPrivateFieldGet(this,
|
|
14415
|
+
__classPrivateFieldSet(this, _Cube_outlineMesh, new LineSegments(outlineGeometry, outlineMaterial), "f");
|
|
14416
|
+
this.add(__classPrivateFieldGet(this, _Cube_outlineMesh, "f"));
|
|
13889
14417
|
}
|
|
13890
|
-
if (!enable && __classPrivateFieldGet(this,
|
|
13891
|
-
this.remove(__classPrivateFieldGet(this,
|
|
13892
|
-
__classPrivateFieldGet(this,
|
|
13893
|
-
__classPrivateFieldSet(this,
|
|
14418
|
+
if (!enable && __classPrivateFieldGet(this, _Cube_outlineMesh, "f")) {
|
|
14419
|
+
this.remove(__classPrivateFieldGet(this, _Cube_outlineMesh, "f"));
|
|
14420
|
+
__classPrivateFieldGet(this, _Cube_outlineMesh, "f").geometry.dispose();
|
|
14421
|
+
__classPrivateFieldSet(this, _Cube_outlineMesh, null, "f");
|
|
13894
14422
|
}
|
|
13895
14423
|
}
|
|
13896
|
-
get
|
|
13897
|
-
|
|
13898
|
-
return true;
|
|
13899
|
-
}
|
|
13900
|
-
return false;
|
|
14424
|
+
get outlineMesh() {
|
|
14425
|
+
return __classPrivateFieldGet(this, _Cube_outlineMesh, "f");
|
|
13901
14426
|
}
|
|
13902
14427
|
}
|
|
13903
|
-
|
|
14428
|
+
_Cube_outlineMesh = new WeakMap();
|
|
13904
14429
|
|
|
13905
14430
|
class OpenGeometry {
|
|
14431
|
+
set enablePencil(value) {
|
|
14432
|
+
if (value && !this._pencil) {
|
|
14433
|
+
if (!this.container || !this.scene) {
|
|
14434
|
+
throw new Error("Container or Scene is not defined");
|
|
14435
|
+
}
|
|
14436
|
+
this._pencil = new Pencil(this.container, this.scene, this.camera);
|
|
14437
|
+
}
|
|
14438
|
+
else if (!value && this._pencil) ;
|
|
14439
|
+
}
|
|
14440
|
+
get pencil() {
|
|
14441
|
+
return this._pencil;
|
|
14442
|
+
}
|
|
14443
|
+
get labelRenderer() {
|
|
14444
|
+
return this._labelRenderer;
|
|
14445
|
+
}
|
|
14446
|
+
get enableDebug() {
|
|
14447
|
+
return this._enableDebug;
|
|
14448
|
+
}
|
|
14449
|
+
/**
|
|
14450
|
+
* Enables or disables debug mode for OpenGeometry.
|
|
14451
|
+
* When enabled, it logs debug information to the console.
|
|
14452
|
+
* Addtionally,
|
|
14453
|
+
* 1. The geometry will be rendered with a semi-transparent material.
|
|
14454
|
+
* 2. The faces will be rendered with a random color.
|
|
14455
|
+
* 3. The normals will be rendered for better visualization.
|
|
14456
|
+
* @param value - A boolean indicating whether to enable or disable debug mode.
|
|
14457
|
+
*/
|
|
14458
|
+
set enableDebug(value) {
|
|
14459
|
+
this._enableDebug = value;
|
|
14460
|
+
if (this._enableDebug) {
|
|
14461
|
+
console.log("OpenGeometry Debug Mode Enabled");
|
|
14462
|
+
}
|
|
14463
|
+
}
|
|
13906
14464
|
constructor(container, threeScene, camera) {
|
|
13907
14465
|
this.camera = camera;
|
|
14466
|
+
this._enableDebug = false;
|
|
13908
14467
|
this.scene = threeScene;
|
|
13909
14468
|
this.container = container;
|
|
13910
14469
|
}
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
13914
|
-
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
14470
|
+
/**
|
|
14471
|
+
* Asynchronously creates and initializes an instance of OpenGeometry.
|
|
14472
|
+
*
|
|
14473
|
+
* This factory method sets up the OpenGeometry engine by linking it with the
|
|
14474
|
+
* rendering context and the WebAssembly module. It ensures all required
|
|
14475
|
+
* options are provided and prepares the instance for 3D geometry operations.
|
|
14476
|
+
*
|
|
14477
|
+
* @param options - Configuration object for initializing OpenGeometry.
|
|
14478
|
+
* @returns A promise that resolves to a fully initialized OpenGeometry instance.
|
|
14479
|
+
* @throws If any of the required options (`container`, `scene`, or `camera`) are missing.
|
|
14480
|
+
*
|
|
14481
|
+
* @example
|
|
14482
|
+
* ```ts
|
|
14483
|
+
* const openGeometry = await OpenGeometry.create({
|
|
14484
|
+
* container: document.getElementById('myContainer')!,
|
|
14485
|
+
* scene: threeScene,
|
|
14486
|
+
* camera: threeCamera,
|
|
14487
|
+
* wasmURL: '/assets/opengeometry.wasm'
|
|
14488
|
+
* });
|
|
14489
|
+
* ```
|
|
14490
|
+
*/
|
|
13919
14491
|
static create(options) {
|
|
13920
14492
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13921
14493
|
const { container, scene, camera } = options;
|
|
@@ -13931,18 +14503,9 @@ class OpenGeometry {
|
|
|
13931
14503
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13932
14504
|
yield __wbg_init(wasmURL);
|
|
13933
14505
|
this.setuplabelRenderer();
|
|
13934
|
-
if (!this.container || !this.scene)
|
|
13935
|
-
return;
|
|
13936
|
-
this._pencil = new Pencil(this.container, this.scene, this.camera);
|
|
13937
14506
|
this.setupEvent();
|
|
13938
14507
|
});
|
|
13939
14508
|
}
|
|
13940
|
-
get pencil() {
|
|
13941
|
-
return this._pencil;
|
|
13942
|
-
}
|
|
13943
|
-
get labelRenderer() {
|
|
13944
|
-
return this._labelRenderer;
|
|
13945
|
-
}
|
|
13946
14509
|
setuplabelRenderer() {
|
|
13947
14510
|
if (!this.container || !this.scene) {
|
|
13948
14511
|
throw new Error("Container or Scene is not defined");
|
|
@@ -13955,6 +14518,8 @@ class OpenGeometry {
|
|
|
13955
14518
|
this._labelRenderer = labelRenderer;
|
|
13956
14519
|
}
|
|
13957
14520
|
setupEvent() {
|
|
14521
|
+
// NOTE: The responsibility to resize normal rendererer lies with the user
|
|
14522
|
+
// but the label renderer should be resized automatically
|
|
13958
14523
|
window.addEventListener("resize", () => {
|
|
13959
14524
|
var _a, _b, _c;
|
|
13960
14525
|
if (!this.container)
|
|
@@ -13962,6 +14527,13 @@ class OpenGeometry {
|
|
|
13962
14527
|
(_a = this._labelRenderer) === null || _a === void 0 ? void 0 : _a.setSize((_b = this.container) === null || _b === void 0 ? void 0 : _b.clientWidth, (_c = this.container) === null || _c === void 0 ? void 0 : _c.clientHeight);
|
|
13963
14528
|
});
|
|
13964
14529
|
}
|
|
14530
|
+
// TODO: Can this be handled inside the OpenGeometry class itself?
|
|
14531
|
+
/**
|
|
14532
|
+
* Updates the label renderer to render the scene with the given camera.
|
|
14533
|
+
* This method should be called in the animation loop or render loop of your application.
|
|
14534
|
+
* @param scene - The Three.js scene containing the objects to be rendered.
|
|
14535
|
+
* @param camera - The Three.js camera used for rendering the scene.
|
|
14536
|
+
*/
|
|
13965
14537
|
update(scene, camera) {
|
|
13966
14538
|
var _a;
|
|
13967
14539
|
(_a = this._labelRenderer) === null || _a === void 0 ? void 0 : _a.render(scene, camera);
|
|
@@ -14015,9 +14587,9 @@ class BasePoly extends Mesh {
|
|
|
14015
14587
|
this.layerVertices.push(vertex.clone());
|
|
14016
14588
|
}
|
|
14017
14589
|
}
|
|
14018
|
-
const backupVertex = new
|
|
14590
|
+
const backupVertex = new Vector3$1(parseFloat(threeVertex.x.toFixed(2)), 0, parseFloat(threeVertex.z.toFixed(2)));
|
|
14019
14591
|
this.layerBackVertices.push(backupVertex);
|
|
14020
|
-
const vertex = new
|
|
14592
|
+
const vertex = new Vector3$1(parseFloat(threeVertex.x.toFixed(2)),
|
|
14021
14593
|
// when doing the parse operation getting -0 instead of 0
|
|
14022
14594
|
0, parseFloat(threeVertex.z.toFixed(2)));
|
|
14023
14595
|
this.layerVertices.push(vertex);
|
|
@@ -14079,230 +14651,237 @@ class BasePoly extends Mesh {
|
|
|
14079
14651
|
// this.material = material;
|
|
14080
14652
|
}
|
|
14081
14653
|
}
|
|
14082
|
-
class CirclePoly extends Mesh {
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
|
|
14100
|
-
|
|
14101
|
-
|
|
14102
|
-
|
|
14103
|
-
|
|
14104
|
-
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
|
|
14108
|
-
|
|
14109
|
-
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
|
|
14157
|
-
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
|
|
14165
|
-
|
|
14166
|
-
|
|
14167
|
-
|
|
14168
|
-
|
|
14169
|
-
|
|
14170
|
-
|
|
14171
|
-
|
|
14172
|
-
|
|
14173
|
-
|
|
14174
|
-
|
|
14175
|
-
|
|
14176
|
-
|
|
14177
|
-
|
|
14178
|
-
|
|
14179
|
-
|
|
14180
|
-
|
|
14181
|
-
|
|
14182
|
-
|
|
14183
|
-
|
|
14184
|
-
|
|
14185
|
-
|
|
14186
|
-
|
|
14187
|
-
|
|
14188
|
-
|
|
14189
|
-
|
|
14190
|
-
|
|
14191
|
-
|
|
14192
|
-
|
|
14193
|
-
|
|
14194
|
-
|
|
14195
|
-
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
|
|
14199
|
-
|
|
14200
|
-
|
|
14201
|
-
|
|
14202
|
-
|
|
14203
|
-
|
|
14204
|
-
|
|
14205
|
-
|
|
14206
|
-
|
|
14207
|
-
|
|
14208
|
-
|
|
14209
|
-
|
|
14210
|
-
|
|
14211
|
-
|
|
14212
|
-
|
|
14213
|
-
|
|
14214
|
-
|
|
14215
|
-
|
|
14216
|
-
|
|
14217
|
-
|
|
14218
|
-
|
|
14219
|
-
|
|
14220
|
-
|
|
14221
|
-
|
|
14222
|
-
|
|
14223
|
-
|
|
14224
|
-
|
|
14225
|
-
|
|
14226
|
-
|
|
14227
|
-
|
|
14228
|
-
|
|
14229
|
-
|
|
14230
|
-
|
|
14231
|
-
|
|
14232
|
-
|
|
14233
|
-
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
|
|
14237
|
-
|
|
14238
|
-
|
|
14239
|
-
|
|
14240
|
-
|
|
14241
|
-
|
|
14242
|
-
|
|
14243
|
-
|
|
14244
|
-
|
|
14245
|
-
|
|
14246
|
-
|
|
14247
|
-
|
|
14248
|
-
|
|
14249
|
-
|
|
14250
|
-
|
|
14251
|
-
|
|
14252
|
-
|
|
14253
|
-
|
|
14254
|
-
|
|
14255
|
-
|
|
14256
|
-
|
|
14257
|
-
|
|
14258
|
-
|
|
14259
|
-
|
|
14260
|
-
|
|
14261
|
-
|
|
14262
|
-
|
|
14263
|
-
|
|
14264
|
-
|
|
14265
|
-
|
|
14266
|
-
|
|
14267
|
-
|
|
14268
|
-
|
|
14269
|
-
|
|
14270
|
-
|
|
14271
|
-
|
|
14272
|
-
|
|
14273
|
-
|
|
14274
|
-
|
|
14275
|
-
|
|
14276
|
-
|
|
14277
|
-
|
|
14278
|
-
}
|
|
14654
|
+
// export class CirclePoly extends THREE.Mesh {
|
|
14655
|
+
// ogid: string;
|
|
14656
|
+
// polygon: OGPolygon | null = null;
|
|
14657
|
+
// baseCircle: Arc;
|
|
14658
|
+
// isExtruded: boolean = false;
|
|
14659
|
+
// constructor(baseCircle: Arc) {
|
|
14660
|
+
// super();
|
|
14661
|
+
// this.ogid = getUUID();
|
|
14662
|
+
// if (!baseCircle.circleArc) {
|
|
14663
|
+
// throw new Error("CircleArc is not defined");
|
|
14664
|
+
// }
|
|
14665
|
+
// // baseCircle.nodeChild = this;
|
|
14666
|
+
// baseCircle.nodeOperation = "polygon";
|
|
14667
|
+
// this.baseCircle = baseCircle;
|
|
14668
|
+
// this.generateGeometry();
|
|
14669
|
+
// this.addFlushBufferToScene();
|
|
14670
|
+
// }
|
|
14671
|
+
// update() {
|
|
14672
|
+
// this.geometry.dispose();
|
|
14673
|
+
// this.polygon?.clear_vertices();
|
|
14674
|
+
// this.polygon?.add_vertices(this.baseCircle.circleArc.get_raw_points());
|
|
14675
|
+
// this.generateGeometry();
|
|
14676
|
+
// this.addFlushBufferToScene();
|
|
14677
|
+
// }
|
|
14678
|
+
// generateGeometry() {
|
|
14679
|
+
// if (!this.baseCircle.circleArc) return;
|
|
14680
|
+
// this.polygon = OGPolygon.new_with_circle(this.baseCircle.circleArc.clone());
|
|
14681
|
+
// }
|
|
14682
|
+
// addFlushBufferToScene() {
|
|
14683
|
+
// if (!this.polygon) return;
|
|
14684
|
+
// const bufFlush = this.polygon.get_buffer_flush();
|
|
14685
|
+
// const flushBuffer = JSON.parse(bufFlush);
|
|
14686
|
+
// const geometry = new THREE.BufferGeometry();
|
|
14687
|
+
// geometry.setAttribute("position", new THREE.BufferAttribute(new Float32Array(flushBuffer), 3));
|
|
14688
|
+
// // TODO: Do this using a set method, poly.visualizeTriangles = true
|
|
14689
|
+
// // different colors for each triangle in the polygon dont interolate
|
|
14690
|
+
// // const colors = new Float32Array(flushBuffer.length);
|
|
14691
|
+
// // for (let i = 0; i < colors.length; i += 9) {
|
|
14692
|
+
// // const r = Math.random();
|
|
14693
|
+
// // const g = Math.random();
|
|
14694
|
+
// // const b = Math.random();
|
|
14695
|
+
// // colors[i] = r;
|
|
14696
|
+
// // colors[i + 1] = g;
|
|
14697
|
+
// // colors[i + 2] = b;
|
|
14698
|
+
// // colors[i + 3] = r;
|
|
14699
|
+
// // colors[i + 4] = g;
|
|
14700
|
+
// // colors[i + 5] = b;
|
|
14701
|
+
// // colors[i + 6] = r;
|
|
14702
|
+
// // colors[i + 7] = g;
|
|
14703
|
+
// // colors[i + 8] = b;
|
|
14704
|
+
// // }
|
|
14705
|
+
// // geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3));
|
|
14706
|
+
// const material = new THREE.MeshStandardMaterial({
|
|
14707
|
+
// color: 0x00ff00,
|
|
14708
|
+
// // side: THREE.DoubleSide,
|
|
14709
|
+
// transparent: true,
|
|
14710
|
+
// opacity: 0.5,
|
|
14711
|
+
// // wireframe: true
|
|
14712
|
+
// });
|
|
14713
|
+
// this.geometry = geometry;
|
|
14714
|
+
// this.material = material;
|
|
14715
|
+
// }
|
|
14716
|
+
// clearGeometry() {
|
|
14717
|
+
// this.geometry.dispose();
|
|
14718
|
+
// }
|
|
14719
|
+
// extrude(height: number) {
|
|
14720
|
+
// if (!this.polygon) return;
|
|
14721
|
+
// const extruded_buff = this.polygon.extrude_by_height(height);
|
|
14722
|
+
// console.log(JSON.parse(extruded_buff));
|
|
14723
|
+
// this.isExtruded = true;
|
|
14724
|
+
// this.generateExtrudedGeometry(extruded_buff);
|
|
14725
|
+
// }
|
|
14726
|
+
// getBrepData() {
|
|
14727
|
+
// if (!this.polygon) return;
|
|
14728
|
+
// const brepData = this.polygon.get_brep_data();
|
|
14729
|
+
// const parsedData = JSON.parse(brepData);
|
|
14730
|
+
// console.log(parsedData);
|
|
14731
|
+
// }
|
|
14732
|
+
// getOutline(type: OUTLINE_TYPE) {
|
|
14733
|
+
// if (!this.polygon) return;
|
|
14734
|
+
// const outlines = this.polygon.get_outlines();
|
|
14735
|
+
// const outlineBuffer = JSON.parse(outlines);
|
|
14736
|
+
// // TODO: move this logic to Kernel
|
|
14737
|
+
// const faces = [];
|
|
14738
|
+
// for (const data of outlineBuffer) {
|
|
14739
|
+
// const vertices = [];
|
|
14740
|
+
// for (const vertex of data) {
|
|
14741
|
+
// const x_float = type === "side" ? 0 : parseFloat(vertex.x.toFixed(5));
|
|
14742
|
+
// const y_float = type === "top" ? 0 : parseFloat(vertex.y.toFixed(5));
|
|
14743
|
+
// const z_float = type === "front" ? 0 : parseFloat(vertex.z.toFixed(5));
|
|
14744
|
+
// vertices.push(new THREE.Vector3(x_float, y_float, z_float));
|
|
14745
|
+
// }
|
|
14746
|
+
// faces.push(vertices);
|
|
14747
|
+
// }
|
|
14748
|
+
// const clonedFaces = faces.map((face) => {
|
|
14749
|
+
// return face.map((vertex) => {
|
|
14750
|
+
// return new THREE.Vector3(vertex.x, vertex.y, vertex.z);
|
|
14751
|
+
// });
|
|
14752
|
+
// }
|
|
14753
|
+
// );
|
|
14754
|
+
// // remove duplicates inside the faces
|
|
14755
|
+
// const uniqueFaces = clonedFaces.map((face) => {
|
|
14756
|
+
// return face.filter((vertex, index, self) =>
|
|
14757
|
+
// index === self.findIndex((v) => (
|
|
14758
|
+
// v.x === vertex.x && v.y === vertex.y && v.z === vertex.z
|
|
14759
|
+
// ))
|
|
14760
|
+
// );
|
|
14761
|
+
// });
|
|
14762
|
+
// // Picking unique vertices from all faces
|
|
14763
|
+
// const uniqueVertices = [];
|
|
14764
|
+
// const vertexSet = new Set();
|
|
14765
|
+
// for (const face of uniqueFaces) {
|
|
14766
|
+
// for (const vertex of face) {
|
|
14767
|
+
// const key = `${vertex.x},${vertex.y},${vertex.z}`;
|
|
14768
|
+
// if (!vertexSet.has(key)) {
|
|
14769
|
+
// vertexSet.add(key);
|
|
14770
|
+
// uniqueVertices.push(vertex);
|
|
14771
|
+
// }
|
|
14772
|
+
// }
|
|
14773
|
+
// }
|
|
14774
|
+
// // arrange the vertices in a clockwise manner
|
|
14775
|
+
// const center = new THREE.Vector3();
|
|
14776
|
+
// for (const vertex of uniqueVertices) {
|
|
14777
|
+
// center.add(vertex);
|
|
14778
|
+
// }
|
|
14779
|
+
// center.divideScalar(uniqueVertices.length);
|
|
14780
|
+
// uniqueVertices.sort((a, b) => {
|
|
14781
|
+
// if (type === "side") {
|
|
14782
|
+
// const angleA = Math.atan2(a.y - center.y, a.z - center.z);
|
|
14783
|
+
// const angleB = Math.atan2(b.y - center.y, b.z - center.z);
|
|
14784
|
+
// return angleA - angleB;
|
|
14785
|
+
// } else if (type === "top") {
|
|
14786
|
+
// const angleA = Math.atan2(a.x - center.x, a.z - center.z);
|
|
14787
|
+
// const angleB = Math.atan2(b.x - center.x, b.z - center.z);
|
|
14788
|
+
// return angleA - angleB;
|
|
14789
|
+
// }
|
|
14790
|
+
// const angleA = Math.atan2(a.x - center.x, a.y - center.y);
|
|
14791
|
+
// const angleB = Math.atan2(b.x - center.x, b.y - center.y);
|
|
14792
|
+
// return angleA - angleB;
|
|
14793
|
+
// }
|
|
14794
|
+
// );
|
|
14795
|
+
// // merge collinear vertices
|
|
14796
|
+
// const mergedVertices = [];
|
|
14797
|
+
// for (let i = 0; i < uniqueVertices.length; i++) {
|
|
14798
|
+
// const current = uniqueVertices[i];
|
|
14799
|
+
// const next = uniqueVertices[(i + 1) % uniqueVertices.length];
|
|
14800
|
+
// const prev = uniqueVertices[(i - 1 + uniqueVertices.length) % uniqueVertices.length];
|
|
14801
|
+
// const v1 = new THREE.Vector3().subVectors(current, prev);
|
|
14802
|
+
// const v2 = new THREE.Vector3().subVectors(next, current);
|
|
14803
|
+
// if (v1.angleTo(v2) > 0.01) {
|
|
14804
|
+
// mergedVertices.push(current);
|
|
14805
|
+
// }
|
|
14806
|
+
// }
|
|
14807
|
+
// mergedVertices.push(mergedVertices[0]);
|
|
14808
|
+
// // TODO: move logic until here to Kernel
|
|
14809
|
+
// // Create a new geometry with the merged vertices
|
|
14810
|
+
// const mergedGeometry = new THREE.BufferGeometry().setFromPoints(mergedVertices);
|
|
14811
|
+
// const mergedMaterial = new THREE.MeshBasicMaterial({ color: 0x000000, side: THREE.DoubleSide });
|
|
14812
|
+
// const mergedMesh = new THREE.Line(mergedGeometry, mergedMaterial);
|
|
14813
|
+
// return mergedMesh;
|
|
14814
|
+
// }
|
|
14815
|
+
// generateExtrudedGeometry(extruded_buff: string) {
|
|
14816
|
+
// // THIS WORKS
|
|
14817
|
+
// const flushBuffer = JSON.parse(extruded_buff);
|
|
14818
|
+
// const geometry = new THREE.BufferGeometry();
|
|
14819
|
+
// geometry.setAttribute("position", new THREE.BufferAttribute(new Float32Array(flushBuffer), 3));
|
|
14820
|
+
// // To Test If Triangulation is working
|
|
14821
|
+
// // const colors = new Float32Array(flushBuffer.length);
|
|
14822
|
+
// // for (let i = 0; i < colors.length; i += 9) {
|
|
14823
|
+
// // const r = Math.random();
|
|
14824
|
+
// // const g = Math.random();
|
|
14825
|
+
// // const b = Math.random();
|
|
14826
|
+
// // colors[i] = r;
|
|
14827
|
+
// // colors[i + 1] = g;
|
|
14828
|
+
// // colors[i + 2] = b;
|
|
14829
|
+
// // colors[i + 3] = r;
|
|
14830
|
+
// // colors[i + 4] = g;
|
|
14831
|
+
// // colors[i + 5] = b;
|
|
14832
|
+
// // colors[i + 6] = r;
|
|
14833
|
+
// // colors[i + 7] = g;
|
|
14834
|
+
// // colors[i + 8] = b;
|
|
14835
|
+
// // }
|
|
14836
|
+
// // geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3));
|
|
14837
|
+
// // const material = new THREE.MeshPhongMaterial( {
|
|
14838
|
+
// // color: 0xffffff,
|
|
14839
|
+
// // flatShading: true,
|
|
14840
|
+
// // vertexColors: true,
|
|
14841
|
+
// // shininess: 0,
|
|
14842
|
+
// // side: THREE.DoubleSide
|
|
14843
|
+
// // });
|
|
14844
|
+
// // const material = new THREE.MeshPhongMaterial({
|
|
14845
|
+
// // color: 0x3a86ff,
|
|
14846
|
+
// // });
|
|
14847
|
+
// // material.side = THREE.DoubleSide;
|
|
14848
|
+
// this.geometry = geometry;
|
|
14849
|
+
// // this.material = material;
|
|
14850
|
+
// }
|
|
14851
|
+
// dispose() {
|
|
14852
|
+
// if (!this.polygon) return;
|
|
14853
|
+
// this.geometry.dispose();
|
|
14854
|
+
// this.polygon?.clear_vertices();
|
|
14855
|
+
// this.polygon = null;
|
|
14856
|
+
// this.isExtruded = false;
|
|
14857
|
+
// }
|
|
14858
|
+
// }
|
|
14279
14859
|
class RectanglePoly extends Mesh {
|
|
14280
14860
|
constructor(baseRectangle) {
|
|
14281
14861
|
super();
|
|
14282
14862
|
this.polygon = null;
|
|
14283
14863
|
this.isExtruded = false;
|
|
14284
14864
|
this.ogid = getUUID();
|
|
14285
|
-
if (!baseRectangle.polyLineRectangle) {
|
|
14286
|
-
|
|
14287
|
-
}
|
|
14288
|
-
// baseRectangle.nodeChild = this;
|
|
14289
|
-
baseRectangle.nodeOperation = "polygon";
|
|
14865
|
+
// if (!baseRectangle.polyLineRectangle) {
|
|
14866
|
+
// throw new Error("BaseRectangle is not defined");
|
|
14867
|
+
// }
|
|
14868
|
+
// // baseRectangle.nodeChild = this;
|
|
14869
|
+
// baseRectangle.nodeOperation = "polygon";
|
|
14290
14870
|
this.baseRectangle = baseRectangle;
|
|
14291
14871
|
this.generateGeometry();
|
|
14292
14872
|
this.addFlushBufferToScene();
|
|
14293
14873
|
}
|
|
14294
14874
|
update() {
|
|
14295
|
-
var _a
|
|
14875
|
+
var _a;
|
|
14296
14876
|
this.geometry.dispose();
|
|
14297
14877
|
(_a = this.polygon) === null || _a === void 0 ? void 0 : _a.clear_vertices();
|
|
14298
|
-
|
|
14878
|
+
// this.polygon?.add_vertices(this.baseRectangle.polyLineRectangle.get_raw_points());
|
|
14299
14879
|
this.generateGeometry();
|
|
14300
14880
|
this.addFlushBufferToScene();
|
|
14301
14881
|
}
|
|
14302
14882
|
generateGeometry() {
|
|
14303
|
-
if (!this.baseRectangle.polyLineRectangle)
|
|
14304
|
-
|
|
14305
|
-
this.polygon = BasePolygon.new_with_rectangle(this.baseRectangle.polyLineRectangle.clone());
|
|
14883
|
+
// if (!this.baseRectangle.polyLineRectangle) return;
|
|
14884
|
+
// this.polygon = BasePolygon.new_with_rectangle(this.baseRectangle.polyLineRectangle.clone());
|
|
14306
14885
|
}
|
|
14307
14886
|
addFlushBufferToScene() {
|
|
14308
14887
|
if (!this.polygon)
|
|
@@ -14437,7 +15016,7 @@ class RectanglePoly extends Mesh {
|
|
|
14437
15016
|
// Create a new geometry with the merged vertices
|
|
14438
15017
|
const mergedGeometry = new BufferGeometry().setFromPoints(mergedVertices);
|
|
14439
15018
|
const mergedMaterial = new MeshBasicMaterial({ color: 0x000000, side: DoubleSide });
|
|
14440
|
-
const mergedMesh = new Line(mergedGeometry, mergedMaterial);
|
|
15019
|
+
const mergedMesh = new Line$1(mergedGeometry, mergedMaterial);
|
|
14441
15020
|
return mergedMesh;
|
|
14442
15021
|
}
|
|
14443
15022
|
}
|
|
@@ -14459,5 +15038,5 @@ class FlatMesh extends Mesh {
|
|
|
14459
15038
|
}
|
|
14460
15039
|
}
|
|
14461
15040
|
|
|
14462
|
-
export {
|
|
15041
|
+
export { Arc, BasePoly, Cube, Cylinder, CylinderOld, FlatMesh, Line, OpenGeometry, Polygon, Polyline, Rectangle, RectanglePoly, SpotLabel, Vector3$1 as Vector3 };
|
|
14463
15042
|
//# sourceMappingURL=index.js.map
|