opengeometry 1.0.9 → 2.0.1

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 (50) hide show
  1. package/README.md +169 -0
  2. package/index.d.ts +15 -7
  3. package/index.js +6158 -16678
  4. package/index.js.map +1 -1
  5. package/opengeometry/pkg/opengeometry.d.ts +1103 -0
  6. package/opengeometry/pkg/opengeometry.js +5663 -0
  7. package/opengeometry/pkg/opengeometry_bg.wasm +0 -0
  8. package/opengeometry/pkg/opengeometry_bg.wasm.d.ts +423 -0
  9. package/opengeometry_bg.wasm +0 -0
  10. package/opengeometry_bg.wasm.d.ts +291 -122
  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 +2 -2
  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/extruded-shape.d.ts +49 -0
  43. package/src/shapes/index.d.ts +8 -7
  44. package/src/shapes/opening.d.ts +25 -5
  45. package/src/shapes/polygon.d.ts +29 -3
  46. package/src/shapes/sphere.d.ts +26 -4
  47. package/src/shapes/sweep.d.ts +27 -3
  48. package/src/shapes/wedge.d.ts +25 -4
  49. package/src/examples/shape-outline-dropdown.d.ts +0 -23
  50. package/src/shapes/swept-shape.d.ts +0 -63
package/README.md ADDED
@@ -0,0 +1,169 @@
1
+ <p align="center">
2
+ <a href="https://opengeometry.io">
3
+ <img src="https://raw.githubusercontent.com/OpenGeometry-io/.github/main/profile/opengeometryTextLogo.png" alt="OpenGeometry" />
4
+ </a>
5
+ </p>
6
+
7
+ <h1 align="center">OpenGeometry</h1>
8
+
9
+ <p align="center">
10
+ <strong>CAD kernel for the web — built with Rust, WebAssembly, and Three.js.</strong>
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="https://www.npmjs.com/package/opengeometry"><img src="https://img.shields.io/npm/v/opengeometry?style=flat-square&color=4460FF&label=npm" alt="npm version" /></a>
15
+ <a href="https://github.com/OpenGeometry-io/OpenGeometry/blob/main/LICENSE.md"><img src="https://img.shields.io/github/license/opengeometry-io/opengeometry?style=flat-square" alt="License" /></a>
16
+ <a href="https://discord.com/invite/cZY2Vm6E"><img src="https://img.shields.io/badge/Discord-Join%20us-5865F2?style=flat-square&logo=discord&logoColor=white" alt="Discord" /></a>
17
+ <a href="https://x.com/openGeometry"><img src="https://img.shields.io/badge/Twitter-Follow-1DA1F2?style=flat-square&logo=x&logoColor=white" alt="Twitter" /></a>
18
+ <a href="https://linkedin.com/company/openGeometry"><img src="https://img.shields.io/badge/LinkedIn-Connect-0A66C2?style=flat-square&logo=linkedin&logoColor=white" alt="LinkedIn" /></a>
19
+ </p>
20
+
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://opengeometry.io/blog">Blog</a> · <a href="https://www.npmjs.com/package/opengeometry">npm</a>
23
+ </p>
24
+
25
+ ---
26
+
27
+ > **Actively under development.** We're building OpenGeometry in the open. APIs, examples, and package structure are evolving — breaking changes are still possible. Star the repo to follow along.
28
+
29
+ ---
30
+
31
+ ## What is OpenGeometry?
32
+
33
+ OpenGeometry is an **open-source CAD kernel** purpose-built for the browser. The geometry engine is written in **Rust**, compiled to **WebAssembly**, and ships with a **Three.js integration layer** — so you can build real CAD tools that run entirely on the web.
34
+
35
+ Whether you're building a parametric modeler, a BIM viewer, a 3D configurator, or any geometry-heavy web app, OpenGeometry gives you the primitives and operations you need without leaving JavaScript.
36
+
37
+ ### What you can do today
38
+
39
+ | Category | Capabilities |
40
+ | --- | --- |
41
+ | **Primitives** | Lines, arcs, curves, polylines, rectangles |
42
+ | **Shapes** | Polygons, cylinders, cuboids, spheres, wedges |
43
+ | **Operations** | Triangulation, extrusion, sweep, offset, boolean operations |
44
+ | **Exports** | STL, STEP, IFC, PDF projection |
45
+ | **Integration** | Three.js scene management, WebAssembly-powered performance |
46
+
47
+ ## Demos
48
+
49
+ See OpenGeometry in action — interactive, browser-based demos showcasing the kernel's capabilities:
50
+
51
+ **[demos.opengeometry.io](https://demos.opengeometry.io)**
52
+
53
+ Demos include primitives rendering, shape generation, sweep operations, boolean operations, file exports, and more. All running client-side via WebAssembly.
54
+
55
+ ## Quick Start
56
+
57
+ Install from npm:
58
+
59
+ ```bash
60
+ npm install opengeometry
61
+ ```
62
+
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
+ });
87
+ ```
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
+
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.
92
+
93
+ ## Documentation
94
+
95
+ Full API reference, guides, and concepts are available at:
96
+
97
+ **[docs.opengeometry.io](https://docs.opengeometry.io)**
98
+
99
+ Key pages:
100
+ - [Installation](https://docs.opengeometry.io/installation)
101
+ - [Quick Start](https://docs.opengeometry.io/quickstart)
102
+ - [Architecture & Concepts](https://docs.opengeometry.io/concepts/architecture)
103
+ - [API Reference](https://docs.opengeometry.io/api)
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
+
145
+ ## Community
146
+
147
+ We'd love to have you involved — whether you're using OpenGeometry, building on it, or just curious.
148
+
149
+ - **[Discord](https://discord.com/invite/cZY2Vm6E)** — Chat with the team and community
150
+ - **[Twitter / X](https://x.com/openGeometry)** — Updates and announcements
151
+ - **[LinkedIn](https://linkedin.com/company/openGeometry)** — Company updates
152
+ - **[GitHub Issues](https://github.com/OpenGeometry-io/OpenGeometry/issues)** — Bug reports and feature requests
153
+ - **[Blog](https://opengeometry.io/blog)** — Deep dives and release notes
154
+
155
+ ## Contributing
156
+
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.
164
+
165
+ ---
166
+
167
+ <p align="center">
168
+ <sub><em>"It is my land. Who would I be if I did not try to make it better?" — A Knight.</em></sub>
169
+ </p>
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";