opengeometry 2.0.8 → 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/index.js +448 -83
- package/index.js.map +1 -1
- package/opengeometry/pkg/opengeometry.d.ts +145 -145
- package/opengeometry/pkg/opengeometry.js +126 -53
- package/opengeometry/pkg/opengeometry_bg.wasm +0 -0
- package/opengeometry/pkg/opengeometry_bg.wasm.d.ts +144 -144
- package/opengeometry_bg.wasm +0 -0
- package/opengeometry_bg.wasm.d.ts +144 -144
- package/package.json +1 -2
- package/src/examples/wall-from-offsets.d.ts +30 -1
- package/src/operations/boolean-errors.d.ts +90 -0
- package/src/operations/boolean.d.ts +26 -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/index.d.ts +1 -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
|
@@ -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
|
+
}
|