opengeometry 2.0.5 → 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 +73 -66
- package/index.js.map +1 -1
- package/opengeometry/pkg/opengeometry.d.ts +215 -215
- package/opengeometry/pkg/opengeometry.js +38 -39
- package/opengeometry/pkg/opengeometry_bg.wasm +0 -0
- package/opengeometry/pkg/opengeometry_bg.wasm.d.ts +214 -214
- package/opengeometry_bg.wasm +0 -0
- package/opengeometry_bg.wasm.d.ts +214 -214
- 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
|
@@ -138,6 +138,11 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
138
138
|
WASM_VECTOR_LEN = offset;
|
|
139
139
|
return ptr;
|
|
140
140
|
}
|
|
141
|
+
function _assertClass(instance, klass) {
|
|
142
|
+
if (!(instance instanceof klass)) {
|
|
143
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
141
146
|
function takeFromExternrefTable0(idx) {
|
|
142
147
|
const value = wasm.__wbindgen_export_2.get(idx);
|
|
143
148
|
wasm.__externref_table_dealloc(idx);
|
|
@@ -154,9 +159,30 @@ function getArrayF64FromWasm0(ptr, len) {
|
|
|
154
159
|
ptr = ptr >>> 0;
|
|
155
160
|
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
156
161
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
162
|
+
/**
|
|
163
|
+
* @param {string} local_brep_serialized
|
|
164
|
+
* @param {number} height
|
|
165
|
+
* @returns {string}
|
|
166
|
+
*/
|
|
167
|
+
function extrudeBrepFace$1(local_brep_serialized, height) {
|
|
168
|
+
let deferred3_0;
|
|
169
|
+
let deferred3_1;
|
|
170
|
+
try {
|
|
171
|
+
const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
172
|
+
const len0 = WASM_VECTOR_LEN;
|
|
173
|
+
const ret = wasm.extrudeBrepFace(ptr0, len0, height);
|
|
174
|
+
var ptr2 = ret[0];
|
|
175
|
+
var len2 = ret[1];
|
|
176
|
+
if (ret[3]) {
|
|
177
|
+
ptr2 = 0;
|
|
178
|
+
len2 = 0;
|
|
179
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
180
|
+
}
|
|
181
|
+
deferred3_0 = ptr2;
|
|
182
|
+
deferred3_1 = len2;
|
|
183
|
+
return getStringFromWasm0(ptr2, len2);
|
|
184
|
+
} finally {
|
|
185
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
160
186
|
}
|
|
161
187
|
}
|
|
162
188
|
let cachedDataViewMemory0 = null;
|
|
@@ -175,16 +201,6 @@ function passArrayJsValueToWasm0(array, malloc) {
|
|
|
175
201
|
WASM_VECTOR_LEN = array.length;
|
|
176
202
|
return ptr;
|
|
177
203
|
}
|
|
178
|
-
function getArrayJsValueFromWasm0(ptr, len) {
|
|
179
|
-
ptr = ptr >>> 0;
|
|
180
|
-
const mem = getDataViewMemory0();
|
|
181
|
-
const result = [];
|
|
182
|
-
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
183
|
-
result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
|
|
184
|
-
}
|
|
185
|
-
wasm.__externref_drop_slice(ptr, len);
|
|
186
|
-
return result;
|
|
187
|
-
}
|
|
188
204
|
function isLikeNone(x) {
|
|
189
205
|
return x === undefined || x === null;
|
|
190
206
|
}
|
|
@@ -271,32 +287,15 @@ function booleanSubtractionMany(lhs_brep_serialized, cutters_brep_serialized, op
|
|
|
271
287
|
}
|
|
272
288
|
return OGBooleanResult.__wrap(ret[0]);
|
|
273
289
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
*
|
|
279
|
-
|
|
280
|
-
function extrudeBrepFace$1(local_brep_serialized, height) {
|
|
281
|
-
let deferred3_0;
|
|
282
|
-
let deferred3_1;
|
|
283
|
-
try {
|
|
284
|
-
const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
285
|
-
const len0 = WASM_VECTOR_LEN;
|
|
286
|
-
const ret = wasm.extrudeBrepFace(ptr0, len0, height);
|
|
287
|
-
var ptr2 = ret[0];
|
|
288
|
-
var len2 = ret[1];
|
|
289
|
-
if (ret[3]) {
|
|
290
|
-
ptr2 = 0;
|
|
291
|
-
len2 = 0;
|
|
292
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
293
|
-
}
|
|
294
|
-
deferred3_0 = ptr2;
|
|
295
|
-
deferred3_1 = len2;
|
|
296
|
-
return getStringFromWasm0(ptr2, len2);
|
|
297
|
-
} finally {
|
|
298
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
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)));
|
|
299
296
|
}
|
|
297
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
298
|
+
return result;
|
|
300
299
|
}
|
|
301
300
|
const Matrix3Finalization = typeof FinalizationRegistry === 'undefined' ? {
|
|
302
301
|
register: () => {},
|
|
@@ -4997,7 +4996,7 @@ class OGSweep {
|
|
|
4997
4996
|
* @returns {Vector3}
|
|
4998
4997
|
*/
|
|
4999
4998
|
get_anchor() {
|
|
5000
|
-
const ret = wasm.
|
|
4999
|
+
const ret = wasm.ogarc_get_anchor(this.__wbg_ptr);
|
|
5001
5000
|
return Vector3.__wrap(ret);
|
|
5002
5001
|
}
|
|
5003
5002
|
/**
|
|
@@ -7859,10 +7858,9 @@ class Solid extends THREE.Mesh {
|
|
|
7859
7858
|
var _a;
|
|
7860
7859
|
const bufferData = this.solid.getGeometryBuffer();
|
|
7861
7860
|
this.writePositionsToGeometry(this.geometry, bufferData);
|
|
7861
|
+
let material;
|
|
7862
7862
|
if (this.material instanceof THREE.MeshStandardMaterial) {
|
|
7863
|
-
this.material
|
|
7864
|
-
this.material.transparent = true;
|
|
7865
|
-
this.material.opacity = 0.6;
|
|
7863
|
+
material = this.material;
|
|
7866
7864
|
}
|
|
7867
7865
|
else {
|
|
7868
7866
|
if (Array.isArray(this.material)) {
|
|
@@ -7871,12 +7869,21 @@ class Solid extends THREE.Mesh {
|
|
|
7871
7869
|
else {
|
|
7872
7870
|
this.material.dispose();
|
|
7873
7871
|
}
|
|
7874
|
-
|
|
7872
|
+
material = new THREE.MeshStandardMaterial({
|
|
7875
7873
|
color: this.options.color,
|
|
7876
|
-
transparent:
|
|
7877
|
-
opacity:
|
|
7874
|
+
transparent: false,
|
|
7875
|
+
opacity: 1,
|
|
7876
|
+
depthWrite: true,
|
|
7877
|
+
side: THREE.FrontSide,
|
|
7878
7878
|
});
|
|
7879
|
-
|
|
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;
|
|
7880
7887
|
if (bufferData.length > 0) {
|
|
7881
7888
|
this.geometry.computeVertexNormals();
|
|
7882
7889
|
this.geometry.computeBoundingBox();
|
|
@@ -8487,8 +8494,8 @@ class Cylinder extends THREE.Mesh {
|
|
|
8487
8494
|
this.writePositionsToGeometry(this.geometry, bufferData);
|
|
8488
8495
|
if (this.material instanceof THREE.MeshStandardMaterial) {
|
|
8489
8496
|
this.material.color.set(this.options.color);
|
|
8490
|
-
this.material.transparent = true;
|
|
8491
|
-
this.material.opacity = 0.6;
|
|
8497
|
+
// this.material.transparent = true;
|
|
8498
|
+
// this.material.opacity = 0.6;
|
|
8492
8499
|
}
|
|
8493
8500
|
else {
|
|
8494
8501
|
if (Array.isArray(this.material)) {
|
|
@@ -8499,8 +8506,8 @@ class Cylinder extends THREE.Mesh {
|
|
|
8499
8506
|
}
|
|
8500
8507
|
this.material = new THREE.MeshStandardMaterial({
|
|
8501
8508
|
color: this.options.color,
|
|
8502
|
-
transparent: true,
|
|
8503
|
-
opacity: 0.6,
|
|
8509
|
+
// transparent: true,
|
|
8510
|
+
// opacity: 0.6,
|
|
8504
8511
|
});
|
|
8505
8512
|
}
|
|
8506
8513
|
this.geometry.computeVertexNormals();
|
|
@@ -8698,8 +8705,8 @@ class Cuboid extends THREE.Mesh {
|
|
|
8698
8705
|
this.writePositionsToGeometry(this.geometry, geometryData);
|
|
8699
8706
|
if (this.material instanceof THREE.MeshStandardMaterial) {
|
|
8700
8707
|
this.material.color.set(this.options.color);
|
|
8701
|
-
this.material.transparent = true;
|
|
8702
|
-
this.material.opacity = 0.6;
|
|
8708
|
+
// this.material.transparent = true;
|
|
8709
|
+
// this.material.opacity = 0.6;
|
|
8703
8710
|
}
|
|
8704
8711
|
else {
|
|
8705
8712
|
if (Array.isArray(this.material)) {
|
|
@@ -8710,8 +8717,8 @@ class Cuboid extends THREE.Mesh {
|
|
|
8710
8717
|
}
|
|
8711
8718
|
this.material = new THREE.MeshStandardMaterial({
|
|
8712
8719
|
color: this.options.color,
|
|
8713
|
-
transparent: true,
|
|
8714
|
-
opacity: 0.6,
|
|
8720
|
+
// transparent: true,
|
|
8721
|
+
// opacity: 0.6,
|
|
8715
8722
|
});
|
|
8716
8723
|
}
|
|
8717
8724
|
this.geometry.computeVertexNormals();
|
|
@@ -9311,8 +9318,8 @@ class Sphere extends THREE.Mesh {
|
|
|
9311
9318
|
this.writePositionsToGeometry(this.geometry, bufferData);
|
|
9312
9319
|
if (this.material instanceof THREE.MeshStandardMaterial) {
|
|
9313
9320
|
this.material.color.set(this.options.color);
|
|
9314
|
-
this.material.transparent = true;
|
|
9315
|
-
this.material.opacity = 0.6;
|
|
9321
|
+
// this.material.transparent = true;
|
|
9322
|
+
// this.material.opacity = 0.6;
|
|
9316
9323
|
}
|
|
9317
9324
|
else {
|
|
9318
9325
|
if (Array.isArray(this.material)) {
|
|
@@ -9323,8 +9330,8 @@ class Sphere extends THREE.Mesh {
|
|
|
9323
9330
|
}
|
|
9324
9331
|
this.material = new THREE.MeshStandardMaterial({
|
|
9325
9332
|
color: this.options.color,
|
|
9326
|
-
transparent: true,
|
|
9327
|
-
opacity: 0.6,
|
|
9333
|
+
// transparent: true,
|
|
9334
|
+
// opacity: 0.6,
|
|
9328
9335
|
});
|
|
9329
9336
|
}
|
|
9330
9337
|
this.geometry.computeVertexNormals();
|
|
@@ -9579,8 +9586,8 @@ class Wedge extends THREE.Mesh {
|
|
|
9579
9586
|
this.writePositionsToGeometry(this.geometry, bufferData);
|
|
9580
9587
|
if (this.material instanceof THREE.MeshStandardMaterial) {
|
|
9581
9588
|
this.material.color.set(this.options.color);
|
|
9582
|
-
this.material.transparent = true;
|
|
9583
|
-
this.material.opacity = 0.6;
|
|
9589
|
+
// this.material.transparent = true;
|
|
9590
|
+
// this.material.opacity = 0.6;
|
|
9584
9591
|
}
|
|
9585
9592
|
else {
|
|
9586
9593
|
if (Array.isArray(this.material)) {
|
|
@@ -9591,8 +9598,8 @@ class Wedge extends THREE.Mesh {
|
|
|
9591
9598
|
}
|
|
9592
9599
|
this.material = new THREE.MeshStandardMaterial({
|
|
9593
9600
|
color: this.options.color,
|
|
9594
|
-
transparent: true,
|
|
9595
|
-
opacity: 0.6,
|
|
9601
|
+
// transparent: true,
|
|
9602
|
+
// opacity: 0.6,
|
|
9596
9603
|
});
|
|
9597
9604
|
}
|
|
9598
9605
|
this.geometry.computeVertexNormals();
|
|
@@ -9878,8 +9885,8 @@ class Sweep extends THREE.Mesh {
|
|
|
9878
9885
|
this.writePositionsToGeometry(this.geometry, bufferData);
|
|
9879
9886
|
if (this.material instanceof THREE.MeshStandardMaterial) {
|
|
9880
9887
|
this.material.color.set(this.options.color);
|
|
9881
|
-
this.material.transparent = true;
|
|
9882
|
-
this.material.opacity = 0.6;
|
|
9888
|
+
// this.material.transparent = true;
|
|
9889
|
+
// this.material.opacity = 0.6;
|
|
9883
9890
|
}
|
|
9884
9891
|
else {
|
|
9885
9892
|
if (Array.isArray(this.material)) {
|
|
@@ -9890,8 +9897,8 @@ class Sweep extends THREE.Mesh {
|
|
|
9890
9897
|
}
|
|
9891
9898
|
this.material = new THREE.MeshStandardMaterial({
|
|
9892
9899
|
color: this.options.color,
|
|
9893
|
-
transparent: true,
|
|
9894
|
-
opacity: 0.6,
|
|
9900
|
+
// transparent: true,
|
|
9901
|
+
// opacity: 0.6,
|
|
9895
9902
|
});
|
|
9896
9903
|
}
|
|
9897
9904
|
this.geometry.computeVertexNormals();
|