opengeometry 2.0.0 → 2.0.2

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.
Files changed (49) hide show
  1. package/README.md +77 -14
  2. package/index.d.ts +15 -7
  3. package/index.js +5888 -16596
  4. package/index.js.map +1 -1
  5. package/opengeometry/pkg/opengeometry.d.ts +1101 -0
  6. package/opengeometry/pkg/opengeometry.js +5636 -0
  7. package/opengeometry/pkg/opengeometry_bg.wasm +0 -0
  8. package/opengeometry/pkg/opengeometry_bg.wasm.d.ts +422 -0
  9. package/opengeometry_bg.wasm +0 -0
  10. package/opengeometry_bg.wasm.d.ts +287 -119
  11. package/package.json +22 -33
  12. package/src/editor/freeform.d.ts +28 -0
  13. package/src/editor/index.d.ts +3 -0
  14. package/src/editor/parametric.d.ts +5 -0
  15. package/src/editor/types.d.ts +151 -0
  16. package/src/examples/booleans.d.ts +4 -3
  17. package/src/examples/editor-modes.d.ts +24 -0
  18. package/src/examples/index.d.ts +7 -6
  19. package/src/examples/offset.d.ts +7 -7
  20. package/src/examples/primitives.d.ts +5 -5
  21. package/src/examples/shapes.d.ts +7 -7
  22. package/src/examples/sweep.d.ts +3 -3
  23. package/src/examples/wall-from-offsets.d.ts +4 -4
  24. package/src/freeform/geometry.d.ts +21 -0
  25. package/src/freeform/index.d.ts +2 -0
  26. package/src/freeform/types.d.ts +24 -0
  27. package/src/operations/boolean.d.ts +7 -0
  28. package/src/operations/editor/freeform.d.ts +1 -0
  29. package/src/operations/editor/index.d.ts +1 -0
  30. package/src/operations/editor/parametric.d.ts +1 -0
  31. package/src/operations/editor/types.d.ts +1 -0
  32. package/src/operations/index.d.ts +1 -1
  33. package/src/primitives/arc.d.ts +22 -2
  34. package/src/primitives/curve.d.ts +25 -2
  35. package/src/primitives/index.d.ts +5 -5
  36. package/src/primitives/line.d.ts +25 -2
  37. package/src/primitives/polyline.d.ts +25 -2
  38. package/src/primitives/rectangle.d.ts +22 -2
  39. package/src/shapes/boolean-subtract.d.ts +1 -1
  40. package/src/shapes/cuboid.d.ts +22 -8
  41. package/src/shapes/cylinder.d.ts +24 -3
  42. package/src/shapes/index.d.ts +7 -7
  43. package/src/shapes/opening.d.ts +25 -5
  44. package/src/shapes/polygon.d.ts +26 -3
  45. package/src/shapes/sphere.d.ts +26 -4
  46. package/src/shapes/sweep.d.ts +27 -3
  47. package/src/shapes/wedge.d.ts +25 -4
  48. package/src/examples/shape-outline-dropdown.d.ts +0 -23
  49. package/src/shapes/swept-shape.d.ts +0 -63
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  <p align="center">
2
2
  <a href="https://opengeometry.io">
3
- <img src="https://img.shields.io/badge/OpenGeometry-4460FF?style=for-the-badge&logo=data:image/svg+xml;base64,&logoColor=white" alt="OpenGeometry" />
3
+ <img src="https://raw.githubusercontent.com/OpenGeometry-io/.github/main/profile/opengeometryTextLogo.png" alt="OpenGeometry" />
4
4
  </a>
5
5
  </p>
6
6
 
7
7
  <h1 align="center">OpenGeometry</h1>
8
8
 
9
9
  <p align="center">
10
- <strong>Build. Design. Create. The Engine for Web-Based Design.</strong>
10
+ <strong>CAD kernel for the web — built with Rust, WebAssembly, and Three.js.</strong>
11
11
  </p>
12
12
 
13
13
  <p align="center">
@@ -19,7 +19,7 @@
19
19
  </p>
20
20
 
21
21
  <p align="center">
22
- <a href="https://opengeometry.io">Website</a> · <a href="https://docs.opengeometry.io">Documentation</a> · <a href="https://demos.opengeometry.io">Live Demos</a> · <a href="https://blog.opengeometry.io/">Blog</a> · <a href="https://www.npmjs.com/package/opengeometry">npm</a>
22
+ <a href="https://opengeometry.io">Website</a> · <a href="https://docs.opengeometry.io">Documentation</a> · <a href="https://demos.opengeometry.io">Live Demos</a> · <a href="https://opengeometry.io/blog">Blog</a> · <a href="https://www.npmjs.com/package/opengeometry">npm</a>
23
23
  </p>
24
24
 
25
25
  ---
@@ -60,17 +60,34 @@ Install from npm:
60
60
  npm install opengeometry
61
61
  ```
62
62
 
63
- ```javascript
64
- import { OpenGeometry } from "opengeometry";
65
-
66
- const og = new OpenGeometry();
67
- await og.init();
68
-
69
- // Create a rectangle and extrude it into a 3D shape
70
- const rect = og.rectangle({ width: 2, height: 1 });
71
- const extruded = og.extrude(rect, { depth: 0.5 });
63
+ ```ts
64
+ import { Cuboid, OpenGeometry, Vector3 } from "opengeometry";
65
+
66
+ await OpenGeometry.create({
67
+ wasmURL: new URL(
68
+ "node_modules/opengeometry/opengeometry_bg.wasm",
69
+ import.meta.url
70
+ ).href,
71
+ });
72
+
73
+ const cuboid = new Cuboid({
74
+ center: new Vector3(0, 0, 0),
75
+ width: 2,
76
+ height: 1,
77
+ depth: 1,
78
+ color: 0x33aa66,
79
+ });
80
+
81
+ // Placement is strict: scale must be positive + uniform.
82
+ cuboid.setPlacement({
83
+ translation: new Vector3(1, 0, 0),
84
+ rotation: new Vector3(0, 0.25, 0),
85
+ scale: new Vector3(1.25, 1.25, 1.25),
86
+ });
72
87
  ```
73
88
 
89
+ Scenegraph behavior is snapshot-based: `add*ToScene` captures geometry at insert time. If you change placement/config later, push updates explicitly via `replaceBrepEntityInScene` or `refreshBrepEntityInScene`.
90
+
74
91
  For a complete walkthrough, see the [Quick Start guide](https://docs.opengeometry.io/quickstart) or clone the [quickstart-js](https://github.com/OpenGeometry-io/quickstart-js) repo.
75
92
 
76
93
  ## Documentation
@@ -85,6 +102,46 @@ Key pages:
85
102
  - [Architecture & Concepts](https://docs.opengeometry.io/concepts/architecture)
86
103
  - [API Reference](https://docs.opengeometry.io/api)
87
104
 
105
+ ## Repository Structure
106
+
107
+ ```
108
+ main/opengeometry Rust core → WebAssembly
109
+ main/opengeometry-three Three.js integration layer
110
+ main/opengeometry-webgl WebGL-oriented package (WIP)
111
+ main/opengeometry-babylon Babylon.js-oriented package (WIP)
112
+ docs/ Documentation source (Mintlify)
113
+ ```
114
+
115
+ ## Building from Source
116
+
117
+ **Prerequisites:** Node.js, npm, Rust toolchain, `wasm-pack`
118
+
119
+ ```bash
120
+ # Install dependencies
121
+ npm install
122
+
123
+ # Build Rust core → WebAssembly
124
+ npm run build-core
125
+
126
+ # Build everything (core + Three.js + WASM copy)
127
+ npm run build
128
+
129
+ # Run the Three.js example app locally
130
+ npm --prefix main/opengeometry-three run dev-example-three
131
+
132
+ # Run tests
133
+ npm test
134
+ ```
135
+
136
+ ## Who is this for?
137
+
138
+ - Teams building **browser-based CAD/BIM/geometry tools**
139
+ - Developers evaluating **WebAssembly-powered 3D** for the web
140
+ - Contributors interested in the **Rust → WASM geometry pipeline**
141
+ - Anyone exploring **open-source CAD kernel internals**
142
+
143
+ If you just want a quick look, start with the [hosted demos](https://demos.opengeometry.io) or the [quickstart repo](https://github.com/OpenGeometry-io/quickstart-js).
144
+
88
145
  ## Community
89
146
 
90
147
  We'd love to have you involved — whether you're using OpenGeometry, building on it, or just curious.
@@ -92,12 +149,18 @@ We'd love to have you involved — whether you're using OpenGeometry, building o
92
149
  - **[Discord](https://discord.com/invite/cZY2Vm6E)** — Chat with the team and community
93
150
  - **[Twitter / X](https://x.com/openGeometry)** — Updates and announcements
94
151
  - **[LinkedIn](https://linkedin.com/company/openGeometry)** — Company updates
95
- - **[GitHub](https://github.com/OpenGeometry-io/OpenGeometry)** — Source code and issues
152
+ - **[GitHub Issues](https://github.com/OpenGeometry-io/OpenGeometry/issues)** — Bug reports and feature requests
96
153
  - **[Blog](https://opengeometry.io/blog)** — Deep dives and release notes
97
154
 
98
155
  ## Contributing
99
156
 
100
- OpenGeometry is open source under the [MPL-2.0 license](https://github.com/OpenGeometry-io/OpenGeometry/blob/main/LICENSE.md). Contributions are welcome — check the [issues](https://github.com/OpenGeometry-io/OpenGeometry/issues) for good starting points or open a discussion on [Discord](https://discord.com/invite/cZY2Vm6E).
157
+ OpenGeometry is open source under the [MPL-2.0 license](./LICENSE.md). Contributions are welcome — check the [issues](https://github.com/OpenGeometry-io/OpenGeometry/issues) for good starting points or open a discussion on [Discord](https://discord.com/invite/cZY2Vm6E).
158
+
159
+ ## AI Agent Docs Policy
160
+
161
+ - Repository-level AI agent instructions are in [AGENTS.md](./AGENTS.md).
162
+ - All AI-generated documentation must live under [`AI-DOCs/`](./AI-DOCs/).
163
+ - AI-generated docs should not be added under app/code folders unless explicitly requested.
101
164
 
102
165
  ---
103
166
 
package/index.d.ts CHANGED
@@ -2,9 +2,9 @@
2
2
  * OpenGeometry Three.js adapter entrypoint.
3
3
  * @module @opengeometry/kernel-three
4
4
  */
5
- import { OGSceneManager, Vector3 } from "../opengeometry/pkg/opengeometry";
6
- import { SpotLabel } from "./src/markup/spotMarker";
7
- import { OpenGeometryOptions } from "./src/base-types";
5
+ import { OGSceneManager, Vector3 } from "./opengeometry/pkg/opengeometry.js";
6
+ import { SpotLabel } from "./src/markup/spotMarker.js";
7
+ import { OpenGeometryOptions } from "./src/base-types.js";
8
8
  export type OUTLINE_TYPE = "front" | "side" | "top";
9
9
  export interface OGStlExportResult {
10
10
  bytes: Uint8Array;
@@ -62,16 +62,24 @@ export { OGSceneManager, Vector3, SpotLabel, };
62
62
  /**
63
63
  * Primitive wrappers (line/polyline/arc/rectangle/curve).
64
64
  */
65
- export * from './src/primitives/';
65
+ export * from "./src/primitives/index.js";
66
66
  /**
67
67
  * Shape wrappers (polygon/cuboid/cylinder/wedge/opening/sweep/sphere).
68
68
  */
69
- export * from './src/shapes/';
69
+ export * from "./src/shapes/index.js";
70
70
  /**
71
71
  * Reusable example builders for quickly wiring demo scenes.
72
72
  */
73
- export * from './src/examples/';
73
+ export * from "./src/examples/index.js";
74
+ /**
75
+ * First-class freeform geometry wrapper around the kernel OGFreeformGeometry API.
76
+ */
77
+ export * from "./src/freeform/index.js";
78
+ /**
79
+ * Editing helpers that operate on parametric entities and freeform geometry.
80
+ */
81
+ export * from "./src/editor/index.js";
74
82
  /**
75
83
  * Kernel-backed modeling operations.
76
84
  */
77
- export * from './src/operations/';
85
+ export * from "./src/operations/index.js";