opengeometry 0.0.4 → 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 +9 -26
- package/index.js +1962 -1698
- package/index.js.map +1 -1
- package/opengeometry_bg.wasm +0 -0
- package/opengeometry_bg.wasm.d.ts +219 -223
- package/package.json +7 -1
- package/src/base-types.d.ts +4 -5
- package/src/pencil.d.ts +14 -3
- package/src/primitives/arc.d.ts +22 -0
- package/src/primitives/{base-primitive.d.ts → base-line-primitive.d.ts} +4 -1
- 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 +10 -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 +16 -15
- package/src/primitives/circle.d.ts +0 -15
- package/src/primitives/poly-line.d.ts +0 -22
- 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,45 +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
|
-
function getObject(idx) {
|
|
80
|
-
return heap[idx];
|
|
81
|
-
}
|
|
82
|
-
function dropObject(idx) {
|
|
83
|
-
if (idx < 132) return;
|
|
84
|
-
heap[idx] = heap_next;
|
|
85
|
-
heap_next = idx;
|
|
86
|
-
}
|
|
87
|
-
function takeObject(idx) {
|
|
88
|
-
const ret = getObject(idx);
|
|
89
|
-
dropObject(idx);
|
|
90
|
-
return ret;
|
|
91
|
-
}
|
|
92
86
|
function _assertClass(instance, klass) {
|
|
93
87
|
if (!(instance instanceof klass)) {
|
|
94
88
|
throw new Error(`expected instance of ${klass.name}`);
|
|
95
89
|
}
|
|
96
|
-
return instance.ptr;
|
|
97
90
|
}
|
|
98
91
|
let WASM_VECTOR_LEN = 0;
|
|
99
92
|
const cachedTextEncoder = typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : {
|
|
@@ -150,28 +143,44 @@ function getDataViewMemory0() {
|
|
|
150
143
|
}
|
|
151
144
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
152
145
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
153
|
-
const mem = getDataViewMemory0();
|
|
154
146
|
for (let i = 0; i < array.length; i++) {
|
|
155
|
-
|
|
147
|
+
const add = addToExternrefTable0(array[i]);
|
|
148
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
156
149
|
}
|
|
157
150
|
WASM_VECTOR_LEN = array.length;
|
|
158
151
|
return ptr;
|
|
159
152
|
}
|
|
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;
|
|
159
|
+
}
|
|
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;
|
|
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,1388 +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
|
-
_assertClass(translation, Vector3D);
|
|
1034
|
-
var ptr0 = translation.__destroy_into_raw();
|
|
1035
|
-
wasm.ogpolyline_translate(this.__wbg_ptr, ptr0);
|
|
1036
|
-
}
|
|
1037
|
-
/**
|
|
1038
|
-
* @param {Vector3D} position
|
|
1039
|
-
*/
|
|
1040
|
-
set_position(position) {
|
|
1041
|
-
_assertClass(position, Vector3D);
|
|
1042
|
-
var ptr0 = position.__destroy_into_raw();
|
|
1043
|
-
wasm.ogpolyline_set_position(this.__wbg_ptr, ptr0);
|
|
1044
|
-
}
|
|
1045
|
-
/**
|
|
1046
|
-
* @param {(Vector3D)[]} points
|
|
1047
|
-
*/
|
|
1048
|
-
add_multiple_points(points) {
|
|
1049
|
-
const ptr0 = passArrayJsValueToWasm0(points, wasm.__wbindgen_malloc);
|
|
1050
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1051
|
-
wasm.ogpolyline_add_multiple_points(this.__wbg_ptr, ptr0, len0);
|
|
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);
|
|
1052
1115
|
}
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
*/
|
|
1056
|
-
add_point(point) {
|
|
1057
|
-
_assertClass(point, Vector3D);
|
|
1058
|
-
var ptr0 = point.__destroy_into_raw();
|
|
1059
|
-
wasm.ogpolyline_add_point(this.__wbg_ptr, ptr0);
|
|
1116
|
+
generate_geometry() {
|
|
1117
|
+
wasm.ogcylinder_generate_geometry(this.__wbg_ptr);
|
|
1060
1118
|
}
|
|
1061
1119
|
/**
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1120
|
+
* @returns {string}
|
|
1121
|
+
*/
|
|
1122
|
+
get_brep_serialized() {
|
|
1065
1123
|
let deferred1_0;
|
|
1066
1124
|
let deferred1_1;
|
|
1067
1125
|
try {
|
|
1068
|
-
const
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
deferred1_0 = r0;
|
|
1073
|
-
deferred1_1 = r1;
|
|
1074
|
-
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]);
|
|
1075
1130
|
} finally {
|
|
1076
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1077
1131
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1078
1132
|
}
|
|
1079
1133
|
}
|
|
1080
1134
|
/**
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
try {
|
|
1085
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1086
|
-
wasm.ogpolyline_get_raw_points(retptr, this.__wbg_ptr);
|
|
1087
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1088
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1089
|
-
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1090
|
-
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
1091
|
-
return v1;
|
|
1092
|
-
} finally {
|
|
1093
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
/**
|
|
1097
|
-
* @returns {boolean}
|
|
1098
|
-
*/
|
|
1099
|
-
is_closed() {
|
|
1100
|
-
const ret = wasm.ogpolyline_is_closed(this.__wbg_ptr);
|
|
1101
|
-
return ret !== 0;
|
|
1102
|
-
}
|
|
1103
|
-
/**
|
|
1104
|
-
*/
|
|
1105
|
-
check_closed_test() {
|
|
1106
|
-
wasm.ogpolyline_check_closed_test(this.__wbg_ptr);
|
|
1107
|
-
}
|
|
1108
|
-
/**
|
|
1109
|
-
*/
|
|
1110
|
-
generate_brep() {
|
|
1111
|
-
wasm.ogpolyline_generate_brep(this.__wbg_ptr);
|
|
1112
|
-
}
|
|
1113
|
-
/**
|
|
1114
|
-
* @returns {string}
|
|
1115
|
-
*/
|
|
1116
|
-
get_brep_data() {
|
|
1135
|
+
* @returns {string}
|
|
1136
|
+
*/
|
|
1137
|
+
get_geometry_serialized() {
|
|
1117
1138
|
let deferred1_0;
|
|
1118
1139
|
let deferred1_1;
|
|
1119
1140
|
try {
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
deferred1_0 = r0;
|
|
1125
|
-
deferred1_1 = r1;
|
|
1126
|
-
return getStringFromWasm0(r0, r1);
|
|
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]);
|
|
1127
1145
|
} finally {
|
|
1128
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1129
1146
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1130
1147
|
}
|
|
1131
1148
|
}
|
|
1132
1149
|
/**
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
get_offset(distance) {
|
|
1150
|
+
* @returns {string}
|
|
1151
|
+
*/
|
|
1152
|
+
get_outline_geometry_serialized() {
|
|
1137
1153
|
let deferred1_0;
|
|
1138
1154
|
let deferred1_1;
|
|
1139
1155
|
try {
|
|
1140
|
-
const
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
deferred1_0 = r0;
|
|
1145
|
-
deferred1_1 = r1;
|
|
1146
|
-
return getStringFromWasm0(r0, r1);
|
|
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]);
|
|
1147
1160
|
} finally {
|
|
1148
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1149
1161
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1150
1162
|
}
|
|
1151
1163
|
}
|
|
1152
|
-
/**
|
|
1153
|
-
* @param {Vector3D} point_a
|
|
1154
|
-
* @param {Vector3D} point_b
|
|
1155
|
-
* @param {Vector3D} point_c
|
|
1156
|
-
* @param {Vector3D} point_d
|
|
1157
|
-
* @returns {Vector3D | undefined}
|
|
1158
|
-
*/
|
|
1159
|
-
static calculate_2D_interesection(point_a, point_b, point_c, point_d) {
|
|
1160
|
-
_assertClass(point_a, Vector3D);
|
|
1161
|
-
_assertClass(point_b, Vector3D);
|
|
1162
|
-
_assertClass(point_c, Vector3D);
|
|
1163
|
-
_assertClass(point_d, Vector3D);
|
|
1164
|
-
const ret = wasm.ogpolyline_calculate_2D_interesection(point_a.__wbg_ptr, point_b.__wbg_ptr, point_c.__wbg_ptr, point_d.__wbg_ptr);
|
|
1165
|
-
return ret === 0 ? undefined : Vector3D.__wrap(ret);
|
|
1166
|
-
}
|
|
1167
1164
|
}
|
|
1168
|
-
const
|
|
1165
|
+
const OGCylinderOldFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
1169
1166
|
register: () => {},
|
|
1170
1167
|
unregister: () => {}
|
|
1171
|
-
} : new FinalizationRegistry(ptr => wasm.
|
|
1172
|
-
|
|
1173
|
-
*/
|
|
1174
|
-
class OGPolygon {
|
|
1175
|
-
static __wrap(ptr) {
|
|
1176
|
-
ptr = ptr >>> 0;
|
|
1177
|
-
const obj = Object.create(OGPolygon.prototype);
|
|
1178
|
-
obj.__wbg_ptr = ptr;
|
|
1179
|
-
OGPolygonFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1180
|
-
return obj;
|
|
1181
|
-
}
|
|
1168
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_ogcylinderold_free(ptr >>> 0, 1));
|
|
1169
|
+
class OGCylinderOld {
|
|
1182
1170
|
__destroy_into_raw() {
|
|
1183
1171
|
const ptr = this.__wbg_ptr;
|
|
1184
1172
|
this.__wbg_ptr = 0;
|
|
1185
|
-
|
|
1173
|
+
OGCylinderOldFinalization.unregister(this);
|
|
1186
1174
|
return ptr;
|
|
1187
1175
|
}
|
|
1188
1176
|
free() {
|
|
1189
1177
|
const ptr = this.__destroy_into_raw();
|
|
1190
|
-
wasm.
|
|
1191
|
-
}
|
|
1192
|
-
/**
|
|
1193
|
-
* @returns {boolean}
|
|
1194
|
-
*/
|
|
1195
|
-
get extruded() {
|
|
1196
|
-
const ret = wasm.__wbg_get_ogpolygon_extruded(this.__wbg_ptr);
|
|
1197
|
-
return ret !== 0;
|
|
1198
|
-
}
|
|
1199
|
-
/**
|
|
1200
|
-
* @param {boolean} arg0
|
|
1201
|
-
*/
|
|
1202
|
-
set extruded(arg0) {
|
|
1203
|
-
wasm.__wbg_set_ogpolygon_extruded(this.__wbg_ptr, arg0);
|
|
1204
|
-
}
|
|
1205
|
-
/**
|
|
1206
|
-
* @returns {number}
|
|
1207
|
-
*/
|
|
1208
|
-
get extruded_height() {
|
|
1209
|
-
const ret = wasm.__wbg_get_ogpolygon_extruded_height(this.__wbg_ptr);
|
|
1210
|
-
return ret;
|
|
1211
|
-
}
|
|
1212
|
-
/**
|
|
1213
|
-
* @param {number} arg0
|
|
1214
|
-
*/
|
|
1215
|
-
set extruded_height(arg0) {
|
|
1216
|
-
wasm.__wbg_set_ogpolygon_extruded_height(this.__wbg_ptr, arg0);
|
|
1217
|
-
}
|
|
1218
|
-
/**
|
|
1219
|
-
* @returns {boolean}
|
|
1220
|
-
*/
|
|
1221
|
-
get is_polygon() {
|
|
1222
|
-
const ret = wasm.__wbg_get_ogpolygon_is_polygon(this.__wbg_ptr);
|
|
1223
|
-
return ret !== 0;
|
|
1224
|
-
}
|
|
1225
|
-
/**
|
|
1226
|
-
* @param {boolean} arg0
|
|
1227
|
-
*/
|
|
1228
|
-
set is_polygon(arg0) {
|
|
1229
|
-
wasm.__wbg_set_ogpolygon_is_polygon(this.__wbg_ptr, arg0);
|
|
1230
|
-
}
|
|
1231
|
-
/**
|
|
1232
|
-
* @returns {Vector3D}
|
|
1233
|
-
*/
|
|
1234
|
-
get position() {
|
|
1235
|
-
const ret = wasm.__wbg_get_ogpolygon_position(this.__wbg_ptr);
|
|
1236
|
-
return Vector3D.__wrap(ret);
|
|
1237
|
-
}
|
|
1238
|
-
/**
|
|
1239
|
-
* @param {Vector3D} arg0
|
|
1240
|
-
*/
|
|
1241
|
-
set position(arg0) {
|
|
1242
|
-
_assertClass(arg0, Vector3D);
|
|
1243
|
-
var ptr0 = arg0.__destroy_into_raw();
|
|
1244
|
-
wasm.__wbg_set_ogpolygon_position(this.__wbg_ptr, ptr0);
|
|
1245
|
-
}
|
|
1246
|
-
/**
|
|
1247
|
-
* @returns {Vector3D}
|
|
1248
|
-
*/
|
|
1249
|
-
get rotation() {
|
|
1250
|
-
const ret = wasm.__wbg_get_ogpolygon_rotation(this.__wbg_ptr);
|
|
1251
|
-
return Vector3D.__wrap(ret);
|
|
1252
|
-
}
|
|
1253
|
-
/**
|
|
1254
|
-
* @param {Vector3D} arg0
|
|
1255
|
-
*/
|
|
1256
|
-
set rotation(arg0) {
|
|
1257
|
-
_assertClass(arg0, Vector3D);
|
|
1258
|
-
var ptr0 = arg0.__destroy_into_raw();
|
|
1259
|
-
wasm.__wbg_set_ogpolygon_rotation(this.__wbg_ptr, ptr0);
|
|
1260
|
-
}
|
|
1261
|
-
/**
|
|
1262
|
-
* @returns {Vector3D}
|
|
1263
|
-
*/
|
|
1264
|
-
get scale() {
|
|
1265
|
-
const ret = wasm.__wbg_get_ogpolygon_scale(this.__wbg_ptr);
|
|
1266
|
-
return Vector3D.__wrap(ret);
|
|
1267
|
-
}
|
|
1268
|
-
/**
|
|
1269
|
-
* @param {Vector3D} arg0
|
|
1270
|
-
*/
|
|
1271
|
-
set scale(arg0) {
|
|
1272
|
-
_assertClass(arg0, Vector3D);
|
|
1273
|
-
var ptr0 = arg0.__destroy_into_raw();
|
|
1274
|
-
wasm.__wbg_set_ogpolygon_scale(this.__wbg_ptr, ptr0);
|
|
1178
|
+
wasm.__wbg_ogcylinderold_free(ptr, 0);
|
|
1275
1179
|
}
|
|
1276
1180
|
/**
|
|
1277
|
-
|
|
1278
|
-
|
|
1181
|
+
* @param {string} id
|
|
1182
|
+
*/
|
|
1279
1183
|
set id(id) {
|
|
1280
1184
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1281
1185
|
const len0 = WASM_VECTOR_LEN;
|
|
1282
|
-
wasm.
|
|
1186
|
+
wasm.ogcylinderold_set_id(this.__wbg_ptr, ptr0, len0);
|
|
1283
1187
|
}
|
|
1284
1188
|
/**
|
|
1285
|
-
|
|
1286
|
-
|
|
1189
|
+
* @returns {string}
|
|
1190
|
+
*/
|
|
1287
1191
|
get id() {
|
|
1288
1192
|
let deferred1_0;
|
|
1289
1193
|
let deferred1_1;
|
|
1290
1194
|
try {
|
|
1291
|
-
const
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
deferred1_0 = r0;
|
|
1296
|
-
deferred1_1 = r1;
|
|
1297
|
-
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]);
|
|
1298
1199
|
} finally {
|
|
1299
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1300
1200
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1301
1201
|
}
|
|
1302
1202
|
}
|
|
1303
1203
|
/**
|
|
1304
|
-
|
|
1305
|
-
|
|
1204
|
+
* @param {string} id
|
|
1205
|
+
*/
|
|
1306
1206
|
constructor(id) {
|
|
1307
1207
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1308
1208
|
const len0 = WASM_VECTOR_LEN;
|
|
1309
|
-
const ret = wasm.
|
|
1209
|
+
const ret = wasm.ogcylinderold_new(ptr0, len0);
|
|
1310
1210
|
this.__wbg_ptr = ret >>> 0;
|
|
1311
|
-
|
|
1211
|
+
OGCylinderOldFinalization.register(this, this.__wbg_ptr, this);
|
|
1312
1212
|
return this;
|
|
1313
1213
|
}
|
|
1314
1214
|
/**
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
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);
|
|
1321
1225
|
}
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
* @returns {OGPolygon}
|
|
1325
|
-
*/
|
|
1326
|
-
static new_with_circle(circle_arc) {
|
|
1327
|
-
_assertClass(circle_arc, CircleArc);
|
|
1328
|
-
var ptr0 = circle_arc.__destroy_into_raw();
|
|
1329
|
-
const ret = wasm.ogpolygon_new_with_circle(ptr0);
|
|
1330
|
-
return OGPolygon.__wrap(ret);
|
|
1226
|
+
generate_geometry() {
|
|
1227
|
+
wasm.ogcylinderold_generate_geometry(this.__wbg_ptr);
|
|
1331
1228
|
}
|
|
1332
1229
|
/**
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
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);
|
|
1341
1246
|
}
|
|
1342
1247
|
/**
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
const ptr0 = passArrayJsValueToWasm0(vertices, wasm.__wbindgen_malloc);
|
|
1347
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1348
|
-
wasm.ogpolygon_add_vertices(this.__wbg_ptr, ptr0, len0);
|
|
1349
|
-
}
|
|
1350
|
-
/**
|
|
1351
|
-
* @param {Vector3D} vertex
|
|
1352
|
-
*/
|
|
1353
|
-
add_vertex(vertex) {
|
|
1354
|
-
_assertClass(vertex, Vector3D);
|
|
1355
|
-
var ptr0 = vertex.__destroy_into_raw();
|
|
1356
|
-
wasm.ogpolygon_add_vertex(this.__wbg_ptr, ptr0);
|
|
1357
|
-
}
|
|
1358
|
-
/**
|
|
1359
|
-
* @param {(Vector3D)[]} holes
|
|
1360
|
-
*/
|
|
1361
|
-
add_holes(holes) {
|
|
1362
|
-
const ptr0 = passArrayJsValueToWasm0(holes, wasm.__wbindgen_malloc);
|
|
1363
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1364
|
-
wasm.ogpolygon_add_holes(this.__wbg_ptr, ptr0, len0);
|
|
1365
|
-
}
|
|
1366
|
-
/**
|
|
1367
|
-
* @returns {string}
|
|
1368
|
-
*/
|
|
1369
|
-
triangulate() {
|
|
1248
|
+
* @returns {string}
|
|
1249
|
+
*/
|
|
1250
|
+
outline_edges() {
|
|
1370
1251
|
let deferred1_0;
|
|
1371
1252
|
let deferred1_1;
|
|
1372
1253
|
try {
|
|
1373
|
-
const
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
deferred1_0 = r0;
|
|
1378
|
-
deferred1_1 = r1;
|
|
1379
|
-
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]);
|
|
1380
1258
|
} finally {
|
|
1381
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1382
1259
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1383
1260
|
}
|
|
1384
1261
|
}
|
|
1385
1262
|
/**
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
triangulate_with_holes_variable_geometry(is_ccw) {
|
|
1263
|
+
* @returns {string}
|
|
1264
|
+
*/
|
|
1265
|
+
get_brep_dump() {
|
|
1390
1266
|
let deferred1_0;
|
|
1391
1267
|
let deferred1_1;
|
|
1392
1268
|
try {
|
|
1393
|
-
const
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
deferred1_0 = r0;
|
|
1398
|
-
deferred1_1 = r1;
|
|
1399
|
-
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]);
|
|
1400
1273
|
} finally {
|
|
1401
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1402
1274
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1403
1275
|
}
|
|
1404
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
|
+
}
|
|
1405
1293
|
/**
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1413
|
-
wasm.ogpolygon_triangulate_with_holes(retptr, this.__wbg_ptr);
|
|
1414
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1415
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1416
|
-
deferred1_0 = r0;
|
|
1417
|
-
deferred1_1 = r1;
|
|
1418
|
-
return getStringFromWasm0(r0, r1);
|
|
1419
|
-
} finally {
|
|
1420
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1421
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1422
|
-
}
|
|
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);
|
|
1423
1300
|
}
|
|
1424
1301
|
/**
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1302
|
+
* @returns {string}
|
|
1303
|
+
*/
|
|
1304
|
+
get id() {
|
|
1428
1305
|
let deferred1_0;
|
|
1429
1306
|
let deferred1_1;
|
|
1430
1307
|
try {
|
|
1431
|
-
const
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
deferred1_0 = r0;
|
|
1436
|
-
deferred1_1 = r1;
|
|
1437
|
-
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]);
|
|
1438
1312
|
} finally {
|
|
1439
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1440
1313
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1441
1314
|
}
|
|
1442
1315
|
}
|
|
1443
1316
|
/**
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
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;
|
|
1447
1326
|
}
|
|
1448
1327
|
/**
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
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);
|
|
1452
1337
|
}
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
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);
|
|
1457
1346
|
}
|
|
1458
1347
|
/**
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
extrude_by_height_with_holes(height) {
|
|
1348
|
+
* @returns {string}
|
|
1349
|
+
*/
|
|
1350
|
+
get_brep_serialized() {
|
|
1463
1351
|
let deferred1_0;
|
|
1464
1352
|
let deferred1_1;
|
|
1465
1353
|
try {
|
|
1466
|
-
const
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
deferred1_0 = r0;
|
|
1471
|
-
deferred1_1 = r1;
|
|
1472
|
-
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]);
|
|
1473
1358
|
} finally {
|
|
1474
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1475
1359
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1476
1360
|
}
|
|
1477
1361
|
}
|
|
1478
1362
|
/**
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
extrude_by_height(height) {
|
|
1363
|
+
* @returns {string}
|
|
1364
|
+
*/
|
|
1365
|
+
get_geometry_serialized() {
|
|
1483
1366
|
let deferred1_0;
|
|
1484
1367
|
let deferred1_1;
|
|
1485
1368
|
try {
|
|
1486
|
-
const
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
deferred1_0 = r0;
|
|
1491
|
-
deferred1_1 = r1;
|
|
1492
|
-
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]);
|
|
1493
1373
|
} finally {
|
|
1494
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1495
1374
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1496
1375
|
}
|
|
1497
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
|
+
}
|
|
1498
1393
|
/**
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1506
|
-
wasm.ogpolygon_get_outlines(retptr, this.__wbg_ptr);
|
|
1507
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1508
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1509
|
-
deferred1_0 = r0;
|
|
1510
|
-
deferred1_1 = r1;
|
|
1511
|
-
return getStringFromWasm0(r0, r1);
|
|
1512
|
-
} finally {
|
|
1513
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1514
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1515
|
-
}
|
|
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);
|
|
1516
1400
|
}
|
|
1517
1401
|
/**
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1402
|
+
* @returns {string}
|
|
1403
|
+
*/
|
|
1404
|
+
get id() {
|
|
1521
1405
|
let deferred1_0;
|
|
1522
1406
|
let deferred1_1;
|
|
1523
1407
|
try {
|
|
1524
|
-
const
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
deferred1_0 = r0;
|
|
1529
|
-
deferred1_1 = r1;
|
|
1530
|
-
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]);
|
|
1531
1412
|
} finally {
|
|
1532
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1533
1413
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1534
1414
|
}
|
|
1535
1415
|
}
|
|
1536
1416
|
/**
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
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() {
|
|
1540
1461
|
let deferred1_0;
|
|
1541
1462
|
let deferred1_1;
|
|
1542
1463
|
try {
|
|
1543
|
-
const
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
deferred1_0 = r0;
|
|
1548
|
-
deferred1_1 = r1;
|
|
1549
|
-
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]);
|
|
1550
1468
|
} finally {
|
|
1551
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1552
1469
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1553
1470
|
}
|
|
1554
1471
|
}
|
|
1555
1472
|
/**
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1473
|
+
* @returns {string}
|
|
1474
|
+
*/
|
|
1475
|
+
get_geometry_serialized() {
|
|
1559
1476
|
let deferred1_0;
|
|
1560
1477
|
let deferred1_1;
|
|
1561
1478
|
try {
|
|
1562
|
-
const
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
deferred1_0 = r0;
|
|
1567
|
-
deferred1_1 = r1;
|
|
1568
|
-
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]);
|
|
1569
1483
|
} finally {
|
|
1570
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1571
1484
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1572
1485
|
}
|
|
1573
1486
|
}
|
|
1574
1487
|
/**
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1488
|
+
* @returns {string}
|
|
1489
|
+
*/
|
|
1490
|
+
get_outline_geometry_serialized() {
|
|
1578
1491
|
let deferred1_0;
|
|
1579
1492
|
let deferred1_1;
|
|
1580
1493
|
try {
|
|
1581
|
-
const
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
deferred1_0 = r0;
|
|
1586
|
-
deferred1_1 = r1;
|
|
1587
|
-
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]);
|
|
1588
1498
|
} finally {
|
|
1589
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1590
1499
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1591
1500
|
}
|
|
1592
1501
|
}
|
|
1593
1502
|
}
|
|
1594
|
-
const
|
|
1503
|
+
const OGPolylineFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
1595
1504
|
register: () => {},
|
|
1596
1505
|
unregister: () => {}
|
|
1597
|
-
} : new FinalizationRegistry(ptr => wasm.
|
|
1598
|
-
|
|
1599
|
-
*/
|
|
1600
|
-
class OGRectangle {
|
|
1506
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_ogpolyline_free(ptr >>> 0, 1));
|
|
1507
|
+
class OGPolyline {
|
|
1601
1508
|
static __wrap(ptr) {
|
|
1602
1509
|
ptr = ptr >>> 0;
|
|
1603
|
-
const obj = Object.create(
|
|
1510
|
+
const obj = Object.create(OGPolyline.prototype);
|
|
1604
1511
|
obj.__wbg_ptr = ptr;
|
|
1605
|
-
|
|
1512
|
+
OGPolylineFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1606
1513
|
return obj;
|
|
1607
1514
|
}
|
|
1608
1515
|
__destroy_into_raw() {
|
|
1609
1516
|
const ptr = this.__wbg_ptr;
|
|
1610
1517
|
this.__wbg_ptr = 0;
|
|
1611
|
-
|
|
1518
|
+
OGPolylineFinalization.unregister(this);
|
|
1612
1519
|
return ptr;
|
|
1613
1520
|
}
|
|
1614
1521
|
free() {
|
|
1615
1522
|
const ptr = this.__destroy_into_raw();
|
|
1616
|
-
wasm.
|
|
1523
|
+
wasm.__wbg_ogpolyline_free(ptr, 0);
|
|
1617
1524
|
}
|
|
1618
1525
|
/**
|
|
1619
|
-
|
|
1620
|
-
|
|
1526
|
+
* @param {string} id
|
|
1527
|
+
*/
|
|
1621
1528
|
set id(id) {
|
|
1622
1529
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1623
1530
|
const len0 = WASM_VECTOR_LEN;
|
|
1624
|
-
wasm.
|
|
1531
|
+
wasm.ogpolyline_set_id(this.__wbg_ptr, ptr0, len0);
|
|
1625
1532
|
}
|
|
1626
1533
|
/**
|
|
1627
|
-
|
|
1628
|
-
|
|
1534
|
+
* @returns {string}
|
|
1535
|
+
*/
|
|
1629
1536
|
get id() {
|
|
1630
1537
|
let deferred1_0;
|
|
1631
1538
|
let deferred1_1;
|
|
1632
1539
|
try {
|
|
1633
|
-
const
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
deferred1_0 = r0;
|
|
1638
|
-
deferred1_1 = r1;
|
|
1639
|
-
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]);
|
|
1640
1544
|
} finally {
|
|
1641
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1642
1545
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1643
1546
|
}
|
|
1644
1547
|
}
|
|
1645
1548
|
/**
|
|
1646
|
-
|
|
1647
|
-
|
|
1549
|
+
* @param {string} id
|
|
1550
|
+
*/
|
|
1648
1551
|
constructor(id) {
|
|
1649
1552
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1650
1553
|
const len0 = WASM_VECTOR_LEN;
|
|
1651
|
-
const ret = wasm.
|
|
1554
|
+
const ret = wasm.ogpolyline_new(ptr0, len0);
|
|
1652
1555
|
this.__wbg_ptr = ret >>> 0;
|
|
1653
|
-
|
|
1556
|
+
OGPolylineFinalization.register(this, this.__wbg_ptr, this);
|
|
1654
1557
|
return this;
|
|
1655
1558
|
}
|
|
1656
1559
|
/**
|
|
1657
|
-
|
|
1658
|
-
|
|
1560
|
+
* @returns {OGPolyline}
|
|
1561
|
+
*/
|
|
1659
1562
|
clone() {
|
|
1660
|
-
const ret = wasm.
|
|
1661
|
-
return
|
|
1563
|
+
const ret = wasm.ogpolyline_clone(this.__wbg_ptr);
|
|
1564
|
+
return OGPolyline.__wrap(ret);
|
|
1662
1565
|
}
|
|
1663
1566
|
/**
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
var ptr0 = center.__destroy_into_raw();
|
|
1671
|
-
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);
|
|
1672
1573
|
}
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
generate_points() {
|
|
1676
|
-
wasm.ogrectangle_generate_points(this.__wbg_ptr);
|
|
1574
|
+
generate_geometry() {
|
|
1575
|
+
wasm.ogpolyline_generate_geometry(this.__wbg_ptr);
|
|
1677
1576
|
}
|
|
1678
1577
|
/**
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
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);
|
|
1683
1584
|
}
|
|
1684
1585
|
/**
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
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);
|
|
1689
1592
|
}
|
|
1690
1593
|
/**
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
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
|
+
}
|
|
1697
1607
|
}
|
|
1698
1608
|
/**
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
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;
|
|
1702
1616
|
}
|
|
1703
1617
|
/**
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
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);
|
|
1707
1626
|
}
|
|
1708
1627
|
/**
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1628
|
+
* @returns {string}
|
|
1629
|
+
*/
|
|
1630
|
+
get_brep_serialized() {
|
|
1712
1631
|
let deferred1_0;
|
|
1713
1632
|
let deferred1_1;
|
|
1714
1633
|
try {
|
|
1715
|
-
const
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
deferred1_0 = r0;
|
|
1720
|
-
deferred1_1 = r1;
|
|
1721
|
-
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]);
|
|
1722
1638
|
} finally {
|
|
1723
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1724
1639
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1725
1640
|
}
|
|
1726
1641
|
}
|
|
1727
1642
|
/**
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1643
|
+
* @returns {string}
|
|
1644
|
+
*/
|
|
1645
|
+
get_geometry_serialized() {
|
|
1646
|
+
let deferred1_0;
|
|
1647
|
+
let deferred1_1;
|
|
1731
1648
|
try {
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1737
|
-
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
1738
|
-
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]);
|
|
1739
1653
|
} finally {
|
|
1740
|
-
wasm.
|
|
1654
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1741
1655
|
}
|
|
1742
1656
|
}
|
|
1743
1657
|
}
|
|
1744
|
-
const
|
|
1658
|
+
const OGRectangleFinalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
1745
1659
|
register: () => {},
|
|
1746
1660
|
unregister: () => {}
|
|
1747
|
-
} : new FinalizationRegistry(ptr => wasm.
|
|
1748
|
-
|
|
1749
|
-
*/
|
|
1750
|
-
class OGSimpleLine {
|
|
1751
|
-
static __wrap(ptr) {
|
|
1752
|
-
ptr = ptr >>> 0;
|
|
1753
|
-
const obj = Object.create(OGSimpleLine.prototype);
|
|
1754
|
-
obj.__wbg_ptr = ptr;
|
|
1755
|
-
OGSimpleLineFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1756
|
-
return obj;
|
|
1757
|
-
}
|
|
1661
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_ogrectangle_free(ptr >>> 0, 1));
|
|
1662
|
+
class OGRectangle {
|
|
1758
1663
|
__destroy_into_raw() {
|
|
1759
1664
|
const ptr = this.__wbg_ptr;
|
|
1760
1665
|
this.__wbg_ptr = 0;
|
|
1761
|
-
|
|
1666
|
+
OGRectangleFinalization.unregister(this);
|
|
1762
1667
|
return ptr;
|
|
1763
1668
|
}
|
|
1764
1669
|
free() {
|
|
1765
1670
|
const ptr = this.__destroy_into_raw();
|
|
1766
|
-
wasm.
|
|
1671
|
+
wasm.__wbg_ogrectangle_free(ptr, 0);
|
|
1767
1672
|
}
|
|
1768
1673
|
/**
|
|
1769
|
-
|
|
1770
|
-
|
|
1674
|
+
* @param {string} id
|
|
1675
|
+
*/
|
|
1771
1676
|
set id(id) {
|
|
1772
1677
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1773
1678
|
const len0 = WASM_VECTOR_LEN;
|
|
1774
|
-
wasm.
|
|
1679
|
+
wasm.ogrectangle_set_id(this.__wbg_ptr, ptr0, len0);
|
|
1775
1680
|
}
|
|
1776
1681
|
/**
|
|
1777
|
-
|
|
1778
|
-
|
|
1682
|
+
* @returns {string}
|
|
1683
|
+
*/
|
|
1779
1684
|
get id() {
|
|
1780
1685
|
let deferred1_0;
|
|
1781
1686
|
let deferred1_1;
|
|
1782
1687
|
try {
|
|
1783
|
-
const
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
deferred1_0 = r0;
|
|
1788
|
-
deferred1_1 = r1;
|
|
1789
|
-
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]);
|
|
1790
1692
|
} finally {
|
|
1791
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1792
1693
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1793
1694
|
}
|
|
1794
1695
|
}
|
|
1795
1696
|
/**
|
|
1796
|
-
|
|
1797
|
-
|
|
1697
|
+
* @param {string} id
|
|
1698
|
+
*/
|
|
1798
1699
|
constructor(id) {
|
|
1799
1700
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1800
1701
|
const len0 = WASM_VECTOR_LEN;
|
|
1801
|
-
const ret = wasm.
|
|
1702
|
+
const ret = wasm.ogrectangle_new(ptr0, len0);
|
|
1802
1703
|
this.__wbg_ptr = ret >>> 0;
|
|
1803
|
-
|
|
1704
|
+
OGRectangleFinalization.register(this, this.__wbg_ptr, this);
|
|
1804
1705
|
return this;
|
|
1805
1706
|
}
|
|
1806
1707
|
/**
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
* @param {Vector3D} end
|
|
1816
|
-
*/
|
|
1817
|
-
set_config(start, end) {
|
|
1818
|
-
_assertClass(start, Vector3D);
|
|
1819
|
-
var ptr0 = start.__destroy_into_raw();
|
|
1820
|
-
_assertClass(end, Vector3D);
|
|
1821
|
-
var ptr1 = end.__destroy_into_raw();
|
|
1822
|
-
wasm.ogsimpleline_set_config(this.__wbg_ptr, ptr0, ptr1);
|
|
1823
|
-
}
|
|
1824
|
-
/**
|
|
1825
|
-
*/
|
|
1826
|
-
dispose_points() {
|
|
1827
|
-
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);
|
|
1828
1716
|
}
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
destroy() {
|
|
1832
|
-
wasm.ogsimpleline_destroy(this.__wbg_ptr);
|
|
1717
|
+
generate_geometry() {
|
|
1718
|
+
wasm.ogrectangle_generate_geometry(this.__wbg_ptr);
|
|
1833
1719
|
}
|
|
1834
1720
|
/**
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1721
|
+
* @returns {string}
|
|
1722
|
+
*/
|
|
1723
|
+
get_brep_serialized() {
|
|
1838
1724
|
let deferred1_0;
|
|
1839
1725
|
let deferred1_1;
|
|
1840
1726
|
try {
|
|
1841
|
-
const
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
deferred1_0 = r0;
|
|
1846
|
-
deferred1_1 = r1;
|
|
1847
|
-
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]);
|
|
1848
1731
|
} finally {
|
|
1849
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1850
1732
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1851
1733
|
}
|
|
1852
1734
|
}
|
|
1853
1735
|
/**
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1736
|
+
* @returns {string}
|
|
1737
|
+
*/
|
|
1738
|
+
get_geometry_serialized() {
|
|
1739
|
+
let deferred1_0;
|
|
1740
|
+
let deferred1_1;
|
|
1857
1741
|
try {
|
|
1858
|
-
const
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1863
|
-
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
1864
|
-
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]);
|
|
1865
1746
|
} finally {
|
|
1866
|
-
wasm.
|
|
1747
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1867
1748
|
}
|
|
1868
1749
|
}
|
|
1869
1750
|
}
|
|
1870
|
-
const
|
|
1751
|
+
const Vector3Finalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
1871
1752
|
register: () => {},
|
|
1872
1753
|
unregister: () => {}
|
|
1873
|
-
} : new FinalizationRegistry(ptr => wasm.
|
|
1874
|
-
|
|
1875
|
-
*/
|
|
1876
|
-
class Vector3D {
|
|
1754
|
+
} : new FinalizationRegistry(ptr => wasm.__wbg_vector3_free(ptr >>> 0, 1));
|
|
1755
|
+
let Vector3$1 = class Vector3 {
|
|
1877
1756
|
static __wrap(ptr) {
|
|
1878
1757
|
ptr = ptr >>> 0;
|
|
1879
|
-
const obj = Object.create(
|
|
1758
|
+
const obj = Object.create(Vector3.prototype);
|
|
1880
1759
|
obj.__wbg_ptr = ptr;
|
|
1881
|
-
|
|
1760
|
+
Vector3Finalization.register(obj, obj.__wbg_ptr, obj);
|
|
1882
1761
|
return obj;
|
|
1883
1762
|
}
|
|
1884
1763
|
static __unwrap(jsValue) {
|
|
1885
|
-
if (!(jsValue instanceof
|
|
1764
|
+
if (!(jsValue instanceof Vector3)) {
|
|
1886
1765
|
return 0;
|
|
1887
1766
|
}
|
|
1888
1767
|
return jsValue.__destroy_into_raw();
|
|
@@ -1890,180 +1769,274 @@ class Vector3D {
|
|
|
1890
1769
|
__destroy_into_raw() {
|
|
1891
1770
|
const ptr = this.__wbg_ptr;
|
|
1892
1771
|
this.__wbg_ptr = 0;
|
|
1893
|
-
|
|
1772
|
+
Vector3Finalization.unregister(this);
|
|
1894
1773
|
return ptr;
|
|
1895
1774
|
}
|
|
1896
1775
|
free() {
|
|
1897
1776
|
const ptr = this.__destroy_into_raw();
|
|
1898
|
-
wasm.
|
|
1777
|
+
wasm.__wbg_vector3_free(ptr, 0);
|
|
1899
1778
|
}
|
|
1900
1779
|
/**
|
|
1901
|
-
|
|
1902
|
-
|
|
1780
|
+
* @returns {number}
|
|
1781
|
+
*/
|
|
1903
1782
|
get x() {
|
|
1904
|
-
const ret = wasm.
|
|
1783
|
+
const ret = wasm.__wbg_get_vector3_x(this.__wbg_ptr);
|
|
1905
1784
|
return ret;
|
|
1906
1785
|
}
|
|
1907
1786
|
/**
|
|
1908
|
-
|
|
1909
|
-
|
|
1787
|
+
* @param {number} arg0
|
|
1788
|
+
*/
|
|
1910
1789
|
set x(arg0) {
|
|
1911
|
-
wasm.
|
|
1790
|
+
wasm.__wbg_set_vector3_x(this.__wbg_ptr, arg0);
|
|
1912
1791
|
}
|
|
1913
1792
|
/**
|
|
1914
|
-
|
|
1915
|
-
|
|
1793
|
+
* @returns {number}
|
|
1794
|
+
*/
|
|
1916
1795
|
get y() {
|
|
1917
|
-
const ret = wasm.
|
|
1796
|
+
const ret = wasm.__wbg_get_vector3_y(this.__wbg_ptr);
|
|
1918
1797
|
return ret;
|
|
1919
1798
|
}
|
|
1920
1799
|
/**
|
|
1921
|
-
|
|
1922
|
-
|
|
1800
|
+
* @param {number} arg0
|
|
1801
|
+
*/
|
|
1923
1802
|
set y(arg0) {
|
|
1924
|
-
wasm.
|
|
1803
|
+
wasm.__wbg_set_vector3_y(this.__wbg_ptr, arg0);
|
|
1925
1804
|
}
|
|
1926
1805
|
/**
|
|
1927
|
-
|
|
1928
|
-
|
|
1806
|
+
* @returns {number}
|
|
1807
|
+
*/
|
|
1929
1808
|
get z() {
|
|
1930
|
-
const ret = wasm.
|
|
1809
|
+
const ret = wasm.__wbg_get_vector3_z(this.__wbg_ptr);
|
|
1931
1810
|
return ret;
|
|
1932
1811
|
}
|
|
1933
1812
|
/**
|
|
1934
|
-
|
|
1935
|
-
|
|
1813
|
+
* @param {number} arg0
|
|
1814
|
+
*/
|
|
1936
1815
|
set z(arg0) {
|
|
1937
|
-
wasm.
|
|
1816
|
+
wasm.__wbg_set_vector3_z(this.__wbg_ptr, arg0);
|
|
1938
1817
|
}
|
|
1939
1818
|
/**
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1819
|
+
* @param {number} x
|
|
1820
|
+
* @param {number} y
|
|
1821
|
+
* @param {number} z
|
|
1822
|
+
*/
|
|
1944
1823
|
constructor(x, y, z) {
|
|
1945
|
-
const ret = wasm.
|
|
1824
|
+
const ret = wasm.vector3_new(x, y, z);
|
|
1946
1825
|
this.__wbg_ptr = ret >>> 0;
|
|
1947
|
-
|
|
1826
|
+
Vector3Finalization.register(this, this.__wbg_ptr, this);
|
|
1948
1827
|
return this;
|
|
1949
1828
|
}
|
|
1950
1829
|
/**
|
|
1951
|
-
|
|
1952
|
-
*
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
}
|
|
1958
|
-
/**
|
|
1959
|
-
* @param {Vector3D} other
|
|
1960
|
-
* @returns {Vector3D}
|
|
1961
|
-
*/
|
|
1830
|
+
*
|
|
1831
|
+
* * Add the elements of another vector to this one.
|
|
1832
|
+
*
|
|
1833
|
+
* @param {Vector3} other
|
|
1834
|
+
* @returns {Vector3}
|
|
1835
|
+
*/
|
|
1962
1836
|
add(other) {
|
|
1963
|
-
_assertClass(other,
|
|
1964
|
-
const ret = wasm.
|
|
1965
|
-
return
|
|
1966
|
-
}
|
|
1967
|
-
/**
|
|
1968
|
-
* @param {Vector3D} other
|
|
1969
|
-
* @returns {Vector3D}
|
|
1970
|
-
*/
|
|
1971
|
-
subtract(other) {
|
|
1972
|
-
_assertClass(other, Vector3D);
|
|
1973
|
-
const ret = wasm.vector3d_subtract(this.__wbg_ptr, other.__wbg_ptr);
|
|
1974
|
-
return Vector3D.__wrap(ret);
|
|
1837
|
+
_assertClass(other, Vector3);
|
|
1838
|
+
const ret = wasm.vector3_add(this.__wbg_ptr, other.__wbg_ptr);
|
|
1839
|
+
return Vector3.__wrap(ret);
|
|
1975
1840
|
}
|
|
1976
1841
|
/**
|
|
1977
|
-
|
|
1978
|
-
*
|
|
1979
|
-
|
|
1842
|
+
*
|
|
1843
|
+
* * Add a scalar value to each element of the vector.
|
|
1844
|
+
*
|
|
1845
|
+
* @param {number} scalar
|
|
1846
|
+
* @returns {Vector3}
|
|
1847
|
+
*/
|
|
1980
1848
|
add_scalar(scalar) {
|
|
1981
|
-
const ret = wasm.
|
|
1982
|
-
return
|
|
1983
|
-
}
|
|
1984
|
-
/**
|
|
1985
|
-
* @param {number} scalar
|
|
1986
|
-
* @returns {Vector3D}
|
|
1987
|
-
*/
|
|
1988
|
-
subtract_scalar(scalar) {
|
|
1989
|
-
const ret = wasm.vector3d_subtract_scalar(this.__wbg_ptr, scalar);
|
|
1990
|
-
return Vector3D.__wrap(ret);
|
|
1849
|
+
const ret = wasm.vector3_add_scalar(this.__wbg_ptr, scalar);
|
|
1850
|
+
return Vector3.__wrap(ret);
|
|
1991
1851
|
}
|
|
1992
1852
|
/**
|
|
1993
|
-
|
|
1994
|
-
*
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
1853
|
+
*
|
|
1854
|
+
* * Subtract the elements of another vector from this one.
|
|
1855
|
+
*
|
|
1856
|
+
* @param {Vector3} other
|
|
1857
|
+
* @returns {Vector3}
|
|
1858
|
+
*/
|
|
1859
|
+
subtract(other) {
|
|
1860
|
+
_assertClass(other, Vector3);
|
|
1861
|
+
const ret = wasm.vector3_subtract(this.__wbg_ptr, other.__wbg_ptr);
|
|
1862
|
+
return Vector3.__wrap(ret);
|
|
2002
1863
|
}
|
|
2003
1864
|
/**
|
|
2004
|
-
|
|
2005
|
-
*
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
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);
|
|
2011
1874
|
}
|
|
2012
1875
|
/**
|
|
2013
|
-
|
|
2014
|
-
*
|
|
2015
|
-
|
|
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
|
+
*/
|
|
2016
1966
|
dot(other) {
|
|
2017
|
-
_assertClass(other,
|
|
2018
|
-
const ret = wasm.
|
|
1967
|
+
_assertClass(other, Vector3);
|
|
1968
|
+
const ret = wasm.vector3_dot(this.__wbg_ptr, other.__wbg_ptr);
|
|
2019
1969
|
return ret;
|
|
2020
1970
|
}
|
|
2021
1971
|
/**
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
* @returns {number}
|
|
2030
|
-
*/
|
|
2031
|
-
length_squared() {
|
|
2032
|
-
const ret = wasm.vector3d_length_squared(this.__wbg_ptr);
|
|
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);
|
|
2033
1979
|
return ret;
|
|
2034
1980
|
}
|
|
2035
1981
|
/**
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
magnitude
|
|
2039
|
-
|
|
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);
|
|
2040
1990
|
return ret;
|
|
2041
1991
|
}
|
|
2042
1992
|
/**
|
|
2043
|
-
|
|
2044
|
-
|
|
1993
|
+
*
|
|
1994
|
+
* * Normalize the vector
|
|
1995
|
+
*
|
|
1996
|
+
* @returns {Vector3}
|
|
1997
|
+
*/
|
|
2045
1998
|
normalize() {
|
|
2046
|
-
const ret = wasm.
|
|
2047
|
-
return
|
|
1999
|
+
const ret = wasm.vector3_normalize(this.__wbg_ptr);
|
|
2000
|
+
return Vector3.__wrap(ret);
|
|
2048
2001
|
}
|
|
2049
2002
|
/**
|
|
2050
|
-
|
|
2051
|
-
*
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
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);
|
|
2025
|
+
return ret;
|
|
2056
2026
|
}
|
|
2057
2027
|
/**
|
|
2058
|
-
|
|
2059
|
-
*
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
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);
|
|
2065
2038
|
}
|
|
2066
|
-
}
|
|
2039
|
+
};
|
|
2067
2040
|
async function __wbg_load(module, imports) {
|
|
2068
2041
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
2069
2042
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
@@ -2071,7 +2044,7 @@ async function __wbg_load(module, imports) {
|
|
|
2071
2044
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
2072
2045
|
} catch (e) {
|
|
2073
2046
|
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
2074
|
-
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);
|
|
2075
2048
|
} else {
|
|
2076
2049
|
throw e;
|
|
2077
2050
|
}
|
|
@@ -2094,23 +2067,34 @@ async function __wbg_load(module, imports) {
|
|
|
2094
2067
|
function __wbg_get_imports() {
|
|
2095
2068
|
const imports = {};
|
|
2096
2069
|
imports.wbg = {};
|
|
2097
|
-
imports.wbg.
|
|
2098
|
-
|
|
2099
|
-
|
|
2070
|
+
imports.wbg.__wbg_getRandomValues_38097e921c2494c3 = function () {
|
|
2071
|
+
return handleError(function (arg0, arg1) {
|
|
2072
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
2073
|
+
}, arguments);
|
|
2100
2074
|
};
|
|
2101
|
-
imports.wbg.
|
|
2102
|
-
|
|
2075
|
+
imports.wbg.__wbg_log_0c7c294ecbc8af77 = function (arg0) {
|
|
2076
|
+
console.log(arg0);
|
|
2103
2077
|
};
|
|
2104
|
-
imports.wbg.
|
|
2105
|
-
const ret =
|
|
2106
|
-
return
|
|
2078
|
+
imports.wbg.__wbg_vector3_new = function (arg0) {
|
|
2079
|
+
const ret = Vector3$1.__wrap(arg0);
|
|
2080
|
+
return ret;
|
|
2107
2081
|
};
|
|
2108
|
-
imports.wbg.
|
|
2109
|
-
const ret =
|
|
2082
|
+
imports.wbg.__wbg_vector3_unwrap = function (arg0) {
|
|
2083
|
+
const ret = Vector3$1.__unwrap(arg0);
|
|
2110
2084
|
return ret;
|
|
2111
2085
|
};
|
|
2112
|
-
imports.wbg.
|
|
2113
|
-
|
|
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
|
+
};
|
|
2095
|
+
imports.wbg.__wbindgen_string_new = function (arg0, arg1) {
|
|
2096
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
2097
|
+
return ret;
|
|
2114
2098
|
};
|
|
2115
2099
|
imports.wbg.__wbindgen_throw = function (arg0, arg1) {
|
|
2116
2100
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
@@ -2121,14 +2105,22 @@ function __wbg_finalize_init(instance, module) {
|
|
|
2121
2105
|
wasm = instance.exports;
|
|
2122
2106
|
__wbg_init.__wbindgen_wasm_module = module;
|
|
2123
2107
|
cachedDataViewMemory0 = null;
|
|
2108
|
+
cachedFloat64ArrayMemory0 = null;
|
|
2124
2109
|
cachedUint8ArrayMemory0 = null;
|
|
2110
|
+
wasm.__wbindgen_start();
|
|
2125
2111
|
return wasm;
|
|
2126
2112
|
}
|
|
2127
2113
|
async function __wbg_init(module_or_path) {
|
|
2128
2114
|
if (wasm !== undefined) return wasm;
|
|
2129
|
-
if (typeof module_or_path !== 'undefined'
|
|
2130
|
-
module_or_path
|
|
2131
|
-
|
|
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
|
+
}
|
|
2132
2124
|
if (typeof module_or_path === 'undefined') {
|
|
2133
2125
|
module_or_path = new URL('opengeometry_bg.wasm', import.meta.url);
|
|
2134
2126
|
}
|
|
@@ -12515,7 +12507,7 @@ const _sphere$1 = /*@__PURE__*/ new Sphere();
|
|
|
12515
12507
|
const _intersectPointOnRay = /*@__PURE__*/ new Vector3();
|
|
12516
12508
|
const _intersectPointOnSegment = /*@__PURE__*/ new Vector3();
|
|
12517
12509
|
|
|
12518
|
-
class Line extends Object3D {
|
|
12510
|
+
let Line$1 = class Line extends Object3D {
|
|
12519
12511
|
|
|
12520
12512
|
constructor( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) {
|
|
12521
12513
|
|
|
@@ -12706,7 +12698,7 @@ class Line extends Object3D {
|
|
|
12706
12698
|
|
|
12707
12699
|
}
|
|
12708
12700
|
|
|
12709
|
-
}
|
|
12701
|
+
};
|
|
12710
12702
|
|
|
12711
12703
|
function checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {
|
|
12712
12704
|
|
|
@@ -12743,7 +12735,7 @@ function checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {
|
|
|
12743
12735
|
const _start = /*@__PURE__*/ new Vector3();
|
|
12744
12736
|
const _end = /*@__PURE__*/ new Vector3();
|
|
12745
12737
|
|
|
12746
|
-
class LineSegments extends Line {
|
|
12738
|
+
class LineSegments extends Line$1 {
|
|
12747
12739
|
|
|
12748
12740
|
constructor( geometry, material ) {
|
|
12749
12741
|
|
|
@@ -13500,6 +13492,7 @@ class Pencil {
|
|
|
13500
13492
|
this.onCursorMove = new Event();
|
|
13501
13493
|
this.onElementHover = new Event();
|
|
13502
13494
|
this.onElementSelected = new Event();
|
|
13495
|
+
this.onElementUnselected = new Event();
|
|
13503
13496
|
this.pencilMode = "cursor";
|
|
13504
13497
|
this.container = container;
|
|
13505
13498
|
this.scene = scene;
|
|
@@ -13582,7 +13575,10 @@ class Pencil {
|
|
|
13582
13575
|
return;
|
|
13583
13576
|
}
|
|
13584
13577
|
const intersect = intersects[0];
|
|
13585
|
-
this.onElementHover.trigger(
|
|
13578
|
+
this.onElementHover.trigger({
|
|
13579
|
+
mesh: intersect.object,
|
|
13580
|
+
point: intersect.point
|
|
13581
|
+
});
|
|
13586
13582
|
}
|
|
13587
13583
|
});
|
|
13588
13584
|
this.container.addEventListener("mousedown", (event) => {
|
|
@@ -13599,7 +13595,26 @@ class Pencil {
|
|
|
13599
13595
|
else if (this.pencilMode === "select") {
|
|
13600
13596
|
const intersects = this.raycaster.intersectObjects(this.pencilMeshes);
|
|
13601
13597
|
const intersect = intersects[0];
|
|
13602
|
-
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
|
+
}
|
|
13603
13618
|
}
|
|
13604
13619
|
});
|
|
13605
13620
|
}
|
|
@@ -13614,6 +13629,17 @@ class Pencil {
|
|
|
13614
13629
|
this.onCursorDown.trigger(point);
|
|
13615
13630
|
}
|
|
13616
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
|
+
}
|
|
13617
13643
|
}
|
|
13618
13644
|
|
|
13619
13645
|
function spotLabelElement() {
|
|
@@ -13639,131 +13665,126 @@ const OPEN_GEOMETRY_THREE_VERSION = '0.0.1';
|
|
|
13639
13665
|
/**
|
|
13640
13666
|
* Simple Line defined by Two Points
|
|
13641
13667
|
*/
|
|
13642
|
-
class
|
|
13668
|
+
class Line extends Line$1 {
|
|
13643
13669
|
set color(color) {
|
|
13644
13670
|
if (this.material instanceof LineBasicMaterial) {
|
|
13645
13671
|
this.material.color.set(color);
|
|
13646
13672
|
}
|
|
13647
13673
|
}
|
|
13648
|
-
constructor(
|
|
13674
|
+
constructor(options) {
|
|
13649
13675
|
super();
|
|
13650
|
-
this.points = [];
|
|
13651
13676
|
this.ogid = getUUID();
|
|
13652
|
-
this.
|
|
13653
|
-
this.
|
|
13677
|
+
this.options = options;
|
|
13678
|
+
this.line = new OGLine(this.ogid);
|
|
13679
|
+
this.setConfig();
|
|
13654
13680
|
this.generateGeometry();
|
|
13655
13681
|
}
|
|
13656
|
-
|
|
13657
|
-
this.
|
|
13658
|
-
|
|
13659
|
-
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");
|
|
13660
13685
|
}
|
|
13661
|
-
if (this.points.length < 2)
|
|
13662
|
-
return;
|
|
13663
|
-
this.generateGeometry();
|
|
13664
13686
|
}
|
|
13665
|
-
|
|
13666
|
-
|
|
13667
|
-
|
|
13668
|
-
|
|
13669
|
-
|
|
13670
|
-
|
|
13671
|
-
|
|
13672
|
-
|
|
13673
|
-
|
|
13687
|
+
setConfig() {
|
|
13688
|
+
this.validateOptions();
|
|
13689
|
+
const { start, end } = this.options;
|
|
13690
|
+
this.line.set_config(start.clone(), end.clone());
|
|
13691
|
+
}
|
|
13692
|
+
generateGeometry() {
|
|
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 });
|
|
13674
13700
|
}
|
|
13675
13701
|
}
|
|
13676
13702
|
|
|
13677
|
-
|
|
13678
|
-
|
|
13679
|
-
*/
|
|
13680
|
-
class PolyLine extends Line {
|
|
13703
|
+
var _Polyline_color;
|
|
13704
|
+
class Polyline extends Line$1 {
|
|
13681
13705
|
set color(color) {
|
|
13706
|
+
__classPrivateFieldSet(this, _Polyline_color, color, "f");
|
|
13682
13707
|
if (this.material instanceof LineBasicMaterial) {
|
|
13683
13708
|
this.material.color.set(color);
|
|
13684
13709
|
}
|
|
13685
13710
|
}
|
|
13686
|
-
constructor(
|
|
13711
|
+
constructor(options) {
|
|
13687
13712
|
super();
|
|
13688
|
-
this.
|
|
13713
|
+
this.options = { points: [] };
|
|
13689
13714
|
this.isClosed = false;
|
|
13690
|
-
this.
|
|
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);
|
|
13691
13719
|
this.ogid = getUUID();
|
|
13692
|
-
this.polyline = new
|
|
13693
|
-
if (
|
|
13694
|
-
this.
|
|
13720
|
+
this.polyline = new OGPolyline(this.ogid);
|
|
13721
|
+
if (options) {
|
|
13722
|
+
this.options = options;
|
|
13723
|
+
this.setConfig();
|
|
13724
|
+
this.generateGeometry();
|
|
13695
13725
|
}
|
|
13696
13726
|
}
|
|
13697
|
-
|
|
13698
|
-
this.
|
|
13699
|
-
|
|
13700
|
-
|
|
13701
|
-
this.polyline.add_multiple_points(points);
|
|
13702
|
-
this.generateGeometry();
|
|
13703
|
-
}
|
|
13704
|
-
// TODO: This needs to be improved
|
|
13705
|
-
translate(translation) {
|
|
13706
|
-
if (!this.polyline)
|
|
13707
|
-
return;
|
|
13708
|
-
this.polyline.translate(translation);
|
|
13709
|
-
this.generateGeometry();
|
|
13710
|
-
}
|
|
13711
|
-
set_position(position) {
|
|
13712
|
-
if (!this.polyline)
|
|
13713
|
-
return;
|
|
13714
|
-
this.polyline.set_position(position);
|
|
13727
|
+
validateOptions() {
|
|
13728
|
+
if (!this.options) {
|
|
13729
|
+
throw new Error("Options are not defined for Polyline");
|
|
13730
|
+
}
|
|
13715
13731
|
}
|
|
13732
|
+
setConfig() {
|
|
13733
|
+
this.validateOptions();
|
|
13734
|
+
const { points } = this.options;
|
|
13735
|
+
this.polyline.set_config(points);
|
|
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
|
+
// }
|
|
13716
13753
|
addPoint(point) {
|
|
13717
|
-
this.points.push(point);
|
|
13718
13754
|
if (!this.polyline)
|
|
13719
13755
|
return;
|
|
13720
13756
|
this.polyline.add_point(point);
|
|
13721
|
-
if (this.points.length < 2)
|
|
13722
|
-
|
|
13757
|
+
// if (this.points.length < 2) return;
|
|
13758
|
+
this.clearGeometry();
|
|
13723
13759
|
this.generateGeometry();
|
|
13724
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
|
+
*/
|
|
13725
13765
|
clearGeometry() {
|
|
13726
13766
|
this.geometry.dispose();
|
|
13727
13767
|
}
|
|
13728
|
-
|
|
13729
|
-
this.clearGeometry();
|
|
13768
|
+
saveTransformationToBREP() {
|
|
13730
13769
|
if (!this.polyline)
|
|
13731
13770
|
return;
|
|
13732
|
-
|
|
13733
|
-
const bufFlush = JSON.parse(buf);
|
|
13734
|
-
const line = new BufferGeometry().setFromPoints(bufFlush);
|
|
13735
|
-
const material = new LineBasicMaterial({ color: 0xff0000 });
|
|
13736
|
-
this.geometry = line;
|
|
13737
|
-
this.material = material;
|
|
13738
|
-
this.isClosed = this.polyline.is_closed();
|
|
13771
|
+
// this.polyline.set_transformation_matrix(this.transformationMatrix.toArray());
|
|
13739
13772
|
}
|
|
13740
|
-
|
|
13741
|
-
|
|
13742
|
-
|
|
13743
|
-
|
|
13744
|
-
|
|
13745
|
-
|
|
13746
|
-
|
|
13747
|
-
|
|
13748
|
-
|
|
13749
|
-
const offsetData = this.polyline.get_offset(offset);
|
|
13750
|
-
if (!offsetData)
|
|
13751
|
-
return null;
|
|
13752
|
-
const data = JSON.parse(offsetData);
|
|
13753
|
-
if (!data.treated || data.treated.length === 0) {
|
|
13754
|
-
return null;
|
|
13755
|
-
}
|
|
13756
|
-
return data;
|
|
13757
|
-
}
|
|
13758
|
-
dispose() {
|
|
13759
|
-
console.log("Disposing OG - Polyline");
|
|
13760
|
-
this.clearGeometry();
|
|
13761
|
-
this.polyline = null;
|
|
13773
|
+
generateGeometry() {
|
|
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") });
|
|
13781
|
+
this.isClosed = this.polyline.is_closed();
|
|
13762
13782
|
}
|
|
13763
13783
|
}
|
|
13784
|
+
_Polyline_color = new WeakMap();
|
|
13764
13785
|
|
|
13765
|
-
|
|
13766
|
-
class
|
|
13786
|
+
var _Arc_color;
|
|
13787
|
+
class Arc extends Line$1 {
|
|
13767
13788
|
set color(color) {
|
|
13768
13789
|
if (this.material instanceof LineBasicMaterial) {
|
|
13769
13790
|
this.material.color.set(color);
|
|
@@ -13771,117 +13792,136 @@ class BaseCircle extends Line {
|
|
|
13771
13792
|
}
|
|
13772
13793
|
constructor(options) {
|
|
13773
13794
|
super();
|
|
13774
|
-
//
|
|
13775
|
-
this
|
|
13795
|
+
// TODO: Create local properties for all Primitive classes
|
|
13796
|
+
_Arc_color.set(this, 0x00ff00);
|
|
13776
13797
|
this.ogid = getUUID();
|
|
13777
13798
|
this.options = options;
|
|
13778
|
-
this.
|
|
13799
|
+
this.arc = new OGArc(this.ogid);
|
|
13779
13800
|
this.setConfig();
|
|
13780
13801
|
this.generateGeometry();
|
|
13781
13802
|
}
|
|
13803
|
+
validateOptions() {
|
|
13804
|
+
if (!this.options) {
|
|
13805
|
+
throw new Error("Options are not defined for Circle Arc");
|
|
13806
|
+
}
|
|
13807
|
+
}
|
|
13782
13808
|
setConfig() {
|
|
13783
|
-
|
|
13784
|
-
|
|
13809
|
+
this.validateOptions();
|
|
13810
|
+
const { center, radius, segments, startAngle, endAngle } = this.options;
|
|
13811
|
+
this.arc.set_config(center.clone(), radius, startAngle, endAngle, segments);
|
|
13785
13812
|
}
|
|
13786
13813
|
generateGeometry() {
|
|
13787
|
-
this.
|
|
13788
|
-
const
|
|
13789
|
-
const
|
|
13790
|
-
const
|
|
13791
|
-
|
|
13792
|
-
this.geometry =
|
|
13793
|
-
this.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") });
|
|
13794
13821
|
}
|
|
13795
13822
|
discardGeoemtry() {
|
|
13796
13823
|
this.geometry.dispose();
|
|
13797
13824
|
}
|
|
13798
|
-
set radius(radius) {
|
|
13799
|
-
this.options.radius = radius;
|
|
13800
|
-
this.circleArc.update_radius(radius);
|
|
13801
|
-
this.generateGeometry();
|
|
13802
|
-
// if (this.nodeChild) {
|
|
13803
|
-
// this.nodeChild.update();
|
|
13804
|
-
// }
|
|
13805
|
-
}
|
|
13806
|
-
}
|
|
13807
|
-
|
|
13808
|
-
class BasePrimitive extends Line {
|
|
13809
13825
|
}
|
|
13826
|
+
_Arc_color = new WeakMap();
|
|
13810
13827
|
|
|
13811
13828
|
/**
|
|
13812
|
-
*
|
|
13829
|
+
* Base class for all line-based primitives in OpenGeometry.
|
|
13813
13830
|
*/
|
|
13814
|
-
class
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
|
|
13826
|
-
|
|
13827
|
-
|
|
13828
|
-
|
|
13829
|
-
|
|
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
|
+
// }
|
|
13830
13850
|
set color(color) {
|
|
13851
|
+
this.options.color = color;
|
|
13831
13852
|
if (this.material instanceof LineBasicMaterial) {
|
|
13832
13853
|
this.material.color.set(color);
|
|
13833
|
-
this.options.color = color;
|
|
13834
13854
|
}
|
|
13835
13855
|
}
|
|
13856
|
+
// FINAL: This flow should be used for other primitives
|
|
13836
13857
|
constructor(options) {
|
|
13837
13858
|
var _a;
|
|
13838
13859
|
super();
|
|
13839
13860
|
this.options = {
|
|
13840
13861
|
width: 1,
|
|
13841
13862
|
breadth: 1,
|
|
13842
|
-
center: new
|
|
13843
|
-
color:
|
|
13863
|
+
center: new Vector3$1(0, 0, 0),
|
|
13864
|
+
color: 0x00ff00,
|
|
13844
13865
|
};
|
|
13845
13866
|
const ogid = (_a = options === null || options === void 0 ? void 0 : options.ogid) !== null && _a !== void 0 ? _a : getUUID();
|
|
13846
13867
|
this.polyLineRectangle = new OGRectangle(ogid);
|
|
13847
|
-
const mergedOptions =
|
|
13848
|
-
|
|
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
|
+
}
|
|
13876
|
+
this.setConfig();
|
|
13849
13877
|
this.generateGeometry();
|
|
13850
13878
|
}
|
|
13851
|
-
|
|
13852
|
-
this.options
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
|
|
13879
|
+
validateOptions() {
|
|
13880
|
+
if (!this.options) {
|
|
13881
|
+
throw new Error("Options are not defined for Rectangle");
|
|
13882
|
+
}
|
|
13883
|
+
}
|
|
13884
|
+
setConfig() {
|
|
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);
|
|
13856
13888
|
}
|
|
13857
13889
|
getConfig() {
|
|
13858
13890
|
return this.options;
|
|
13859
13891
|
}
|
|
13860
13892
|
generateGeometry() {
|
|
13861
|
-
this.polyLineRectangle.
|
|
13862
|
-
const
|
|
13863
|
-
const
|
|
13864
|
-
|
|
13865
|
-
const
|
|
13866
|
-
|
|
13867
|
-
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);
|
|
13868
13908
|
}
|
|
13869
13909
|
discardGeometry() {
|
|
13870
13910
|
this.geometry.dispose();
|
|
13871
13911
|
}
|
|
13872
13912
|
}
|
|
13873
13913
|
|
|
13874
|
-
var
|
|
13875
|
-
class
|
|
13914
|
+
var _CylinderOld_outlineMesh;
|
|
13915
|
+
class CylinderOld extends Mesh {
|
|
13876
13916
|
constructor(options) {
|
|
13877
13917
|
super();
|
|
13878
|
-
|
|
13918
|
+
_CylinderOld_outlineMesh.set(this, null);
|
|
13879
13919
|
// Store local center offset to align outlines
|
|
13880
13920
|
// TODO: Can this be moved to Engine? It can increase performance | Needs to be used in other shapes too
|
|
13881
13921
|
this._geometryCenterOffset = new Vector3();
|
|
13882
13922
|
this.ogid = getUUID();
|
|
13883
13923
|
this.options = options;
|
|
13884
|
-
this.cylinder = new
|
|
13924
|
+
this.cylinder = new OGCylinderOld(this.ogid);
|
|
13885
13925
|
this.setConfig();
|
|
13886
13926
|
this.generateGeometry();
|
|
13887
13927
|
}
|
|
@@ -13893,7 +13933,7 @@ class Cylinder extends Mesh {
|
|
|
13893
13933
|
setConfig() {
|
|
13894
13934
|
this.validateOptions();
|
|
13895
13935
|
const { radius, height, segments, angle, center } = this.options;
|
|
13896
|
-
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);
|
|
13897
13937
|
}
|
|
13898
13938
|
generateGeometry() {
|
|
13899
13939
|
var _a, _b, _c;
|
|
@@ -13920,20 +13960,20 @@ class Cylinder extends Mesh {
|
|
|
13920
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);
|
|
13921
13961
|
}
|
|
13922
13962
|
set outline(enable) {
|
|
13923
|
-
if (enable && !__classPrivateFieldGet(this,
|
|
13963
|
+
if (enable && !__classPrivateFieldGet(this, _CylinderOld_outlineMesh, "f")) {
|
|
13924
13964
|
const outline_buff = this.cylinder.outline_edges();
|
|
13925
13965
|
const outline_buf = JSON.parse(outline_buff);
|
|
13926
13966
|
const outlineGeometry = new BufferGeometry();
|
|
13927
13967
|
outlineGeometry.setAttribute("position", new Float32BufferAttribute(outline_buf, 3));
|
|
13928
13968
|
outlineGeometry.translate(-this._geometryCenterOffset.x, -this._geometryCenterOffset.y, -this._geometryCenterOffset.z);
|
|
13929
13969
|
const outlineMaterial = new LineBasicMaterial({ color: 0x000000 });
|
|
13930
|
-
__classPrivateFieldSet(this,
|
|
13931
|
-
this.add(__classPrivateFieldGet(this,
|
|
13970
|
+
__classPrivateFieldSet(this, _CylinderOld_outlineMesh, new LineSegments(outlineGeometry, outlineMaterial), "f");
|
|
13971
|
+
this.add(__classPrivateFieldGet(this, _CylinderOld_outlineMesh, "f"));
|
|
13932
13972
|
}
|
|
13933
|
-
if (!enable && __classPrivateFieldGet(this,
|
|
13934
|
-
this.remove(__classPrivateFieldGet(this,
|
|
13935
|
-
__classPrivateFieldGet(this,
|
|
13936
|
-
__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");
|
|
13937
13977
|
}
|
|
13938
13978
|
}
|
|
13939
13979
|
getBrepData() {
|
|
@@ -13942,32 +13982,37 @@ class Cylinder extends Mesh {
|
|
|
13942
13982
|
console.log(brepDataParsed);
|
|
13943
13983
|
}
|
|
13944
13984
|
}
|
|
13945
|
-
|
|
13985
|
+
_CylinderOld_outlineMesh = new WeakMap();
|
|
13946
13986
|
|
|
13947
|
-
var _Polygon_outlineMesh;
|
|
13987
|
+
var _Polygon_outlineMesh, _Polygon_color;
|
|
13948
13988
|
class Polygon extends Mesh {
|
|
13949
|
-
|
|
13950
|
-
|
|
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) {
|
|
13951
13998
|
super();
|
|
13952
|
-
this.
|
|
13953
|
-
this.layerBackVertices = [];
|
|
13954
|
-
this.polygon = null;
|
|
13955
|
-
this.isTriangulated = false;
|
|
13999
|
+
this.options = { vertices: [] };
|
|
13956
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
|
|
13957
14007
|
this._geometryCenterOffset = new Vector3();
|
|
13958
14008
|
this.ogid = getUUID();
|
|
13959
|
-
|
|
13960
|
-
|
|
13961
|
-
this.polygon.add_vertices(vertices);
|
|
13962
|
-
// Triangulate the polygon - WORKS
|
|
13963
|
-
(_a = this.polygon) === null || _a === void 0 ? void 0 : _a.triangulate();
|
|
13964
|
-
const bufFlush = (_b = this.polygon) === null || _b === void 0 ? void 0 : _b.get_buffer_flush();
|
|
13965
|
-
this.addFlushBufferToScene(bufFlush);
|
|
13966
|
-
// Testing New Triangulation - FAILING
|
|
13967
|
-
// const triResult = JSON.parse(this.polygon.new_triangulate());
|
|
13968
|
-
// console.log(triResult);
|
|
14009
|
+
if (options) {
|
|
14010
|
+
this.options = options;
|
|
13969
14011
|
}
|
|
13970
|
-
|
|
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
|
|
13971
14016
|
// const originalSet = this.position.set.bind(this.position);
|
|
13972
14017
|
// this.position.set = (x: number, y: number, z: number) => {
|
|
13973
14018
|
// console.log(`Position set to (${x}, ${y}, ${z})`);
|
|
@@ -13981,186 +14026,406 @@ class Polygon extends Mesh {
|
|
|
13981
14026
|
// return originalCopy(v);
|
|
13982
14027
|
// };
|
|
13983
14028
|
}
|
|
13984
|
-
|
|
13985
|
-
if (!this.
|
|
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.");
|
|
13986
14097
|
return;
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
|
|
13992
|
-
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
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);
|
|
13996
14128
|
}
|
|
13997
14129
|
addVertices(vertices) {
|
|
13998
|
-
var _a, _b;
|
|
13999
14130
|
if (!this.polygon)
|
|
14000
14131
|
return;
|
|
14132
|
+
this.disposeGeometryMaterial();
|
|
14001
14133
|
this.polygon.add_vertices(vertices);
|
|
14002
|
-
|
|
14003
|
-
const bufFlush = (_b = this.polygon) === null || _b === void 0 ? void 0 : _b.get_buffer_flush();
|
|
14004
|
-
this.addFlushBufferToScene(bufFlush);
|
|
14134
|
+
this.generateGeometry();
|
|
14005
14135
|
}
|
|
14006
|
-
|
|
14007
|
-
var _a;
|
|
14136
|
+
saveTransformationToBREP() {
|
|
14008
14137
|
if (!this.polygon)
|
|
14009
14138
|
return;
|
|
14010
|
-
this.layerVertices = [];
|
|
14011
|
-
this.geometry.dispose();
|
|
14012
|
-
(_a = this.polygon) === null || _a === void 0 ? void 0 : _a.clear_vertices();
|
|
14013
|
-
this.isTriangulated = false;
|
|
14014
14139
|
}
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
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) {
|
|
14019
14273
|
this.geometry.dispose();
|
|
14020
|
-
(_a = this.polygon) === null || _a === void 0 ? void 0 : _a.clear_vertices();
|
|
14021
|
-
this.isTriangulated = false;
|
|
14022
|
-
for (const vertex of this.layerBackVertices) {
|
|
14023
|
-
this.layerVertices.push(vertex.clone());
|
|
14024
|
-
}
|
|
14025
14274
|
}
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
|
|
14030
|
-
|
|
14031
|
-
|
|
14032
|
-
|
|
14033
|
-
(_b = this.polygon) === null || _b === void 0 ? void 0 : _b.add_vertices(this.layerVertices);
|
|
14034
|
-
const bufFlush = (_c = this.polygon) === null || _c === void 0 ? void 0 : _c.triangulate();
|
|
14035
|
-
if (!bufFlush) {
|
|
14036
|
-
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();
|
|
14037
14282
|
}
|
|
14038
|
-
this.addFlushBufferToScene(bufFlush);
|
|
14039
|
-
this.isTriangulated = true;
|
|
14040
14283
|
}
|
|
14041
14284
|
}
|
|
14042
|
-
|
|
14043
|
-
|
|
14044
|
-
|
|
14045
|
-
this.
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
this.
|
|
14052
|
-
//
|
|
14053
|
-
//
|
|
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 = [];
|
|
14054
14300
|
}
|
|
14055
|
-
|
|
14056
|
-
|
|
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);
|
|
14057
14329
|
const geometry = new BufferGeometry();
|
|
14058
|
-
geometry.setAttribute("position", new
|
|
14059
|
-
geometry.computeVertexNormals();
|
|
14330
|
+
geometry.setAttribute("position", new Float32BufferAttribute(bufferData, 3));
|
|
14060
14331
|
const material = new MeshStandardMaterial({
|
|
14061
14332
|
color: 0x00ff00,
|
|
14062
|
-
side: DoubleSide,
|
|
14063
14333
|
transparent: true,
|
|
14064
|
-
opacity: 0.
|
|
14065
|
-
// wireframe: true
|
|
14334
|
+
opacity: 0.6,
|
|
14066
14335
|
});
|
|
14336
|
+
geometry.computeVertexNormals();
|
|
14337
|
+
geometry.computeBoundingBox();
|
|
14067
14338
|
this.geometry = geometry;
|
|
14068
14339
|
this.material = material;
|
|
14069
14340
|
}
|
|
14070
|
-
|
|
14071
|
-
if (!this
|
|
14072
|
-
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
|
|
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);
|
|
14076
14390
|
}
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
const
|
|
14080
|
-
|
|
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);
|
|
14081
14396
|
const geometry = new BufferGeometry();
|
|
14082
|
-
geometry.setAttribute("position", new
|
|
14083
|
-
geometry.computeVertexNormals();
|
|
14084
|
-
this.geometry = geometry;
|
|
14397
|
+
geometry.setAttribute("position", new Float32BufferAttribute(bufferData, 3));
|
|
14085
14398
|
const material = new MeshStandardMaterial({
|
|
14086
14399
|
color: 0x00ff00,
|
|
14087
|
-
side: FrontSide,
|
|
14088
14400
|
transparent: true,
|
|
14089
|
-
opacity: 0.
|
|
14090
|
-
// wireframe: true
|
|
14401
|
+
opacity: 0.6,
|
|
14091
14402
|
});
|
|
14403
|
+
geometry.computeVertexNormals();
|
|
14404
|
+
geometry.computeBoundingBox();
|
|
14405
|
+
this.geometry = geometry;
|
|
14092
14406
|
this.material = material;
|
|
14093
14407
|
}
|
|
14094
|
-
getBrepData() {
|
|
14095
|
-
if (!this.polygon)
|
|
14096
|
-
return null;
|
|
14097
|
-
const brepData = this.polygon.get_brep_data();
|
|
14098
|
-
return brepData;
|
|
14099
|
-
}
|
|
14100
|
-
set outlineColor(color) {
|
|
14101
|
-
if (__classPrivateFieldGet(this, _Polygon_outlineMesh, "f") && __classPrivateFieldGet(this, _Polygon_outlineMesh, "f").material instanceof LineBasicMaterial) {
|
|
14102
|
-
__classPrivateFieldGet(this, _Polygon_outlineMesh, "f").material.color.set(color);
|
|
14103
|
-
}
|
|
14104
|
-
}
|
|
14105
|
-
get outlineColor() {
|
|
14106
|
-
if (__classPrivateFieldGet(this, _Polygon_outlineMesh, "f") && __classPrivateFieldGet(this, _Polygon_outlineMesh, "f").material instanceof LineBasicMaterial) {
|
|
14107
|
-
return __classPrivateFieldGet(this, _Polygon_outlineMesh, "f").material.color.getHex();
|
|
14108
|
-
}
|
|
14109
|
-
return 0x000000; // Default color if outline mesh is not present
|
|
14110
|
-
}
|
|
14111
14408
|
set outline(enable) {
|
|
14112
|
-
if (enable && !__classPrivateFieldGet(this,
|
|
14113
|
-
const outline_buff = this.
|
|
14409
|
+
if (enable && !__classPrivateFieldGet(this, _Cube_outlineMesh, "f")) {
|
|
14410
|
+
const outline_buff = this.cube.get_outline_geometry_serialized();
|
|
14114
14411
|
const outline_buf = JSON.parse(outline_buff);
|
|
14115
14412
|
const outlineGeometry = new BufferGeometry();
|
|
14116
14413
|
outlineGeometry.setAttribute("position", new Float32BufferAttribute(outline_buf, 3));
|
|
14117
|
-
// TODO: Fix the outline position
|
|
14118
|
-
// outlineGeometry.translate(
|
|
14119
|
-
// -this._geometryCenterOffset.x,
|
|
14120
|
-
// -this._geometryCenterOffset.y,
|
|
14121
|
-
// -this._geometryCenterOffset.z
|
|
14122
|
-
// );
|
|
14123
14414
|
const outlineMaterial = new LineBasicMaterial({ color: 0x000000 });
|
|
14124
|
-
__classPrivateFieldSet(this,
|
|
14125
|
-
this.add(__classPrivateFieldGet(this,
|
|
14126
|
-
}
|
|
14127
|
-
if (!enable && __classPrivateFieldGet(this, _Polygon_outlineMesh, "f")) {
|
|
14128
|
-
this.remove(__classPrivateFieldGet(this, _Polygon_outlineMesh, "f"));
|
|
14129
|
-
__classPrivateFieldGet(this, _Polygon_outlineMesh, "f").geometry.dispose();
|
|
14130
|
-
__classPrivateFieldSet(this, _Polygon_outlineMesh, null, "f");
|
|
14415
|
+
__classPrivateFieldSet(this, _Cube_outlineMesh, new LineSegments(outlineGeometry, outlineMaterial), "f");
|
|
14416
|
+
this.add(__classPrivateFieldGet(this, _Cube_outlineMesh, "f"));
|
|
14131
14417
|
}
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
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");
|
|
14136
14422
|
}
|
|
14137
|
-
return false;
|
|
14138
|
-
}
|
|
14139
|
-
bTree() {
|
|
14140
|
-
if (!this.polygon)
|
|
14141
|
-
return;
|
|
14142
|
-
const bTree = this.polygon.binary_tree();
|
|
14143
|
-
const parsedData = JSON.parse(bTree);
|
|
14144
|
-
console.log(parsedData);
|
|
14145
14423
|
}
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
this.geometry.dispose();
|
|
14149
|
-
if (this.material instanceof Material) {
|
|
14150
|
-
this.material.dispose();
|
|
14151
|
-
}
|
|
14152
|
-
if (__classPrivateFieldGet(this, _Polygon_outlineMesh, "f")) {
|
|
14153
|
-
__classPrivateFieldGet(this, _Polygon_outlineMesh, "f").geometry.dispose();
|
|
14154
|
-
if (__classPrivateFieldGet(this, _Polygon_outlineMesh, "f").material instanceof Material) {
|
|
14155
|
-
__classPrivateFieldGet(this, _Polygon_outlineMesh, "f").material.dispose();
|
|
14156
|
-
}
|
|
14157
|
-
}
|
|
14158
|
-
this.polygon = null;
|
|
14159
|
-
this.layerVertices = [];
|
|
14160
|
-
this.layerBackVertices = [];
|
|
14424
|
+
get outlineMesh() {
|
|
14425
|
+
return __classPrivateFieldGet(this, _Cube_outlineMesh, "f");
|
|
14161
14426
|
}
|
|
14162
14427
|
}
|
|
14163
|
-
|
|
14428
|
+
_Cube_outlineMesh = new WeakMap();
|
|
14164
14429
|
|
|
14165
14430
|
class OpenGeometry {
|
|
14166
14431
|
set enablePencil(value) {
|
|
@@ -14322,9 +14587,9 @@ class BasePoly extends Mesh {
|
|
|
14322
14587
|
this.layerVertices.push(vertex.clone());
|
|
14323
14588
|
}
|
|
14324
14589
|
}
|
|
14325
|
-
const backupVertex = new
|
|
14590
|
+
const backupVertex = new Vector3$1(parseFloat(threeVertex.x.toFixed(2)), 0, parseFloat(threeVertex.z.toFixed(2)));
|
|
14326
14591
|
this.layerBackVertices.push(backupVertex);
|
|
14327
|
-
const vertex = new
|
|
14592
|
+
const vertex = new Vector3$1(parseFloat(threeVertex.x.toFixed(2)),
|
|
14328
14593
|
// when doing the parse operation getting -0 instead of 0
|
|
14329
14594
|
0, parseFloat(threeVertex.z.toFixed(2)));
|
|
14330
14595
|
this.layerVertices.push(vertex);
|
|
@@ -14386,212 +14651,211 @@ class BasePoly extends Mesh {
|
|
|
14386
14651
|
// this.material = material;
|
|
14387
14652
|
}
|
|
14388
14653
|
}
|
|
14389
|
-
class CirclePoly extends Mesh {
|
|
14390
|
-
|
|
14391
|
-
|
|
14392
|
-
|
|
14393
|
-
|
|
14394
|
-
|
|
14395
|
-
|
|
14396
|
-
|
|
14397
|
-
|
|
14398
|
-
|
|
14399
|
-
|
|
14400
|
-
|
|
14401
|
-
|
|
14402
|
-
|
|
14403
|
-
|
|
14404
|
-
|
|
14405
|
-
|
|
14406
|
-
|
|
14407
|
-
|
|
14408
|
-
|
|
14409
|
-
|
|
14410
|
-
|
|
14411
|
-
|
|
14412
|
-
|
|
14413
|
-
|
|
14414
|
-
|
|
14415
|
-
|
|
14416
|
-
|
|
14417
|
-
|
|
14418
|
-
|
|
14419
|
-
|
|
14420
|
-
|
|
14421
|
-
|
|
14422
|
-
|
|
14423
|
-
|
|
14424
|
-
|
|
14425
|
-
|
|
14426
|
-
|
|
14427
|
-
|
|
14428
|
-
|
|
14429
|
-
|
|
14430
|
-
|
|
14431
|
-
|
|
14432
|
-
|
|
14433
|
-
|
|
14434
|
-
|
|
14435
|
-
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
|
|
14440
|
-
|
|
14441
|
-
|
|
14442
|
-
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
|
|
14446
|
-
|
|
14447
|
-
|
|
14448
|
-
|
|
14449
|
-
|
|
14450
|
-
|
|
14451
|
-
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
|
|
14462
|
-
|
|
14463
|
-
|
|
14464
|
-
|
|
14465
|
-
|
|
14466
|
-
|
|
14467
|
-
|
|
14468
|
-
|
|
14469
|
-
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
|
|
14473
|
-
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
14477
|
-
|
|
14478
|
-
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
|
|
14489
|
-
|
|
14490
|
-
|
|
14491
|
-
|
|
14492
|
-
|
|
14493
|
-
|
|
14494
|
-
|
|
14495
|
-
|
|
14496
|
-
|
|
14497
|
-
|
|
14498
|
-
|
|
14499
|
-
|
|
14500
|
-
|
|
14501
|
-
|
|
14502
|
-
|
|
14503
|
-
|
|
14504
|
-
|
|
14505
|
-
|
|
14506
|
-
|
|
14507
|
-
|
|
14508
|
-
|
|
14509
|
-
|
|
14510
|
-
|
|
14511
|
-
|
|
14512
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
|
|
14537
|
-
|
|
14538
|
-
|
|
14539
|
-
|
|
14540
|
-
|
|
14541
|
-
|
|
14542
|
-
|
|
14543
|
-
|
|
14544
|
-
|
|
14545
|
-
|
|
14546
|
-
|
|
14547
|
-
|
|
14548
|
-
|
|
14549
|
-
|
|
14550
|
-
|
|
14551
|
-
|
|
14552
|
-
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
|
|
14557
|
-
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
|
|
14561
|
-
|
|
14562
|
-
|
|
14563
|
-
|
|
14564
|
-
|
|
14565
|
-
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
|
|
14571
|
-
|
|
14572
|
-
|
|
14573
|
-
|
|
14574
|
-
|
|
14575
|
-
|
|
14576
|
-
|
|
14577
|
-
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
14589
|
-
|
|
14590
|
-
|
|
14591
|
-
|
|
14592
|
-
|
|
14593
|
-
|
|
14594
|
-
}
|
|
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
|
+
// }
|
|
14595
14859
|
class RectanglePoly extends Mesh {
|
|
14596
14860
|
constructor(baseRectangle) {
|
|
14597
14861
|
super();
|
|
@@ -14752,7 +15016,7 @@ class RectanglePoly extends Mesh {
|
|
|
14752
15016
|
// Create a new geometry with the merged vertices
|
|
14753
15017
|
const mergedGeometry = new BufferGeometry().setFromPoints(mergedVertices);
|
|
14754
15018
|
const mergedMaterial = new MeshBasicMaterial({ color: 0x000000, side: DoubleSide });
|
|
14755
|
-
const mergedMesh = new Line(mergedGeometry, mergedMaterial);
|
|
15019
|
+
const mergedMesh = new Line$1(mergedGeometry, mergedMaterial);
|
|
14756
15020
|
return mergedMesh;
|
|
14757
15021
|
}
|
|
14758
15022
|
}
|
|
@@ -14774,5 +15038,5 @@ class FlatMesh extends Mesh {
|
|
|
14774
15038
|
}
|
|
14775
15039
|
}
|
|
14776
15040
|
|
|
14777
|
-
export {
|
|
15041
|
+
export { Arc, BasePoly, Cube, Cylinder, CylinderOld, FlatMesh, Line, OpenGeometry, Polygon, Polyline, Rectangle, RectanglePoly, SpotLabel, Vector3$1 as Vector3 };
|
|
14778
15042
|
//# sourceMappingURL=index.js.map
|