opengeometry 2.0.6 → 2.0.7
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/README.md +40 -9
- package/index.js +61 -53
- package/index.js.map +1 -1
- package/opengeometry/pkg/opengeometry.d.ts +100 -100
- package/opengeometry/pkg/opengeometry.js +29 -29
- package/opengeometry/pkg/opengeometry_bg.wasm +0 -0
- package/opengeometry/pkg/opengeometry_bg.wasm.d.ts +100 -100
- package/opengeometry_bg.wasm +0 -0
- package/opengeometry_bg.wasm.d.ts +100 -100
- package/package.json +1 -1
- package/src/base-types.d.ts +3 -0
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<h1 align="center">OpenGeometry</h1>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
|
-
<strong>CAD kernel
|
|
10
|
+
<strong>Browser-native CAD kernel built with Rust, WebAssembly, and Three.js.</strong>
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
|
|
31
31
|
## What is OpenGeometry?
|
|
32
32
|
|
|
33
|
-
OpenGeometry is an **open-source CAD kernel
|
|
33
|
+
OpenGeometry is an **open-source, browser-native CAD kernel**. The geometry engine is written in **Rust**, compiled to **WebAssembly**, and paired with a **Three.js-friendly TypeScript layer** so you can build real CAD tools that run in the browser.
|
|
34
34
|
|
|
35
|
-
OpenGeometry is best suited for **browser-based CAD, AEC/BIM, configurators, and geometry-heavy web tools**. Whether you're building a parametric modeler, a wall/opening workflow, a BIM viewer, or a custom Three.js modeling tool, OpenGeometry gives you kernel-backed primitives and operations without leaving JavaScript.
|
|
35
|
+
OpenGeometry is best suited for **browser-based CAD, AEC/BIM, configurators, and geometry-heavy web tools**. Whether you're building a parametric modeler, a wall/opening workflow, a BIM viewer, or a custom Three.js modeling tool, OpenGeometry gives you deterministic, kernel-backed primitives and operations without leaving JavaScript.
|
|
36
36
|
|
|
37
|
-
OpenPlans is
|
|
37
|
+
It is the geometry engine layer, not a full CAD application. OpenPlans is a downstream application/toolkit built on top of OpenGeometry for AEC workflows. In this repository, OpenGeometry is the primary SDK and engine.
|
|
38
38
|
|
|
39
39
|
## When to use OpenGeometry
|
|
40
40
|
|
|
@@ -45,15 +45,41 @@ Use OpenGeometry when you need:
|
|
|
45
45
|
- polygon extrusion into solids for CAD or AEC modeling
|
|
46
46
|
- IFC, STEP, STL, and PDF-style export/projection in web apps
|
|
47
47
|
- a Three.js-friendly CAD kernel instead of ad hoc mesh math
|
|
48
|
+
- a deterministic geometry engine behind AI-assisted CAD or design workflows
|
|
49
|
+
|
|
50
|
+
## Why it works well for AI-powered CAD apps
|
|
51
|
+
|
|
52
|
+
OpenGeometry is a good fit for **AI-assisted CAD apps** because the kernel layer stays explicit and deterministic. An AI copilot or agent can suggest modeling steps, generate profiles, or orchestrate edits, while OpenGeometry executes the actual geometry operations, booleans, projections, and exports in a predictable browser runtime.
|
|
53
|
+
|
|
54
|
+
Good examples include:
|
|
55
|
+
|
|
56
|
+
- AI copilots that translate user intent into concrete modeling operations
|
|
57
|
+
- prompt-to-geometry or agent-driven editing flows inside browser CAD tools
|
|
58
|
+
- AI-assisted design interfaces that still need reliable extrusion, boolean, projection, and export workflows
|
|
59
|
+
|
|
60
|
+
## Good fit / Not the right fit
|
|
61
|
+
|
|
62
|
+
**Good fit**
|
|
63
|
+
|
|
64
|
+
- browser CAD, AEC/BIM, and geometry-heavy web applications
|
|
65
|
+
- Three.js-based modeling tools that need a real kernel behind them
|
|
66
|
+
- AI-assisted CAD frontends that need deterministic geometry execution in the browser
|
|
67
|
+
|
|
68
|
+
**Not the default fit**
|
|
69
|
+
|
|
70
|
+
- desktop-native CAD products instead of an embeddable web SDK
|
|
71
|
+
- non-browser runtimes with no WebAssembly or browser delivery story
|
|
72
|
+
- pure visualization-only apps where raw Three.js is enough and kernel-backed modeling is unnecessary
|
|
48
73
|
|
|
49
74
|
## AI and Coding Agent Entrypoints
|
|
50
75
|
|
|
51
76
|
If you are using ChatGPT, Claude, Gemini, Copilot, or other coding agents on this repository, start here:
|
|
52
77
|
|
|
53
|
-
- [
|
|
54
|
-
- [llms
|
|
55
|
-
- [
|
|
56
|
-
- [
|
|
78
|
+
- [README.md](./README.md) - product overview, positioning, and quick start
|
|
79
|
+
- [llms.txt](./llms.txt) - concise repo and API guide for coding agents
|
|
80
|
+
- [llms-full.txt](./llms-full.txt) - expanded agent guide with workflows and examples
|
|
81
|
+
- [llm.txt](./llm.txt) - redirect for tools that look for a single LLM entrypoint
|
|
82
|
+
- [AGENTS.md](./AGENTS.md) - repository workflow rules and validation expectations
|
|
57
83
|
- [Quickstart](https://docs.opengeometry.io/quickstart)
|
|
58
84
|
- [Three.js integration](https://docs.opengeometry.io/integration/threejs)
|
|
59
85
|
- [Boolean operations](https://docs.opengeometry.io/api/operations/boolean-operations)
|
|
@@ -85,6 +111,8 @@ Install from npm:
|
|
|
85
111
|
npm install opengeometry
|
|
86
112
|
```
|
|
87
113
|
|
|
114
|
+
A practical browser deployment looks like this: install `opengeometry` from npm, serve `opengeometry_bg.wasm` from your app, then initialize the runtime once with `OpenGeometry.create({ wasmURL })` before creating `Vector3` values or kernel-backed wrappers.
|
|
115
|
+
|
|
88
116
|
```ts
|
|
89
117
|
import { Cuboid, OpenGeometry, Vector3 } from "opengeometry";
|
|
90
118
|
|
|
@@ -187,7 +215,10 @@ OpenGeometry is open source under the [MPL-2.0 license](./LICENSE.md). Contribut
|
|
|
187
215
|
- Repository-level AI agent instructions are in [AGENTS.md](./AGENTS.md).
|
|
188
216
|
- LLM-friendly repo entrypoints are [llms.txt](./llms.txt), [llms-full.txt](./llms-full.txt), and
|
|
189
217
|
[llm.txt](./llm.txt).
|
|
190
|
-
-
|
|
218
|
+
- In the current workflow, [`AI-DOCs/`](./AI-DOCs/) is used for AI-generated handoffs, runbooks,
|
|
219
|
+
testing notes, and temporary implementation context.
|
|
220
|
+
- The maintained user-facing docs live in [`docs/`](./docs/), and stable architecture/domain notes
|
|
221
|
+
are tracked in [`knowledge/`](./knowledge/).
|
|
191
222
|
- AI-generated docs should not be added under app/code folders unless explicitly requested.
|
|
192
223
|
|
|
193
224
|
---
|
package/index.js
CHANGED
|
@@ -159,22 +159,6 @@ function getArrayF64FromWasm0(ptr, len) {
|
|
|
159
159
|
ptr = ptr >>> 0;
|
|
160
160
|
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
161
161
|
}
|
|
162
|
-
let cachedDataViewMemory0 = null;
|
|
163
|
-
function getDataViewMemory0() {
|
|
164
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
|
|
165
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
166
|
-
}
|
|
167
|
-
return cachedDataViewMemory0;
|
|
168
|
-
}
|
|
169
|
-
function passArrayJsValueToWasm0(array, malloc) {
|
|
170
|
-
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
171
|
-
for (let i = 0; i < array.length; i++) {
|
|
172
|
-
const add = addToExternrefTable0(array[i]);
|
|
173
|
-
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
174
|
-
}
|
|
175
|
-
WASM_VECTOR_LEN = array.length;
|
|
176
|
-
return ptr;
|
|
177
|
-
}
|
|
178
162
|
/**
|
|
179
163
|
* @param {string} local_brep_serialized
|
|
180
164
|
* @param {number} height
|
|
@@ -201,18 +185,24 @@ function extrudeBrepFace$1(local_brep_serialized, height) {
|
|
|
201
185
|
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
202
186
|
}
|
|
203
187
|
}
|
|
204
|
-
|
|
205
|
-
|
|
188
|
+
let cachedDataViewMemory0 = null;
|
|
189
|
+
function getDataViewMemory0() {
|
|
190
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
|
|
191
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
192
|
+
}
|
|
193
|
+
return cachedDataViewMemory0;
|
|
206
194
|
}
|
|
207
|
-
function
|
|
208
|
-
ptr =
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
|
|
195
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
196
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
197
|
+
for (let i = 0; i < array.length; i++) {
|
|
198
|
+
const add = addToExternrefTable0(array[i]);
|
|
199
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
213
200
|
}
|
|
214
|
-
|
|
215
|
-
return
|
|
201
|
+
WASM_VECTOR_LEN = array.length;
|
|
202
|
+
return ptr;
|
|
203
|
+
}
|
|
204
|
+
function isLikeNone(x) {
|
|
205
|
+
return x === undefined || x === null;
|
|
216
206
|
}
|
|
217
207
|
/**
|
|
218
208
|
* Wasm entry point for union.
|
|
@@ -297,6 +287,16 @@ function booleanSubtractionMany(lhs_brep_serialized, cutters_brep_serialized, op
|
|
|
297
287
|
}
|
|
298
288
|
return OGBooleanResult.__wrap(ret[0]);
|
|
299
289
|
}
|
|
290
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
291
|
+
ptr = ptr >>> 0;
|
|
292
|
+
const mem = getDataViewMemory0();
|
|
293
|
+
const result = [];
|
|
294
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
295
|
+
result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
|
|
296
|
+
}
|
|
297
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
298
|
+
return result;
|
|
299
|
+
}
|
|
300
300
|
const Matrix3Finalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
301
301
|
register: () => {},
|
|
302
302
|
unregister: () => {}
|
|
@@ -7858,10 +7858,9 @@ class Solid extends THREE.Mesh {
|
|
|
7858
7858
|
var _a;
|
|
7859
7859
|
const bufferData = this.solid.getGeometryBuffer();
|
|
7860
7860
|
this.writePositionsToGeometry(this.geometry, bufferData);
|
|
7861
|
+
let material;
|
|
7861
7862
|
if (this.material instanceof THREE.MeshStandardMaterial) {
|
|
7862
|
-
this.material
|
|
7863
|
-
this.material.transparent = true;
|
|
7864
|
-
this.material.opacity = 0.6;
|
|
7863
|
+
material = this.material;
|
|
7865
7864
|
}
|
|
7866
7865
|
else {
|
|
7867
7866
|
if (Array.isArray(this.material)) {
|
|
@@ -7870,12 +7869,21 @@ class Solid extends THREE.Mesh {
|
|
|
7870
7869
|
else {
|
|
7871
7870
|
this.material.dispose();
|
|
7872
7871
|
}
|
|
7873
|
-
|
|
7872
|
+
material = new THREE.MeshStandardMaterial({
|
|
7874
7873
|
color: this.options.color,
|
|
7875
|
-
transparent:
|
|
7876
|
-
opacity:
|
|
7874
|
+
transparent: false,
|
|
7875
|
+
opacity: 1,
|
|
7876
|
+
depthWrite: true,
|
|
7877
|
+
side: THREE.FrontSide,
|
|
7877
7878
|
});
|
|
7878
|
-
|
|
7879
|
+
this.material = material;
|
|
7880
|
+
}
|
|
7881
|
+
material.color.set(this.options.color);
|
|
7882
|
+
material.transparent = false;
|
|
7883
|
+
material.opacity = 1;
|
|
7884
|
+
material.depthWrite = true;
|
|
7885
|
+
material.side = THREE.FrontSide;
|
|
7886
|
+
material.needsUpdate = true;
|
|
7879
7887
|
if (bufferData.length > 0) {
|
|
7880
7888
|
this.geometry.computeVertexNormals();
|
|
7881
7889
|
this.geometry.computeBoundingBox();
|
|
@@ -8486,8 +8494,8 @@ class Cylinder extends THREE.Mesh {
|
|
|
8486
8494
|
this.writePositionsToGeometry(this.geometry, bufferData);
|
|
8487
8495
|
if (this.material instanceof THREE.MeshStandardMaterial) {
|
|
8488
8496
|
this.material.color.set(this.options.color);
|
|
8489
|
-
this.material.transparent = true;
|
|
8490
|
-
this.material.opacity = 0.6;
|
|
8497
|
+
// this.material.transparent = true;
|
|
8498
|
+
// this.material.opacity = 0.6;
|
|
8491
8499
|
}
|
|
8492
8500
|
else {
|
|
8493
8501
|
if (Array.isArray(this.material)) {
|
|
@@ -8498,8 +8506,8 @@ class Cylinder extends THREE.Mesh {
|
|
|
8498
8506
|
}
|
|
8499
8507
|
this.material = new THREE.MeshStandardMaterial({
|
|
8500
8508
|
color: this.options.color,
|
|
8501
|
-
transparent: true,
|
|
8502
|
-
opacity: 0.6,
|
|
8509
|
+
// transparent: true,
|
|
8510
|
+
// opacity: 0.6,
|
|
8503
8511
|
});
|
|
8504
8512
|
}
|
|
8505
8513
|
this.geometry.computeVertexNormals();
|
|
@@ -8697,8 +8705,8 @@ class Cuboid extends THREE.Mesh {
|
|
|
8697
8705
|
this.writePositionsToGeometry(this.geometry, geometryData);
|
|
8698
8706
|
if (this.material instanceof THREE.MeshStandardMaterial) {
|
|
8699
8707
|
this.material.color.set(this.options.color);
|
|
8700
|
-
this.material.transparent = true;
|
|
8701
|
-
this.material.opacity = 0.6;
|
|
8708
|
+
// this.material.transparent = true;
|
|
8709
|
+
// this.material.opacity = 0.6;
|
|
8702
8710
|
}
|
|
8703
8711
|
else {
|
|
8704
8712
|
if (Array.isArray(this.material)) {
|
|
@@ -8709,8 +8717,8 @@ class Cuboid extends THREE.Mesh {
|
|
|
8709
8717
|
}
|
|
8710
8718
|
this.material = new THREE.MeshStandardMaterial({
|
|
8711
8719
|
color: this.options.color,
|
|
8712
|
-
transparent: true,
|
|
8713
|
-
opacity: 0.6,
|
|
8720
|
+
// transparent: true,
|
|
8721
|
+
// opacity: 0.6,
|
|
8714
8722
|
});
|
|
8715
8723
|
}
|
|
8716
8724
|
this.geometry.computeVertexNormals();
|
|
@@ -9310,8 +9318,8 @@ class Sphere extends THREE.Mesh {
|
|
|
9310
9318
|
this.writePositionsToGeometry(this.geometry, bufferData);
|
|
9311
9319
|
if (this.material instanceof THREE.MeshStandardMaterial) {
|
|
9312
9320
|
this.material.color.set(this.options.color);
|
|
9313
|
-
this.material.transparent = true;
|
|
9314
|
-
this.material.opacity = 0.6;
|
|
9321
|
+
// this.material.transparent = true;
|
|
9322
|
+
// this.material.opacity = 0.6;
|
|
9315
9323
|
}
|
|
9316
9324
|
else {
|
|
9317
9325
|
if (Array.isArray(this.material)) {
|
|
@@ -9322,8 +9330,8 @@ class Sphere extends THREE.Mesh {
|
|
|
9322
9330
|
}
|
|
9323
9331
|
this.material = new THREE.MeshStandardMaterial({
|
|
9324
9332
|
color: this.options.color,
|
|
9325
|
-
transparent: true,
|
|
9326
|
-
opacity: 0.6,
|
|
9333
|
+
// transparent: true,
|
|
9334
|
+
// opacity: 0.6,
|
|
9327
9335
|
});
|
|
9328
9336
|
}
|
|
9329
9337
|
this.geometry.computeVertexNormals();
|
|
@@ -9578,8 +9586,8 @@ class Wedge extends THREE.Mesh {
|
|
|
9578
9586
|
this.writePositionsToGeometry(this.geometry, bufferData);
|
|
9579
9587
|
if (this.material instanceof THREE.MeshStandardMaterial) {
|
|
9580
9588
|
this.material.color.set(this.options.color);
|
|
9581
|
-
this.material.transparent = true;
|
|
9582
|
-
this.material.opacity = 0.6;
|
|
9589
|
+
// this.material.transparent = true;
|
|
9590
|
+
// this.material.opacity = 0.6;
|
|
9583
9591
|
}
|
|
9584
9592
|
else {
|
|
9585
9593
|
if (Array.isArray(this.material)) {
|
|
@@ -9590,8 +9598,8 @@ class Wedge extends THREE.Mesh {
|
|
|
9590
9598
|
}
|
|
9591
9599
|
this.material = new THREE.MeshStandardMaterial({
|
|
9592
9600
|
color: this.options.color,
|
|
9593
|
-
transparent: true,
|
|
9594
|
-
opacity: 0.6,
|
|
9601
|
+
// transparent: true,
|
|
9602
|
+
// opacity: 0.6,
|
|
9595
9603
|
});
|
|
9596
9604
|
}
|
|
9597
9605
|
this.geometry.computeVertexNormals();
|
|
@@ -9877,8 +9885,8 @@ class Sweep extends THREE.Mesh {
|
|
|
9877
9885
|
this.writePositionsToGeometry(this.geometry, bufferData);
|
|
9878
9886
|
if (this.material instanceof THREE.MeshStandardMaterial) {
|
|
9879
9887
|
this.material.color.set(this.options.color);
|
|
9880
|
-
this.material.transparent = true;
|
|
9881
|
-
this.material.opacity = 0.6;
|
|
9888
|
+
// this.material.transparent = true;
|
|
9889
|
+
// this.material.opacity = 0.6;
|
|
9882
9890
|
}
|
|
9883
9891
|
else {
|
|
9884
9892
|
if (Array.isArray(this.material)) {
|
|
@@ -9889,8 +9897,8 @@ class Sweep extends THREE.Mesh {
|
|
|
9889
9897
|
}
|
|
9890
9898
|
this.material = new THREE.MeshStandardMaterial({
|
|
9891
9899
|
color: this.options.color,
|
|
9892
|
-
transparent: true,
|
|
9893
|
-
opacity: 0.6,
|
|
9900
|
+
// transparent: true,
|
|
9901
|
+
// opacity: 0.6,
|
|
9894
9902
|
});
|
|
9895
9903
|
}
|
|
9896
9904
|
this.geometry.computeVertexNormals();
|