UNPKG

opengeometry

Version:
1,822 lines (1,774 loc) 300 kB
/****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; let wasm; let cachedUint8ArrayMemory0 = null; function getUint8ArrayMemory0() { if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); } return cachedUint8ArrayMemory0; } function getArrayU8FromWasm0(ptr, len) { ptr = ptr >>> 0; return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); } function addToExternrefTable0(obj) { const idx = wasm.__externref_table_alloc(); wasm.__wbindgen_export_2.set(idx, obj); return idx; } function handleError(f, args) { try { return f.apply(this, args); } catch (e) { const idx = addToExternrefTable0(e); wasm.__wbindgen_exn_store(idx); } } let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); cachedTextDecoder.decode(); const MAX_SAFARI_DECODE_BYTES = 2146435072; let numBytesDecoded = 0; function decodeText(ptr, len) { numBytesDecoded += len; if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) { cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); cachedTextDecoder.decode(); numBytesDecoded = len; } return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; return decodeText(ptr, len); } let WASM_VECTOR_LEN = 0; const cachedTextEncoder = new TextEncoder(); if (!('encodeInto' in cachedTextEncoder)) { cachedTextEncoder.encodeInto = function (arg, view) { const buf = cachedTextEncoder.encode(arg); view.set(buf); return { read: arg.length, written: buf.length }; }; } function passStringToWasm0(arg, malloc, realloc) { if (realloc === undefined) { const buf = cachedTextEncoder.encode(arg); const ptr = malloc(buf.length, 1) >>> 0; getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); WASM_VECTOR_LEN = buf.length; return ptr; } let len = arg.length; let ptr = malloc(len, 1) >>> 0; const mem = getUint8ArrayMemory0(); let offset = 0; for (; offset < len; offset++) { const code = arg.charCodeAt(offset); if (code > 0x7F) break; mem[ptr + offset] = code; } if (offset !== len) { if (offset !== 0) { arg = arg.slice(offset); } ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); const ret = cachedTextEncoder.encodeInto(arg, view); offset += ret.written; ptr = realloc(ptr, len, offset, 1) >>> 0; } WASM_VECTOR_LEN = offset; return ptr; } let cachedDataViewMemory0 = null; function getDataViewMemory0() { if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer) { cachedDataViewMemory0 = new DataView(wasm.memory.buffer); } return cachedDataViewMemory0; } function passArrayJsValueToWasm0(array, malloc) { const ptr = malloc(array.length * 4, 4) >>> 0; for (let i = 0; i < array.length; i++) { const add = addToExternrefTable0(array[i]); getDataViewMemory0().setUint32(ptr + 4 * i, add, true); } WASM_VECTOR_LEN = array.length; return ptr; } let cachedFloat64ArrayMemory0 = null; function getFloat64ArrayMemory0() { if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) { cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer); } return cachedFloat64ArrayMemory0; } function passArrayF64ToWasm0(arg, malloc) { const ptr = malloc(arg.length * 8, 8) >>> 0; getFloat64ArrayMemory0().set(arg, ptr / 8); WASM_VECTOR_LEN = arg.length; return ptr; } function _assertClass(instance, klass) { if (!(instance instanceof klass)) { throw new Error(`expected instance of ${klass.name}`); } } function getArrayJsValueFromWasm0(ptr, len) { ptr = ptr >>> 0; const mem = getDataViewMemory0(); const result = []; for (let i = ptr; i < ptr + 4 * len; i += 4) { result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true))); } wasm.__externref_drop_slice(ptr, len); return result; } function getArrayF64FromWasm0(ptr, len) { ptr = ptr >>> 0; return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len); } typeof FinalizationRegistry === 'undefined' ? { } : new FinalizationRegistry(ptr => wasm.__wbg_color_free(ptr >>> 0, 1)); const ColorRGBFinalization = typeof FinalizationRegistry === 'undefined' ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(ptr => wasm.__wbg_colorrgb_free(ptr >>> 0, 1)); class ColorRGB { static __wrap(ptr) { ptr = ptr >>> 0; const obj = Object.create(ColorRGB.prototype); obj.__wbg_ptr = ptr; ColorRGBFinalization.register(obj, obj.__wbg_ptr, obj); return obj; } __destroy_into_raw() { const ptr = this.__wbg_ptr; this.__wbg_ptr = 0; ColorRGBFinalization.unregister(this); return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_colorrgb_free(ptr, 0); } /** * @returns {number} */ get r() { const ret = wasm.__wbg_get_colorrgb_r(this.__wbg_ptr); return ret; } /** * @param {number} arg0 */ set r(arg0) { wasm.__wbg_set_colorrgb_r(this.__wbg_ptr, arg0); } /** * @returns {number} */ get g() { const ret = wasm.__wbg_get_colorrgb_g(this.__wbg_ptr); return ret; } /** * @param {number} arg0 */ set g(arg0) { wasm.__wbg_set_colorrgb_g(this.__wbg_ptr, arg0); } /** * @returns {number} */ get b() { const ret = wasm.__wbg_get_colorrgb_b(this.__wbg_ptr); return ret; } /** * @param {number} arg0 */ set b(arg0) { wasm.__wbg_set_colorrgb_b(this.__wbg_ptr, arg0); } /** * @param {number} r * @param {number} g * @param {number} b */ constructor(r, g, b) { const ret = wasm.colorrgb_new(r, g, b); this.__wbg_ptr = ret >>> 0; ColorRGBFinalization.register(this, this.__wbg_ptr, this); return this; } /** * @returns {string} */ to_hex() { let deferred1_0; let deferred1_1; try { const ret = wasm.colorrgb_to_hex(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } } if (Symbol.dispose) ColorRGB.prototype[Symbol.dispose] = ColorRGB.prototype.free; typeof FinalizationRegistry === 'undefined' ? { } : new FinalizationRegistry(ptr => wasm.__wbg_matrix3_free(ptr >>> 0, 1)); const Matrix4Finalization = typeof FinalizationRegistry === 'undefined' ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(ptr => wasm.__wbg_matrix4_free(ptr >>> 0, 1)); /** * * * Matrix4 Module * * 2D Representation of a 4x4 Matrix * * It's a row-major matrix. * */ let Matrix4$1 = class Matrix4 { static __wrap(ptr) { ptr = ptr >>> 0; const obj = Object.create(Matrix4.prototype); obj.__wbg_ptr = ptr; Matrix4Finalization.register(obj, obj.__wbg_ptr, obj); return obj; } __destroy_into_raw() { const ptr = this.__wbg_ptr; this.__wbg_ptr = 0; Matrix4Finalization.unregister(this); return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_matrix4_free(ptr, 0); } /** * @returns {Float64Array} */ get elements() { const ret = wasm.matrix4_elements(this.__wbg_ptr); var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice(); wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); return v1; } /** * * * Create a new Matrix4 with identity elements. * */ constructor() { const ret = wasm.matrix4_new(); this.__wbg_ptr = ret >>> 0; Matrix4Finalization.register(this, this.__wbg_ptr, this); return this; } /** * @param {number} m0 * @param {number} m1 * @param {number} m2 * @param {number} m3 * @param {number} m4 * @param {number} m5 * @param {number} m6 * @param {number} m7 * @param {number} m8 * @param {number} m9 * @param {number} m10 * @param {number} m11 * @param {number} m12 * @param {number} m13 * @param {number} m14 * @param {number} m15 * @returns {Matrix4} */ static set(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15) { const ret = wasm.matrix4_set(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15); return Matrix4.__wrap(ret); } /** * * * Clone the Matrix4 instance and return a new one. * * @returns {Matrix4} */ clone() { const ret = wasm.matrix4_clone(this.__wbg_ptr); return Matrix4.__wrap(ret); } /** * * * Sets the matrix element to create an identity matrix. * */ identity() { wasm.matrix4_identity(this.__wbg_ptr); } /** * * * Determinant for a 4x4 matrix. * * https://en.wikipedia.org/wiki/Determinant * * @returns {number} */ determinant() { const ret = wasm.matrix4_determinant(this.__wbg_ptr); return ret; } /** * @returns {Matrix4} */ adjucate() { const ret = wasm.matrix4_adjucate(this.__wbg_ptr); return Matrix4.__wrap(ret); } /** * * * Inverse of a matrix * * Returns a new Matrix4 instance. * * If the determinant is zero, it returns a zero matrix. * * It can be checked with is_zero() method. * * @returns {Matrix4} */ inverse() { const ret = wasm.matrix4_inverse(this.__wbg_ptr); return Matrix4.__wrap(ret); } /** * * * Multiply this matrix with another Matrix4 * * Returns a new Matrix4 instance * * @param {Matrix4} other * @returns {Matrix4} */ multiply(other) { _assertClass(other, Matrix4); const ret = wasm.matrix4_multiply(this.__wbg_ptr, other.__wbg_ptr); return Matrix4.__wrap(ret); } /** * * * Add another Matrix4 to this one. * * Returns a new Matrix4 instance with the result. * * @param {Matrix4} incoming * @returns {Matrix4} */ add(incoming) { _assertClass(incoming, Matrix4); const ret = wasm.matrix4_add(this.__wbg_ptr, incoming.__wbg_ptr); return Matrix4.__wrap(ret); } /** * * * Subtract another Matrix4 from this one. * * Returns a new Matrix4 instance with the result. * * @param {Matrix4} incoming * @returns {Matrix4} */ subtract(incoming) { _assertClass(incoming, Matrix4); const ret = wasm.matrix4_subtract(this.__wbg_ptr, incoming.__wbg_ptr); return Matrix4.__wrap(ret); } /** * * * Flatten the matrix into a vector of f64. * * @returns {Float64Array} */ flatten() { const ret = wasm.matrix4_flatten(this.__wbg_ptr); var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice(); wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); return v1; } /** * * * Get the element at a specific index in the flattened matrix. * * @param {number} index * @returns {number | undefined} */ get_element_at(index) { const ret = wasm.matrix4_get_element_at(this.__wbg_ptr, index); return ret[0] === 0 ? undefined : ret[1]; } /** * * * Check if the matrix is a zero matrix. * * @returns {boolean} */ is_zero() { const ret = wasm.matrix4_is_zero(this.__wbg_ptr); return ret !== 0; } /** * * * Check if the matrix is an identity matrix. * * @returns {boolean} */ is_identity() { const ret = wasm.matrix4_is_identity(this.__wbg_ptr); return ret !== 0; } /** * * * Create a Transpose of the matrix. * * Returns a new Matrix4 instance. * * @returns {Matrix4} */ transpose() { const ret = wasm.matrix4_transpose(this.__wbg_ptr); return Matrix4.__wrap(ret); } }; if (Symbol.dispose) Matrix4$1.prototype[Symbol.dispose] = Matrix4$1.prototype.free; const OGArcFinalization = typeof FinalizationRegistry === 'undefined' ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(ptr => wasm.__wbg_ogarc_free(ptr >>> 0, 1)); class OGArc { __destroy_into_raw() { const ptr = this.__wbg_ptr; this.__wbg_ptr = 0; OGArcFinalization.unregister(this); return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_ogarc_free(ptr, 0); } /** * @param {string} id */ set id(id) { const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; wasm.ogarc_set_id(this.__wbg_ptr, ptr0, len0); } /** * @returns {string} */ get id() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogarc_id(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @param {string} id */ constructor(id) { const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; const ret = wasm.ogarc_new(ptr0, len0); this.__wbg_ptr = ret >>> 0; OGArcFinalization.register(this, this.__wbg_ptr, this); return this; } /** * @param {Vector3} center * @param {number} radius * @param {number} start_angle * @param {number} end_angle * @param {number} segments */ set_config(center, radius, start_angle, end_angle, segments) { _assertClass(center, Vector3$1); var ptr0 = center.__destroy_into_raw(); wasm.ogarc_set_config(this.__wbg_ptr, ptr0, radius, start_angle, end_angle, segments); } generate_geometry() { wasm.ogarc_generate_geometry(this.__wbg_ptr); } dispose_points() { wasm.ogarc_dispose_points(this.__wbg_ptr); } destroy() { wasm.ogarc_destroy(this.__wbg_ptr); } /** * @returns {string} */ get_brep_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogarc_get_brep_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @returns {string} */ get_geometry_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogarc_get_geometry_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } } if (Symbol.dispose) OGArc.prototype[Symbol.dispose] = OGArc.prototype.free; const OGCuboidFinalization = typeof FinalizationRegistry === 'undefined' ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(ptr => wasm.__wbg_ogcuboid_free(ptr >>> 0, 1)); class OGCuboid { __destroy_into_raw() { const ptr = this.__wbg_ptr; this.__wbg_ptr = 0; OGCuboidFinalization.unregister(this); return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_ogcuboid_free(ptr, 0); } /** * @param {string} id */ set id(id) { const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; wasm.ogcuboid_set_id(this.__wbg_ptr, ptr0, len0); } /** * @returns {string} */ get id() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogcuboid_id(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @param {string} id */ constructor(id) { const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; const ret = wasm.ogcuboid_new(ptr0, len0); this.__wbg_ptr = ret >>> 0; OGCuboidFinalization.register(this, this.__wbg_ptr, this); return this; } /** * @param {Vector3} center * @param {number} width * @param {number} height * @param {number} depth */ set_config(center, width, height, depth) { _assertClass(center, Vector3$1); var ptr0 = center.__destroy_into_raw(); wasm.ogcuboid_set_config(this.__wbg_ptr, ptr0, width, height, depth); } generate_brep() { wasm.ogcuboid_generate_brep(this.__wbg_ptr); } clean_geometry() { wasm.ogcuboid_clean_geometry(this.__wbg_ptr); } generate_geometry() { wasm.ogcuboid_generate_geometry(this.__wbg_ptr); } /** * @returns {string} */ get_brep_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogcuboid_get_brep_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @returns {string} */ get_geometry_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogcuboid_get_geometry_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @returns {string} */ get_outline_geometry_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogcuboid_get_outline_geometry_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } } if (Symbol.dispose) OGCuboid.prototype[Symbol.dispose] = OGCuboid.prototype.free; const OGCylinderFinalization = typeof FinalizationRegistry === 'undefined' ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(ptr => wasm.__wbg_ogcylinder_free(ptr >>> 0, 1)); class OGCylinder { __destroy_into_raw() { const ptr = this.__wbg_ptr; this.__wbg_ptr = 0; OGCylinderFinalization.unregister(this); return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_ogcylinder_free(ptr, 0); } /** * @param {string} id */ set id(id) { const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; wasm.ogcylinder_set_id(this.__wbg_ptr, ptr0, len0); } /** * @returns {string} */ get id() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogcylinder_id(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @param {string} id */ constructor(id) { const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; const ret = wasm.ogcylinder_new(ptr0, len0); this.__wbg_ptr = ret >>> 0; OGCylinderFinalization.register(this, this.__wbg_ptr, this); return this; } /** * @param {Vector3} center * @param {number} radius * @param {number} height * @param {number} angle * @param {number} segments */ set_config(center, radius, height, angle, segments) { _assertClass(center, Vector3$1); var ptr0 = center.__destroy_into_raw(); wasm.ogcylinder_set_config(this.__wbg_ptr, ptr0, radius, height, angle, segments); } generate_brep() { wasm.ogcylinder_generate_brep(this.__wbg_ptr); } clean_geometry() { wasm.ogcylinder_clean_geometry(this.__wbg_ptr); } generate_geometry() { wasm.ogcylinder_generate_geometry(this.__wbg_ptr); } /** * @returns {string} */ get_brep_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogcylinder_get_brep_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @returns {string} */ get_geometry_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogcylinder_get_geometry_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @returns {string} */ get_outline_geometry_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogcylinder_get_outline_geometry_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } } if (Symbol.dispose) OGCylinder.prototype[Symbol.dispose] = OGCylinder.prototype.free; const OGLineFinalization = typeof FinalizationRegistry === 'undefined' ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(ptr => wasm.__wbg_ogline_free(ptr >>> 0, 1)); class OGLine { __destroy_into_raw() { const ptr = this.__wbg_ptr; this.__wbg_ptr = 0; OGLineFinalization.unregister(this); return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_ogline_free(ptr, 0); } /** * @param {string} id */ set id(id) { const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; wasm.ogline_set_id(this.__wbg_ptr, ptr0, len0); } /** * @returns {string} */ get id() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogline_id(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @param {string} id */ constructor(id) { const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; const ret = wasm.ogline_new(ptr0, len0); this.__wbg_ptr = ret >>> 0; OGLineFinalization.register(this, this.__wbg_ptr, this); return this; } /** * @param {Vector3} start * @param {Vector3} end */ set_config(start, end) { _assertClass(start, Vector3$1); var ptr0 = start.__destroy_into_raw(); _assertClass(end, Vector3$1); var ptr1 = end.__destroy_into_raw(); wasm.ogline_set_config(this.__wbg_ptr, ptr0, ptr1); } generate_geometry() { wasm.ogline_generate_geometry(this.__wbg_ptr); } dispose_points() { wasm.ogline_dispose_points(this.__wbg_ptr); } destroy() { wasm.ogline_destroy(this.__wbg_ptr); } /** * @returns {string} */ get_brep_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogline_get_brep_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @returns {string} */ get_geometry_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogline_get_geometry_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } } if (Symbol.dispose) OGLine.prototype[Symbol.dispose] = OGLine.prototype.free; const OGPolygonFinalization = typeof FinalizationRegistry === 'undefined' ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(ptr => wasm.__wbg_ogpolygon_free(ptr >>> 0, 1)); class OGPolygon { __destroy_into_raw() { const ptr = this.__wbg_ptr; this.__wbg_ptr = 0; OGPolygonFinalization.unregister(this); return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_ogpolygon_free(ptr, 0); } /** * @param {string} id */ set id(id) { const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; wasm.ogpolygon_set_id(this.__wbg_ptr, ptr0, len0); } /** * @returns {string} */ get id() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogpolygon_id(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @param {string} id */ constructor(id) { const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; const ret = wasm.ogpolygon_new(ptr0, len0); this.__wbg_ptr = ret >>> 0; OGPolygonFinalization.register(this, this.__wbg_ptr, this); return this; } /** * @param {Vector3[]} points */ set_config(points) { const ptr0 = passArrayJsValueToWasm0(points, wasm.__wbindgen_malloc); const len0 = WASM_VECTOR_LEN; wasm.ogpolygon_set_config(this.__wbg_ptr, ptr0, len0); } /** * @param {Float64Array} transformation */ set_transformation(transformation) { const ptr0 = passArrayF64ToWasm0(transformation, wasm.__wbindgen_malloc); const len0 = WASM_VECTOR_LEN; wasm.ogpolygon_set_transformation(this.__wbg_ptr, ptr0, len0); } /** * @param {Vector3[]} vertices */ add_vertices(vertices) { const ptr0 = passArrayJsValueToWasm0(vertices, wasm.__wbindgen_malloc); const len0 = WASM_VECTOR_LEN; wasm.ogpolygon_add_vertices(this.__wbg_ptr, ptr0, len0); } /** * @param {Vector3[]} holes */ add_holes(holes) { const ptr0 = passArrayJsValueToWasm0(holes, wasm.__wbindgen_malloc); const len0 = WASM_VECTOR_LEN; wasm.ogpolygon_add_holes(this.__wbg_ptr, ptr0, len0); } clean_geometry() { wasm.ogpolygon_clean_geometry(this.__wbg_ptr); } generate_brep() { wasm.ogpolygon_generate_brep(this.__wbg_ptr); } generate_geometry() { wasm.ogpolygon_generate_geometry(this.__wbg_ptr); } /** * @returns {string} */ get_brep_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogpolygon_get_brep_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @returns {string} */ get_geometry_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogpolygon_get_geometry_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @returns {string} */ get_outline_geometry_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogpolygon_get_outline_geometry_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } } if (Symbol.dispose) OGPolygon.prototype[Symbol.dispose] = OGPolygon.prototype.free; const OGPolylineFinalization = typeof FinalizationRegistry === 'undefined' ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(ptr => wasm.__wbg_ogpolyline_free(ptr >>> 0, 1)); class OGPolyline { static __wrap(ptr) { ptr = ptr >>> 0; const obj = Object.create(OGPolyline.prototype); obj.__wbg_ptr = ptr; OGPolylineFinalization.register(obj, obj.__wbg_ptr, obj); return obj; } __destroy_into_raw() { const ptr = this.__wbg_ptr; this.__wbg_ptr = 0; OGPolylineFinalization.unregister(this); return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_ogpolyline_free(ptr, 0); } /** * @param {string} id */ set id(id) { const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; wasm.ogpolyline_set_id(this.__wbg_ptr, ptr0, len0); } /** * @returns {string} */ get id() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogpolyline_id(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @param {string} id */ constructor(id) { const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; const ret = wasm.ogpolyline_new(ptr0, len0); this.__wbg_ptr = ret >>> 0; OGPolylineFinalization.register(this, this.__wbg_ptr, this); return this; } /** * @returns {OGPolyline} */ clone() { const ret = wasm.ogpolyline_clone(this.__wbg_ptr); return OGPolyline.__wrap(ret); } /** * @param {Vector3[]} points */ set_config(points) { const ptr0 = passArrayJsValueToWasm0(points, wasm.__wbindgen_malloc); const len0 = WASM_VECTOR_LEN; wasm.ogpolyline_set_config(this.__wbg_ptr, ptr0, len0); } generate_geometry() { wasm.ogpolyline_generate_geometry(this.__wbg_ptr); } /** * @param {Vector3[]} points */ add_multiple_points(points) { const ptr0 = passArrayJsValueToWasm0(points, wasm.__wbindgen_malloc); const len0 = WASM_VECTOR_LEN; wasm.ogpolyline_add_multiple_points(this.__wbg_ptr, ptr0, len0); } /** * @param {Vector3} point */ add_point(point) { _assertClass(point, Vector3$1); var ptr0 = point.__destroy_into_raw(); wasm.ogpolyline_add_point(this.__wbg_ptr, ptr0); } /** * @returns {string} */ get_points() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogpolyline_get_points(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @returns {Vector3[]} */ get_raw_points() { const ret = wasm.ogpolyline_get_raw_points(this.__wbg_ptr); var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice(); wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); return v1; } /** * @returns {boolean} */ is_closed() { const ret = wasm.ogpolyline_is_closed(this.__wbg_ptr); return ret !== 0; } check_closed_test() { wasm.ogpolyline_check_closed_test(this.__wbg_ptr); } /** * @returns {string} */ get_brep_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogpolyline_get_brep_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @returns {string} */ get_geometry_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogpolyline_get_geometry_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } } if (Symbol.dispose) OGPolyline.prototype[Symbol.dispose] = OGPolyline.prototype.free; const OGRectangleFinalization = typeof FinalizationRegistry === 'undefined' ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(ptr => wasm.__wbg_ogrectangle_free(ptr >>> 0, 1)); class OGRectangle { __destroy_into_raw() { const ptr = this.__wbg_ptr; this.__wbg_ptr = 0; OGRectangleFinalization.unregister(this); return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_ogrectangle_free(ptr, 0); } /** * @param {string} id */ set id(id) { const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; wasm.ogrectangle_set_id(this.__wbg_ptr, ptr0, len0); } /** * @returns {string} */ get id() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogrectangle_id(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @param {string} id */ constructor(id) { const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; const ret = wasm.ogrectangle_new(ptr0, len0); this.__wbg_ptr = ret >>> 0; OGRectangleFinalization.register(this, this.__wbg_ptr, this); return this; } /** * @param {Vector3} center * @param {number} width * @param {number} breadth */ set_config(center, width, breadth) { _assertClass(center, Vector3$1); var ptr0 = center.__destroy_into_raw(); wasm.ogrectangle_set_config(this.__wbg_ptr, ptr0, width, breadth); } generate_geometry() { wasm.ogrectangle_generate_geometry(this.__wbg_ptr); } /** * @returns {string} */ get_brep_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogrectangle_get_brep_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } /** * @returns {string} */ get_geometry_serialized() { let deferred1_0; let deferred1_1; try { const ret = wasm.ogrectangle_get_geometry_serialized(this.__wbg_ptr); deferred1_0 = ret[0]; deferred1_1 = ret[1]; return getStringFromWasm0(ret[0], ret[1]); } finally { wasm.__wbindgen_free(deferred1_0, deferred1_1, 1); } } } if (Symbol.dispose) OGRectangle.prototype[Symbol.dispose] = OGRectangle.prototype.free; const Vector3Finalization = typeof FinalizationRegistry === 'undefined' ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(ptr => wasm.__wbg_vector3_free(ptr >>> 0, 1)); let Vector3$1 = class Vector3 { static __wrap(ptr) { ptr = ptr >>> 0; const obj = Object.create(Vector3.prototype); obj.__wbg_ptr = ptr; Vector3Finalization.register(obj, obj.__wbg_ptr, obj); return obj; } static __unwrap(jsValue) { if (!(jsValue instanceof Vector3)) { return 0; } return jsValue.__destroy_into_raw(); } __destroy_into_raw() { const ptr = this.__wbg_ptr; this.__wbg_ptr = 0; Vector3Finalization.unregister(this); return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_vector3_free(ptr, 0); } /** * @returns {number} */ get x() { const ret = wasm.__wbg_get_vector3_x(this.__wbg_ptr); return ret; } /** * @param {number} arg0 */ set x(arg0) { wasm.__wbg_set_vector3_x(this.__wbg_ptr, arg0); } /** * @returns {number} */ get y() { const ret = wasm.__wbg_get_vector3_y(this.__wbg_ptr); return ret; } /** * @param {number} arg0 */ set y(arg0) { wasm.__wbg_set_vector3_y(this.__wbg_ptr, arg0); } /** * @returns {number} */ get z() { const ret = wasm.__wbg_get_vector3_z(this.__wbg_ptr); return ret; } /** * @param {number} arg0 */ set z(arg0) { wasm.__wbg_set_vector3_z(this.__wbg_ptr, arg0); } /** * @param {number} x * @param {number} y * @param {number} z */ constructor(x, y, z) { const ret = wasm.vector3_new(x, y, z); this.__wbg_ptr = ret >>> 0; Vector3Finalization.register(this, this.__wbg_ptr, this); return this; } /** * * * Add the elements of another vector to this one. * * @param {Vector3} other * @returns {Vector3} */ add(other) { _assertClass(other, Vector3); const ret = wasm.vector3_add(this.__wbg_ptr, other.__wbg_ptr); return Vector3.__wrap(ret); } /** * * * Add a scalar value to each element of the vector. * * @param {number} scalar * @returns {Vector3} */ add_scalar(scalar) { const ret = wasm.vector3_add_scalar(this.__wbg_ptr, scalar); return Vector3.__wrap(ret); } /** * * * Subtract the elements of another vector from this one. * * @param {Vector3} other * @returns {Vector3} */ subtract(other) { _assertClass(other, Vector3); const ret = wasm.vector3_subtract(this.__wbg_ptr, other.__wbg_ptr); return Vector3.__wrap(ret); } /** * * * Subtract a scalar value from each element of the vector. * * @param {number} scalar * @returns {Vector3} */ subtract_scalar(scalar) { const ret = wasm.vector3_subtract_scalar(this.__wbg_ptr, scalar); return Vector3.__wrap(ret); } /** * * * Clone the Vector3 instance and return a new one. * * @returns {Vector3} */ clone() { const ret = wasm.vector3_clone(this.__wbg_ptr); return Vector3.__wrap(ret); } /** * * * Set the current vector elements to zero. * */ zero() { wasm.vector3_zero(this.__wbg_ptr); } /** * * * Copy the elements from another Vector3 instance. * * @param {Vector3} other */ copy(other) { _assertClass(other, Vector3); wasm.vector3_copy(this.__wbg_ptr, other.__wbg_ptr); } /** * * * Multiply the vector by a scalar value. * * @param {number} scalar * @returns {Vector3} */ multiply_scalar(scalar) { const ret = wasm.vector3_multiply_scalar(this.__wbg_ptr, scalar); return Vector3.__wrap(ret); } /** * * * Multiply the vector by another Vector3 instance element-wise. * * @param {Vector3} other * @returns {Vector3} */ multiply(other) { _assertClass(other, Vector3); const ret = wasm.vector3_multiply(this.__wbg_ptr, other.__wbg_ptr); return Vector3.__wrap(ret); } /** * * * Divide the vector by another Vector3 instance element-wise. * * @param {Vector3} other * @returns {Vector3} */ divide(other) { _assertClass(other, Vector3); const ret = wasm.vector3_divide(this.__wbg_ptr, other.__wbg_ptr); return Vector3.__wrap(ret); } /** * * * Divide the vector by a scalar value. * * @param {number} scalar * @returns {Vector3} */ divide_scalar(scalar) { const ret = wasm.vector3_divide_scalar(this.__wbg_ptr, scalar); return Vector3.__wrap(ret); } /** * * * Invert the vector by negating the vector elements. * * @returns {Vector3} */ negate() { const ret = wasm.vector3_negate(this.__wbg_ptr); return Vector3.__wrap(ret); } /** * * * Calculate the dot product of this vector with another Vector3 instance. * * @param {Vector3} other * @returns {number} */ dot(other) { _assertClass(other, Vector3); const ret = wasm.vector3_dot(this.__wbg_ptr, other.__wbg_ptr); return ret; } /** * * * Calculate the magnitude (length) of the vector. * * @returns {number} */ magnitude() { const ret = wasm.vector3_magnitude(this.__wbg_ptr); return ret; } /** * * * Calculate the length of the vector. * * Since length is equivalent to magnitude, this method is an alias. * * @returns {number} */ length() { const ret = wasm.vector3_length(this.__wbg_ptr); return ret; } /** * * * Normalize the vector * * @returns {Vector3} */ normalize() { const ret = wasm.vector3_normalize(this.__wbg_ptr); return Vector3.__wrap(ret); } /** * * * Calculate the cross product and return the result as a new Vector3 * * @param {Vector3} other * @returns {Vector3} */ cross(other) { _assertClass(other, Vector3); const ret = wasm.vector3_cross(this.__wbg_ptr, other.__wbg_ptr); return Vector3.__wrap(ret); } /** * * * Calculate the distance between this vector and another Vector3 instance. * * Return the distance as a f64 value in Euclidean space. * * @param {Vector3} other * @returns {number} */ distance(other) { _assertClass(other, Vector3); const ret = wasm.vector3_distance(this.__wbg_ptr, other.__wbg_ptr); return ret; } /** * * * Apply a transformation matrix to the vector. * * This method assumes the transformation matrix is a 4x4 matrix. * * @param {Matrix4} matrix */ apply_matrix4(matrix) { _assertClass(matrix, Matrix4$1); var ptr0 = matrix.__destroy_into_raw(); wasm.vector3_apply_matrix4(this.__wbg_ptr, ptr0); } }; if (Symbol.dispose) Vector3$1.prototype[Symbol.dispose] = Vector3$1.prototype.free; const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']); async function __wbg_load(module, imports) { if (typeof Response === 'function' && module instanceof Response) { if (typeof WebAssembly.instantiateStreaming === 'function') { try { return await WebAssembly.instantiateStreaming(module, imports); } catch (e) { const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type); if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') { 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); } else { throw e; } } } const bytes = await module.arrayBuffer(); return await WebAssembly.instantiate(bytes, imports); } else { const instance = await WebAssembly.instantiate(module, imports); if (instance instanceof WebAssembly.Instance) { return { instance, module }; } else { return instance; } } } function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbg_getRandomValues_38a1ff1ea09f6cc7 = function () { return handleError(function (arg0, arg1) { globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1)); }, arguments); }; imports.wbg.__wbg_log_6c7b5f4f00b8ce3f = function (arg0) { console.log(arg0); }; imports.wbg.__wbg_vector3_new = function (arg0) { const ret = Vector3$1.__wrap(arg0); return ret; }; imports.wbg.__wbg_vector3_unwrap = function (arg0) { const ret = Vector3$1.__unwrap(arg0); return ret; }; imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function (arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) { // Cast intrinsic for `Ref(String) -> Externref`. const ret = getStringFromWasm0(arg0, arg1); return ret; }; imports.wbg.__wbindgen_init_externref_table = function () { const table = wasm.__wbindgen_export_2; const offset = table.grow(4); table.set(0, undefined); table.set(offset + 0, undefined); table.set(offset + 1, null); table.set(offset + 2, true); table.set(offset + 3, false); }; return imports; } function __wbg_finalize_init(instance, module) { wasm = instance.exports; __wbg_init.__wbindgen_wasm_module = module; cachedDataViewMemory0 = null; cachedFloat64ArrayMemory0 = null; cachedUint8ArrayMemory0 = null; wasm.__wbindgen_start(); return wasm; } async function __wbg_init(module_or_path) { if (wasm !== undefined) return wasm; if (typeof module_or_path !== 'undefined') { if (Object.getPrototypeOf(module_or_path) === Object.prototype) { ({ module_or_path } = module_or_path); } else { console.warn('using deprecated parameters for the initialization function; pass a single object instead'); } } if (typeof module_or_path === 'undefined') { module_or_path = new URL('opengeometry_bg.wasm', import.meta.url); } const imports = __wbg_get_imports(); if (typeof module_or_path === 'string' || typeof Request === 'function' && module_or_path instanceof Request || typeof URL === 'function' && module_or_path instanceof URL) { module_or_path = fetch(module_or_path); } const { instance, module } = await __wbg_load(await module_or_path, imports); return __wbg_finalize_init(instance, module); } /** * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT */ const REVISION = '168'; const FrontSide = 0; const BackSide = 1; const DoubleSide = 2; const NormalBlending = 1; const AddEquation = 100; const SrcAlphaFactor = 204; const OneMinusSrcAlphaFactor = 205; const LessEqualDepth = 3; const MultiplyOperation = 0; const UVMapping = 300; const RepeatWrapping = 1000; const ClampToEdgeWrapping = 1001; const MirroredRepeatWrapping = 1002; const LinearFilter = 1006; const LinearMipmapLinearFilter = 1008; const UnsignedByteType = 1009; const FloatType = 1015; const RGBAFormat = 1023; const TangentSpaceNormalMap = 0; // Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available. const NoColorSpace = ''; const SRGBColorSpace = 'srgb'; const LinearSRGBColorSpace = 'srgb-linear'; const DisplayP3ColorSpace = 'display-p3'; const LinearDisplayP3ColorSpace = 'display-p3-linear'; const LinearTransfer = 'linear'; const SRGBTransfer = 'srgb'; const Rec709Primaries = 'rec709'; const P3Primaries = 'p3'; const KeepStencilOp = 7680; const AlwaysStencilFunc = 519; const StaticDrawUsage = 35044; const WebGLCoordinateSystem = 2000; const WebGPUCoordinateSystem = 2001; /** * https://github.com/mrdoob/eventdispatcher.js/ */ class EventDispatcher { addEventListener( type, listener ) { if ( this._listeners === undefined ) this._listeners = {}; const listeners = this._listeners; if ( listeners[ type ] === undefined ) { listeners[ type ] = []; } if ( listeners[ type ].indexOf( listener ) === -1 ) { listeners[ type ].push( listener ); } } hasEventListener( type, listener ) { if ( this._listeners === undefined ) return false; const listeners = this._listeners; return listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== -1; } removeEventListener( type, listener ) { if ( this._listeners === undefined ) return; const listeners = this._listeners; const listenerArray = listeners[ type ]; if ( listenerArray !== undefined ) { const index = listenerArray.indexOf( listener ); if ( index !== -1 ) { listenerArray.splice( index, 1 ); } } } dispatchEvent( event ) { if ( this._listeners === undefined ) return; const listeners = this._listeners; const listenerArray = listeners[ event.type ]; if ( listenerArray !== undefined ) { event.target = this; // Make a copy, in cas