opengeometry 2.0.9 → 2.0.10
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 +24 -27
- package/opengeometry/pkg/opengeometry_bg.wasm +0 -0
- package/opengeometry_bg.wasm +0 -0
- package/package.json +1 -2
- package/src/operations/chamfer.d.ts +10 -0
- package/src/operations/draft.d.ts +14 -0
- package/src/operations/fillet.d.ts +13 -0
- package/src/operations/loft.d.ts +16 -0
- package/src/operations/mirror.d.ts +21 -0
- package/src/operations/pattern-circular.d.ts +19 -0
- package/src/operations/pattern-linear.d.ts +15 -0
- package/src/operations/pipe.d.ts +17 -0
- package/src/operations/revolve.d.ts +29 -0
- package/src/operations/sweep.d.ts +13 -0
- package/src/primitives/helix.d.ts +31 -0
- package/src/shapes/cone.d.ts +64 -0
- package/src/shapes/ellipsoid.d.ts +86 -0
- package/src/shapes/frustum.d.ts +44 -0
- package/src/shapes/torus.d.ts +44 -0
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="https://opengeometry.io">
|
|
2
|
+
<a href="https://opengeometry.io?utm_source=github">
|
|
3
3
|
<img src="https://raw.githubusercontent.com/OpenGeometry-io/.github/main/profile/opengeometryTextLogo.png" alt="OpenGeometry" />
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
@@ -7,24 +7,24 @@
|
|
|
7
7
|
<h1 align="center">OpenGeometry</h1>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
|
-
<strong>Browser-native CAD kernel built with Rust, WebAssembly, and Three.js.</strong>
|
|
10
|
+
<strong>Browser-native CAD kernel for Web Apps and AI CAD built with Rust, WebAssembly, and Three.js.</strong>
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
14
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
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.
|
|
16
|
+
<a href="https://discord.gg/9wJpbfgGGA"><img src="https://img.shields.io/badge/Discord-Join%20us-5865F2?style=flat-square&logo=discord&logoColor=white" alt="Discord" /></a>
|
|
17
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
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
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://
|
|
22
|
+
<a href="https://opengeometry.io?utm_source=github">Website</a> · <a href="https://docs.opengeometry.io/OpenGeometry?utm_source=github">Documentation</a> · <a href="https://demos.opengeometry.io?utm_source=github">Live Demos</a> · <a href="https://blog.opengeometry.io?utm_source=github">Blog</a> · <a href="https://www.npmjs.com/package/opengeometry">npm</a>
|
|
23
23
|
</p>
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
27
|
-
> **Actively maintained and growing.** We're building OpenGeometry in the open. APIs, examples, and package structure are evolving, we are actively improving and expanding the project. Star the repo to follow along. If you have questions or want to get involved, join the [Discord](https://discord.com/invite/
|
|
27
|
+
> **Actively maintained and growing.** We're building OpenGeometry in the open. APIs, examples, and package structure are evolving, we are actively improving and expanding the project. Star the repo to follow along. If you have questions or want to get involved, join the [Discord](https://discord.com/invite/9wJpbfgGGA) or check out the [issues](https://github.com/OpenGeometry-io/OpenGeometry/issues)
|
|
28
28
|
|
|
29
29
|
---
|
|
30
30
|
|
|
@@ -55,15 +55,15 @@ Good examples include:
|
|
|
55
55
|
|
|
56
56
|
- AI copilots that translate user intent into concrete modeling operations
|
|
57
57
|
- prompt-to-geometry or agent-driven editing flows inside browser CAD tools
|
|
58
|
-
- AI
|
|
58
|
+
- AI first design interfaces that still need reliable extrusion, boolean, projection, and export workflows
|
|
59
59
|
|
|
60
60
|
## Good fit / Not the right fit
|
|
61
61
|
|
|
62
62
|
**Good fit**
|
|
63
63
|
|
|
64
|
-
- browser CAD, AEC/BIM, and geometry-heavy web applications
|
|
64
|
+
- browser CAD, AEC/BIM, Mechanical, and geometry-heavy web applications
|
|
65
65
|
- Three.js-based modeling tools that need a real kernel behind them
|
|
66
|
-
- AI
|
|
66
|
+
- AI first CAD frontends that need deterministic geometry execution in the browser
|
|
67
67
|
|
|
68
68
|
**Not the default fit**
|
|
69
69
|
|
|
@@ -77,10 +77,10 @@ If you are using ChatGPT, Claude, Gemini, Copilot, or other coding agents on thi
|
|
|
77
77
|
|
|
78
78
|
- [AGENTS.md](./AGENTS.md) - single source of truth for all coding agents (architecture, commands, gotchas, behavioral rules)
|
|
79
79
|
- [README.md](./README.md) - product overview, positioning, and quick start
|
|
80
|
-
- [Quickstart](https://docs.opengeometry.io/quickstart)
|
|
81
|
-
- [
|
|
82
|
-
- [Boolean operations](https://docs.opengeometry.io/
|
|
83
|
-
- [Extrude](https://docs.opengeometry.io/api/operations/extrude)
|
|
80
|
+
- [Quickstart](https://docs.opengeometry.io/OpenGeometry/quickstart)
|
|
81
|
+
- [Installation](https://docs.opengeometry.io/OpenGeometry/installation)
|
|
82
|
+
- [Boolean operations](https://docs.opengeometry.io/OpenGeometry/concepts/booleans)
|
|
83
|
+
- [Extrude](https://docs.opengeometry.io/OpenGeometry/api/operations/extrude)
|
|
84
84
|
|
|
85
85
|
### What you can do today
|
|
86
86
|
|
|
@@ -96,7 +96,7 @@ If you are using ChatGPT, Claude, Gemini, Copilot, or other coding agents on thi
|
|
|
96
96
|
|
|
97
97
|
See OpenGeometry in action — interactive, browser-based demos showcasing the kernel's capabilities:
|
|
98
98
|
|
|
99
|
-
**[
|
|
99
|
+
**[demos.opengeometry.io](https://demos.opengeometry.io)**
|
|
100
100
|
|
|
101
101
|
Demos include primitives rendering, shape generation, sweep operations, boolean operations, file exports, and more. All running client-side via WebAssembly.
|
|
102
102
|
|
|
@@ -139,7 +139,7 @@ cuboid.setPlacement({
|
|
|
139
139
|
|
|
140
140
|
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`.
|
|
141
141
|
|
|
142
|
-
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.
|
|
142
|
+
For a complete walkthrough, see the [Quick Start guide](https://docs.opengeometry.io/OpenGeometry/quickstart) or clone the [quickstart-js](https://github.com/OpenGeometry-io/quickstart-js) repo.
|
|
143
143
|
|
|
144
144
|
## Documentation
|
|
145
145
|
|
|
@@ -148,10 +148,10 @@ Full API reference, guides, and concepts are available at:
|
|
|
148
148
|
**[docs.opengeometry.io](https://docs.opengeometry.io)**
|
|
149
149
|
|
|
150
150
|
Key pages:
|
|
151
|
-
- [Installation](https://docs.opengeometry.io/installation)
|
|
152
|
-
- [Quick Start](https://docs.opengeometry.io/quickstart)
|
|
153
|
-
- [Architecture & Concepts](https://docs.opengeometry.io/concepts/architecture)
|
|
154
|
-
- [API Reference](https://docs.opengeometry.io/api)
|
|
151
|
+
- [Installation](https://docs.opengeometry.io/OpenGeometry/installation)
|
|
152
|
+
- [Quick Start](https://docs.opengeometry.io/OpenGeometry/quickstart)
|
|
153
|
+
- [Architecture & Concepts](https://docs.opengeometry.io/OpenGeometry/concepts/architecture)
|
|
154
|
+
- [API Reference](https://docs.opengeometry.io/OpenGeometry/api/)
|
|
155
155
|
|
|
156
156
|
## Repository Structure
|
|
157
157
|
|
|
@@ -165,7 +165,7 @@ docs/ Documentation source (Mintlify)
|
|
|
165
165
|
|
|
166
166
|
## Building from Source
|
|
167
167
|
|
|
168
|
-
**Prerequisites:** Node.js, npm, Rust
|
|
168
|
+
**Prerequisites:** Node.js, npm, Rust 1.89.0+ with `wasm32-unknown-unknown`, `wasm-pack`
|
|
169
169
|
|
|
170
170
|
```bash
|
|
171
171
|
# Install dependencies
|
|
@@ -191,28 +191,25 @@ npm test
|
|
|
191
191
|
- Contributors interested in the **Rust → WASM geometry pipeline**
|
|
192
192
|
- Anyone exploring **open-source CAD kernel internals**
|
|
193
193
|
|
|
194
|
-
If you just want a quick look, start with the [hosted demos](https://
|
|
194
|
+
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).
|
|
195
195
|
|
|
196
196
|
## Community
|
|
197
197
|
|
|
198
198
|
We'd love to have you involved — whether you're using OpenGeometry, building on it, or just curious.
|
|
199
199
|
|
|
200
|
-
- **[Discord](https://discord.com/invite/
|
|
200
|
+
- **[Discord](https://discord.com/invite/9wJpbfgGGA)** — Chat with the team and community
|
|
201
201
|
- **[Twitter / X](https://x.com/openGeometry)** — Updates and announcements
|
|
202
202
|
- **[LinkedIn](https://linkedin.com/company/openGeometry)** — Company updates
|
|
203
203
|
- **[GitHub Issues](https://github.com/OpenGeometry-io/OpenGeometry/issues)** — Bug reports and feature requests
|
|
204
|
-
- **[Blog](https://opengeometry.io
|
|
204
|
+
- **[Blog](https://blog.opengeometry.io?utm_source=github)** — Deep dives and release notes
|
|
205
205
|
|
|
206
206
|
## Contributing
|
|
207
207
|
|
|
208
|
-
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/
|
|
208
|
+
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/9wJpbfgGGA).
|
|
209
209
|
|
|
210
210
|
## AI Agent Docs Policy
|
|
211
211
|
|
|
212
|
-
-
|
|
213
|
-
`CLAUDE.md` and `.github/copilot-instructions.md` are thin redirects to it.
|
|
214
|
-
- Stable architecture and domain notes are tracked in [`knowledge/`](./knowledge/).
|
|
215
|
-
- User-facing docs live in [`docs/`](./docs/) (Mintlify source).
|
|
212
|
+
- If you're an AI agent, start with [AGENTS.md](./AGENTS.md) for architecture, commands, and behavioral rules.
|
|
216
213
|
- Agents should not create planning, handoff, or runbook files during a task. The
|
|
217
214
|
conversation, the diff, and the commit message are the handoff.
|
|
218
215
|
|
|
Binary file
|
package/opengeometry_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opengeometry",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"description": "CAD kernel for the web built with Rust, WebAssembly, and Three.js for browser CAD, AEC/BIM, and geometry-heavy tools.",
|
|
5
5
|
"author": "Vishwajeet Vinayak Mane",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
"three": ">=0.168.0"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"tsc": "^2.0.4",
|
|
54
53
|
"uuid": "^10.0.0"
|
|
55
54
|
}
|
|
56
55
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chamfers (bevels) the specified edges of a BRep by a given distance.
|
|
3
|
+
*
|
|
4
|
+
* edgeIds: array of edge indices to chamfer (0-based, from brep.edges).
|
|
5
|
+
* distance: retraction distance along each adjacent face.
|
|
6
|
+
*
|
|
7
|
+
* Returns a JSON-serialized BRep of the result.
|
|
8
|
+
* Throws if the distance exceeds a face extent or an edge id is invalid.
|
|
9
|
+
*/
|
|
10
|
+
export declare function chamferEdges(brepJson: string, edgeIds: number[], distance: number): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applies a draft angle to the specified faces of a BRep.
|
|
3
|
+
*
|
|
4
|
+
* faceIds: array of face indices (0-based) to draft.
|
|
5
|
+
* neutralPlaneNormal: normal of the neutral plane (pull direction).
|
|
6
|
+
* angleRad: draft angle in radians (must be < π/2).
|
|
7
|
+
*
|
|
8
|
+
* Returns a JSON-serialized BRep of the result.
|
|
9
|
+
*/
|
|
10
|
+
export declare function draftFaces(brepJson: string, faceIds: number[], neutralPlaneNormal: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
z: number;
|
|
14
|
+
}, angleRad: number): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rounds (fillets) the specified edges of a closed solid BRep with a constant
|
|
3
|
+
* radius. Each filleted edge becomes a curved tangent strip of radius `radius`.
|
|
4
|
+
*
|
|
5
|
+
* edgeIds: array of edge indices to fillet (0-based, from brep.edges).
|
|
6
|
+
* radius: fillet radius in model units. Must be positive and less than the
|
|
7
|
+
* inradius of both adjacent faces along the edge.
|
|
8
|
+
* segments: angular resolution of the cylindrical cutter (default 16).
|
|
9
|
+
*
|
|
10
|
+
* Returns a JSON-serialized BRep of the result.
|
|
11
|
+
* Throws if the radius exceeds the safe bound or an edge id is invalid.
|
|
12
|
+
*/
|
|
13
|
+
export declare function filletEdges(brepJson: string, edgeIds: number[], radius: number, segments?: number): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface LoftOptions {
|
|
2
|
+
closed?: boolean;
|
|
3
|
+
tolerance?: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Lofts between N profiles with G0 (positional) continuity.
|
|
7
|
+
*
|
|
8
|
+
* Each profile is a flat array of xyz coordinates (3 floats per point).
|
|
9
|
+
* All profiles must have the same vertex count.
|
|
10
|
+
*
|
|
11
|
+
* Returns a JSON-serialized BRep of the lofted solid.
|
|
12
|
+
*
|
|
13
|
+
* On failure the kernel throws a structured LoftError string. Handle it with
|
|
14
|
+
* try/catch and inspect the message for the error variant.
|
|
15
|
+
*/
|
|
16
|
+
export declare function loftProfiles(profiles: number[][], options?: LoftOptions): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mirrors a BRep about a plane defined by an origin and a normal.
|
|
3
|
+
*
|
|
4
|
+
* planeOrigin: any point on the mirror plane.
|
|
5
|
+
* planeNormal: unit normal of the mirror plane.
|
|
6
|
+
* weld: if true, attempt to merge the original and mirrored BReps into a
|
|
7
|
+
* single solid by stitching the parting faces.
|
|
8
|
+
*
|
|
9
|
+
* Returns a JSON-serialized BRep of the result.
|
|
10
|
+
* Throws MirrorError::PlaneIntersectsSolid if weld=true and the plane
|
|
11
|
+
* cuts through the interior.
|
|
12
|
+
*/
|
|
13
|
+
export declare function mirrorAboutPlane(brepJson: string, planeOrigin: {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
z: number;
|
|
17
|
+
}, planeNormal: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
z: number;
|
|
21
|
+
}, weld: boolean): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a circular pattern of a BRep around an axis.
|
|
3
|
+
*
|
|
4
|
+
* axisOrigin: a point on the rotation axis.
|
|
5
|
+
* axisDirection: unit vector along the rotation axis.
|
|
6
|
+
* sweepRad: total angular span to distribute instances over (2*PI = full circle).
|
|
7
|
+
* count: number of instances.
|
|
8
|
+
*
|
|
9
|
+
* Returns a JSON-serialized array of BReps (Vec<Brep>).
|
|
10
|
+
*/
|
|
11
|
+
export declare function patternCircular(brepJson: string, axisOrigin: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
z: number;
|
|
15
|
+
}, axisDirection: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
z: number;
|
|
19
|
+
}, sweepRad: number, count: number): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a linear pattern of a BRep along a direction vector.
|
|
3
|
+
*
|
|
4
|
+
* direction: step vector (does not need to be unit-length; its magnitude
|
|
5
|
+
* sets the per-instance offset when combined with pitch).
|
|
6
|
+
* pitch: spacing between instances along the direction vector.
|
|
7
|
+
* count: number of instances to produce (including the original position).
|
|
8
|
+
*
|
|
9
|
+
* Returns a JSON-serialized array of BReps (Vec<Brep>).
|
|
10
|
+
*/
|
|
11
|
+
export declare function patternLinear(brepJson: string, direction: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
z: number;
|
|
15
|
+
}, pitch: number, count: number): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface PipeOptions {
|
|
2
|
+
/** Number of segments around each circular cross-section (default 32). */
|
|
3
|
+
segments?: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Sweeps a circle along a 3D path, producing a pipe solid.
|
|
7
|
+
*
|
|
8
|
+
* `pathFlat` is a flat array of xyz coordinates: [x0,y0,z0, x1,y1,z1, …].
|
|
9
|
+
* The path must contain at least 3 points.
|
|
10
|
+
*
|
|
11
|
+
* `radiusCurve` is either a single number (constant radius along the whole
|
|
12
|
+
* path) or an array of numbers with the same length as the path point count
|
|
13
|
+
* (variable radius — one value per station).
|
|
14
|
+
*
|
|
15
|
+
* Returns a JSON-serialised BRep of the pipe solid.
|
|
16
|
+
*/
|
|
17
|
+
export declare function pipe(pathFlat: number[], radiusCurve: number | number[], options?: PipeOptions): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface RevolveProfileOptions {
|
|
2
|
+
axisOrigin?: {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
z: number;
|
|
6
|
+
};
|
|
7
|
+
axisDirection?: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
z: number;
|
|
11
|
+
};
|
|
12
|
+
startAngleRad?: number;
|
|
13
|
+
sweepAngleRad?: number;
|
|
14
|
+
segments?: number;
|
|
15
|
+
capStart?: boolean;
|
|
16
|
+
capEnd?: boolean;
|
|
17
|
+
tolerance?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Sweeps a planar generatrix profile around an axis by the given angle.
|
|
21
|
+
*
|
|
22
|
+
* The profile is a flat array of xyz coordinates (3 floats per point).
|
|
23
|
+
* Returns a JSON-serialized BRep of the revolved surface.
|
|
24
|
+
*
|
|
25
|
+
* For full 2π sweeps, angular-seam caps are elided — the surface closes by
|
|
26
|
+
* periodicity. Axis is defined by an origin point and a unit-length direction.
|
|
27
|
+
* On-axis points generate triangle fans rather than degenerate quads.
|
|
28
|
+
*/
|
|
29
|
+
export declare function revolveProfile(profileFlat: number[], options?: RevolveProfileOptions): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface SweepOptions {
|
|
2
|
+
capStart?: boolean;
|
|
3
|
+
capEnd?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Sweeps a planar profile along a 3D path, producing a solid BRep.
|
|
7
|
+
*
|
|
8
|
+
* `pathFlat` is a flat array of xyz coordinates: [x0,y0,z0, x1,y1,z1, …].
|
|
9
|
+
* `profileFlat` is a flat array of xyz coordinates for the cross-section.
|
|
10
|
+
*
|
|
11
|
+
* Returns a JSON-serialised BRep of the swept solid.
|
|
12
|
+
*/
|
|
13
|
+
export declare function sweepProfileAlongPath(pathFlat: number[], profileFlat: number[], options?: SweepOptions): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Vector3 } from "../../opengeometry/pkg/opengeometry.js";
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
/**
|
|
4
|
+
* Construction options for a helix path primitive.
|
|
5
|
+
*/
|
|
6
|
+
export interface IHelixOptions {
|
|
7
|
+
ogid?: string;
|
|
8
|
+
axisOrigin: Vector3;
|
|
9
|
+
axisDirection: Vector3;
|
|
10
|
+
radius: number;
|
|
11
|
+
pitch: number;
|
|
12
|
+
turns: number;
|
|
13
|
+
samplesPerTurn: number;
|
|
14
|
+
color: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Partial config payload accepted by `OGHelix.setConfig(...)`.
|
|
18
|
+
*/
|
|
19
|
+
export type HelixConfigUpdate = Partial<IHelixOptions>;
|
|
20
|
+
/**
|
|
21
|
+
* Helix path primitive rendered as a Three.js line.
|
|
22
|
+
*/
|
|
23
|
+
export declare class OGHelix extends THREE.Line {
|
|
24
|
+
ogid: string;
|
|
25
|
+
options: IHelixOptions;
|
|
26
|
+
constructor(options?: Partial<IHelixOptions>);
|
|
27
|
+
setConfig(options: HelixConfigUpdate): void;
|
|
28
|
+
getConfig(): IHelixOptions;
|
|
29
|
+
getSamples(): Vector3[];
|
|
30
|
+
private generateGeometry;
|
|
31
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import type { ShapeSubtractOperands, ShapeSubtractOptions, ShapeSubtractResult } from "./boolean-subtract.js";
|
|
3
|
+
/**
|
|
4
|
+
* Construction options for a cone shape.
|
|
5
|
+
*/
|
|
6
|
+
export interface IConeOptions {
|
|
7
|
+
ogid?: string;
|
|
8
|
+
/** Apex position in world space. */
|
|
9
|
+
apex: [number, number, number];
|
|
10
|
+
/** Base centre position in world space. */
|
|
11
|
+
baseCenter: [number, number, number];
|
|
12
|
+
baseRadius: number;
|
|
13
|
+
segments: number;
|
|
14
|
+
/** Sweep angle in degrees (default 360). */
|
|
15
|
+
angle: number;
|
|
16
|
+
color: number;
|
|
17
|
+
fatOutlines?: boolean;
|
|
18
|
+
outlineWidth?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Partial config payload accepted by `Cone.setConfig(...)`.
|
|
22
|
+
*/
|
|
23
|
+
export type ConeConfigUpdate = Partial<IConeOptions>;
|
|
24
|
+
/**
|
|
25
|
+
* Cone wrapper backed by the kernel `OGCone` revolve primitive.
|
|
26
|
+
*/
|
|
27
|
+
export declare class Cone extends THREE.Mesh {
|
|
28
|
+
#private;
|
|
29
|
+
ogid: string;
|
|
30
|
+
options: IConeOptions;
|
|
31
|
+
private cone;
|
|
32
|
+
private _outlineEnabled;
|
|
33
|
+
private _fatOutlines;
|
|
34
|
+
private _outlineWidth;
|
|
35
|
+
set color(color: number);
|
|
36
|
+
constructor(options?: Partial<IConeOptions>);
|
|
37
|
+
setConfig(options: ConeConfigUpdate): void;
|
|
38
|
+
getConfig(): IConeOptions;
|
|
39
|
+
getEditCapabilities(): import("../editor.js").ParametricEditCapabilities;
|
|
40
|
+
canConvertToFreeform(): boolean;
|
|
41
|
+
toFreeform(id?: string): import("../freeform.js").FreeformGeometry;
|
|
42
|
+
cleanGeometry(): void;
|
|
43
|
+
generateGeometry(): void;
|
|
44
|
+
getBrep(): any;
|
|
45
|
+
/**
|
|
46
|
+
* Subtracts one or more boolean operands from this cone.
|
|
47
|
+
*/
|
|
48
|
+
subtract(operands: ShapeSubtractOperands, options?: ShapeSubtractOptions): ShapeSubtractResult;
|
|
49
|
+
set outline(enable: boolean);
|
|
50
|
+
get outline(): boolean;
|
|
51
|
+
set fatOutlines(value: boolean);
|
|
52
|
+
get fatOutlines(): boolean;
|
|
53
|
+
set outlineWidth(value: number);
|
|
54
|
+
get outlineWidth(): number;
|
|
55
|
+
/** Sets position/rotation/scale placement. */
|
|
56
|
+
setPlacement(placement: {
|
|
57
|
+
translation?: THREE.Vector3Like;
|
|
58
|
+
rotation?: THREE.Vector3Like;
|
|
59
|
+
scale?: THREE.Vector3Like;
|
|
60
|
+
}): void;
|
|
61
|
+
private clearOutlineMesh;
|
|
62
|
+
discardGeometry(): void;
|
|
63
|
+
private writePositionsToGeometry;
|
|
64
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as OGKernel from "../../opengeometry/pkg/opengeometry.js";
|
|
2
|
+
import { Vector3 } from "../../opengeometry/pkg/opengeometry.js";
|
|
3
|
+
import * as THREE from "three";
|
|
4
|
+
import { ShapeOutlineMesh } from "./outline-utils.js";
|
|
5
|
+
import type { ShapeSubtractOperands, ShapeSubtractOptions, ShapeSubtractResult } from "./boolean-subtract.js";
|
|
6
|
+
/**
|
|
7
|
+
* Construction options for an ellipsoid shape.
|
|
8
|
+
*/
|
|
9
|
+
export interface IEllipsoidOptions {
|
|
10
|
+
ogid?: string;
|
|
11
|
+
center: Vector3;
|
|
12
|
+
semiA: number;
|
|
13
|
+
semiB: number;
|
|
14
|
+
semiC: number;
|
|
15
|
+
longitudeSegments: number;
|
|
16
|
+
latitudeSegments: number;
|
|
17
|
+
color: number;
|
|
18
|
+
fatOutlines?: boolean;
|
|
19
|
+
outlineWidth?: number;
|
|
20
|
+
translation?: Vector3;
|
|
21
|
+
rotation?: Vector3;
|
|
22
|
+
scale?: Vector3;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Placement updates accepted by `Ellipsoid`.
|
|
26
|
+
*/
|
|
27
|
+
export interface EllipsoidPlacementOptions {
|
|
28
|
+
translation?: Vector3;
|
|
29
|
+
rotation?: Vector3;
|
|
30
|
+
scale?: Vector3;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Partial config payload accepted by `Ellipsoid.setConfig(...)`.
|
|
34
|
+
*/
|
|
35
|
+
export type EllipsoidConfigUpdate = Partial<Omit<IEllipsoidOptions, "translation" | "rotation" | "scale">>;
|
|
36
|
+
/**
|
|
37
|
+
* Alias for `Ellipsoid` placement updates.
|
|
38
|
+
*/
|
|
39
|
+
export type EllipsoidPlacementUpdate = EllipsoidPlacementOptions;
|
|
40
|
+
/**
|
|
41
|
+
* Ellipsoid wrapper backed by the kernel OGEllipsoid primitive.
|
|
42
|
+
*
|
|
43
|
+
* All three semi-axes (a, b, c) are independently configurable.
|
|
44
|
+
* When a === b === c the shape degenerates to a sphere.
|
|
45
|
+
*/
|
|
46
|
+
export declare class Ellipsoid extends THREE.Mesh {
|
|
47
|
+
#private;
|
|
48
|
+
ogid: string;
|
|
49
|
+
options: IEllipsoidOptions;
|
|
50
|
+
private ellipsoid;
|
|
51
|
+
private _outlineEnabled;
|
|
52
|
+
private _fatOutlines;
|
|
53
|
+
private _outlineWidth;
|
|
54
|
+
set color(color: number);
|
|
55
|
+
constructor(options?: IEllipsoidOptions);
|
|
56
|
+
validateOptions(): void;
|
|
57
|
+
setConfig(options: EllipsoidConfigUpdate): void;
|
|
58
|
+
getConfig(): IEllipsoidOptions;
|
|
59
|
+
getAnchor(): OGKernel.Vector3;
|
|
60
|
+
setPlacement(placement: EllipsoidPlacementUpdate): void;
|
|
61
|
+
setTransform(translation: Vector3, rotation: Vector3, scale: Vector3): void;
|
|
62
|
+
setTranslation(translation: Vector3): void;
|
|
63
|
+
setRotation(rotation: Vector3): void;
|
|
64
|
+
setScale(scale: Vector3): void;
|
|
65
|
+
getPlacement(): import("../editor.js").ParametricPlacement;
|
|
66
|
+
getEditCapabilities(): import("../editor.js").ParametricEditCapabilities;
|
|
67
|
+
canConvertToFreeform(): boolean;
|
|
68
|
+
toFreeform(id?: string): import("../freeform.js").FreeformGeometry;
|
|
69
|
+
cleanGeometry(): void;
|
|
70
|
+
generateGeometry(): void;
|
|
71
|
+
getBrep(): any;
|
|
72
|
+
/**
|
|
73
|
+
* Subtracts one or more boolean operands, such as Opening volumes, from this ellipsoid.
|
|
74
|
+
*/
|
|
75
|
+
subtract(operands: ShapeSubtractOperands, options?: ShapeSubtractOptions): ShapeSubtractResult;
|
|
76
|
+
set outline(enable: boolean);
|
|
77
|
+
get outline(): boolean;
|
|
78
|
+
set fatOutlines(value: boolean);
|
|
79
|
+
get fatOutlines(): boolean;
|
|
80
|
+
set outlineWidth(value: number);
|
|
81
|
+
get outlineWidth(): number;
|
|
82
|
+
get outlineMesh(): ShapeOutlineMesh | null;
|
|
83
|
+
private clearOutlineMesh;
|
|
84
|
+
discardGeometry(): void;
|
|
85
|
+
private writePositionsToGeometry;
|
|
86
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import type { ShapeSubtractOperands, ShapeSubtractOptions, ShapeSubtractResult } from "./boolean-subtract.js";
|
|
3
|
+
/**
|
|
4
|
+
* Construction options for a frustum (truncated cone) shape.
|
|
5
|
+
*/
|
|
6
|
+
export interface IFrustumOptions {
|
|
7
|
+
ogid?: string;
|
|
8
|
+
baseCenter?: [number, number, number];
|
|
9
|
+
baseRadius: number;
|
|
10
|
+
topRadius: number;
|
|
11
|
+
height: number;
|
|
12
|
+
segments?: number;
|
|
13
|
+
angle?: number;
|
|
14
|
+
color: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Placement updates accepted by `Frustum`.
|
|
18
|
+
*/
|
|
19
|
+
export interface FrustumPlacementOptions {
|
|
20
|
+
translation?: THREE.Vector3;
|
|
21
|
+
rotation?: THREE.Vector3;
|
|
22
|
+
scale?: THREE.Vector3;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Partial config payload accepted by `Frustum.setConfig(...)`.
|
|
26
|
+
*/
|
|
27
|
+
export type FrustumConfigUpdate = Partial<IFrustumOptions>;
|
|
28
|
+
/**
|
|
29
|
+
* Frustum (truncated cone) wrapper backed by the kernel OGFrustum primitive.
|
|
30
|
+
*/
|
|
31
|
+
export declare class Frustum extends THREE.Mesh {
|
|
32
|
+
ogid: string;
|
|
33
|
+
options: Required<IFrustumOptions>;
|
|
34
|
+
private frustum;
|
|
35
|
+
constructor(options?: IFrustumOptions);
|
|
36
|
+
setConfig(options: FrustumConfigUpdate): void;
|
|
37
|
+
setPlacement(placement: FrustumPlacementOptions): void;
|
|
38
|
+
getBrep(): any;
|
|
39
|
+
/**
|
|
40
|
+
* Subtracts one or more boolean operands from this frustum.
|
|
41
|
+
*/
|
|
42
|
+
subtract(operands: ShapeSubtractOperands, options?: ShapeSubtractOptions): ShapeSubtractResult;
|
|
43
|
+
private generateGeometry;
|
|
44
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import type { ShapeSubtractOperands, ShapeSubtractOptions, ShapeSubtractResult } from "./boolean-subtract.js";
|
|
3
|
+
/**
|
|
4
|
+
* Construction options for a torus shape.
|
|
5
|
+
*/
|
|
6
|
+
export interface ITorusOptions {
|
|
7
|
+
ogid?: string;
|
|
8
|
+
center?: [number, number, number];
|
|
9
|
+
axis?: [number, number, number];
|
|
10
|
+
majorRadius: number;
|
|
11
|
+
minorRadius: number;
|
|
12
|
+
majorSegments?: number;
|
|
13
|
+
minorSegments?: number;
|
|
14
|
+
color: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Placement updates accepted by `Torus`.
|
|
18
|
+
*/
|
|
19
|
+
export interface TorusPlacementOptions {
|
|
20
|
+
translation?: THREE.Vector3;
|
|
21
|
+
rotation?: THREE.Vector3;
|
|
22
|
+
scale?: THREE.Vector3;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Partial config payload accepted by `Torus.setConfig(...)`.
|
|
26
|
+
*/
|
|
27
|
+
export type TorusConfigUpdate = Partial<ITorusOptions>;
|
|
28
|
+
/**
|
|
29
|
+
* Torus wrapper backed by the kernel OGTorus primitive.
|
|
30
|
+
*/
|
|
31
|
+
export declare class Torus extends THREE.Mesh {
|
|
32
|
+
ogid: string;
|
|
33
|
+
options: Required<ITorusOptions>;
|
|
34
|
+
private torus;
|
|
35
|
+
constructor(options?: ITorusOptions);
|
|
36
|
+
setConfig(options: TorusConfigUpdate): void;
|
|
37
|
+
setPlacement(placement: TorusPlacementOptions): void;
|
|
38
|
+
getBrep(): any;
|
|
39
|
+
/**
|
|
40
|
+
* Subtracts one or more boolean operands from this torus.
|
|
41
|
+
*/
|
|
42
|
+
subtract(operands: ShapeSubtractOperands, options?: ShapeSubtractOptions): ShapeSubtractResult;
|
|
43
|
+
private generateGeometry;
|
|
44
|
+
}
|