opengeometry 2.0.13 → 2.0.15
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 +4 -4
- package/analytic-worker.js +90 -0
- package/index.d.ts +16 -1
- package/index.js +3096 -3551
- package/index.js.map +1 -1
- package/opengeometry/pkg/opengeometry.d.ts +383 -347
- package/opengeometry/pkg/opengeometry.js +793 -506
- package/opengeometry/pkg/opengeometry_bg.wasm +0 -0
- package/opengeometry/pkg/opengeometry_bg.wasm.d.ts +300 -276
- package/opengeometry_bg.wasm +0 -0
- package/opengeometry_bg.wasm.d.ts +300 -276
- package/package.json +3 -4
- package/src/examples/booleans.d.ts +3 -2
- package/src/examples/editor-modes.d.ts +4 -8
- package/src/examples/index.d.ts +1 -1
- package/src/examples/ribbon-from-offsets.d.ts +33 -0
- package/src/examples/shapes.d.ts +1 -1
- package/src/export/analytic-ifc.d.ts +61 -0
- package/src/freeform/geometry.d.ts +2 -0
- package/src/freeform/index.d.ts +1 -1
- package/src/operations/analytic-errors.d.ts +8 -0
- package/src/operations/boolean-regions.d.ts +20 -0
- package/src/operations/boolean.d.ts +9 -141
- package/src/operations/index.d.ts +3 -1
- package/src/operations/loft.d.ts +13 -0
- package/src/operations/offset-regions.d.ts +11 -12
- package/src/primitives/analytic-curve.d.ts +42 -0
- package/src/primitives/arc.d.ts +26 -55
- package/src/primitives/elliptical_arc.d.ts +29 -57
- package/src/rendering/analytic-lod.d.ts +32 -0
- package/src/rendering/analytic-tessellation.d.ts +32 -0
- package/src/shapes/analytic-pattern.d.ts +36 -0
- package/src/shapes/analytic-solid.d.ts +304 -0
- package/src/shapes/cuboid.d.ts +40 -54
- package/src/shapes/cylinder.d.ts +26 -70
- package/src/shapes/opening.d.ts +19 -82
- package/src/shapes/polygon.d.ts +4 -5
- package/src/shapes/solid.d.ts +0 -8
- package/src/shapes/sphere.d.ts +18 -73
- package/src/shapes/sweep.d.ts +0 -5
- package/src/shapes/wedge.d.ts +0 -5
- package/src/examples/wall-from-offsets.d.ts +0 -40
- package/src/operations/boolean-errors.d.ts +0 -90
- package/src/shapes/boolean-subtract.d.ts +0 -21
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opengeometry",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "CAD kernel for the web built with Rust, WebAssembly, and Three.js
|
|
3
|
+
"version": "2.0.15",
|
|
4
|
+
"description": "CAD geometry kernel for the web built with Rust, WebAssembly, and Three.js.",
|
|
5
5
|
"author": "Vishwajeet Vinayak Mane",
|
|
6
6
|
"license": "MPL-2.0",
|
|
7
7
|
"type": "module",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"default": "./opengeometry/pkg/opengeometry.js"
|
|
20
20
|
},
|
|
21
21
|
"./opengeometry_bg.wasm": "./opengeometry_bg.wasm",
|
|
22
|
+
"./analytic-worker.js": "./analytic-worker.js",
|
|
22
23
|
"./package.json": "./package.json"
|
|
23
24
|
},
|
|
24
25
|
"keywords": [
|
|
@@ -31,8 +32,6 @@
|
|
|
31
32
|
"geometry",
|
|
32
33
|
"webassembly",
|
|
33
34
|
"wasm",
|
|
34
|
-
"aec",
|
|
35
|
-
"bim",
|
|
36
35
|
"ifc",
|
|
37
36
|
"step",
|
|
38
37
|
"stl",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
2
|
import { Vector3 } from "../../opengeometry/pkg/opengeometry.js";
|
|
3
|
-
import { BooleanExecutionOptions
|
|
3
|
+
import { BooleanExecutionOptions } from "../operations/boolean.js";
|
|
4
|
+
import { AnalyticSolid } from "../shapes/analytic-solid.js";
|
|
4
5
|
export type BooleanExampleOperation = "union" | "intersection" | "subtraction";
|
|
5
6
|
export type BooleanExampleMode = "solid" | "polygon" | "extruded";
|
|
6
7
|
export interface BooleanExampleBuildOptions extends BooleanExecutionOptions {
|
|
@@ -13,7 +14,7 @@ export interface BooleanExampleBuildResult {
|
|
|
13
14
|
group: THREE.Group;
|
|
14
15
|
lhs: THREE.Object3D;
|
|
15
16
|
rhs: THREE.Object3D;
|
|
16
|
-
result:
|
|
17
|
+
result: AnalyticSolid;
|
|
17
18
|
title: string;
|
|
18
19
|
description: string;
|
|
19
20
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
|
-
import { FreeformEditResult
|
|
2
|
+
import { FreeformEditResult } from "../editor.js";
|
|
3
3
|
import { Line } from "../primitives/line.js";
|
|
4
4
|
import { Polygon } from "../shapes/polygon.js";
|
|
5
5
|
import { Cuboid } from "../shapes/cuboid.js";
|
|
6
6
|
/**
|
|
7
|
-
* Demonstrates
|
|
8
|
-
*
|
|
9
|
-
* including wire-backed freeform edge insertion on a converted line.
|
|
7
|
+
* Demonstrates strict v2 parametric solid edits and the separate sampled-wire
|
|
8
|
+
* freeform editor. Analytic solid freeform conversion is intentionally unsupported.
|
|
10
9
|
*/
|
|
11
10
|
export declare function createEditorModesExample(scene: THREE.Scene): {
|
|
12
11
|
polygon: Polygon;
|
|
@@ -16,9 +15,6 @@ export declare function createEditorModesExample(scene: THREE.Scene): {
|
|
|
16
15
|
cuboidCapabilities: import("../editor.js").ParametricEditCapabilities;
|
|
17
16
|
guideLineCapabilities: import("../editor.js").ParametricEditCapabilities;
|
|
18
17
|
guideLineFreeform: import("../freeform.js").FreeformGeometry;
|
|
19
|
-
guideLineEditor: FreeformEditor;
|
|
18
|
+
guideLineEditor: import("../editor.js").FreeformEditor;
|
|
20
19
|
guideLineSplitResult: FreeformEditResult | null;
|
|
21
|
-
freeform: import("../freeform.js").FreeformGeometry;
|
|
22
|
-
freeformEditor: FreeformEditor;
|
|
23
|
-
freeformResult: FreeformEditResult | null;
|
|
24
20
|
};
|
package/src/examples/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export * from './shapes.js';
|
|
|
6
6
|
export * from './sweep.js';
|
|
7
7
|
export * from './offset.js';
|
|
8
8
|
export * from './offset-ring-variable.js';
|
|
9
|
-
export * from './
|
|
9
|
+
export * from './ribbon-from-offsets.js';
|
|
10
10
|
export * from './booleans.js';
|
|
11
11
|
export * from './editor-modes.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { Polyline } from "../primitives/polyline.js";
|
|
3
|
+
import { AnalyticSolid } from "../shapes/analytic-solid.js";
|
|
4
|
+
import { Polygon } from "../shapes/polygon.js";
|
|
5
|
+
export interface RibbonFromOffsetsOptions {
|
|
6
|
+
/** Subtract one exact coextensive through slot. Default `false`. */
|
|
7
|
+
cutThroughSlot?: boolean;
|
|
8
|
+
/** Width of the through slot along its centerline segment. Default `0.6`. */
|
|
9
|
+
slotWidth?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Ribbon extrusion height in meters. Default `2.6` to match the example HTML.
|
|
12
|
+
*/
|
|
13
|
+
height?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Renders a human-readable description for an analytic geometry error (or any
|
|
17
|
+
* other thrown value). Used by the example HTML to surface kernel failures
|
|
18
|
+
* in a status panel without losing the structured payload.
|
|
19
|
+
*/
|
|
20
|
+
export declare function describeRibbonSubtractError(error: unknown): string;
|
|
21
|
+
export declare function createRibbonFromOffsetsExample(scene: THREE.Scene, options?: RibbonFromOffsetsOptions): {
|
|
22
|
+
centerline: Polyline;
|
|
23
|
+
leftOffsetPolyline: Polyline;
|
|
24
|
+
rightOffsetPolyline: Polyline;
|
|
25
|
+
ribbonPolygon: Polygon;
|
|
26
|
+
leftOffset: import("../primitives/polyline.js").IOffsetResult;
|
|
27
|
+
rightOffset: import("../primitives/polyline.js").IOffsetResult;
|
|
28
|
+
cutResult: {
|
|
29
|
+
ribbon: THREE.Object3D;
|
|
30
|
+
cutters: AnalyticSolid[];
|
|
31
|
+
} | null;
|
|
32
|
+
cutError: unknown;
|
|
33
|
+
};
|
package/src/examples/shapes.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { Cuboid } from "../shapes/cuboid.js";
|
|
|
3
3
|
import { Cylinder } from "../shapes/cylinder.js";
|
|
4
4
|
import { Opening } from "../shapes/opening.js";
|
|
5
5
|
import { Polygon } from "../shapes/polygon.js";
|
|
6
|
-
import { Sphere } from "../shapes/sphere.js";
|
|
7
6
|
import { Sweep } from "../shapes/sweep.js";
|
|
7
|
+
import { Sphere } from "../shapes/sphere.js";
|
|
8
8
|
import { Wedge } from "../shapes/wedge.js";
|
|
9
9
|
/**
|
|
10
10
|
* Adds a basic shapes showcase to the provided scene.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type IfcPreparedValue = {
|
|
2
|
+
kind: "Ref";
|
|
3
|
+
id: number;
|
|
4
|
+
} | {
|
|
5
|
+
kind: "List";
|
|
6
|
+
values: IfcPreparedValue[];
|
|
7
|
+
} | {
|
|
8
|
+
kind: "Real";
|
|
9
|
+
value: number;
|
|
10
|
+
} | {
|
|
11
|
+
kind: "Integer";
|
|
12
|
+
value: number;
|
|
13
|
+
} | {
|
|
14
|
+
kind: "Text" | "Enum";
|
|
15
|
+
value: string;
|
|
16
|
+
} | {
|
|
17
|
+
kind: "Bool";
|
|
18
|
+
value: boolean;
|
|
19
|
+
} | {
|
|
20
|
+
kind: "Null" | "Derived";
|
|
21
|
+
};
|
|
22
|
+
export interface AnalyticExchangeBodyV2 {
|
|
23
|
+
schema_version: 2;
|
|
24
|
+
revision: string;
|
|
25
|
+
length_unit: "metre";
|
|
26
|
+
up_axis: "Z";
|
|
27
|
+
coordinate_space: "world";
|
|
28
|
+
representation_type: "AdvancedBrep" | "CSG";
|
|
29
|
+
quality: {
|
|
30
|
+
kind: "Analytic";
|
|
31
|
+
} | {
|
|
32
|
+
kind: "Approximate";
|
|
33
|
+
max_error: number;
|
|
34
|
+
};
|
|
35
|
+
geometric_tolerance: number;
|
|
36
|
+
exchange_error_bound: number;
|
|
37
|
+
validation_level: string;
|
|
38
|
+
entities: {
|
|
39
|
+
id: number;
|
|
40
|
+
entity_type: string;
|
|
41
|
+
attributes: IfcPreparedValue[];
|
|
42
|
+
}[];
|
|
43
|
+
solids: number[];
|
|
44
|
+
faces: {
|
|
45
|
+
face: number;
|
|
46
|
+
key: string;
|
|
47
|
+
entity: number;
|
|
48
|
+
provenance: {
|
|
49
|
+
sources: {
|
|
50
|
+
entity: string;
|
|
51
|
+
body: string;
|
|
52
|
+
key: string;
|
|
53
|
+
face: number;
|
|
54
|
+
}[];
|
|
55
|
+
role: "Authored" | "Preserved" | "Split" | "Cut" | "Coincident";
|
|
56
|
+
reversed: boolean;
|
|
57
|
+
};
|
|
58
|
+
}[];
|
|
59
|
+
}
|
|
60
|
+
/** Serializes Rust-prepared geometry; this function does not fit curves or tessellate surfaces. */
|
|
61
|
+
export declare function analyticIfcText(body: AnalyticExchangeBodyV2, name?: string): string;
|
|
@@ -78,3 +78,5 @@ export declare class FreeformGeometry {
|
|
|
78
78
|
* BRep object, or another wrapper exposing BRep accessors.
|
|
79
79
|
*/
|
|
80
80
|
export declare function createFreeformGeometry(source: FreeformSource, options?: CreateFreeformGeometryOptions): FreeformGeometry;
|
|
81
|
+
/** Triangulates an explicitly faceted BRep, including its planar face holes. */
|
|
82
|
+
export declare function tessellateFacetedBrep(serialized: string): Float64Array;
|
package/src/freeform/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Freeform geometry types and helpers for working with raw BRep-backed models.
|
|
3
3
|
*/
|
|
4
4
|
export * from "./types.js";
|
|
5
|
-
export { FreeformGeometry, createFreeformGeometry } from "./geometry.js";
|
|
5
|
+
export { FreeformGeometry, createFreeformGeometry, tessellateFacetedBrep } from "./geometry.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type AnalyticGeometryErrorCode = "math" | "invalid_geometry" | "invalid_topology" | "unsupported_geometry" | "ambiguous_profile_alignment" | "coverage_gap" | "singular_parameterization" | "missing_reference" | "unsupported_schema" | "unresolved_intersection" | "unresolved_tessellation" | "limit_exceeded" | "unknown";
|
|
2
|
+
export declare class AnalyticGeometryError extends Error {
|
|
3
|
+
readonly code: AnalyticGeometryErrorCode;
|
|
4
|
+
readonly detail: unknown;
|
|
5
|
+
readonly families?: readonly [string, string];
|
|
6
|
+
constructor(code: AnalyticGeometryErrorCode, message: string, detail?: unknown);
|
|
7
|
+
}
|
|
8
|
+
export declare function parseAnalyticGeometryError(raw: unknown): AnalyticGeometryError;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { OffsetRegion } from "./offset-regions.js";
|
|
2
|
+
export type PlanarBooleanOperation = "union" | "intersection" | "subtraction";
|
|
3
|
+
export type CurvedRegionEdge = {
|
|
4
|
+
kind: "line";
|
|
5
|
+
from: [number, number];
|
|
6
|
+
to: [number, number];
|
|
7
|
+
} | {
|
|
8
|
+
kind: "arc";
|
|
9
|
+
center: [number, number];
|
|
10
|
+
radius: number;
|
|
11
|
+
start_angle: number;
|
|
12
|
+
sweep_angle: number;
|
|
13
|
+
};
|
|
14
|
+
export interface CurvedRegion2D {
|
|
15
|
+
outer: CurvedRegionEdge[];
|
|
16
|
+
holes: CurvedRegionEdge[][];
|
|
17
|
+
}
|
|
18
|
+
export declare function booleanRegions2D(a: readonly OffsetRegion[], b: readonly OffsetRegion[], operation: PlanarBooleanOperation): OffsetRegion[];
|
|
19
|
+
/** Analytic line/arc region Boolean; output arcs retain their exact circles. */
|
|
20
|
+
export declare function booleanCurvedRegions2D(a: readonly CurvedRegion2D[], b: readonly CurvedRegion2D[], operation: PlanarBooleanOperation): CurvedRegion2D[];
|
|
@@ -1,148 +1,16 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
|
-
import {
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export type BooleanOperand = string | Record<string, unknown> | {
|
|
7
|
-
getBrep?: () => unknown;
|
|
8
|
-
getBrepData?: () => unknown;
|
|
9
|
-
getBrepSerialized?: () => string;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Kernel-side boolean tuning options.
|
|
13
|
-
*
|
|
14
|
-
* `tolerance` is in **model units** (meters by convention). When omitted, the
|
|
15
|
-
* kernel auto-scales it to `operandsDiagonal * 1e-8` (clamped to a `1e-6`
|
|
16
|
-
* floor in many-subtract). This drives the kernel-side polygon / face math
|
|
17
|
-
* (vertex welding, plane coincidence, AABB enforcement).
|
|
18
|
-
*
|
|
19
|
-
* **NOTE: this tolerance does NOT control boolmesh's internal snap window.**
|
|
20
|
-
* Boolmesh has its own welding tolerance that may treat faces within ~1mm
|
|
21
|
-
* of each other as coincident, regardless of what `tolerance` you pass. If
|
|
22
|
-
* your cutter face sits within about 0.001 m – 0.01 m of a host face you
|
|
23
|
-
* may still hit a `DegenerateTriangle` / `CoincidentFaces` error path.
|
|
24
|
-
*
|
|
25
|
-
* **Recommended cutter overshoot for through-cuts:** `max(hostThickness *
|
|
26
|
-
* 0.05, 0.01)` in model units. See `knowledge/boolean-tolerance-guide.md`.
|
|
27
|
-
*
|
|
28
|
-
* `mergeCoplanarFaces` (default `true`) controls whether the planar pipeline
|
|
29
|
-
* merges coplanar adjacent faces in its output.
|
|
30
|
-
*/
|
|
31
|
-
export interface BooleanKernelOptions {
|
|
32
|
-
tolerance?: number;
|
|
33
|
-
mergeCoplanarFaces?: boolean;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Rendering options applied to the boolean result mesh.
|
|
37
|
-
*
|
|
38
|
-
* `color`, `opacity`, `transparent`, and `side` override the corresponding
|
|
39
|
-
* fields on the host (LHS) operand's cloned material. Omit them to inherit
|
|
40
|
-
* the host's appearance unchanged.
|
|
41
|
-
*/
|
|
42
|
-
export interface BooleanRenderOptions {
|
|
2
|
+
import { AnalyticSolid } from "../shapes/analytic-solid.js";
|
|
3
|
+
/** Rendering and tessellation options applied to an analytic boolean result. */
|
|
4
|
+
export interface BooleanExecutionOptions {
|
|
5
|
+
deflection?: number;
|
|
43
6
|
color?: THREE.ColorRepresentation;
|
|
44
7
|
opacity?: number;
|
|
45
8
|
transparent?: boolean;
|
|
46
9
|
side?: THREE.Side;
|
|
47
10
|
outline?: boolean;
|
|
48
|
-
fatOutlines?: boolean;
|
|
49
|
-
outlineWidth?: number;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Combined kernel and rendering options accepted by boolean helpers.
|
|
53
|
-
*/
|
|
54
|
-
export interface BooleanExecutionOptions extends BooleanRenderOptions {
|
|
55
|
-
kernel?: BooleanKernelOptions;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Structured report returned by the kernel boolean pipeline.
|
|
59
|
-
*/
|
|
60
|
-
export interface BooleanReport {
|
|
61
|
-
operation: string;
|
|
62
|
-
operand_kind: string;
|
|
63
|
-
input_face_count: number;
|
|
64
|
-
input_triangle_count: number;
|
|
65
|
-
output_face_count: number;
|
|
66
|
-
output_shell_count: number;
|
|
67
|
-
empty: boolean;
|
|
68
|
-
}
|
|
69
|
-
interface KernelBooleanResult {
|
|
70
|
-
brepSerialized: string;
|
|
71
|
-
geometrySerialized: string;
|
|
72
|
-
outlineGeometrySerialized: string;
|
|
73
|
-
reportJson: string;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Renderable result mesh returned by the kernel boolean helpers.
|
|
77
|
-
*/
|
|
78
|
-
export declare class BooleanResult extends THREE.Mesh {
|
|
79
|
-
#private;
|
|
80
|
-
ogid: string;
|
|
81
|
-
report: BooleanReport | null;
|
|
82
|
-
private brepSerialized;
|
|
83
|
-
private brepData;
|
|
84
|
-
private outlinePositions;
|
|
85
|
-
private _outlineEnabled;
|
|
86
|
-
private _fatOutlines;
|
|
87
|
-
private _outlineWidth;
|
|
88
|
-
constructor(kernelResult: KernelBooleanResult, options?: BooleanRenderOptions, host?: BooleanOperand | null);
|
|
89
|
-
/**
|
|
90
|
-
* Updates the result mesh's color in place without re-running the boolean
|
|
91
|
-
* pipeline. Accepts any value Three.js accepts (`number`, hex string, css
|
|
92
|
-
* color name, or `THREE.Color`). No-op for materials without a `color` field.
|
|
93
|
-
*/
|
|
94
|
-
set color(value: THREE.ColorRepresentation);
|
|
95
|
-
get color(): THREE.Color | null;
|
|
96
|
-
/**
|
|
97
|
-
* Rebuilds the mesh, cached BRep payload, and outline geometry from the kernel output.
|
|
98
|
-
*/
|
|
99
|
-
applyKernelResult(kernelResult: KernelBooleanResult, options?: BooleanRenderOptions, sourceMaterial?: THREE.Material | null): void;
|
|
100
|
-
/**
|
|
101
|
-
* Returns the parsed BRep object for reuse with scene export or downstream operations.
|
|
102
|
-
*/
|
|
103
|
-
getBrepData(): Record<string, unknown> | null;
|
|
104
|
-
/**
|
|
105
|
-
* Returns the serialized BRep JSON emitted by the kernel boolean operation.
|
|
106
|
-
*/
|
|
107
|
-
getBrepSerialized(): string;
|
|
108
|
-
canConvertToFreeform(): boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Converts the boolean output into a first-class freeform geometry object so
|
|
111
|
-
* it can participate in direct face/edge/vertex editing.
|
|
112
|
-
*/
|
|
113
|
-
toFreeform(options?: CreateFreeformGeometryOptions): FreeformGeometry;
|
|
114
|
-
set outline(enable: boolean);
|
|
115
|
-
get outline(): boolean;
|
|
116
|
-
set fatOutlines(value: boolean);
|
|
117
|
-
get fatOutlines(): boolean;
|
|
118
|
-
set outlineWidth(value: number);
|
|
119
|
-
get outlineWidth(): number;
|
|
120
|
-
disposeGeometry(): void;
|
|
121
|
-
private clearOutlineMesh;
|
|
122
11
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
*/
|
|
129
|
-
export declare function booleanUnion(lhs: BooleanOperand, rhs: BooleanOperand, options?: BooleanExecutionOptions): BooleanResult;
|
|
130
|
-
/**
|
|
131
|
-
* Computes a kernel-backed boolean intersection and returns a renderable result mesh.
|
|
132
|
-
*/
|
|
133
|
-
export declare function booleanIntersection(lhs: BooleanOperand, rhs: BooleanOperand, options?: BooleanExecutionOptions): BooleanResult;
|
|
134
|
-
/**
|
|
135
|
-
* Computes a kernel-backed boolean subtraction and returns a renderable result mesh.
|
|
136
|
-
*
|
|
137
|
-
* Use this when you want a standalone helper rather than a shape-level
|
|
138
|
-
* convenience method like `opening.subtractFrom(host)`.
|
|
139
|
-
*/
|
|
140
|
-
export declare function booleanSubtraction(lhs: BooleanOperand, rhs: BooleanOperand, options?: BooleanExecutionOptions): BooleanResult;
|
|
141
|
-
/**
|
|
142
|
-
* Computes a kernel-backed repeated subtraction using a left-to-right cutter array.
|
|
143
|
-
*
|
|
144
|
-
* This is used by the shape-level `.subtract([...])` helpers so the heavy
|
|
145
|
-
* boolean orchestration stays in the Rust/WASM layer instead of JavaScript.
|
|
146
|
-
*/
|
|
147
|
-
export declare function executeBooleanSubtractionMany(lhs: BooleanOperand, cutters: BooleanOperand[], options?: BooleanExecutionOptions): BooleanResult;
|
|
148
|
-
export {};
|
|
12
|
+
export type BooleanOperand = AnalyticSolid;
|
|
13
|
+
export declare function booleanUnion(lhs: AnalyticSolid, rhs: AnalyticSolid, options?: BooleanExecutionOptions): AnalyticSolid;
|
|
14
|
+
export declare function booleanIntersection(lhs: AnalyticSolid, rhs: AnalyticSolid, options?: BooleanExecutionOptions): AnalyticSolid;
|
|
15
|
+
export declare function booleanSubtraction(lhs: AnalyticSolid, rhs: AnalyticSolid, options?: BooleanExecutionOptions): AnalyticSolid;
|
|
16
|
+
export declare function executeBooleanSubtractionMany(lhs: BooleanOperand, cutters: BooleanOperand[], options?: BooleanExecutionOptions): AnalyticSolid;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Kernel-backed boolean helpers and renderable result mesh.
|
|
3
3
|
*/
|
|
4
4
|
export * from "./boolean.js";
|
|
5
|
-
export * from "./boolean-
|
|
5
|
+
export * from "./boolean-regions.js";
|
|
6
|
+
export * from "./analytic-errors.js";
|
|
6
7
|
export * from "./extrude.js";
|
|
8
|
+
export * from "./loft.js";
|
|
7
9
|
export * from "./offset-regions.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { AnalyticSolid, type AnalyticPolygonLoftAlignment } from "../shapes/analytic-solid.js";
|
|
3
|
+
export type PolygonLoftPoint = readonly [number, number, number];
|
|
4
|
+
export interface PolygonLoftOptions {
|
|
5
|
+
alignment?: AnalyticPolygonLoftAlignment;
|
|
6
|
+
deflection?: number;
|
|
7
|
+
color?: THREE.ColorRepresentation;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates a capped ruled solid between two planar polygon sections.
|
|
11
|
+
* Sections must have equal vertex counts and produce planar side faces.
|
|
12
|
+
*/
|
|
13
|
+
export declare function loftPolygonSections(sections: readonly [readonly PolygonLoftPoint[], readonly PolygonLoftPoint[]], options?: PolygonLoftOptions): AnalyticSolid;
|
|
@@ -17,7 +17,7 @@ export interface OffsetRegion {
|
|
|
17
17
|
* trims, and nonzero-winding resolution of reflex / closed loops. NO boolean union
|
|
18
18
|
* (so it is deterministic, unlike the 3D-mesh CSG path). A simple centreline returns
|
|
19
19
|
* one region; a self-crossing closed centreline (e.g. a figure-8) returns one per
|
|
20
|
-
* simple sub-loop. Returns an EMPTY array for a
|
|
20
|
+
* simple sub-loop. Returns an EMPTY array for a collapsed input (does
|
|
21
21
|
* not throw, so it never looks like a kernel crash). Rings are CW-outer / CCW-holes.
|
|
22
22
|
*
|
|
23
23
|
* @param centrelineFlat centreline points as `[x,y,z, …]`.
|
|
@@ -25,9 +25,8 @@ export interface OffsetRegion {
|
|
|
25
25
|
* @param miterLimit SVG stroke-miterlimit; corners sharper than this bevel. Default 4.
|
|
26
26
|
*/
|
|
27
27
|
export declare function offsetPolylineRegions(centrelineFlat: number[] | Float64Array, width: number, closed: boolean, miterLimit?: number): OffsetRegion[];
|
|
28
|
-
/** An excluded interior ring of a variable inset
|
|
29
|
-
*
|
|
30
|
-
* distance per hole edge. The inset GROWS the hole by its distances. */
|
|
28
|
+
/** An excluded interior ring of a variable inset. Its closed ring has one
|
|
29
|
+
* clearance distance per edge; the inset grows the hole by those distances. */
|
|
31
30
|
export interface OffsetHole {
|
|
32
31
|
ring: number[] | Float64Array;
|
|
33
32
|
distances: number[] | Float64Array;
|
|
@@ -35,17 +34,17 @@ export interface OffsetHole {
|
|
|
35
34
|
/**
|
|
36
35
|
* Inset a CLOSED ring inward with one distance per edge (edge i =
|
|
37
36
|
* `ring[i] → ring[i+1]`; an explicit closing duplicate point is accepted and
|
|
38
|
-
* stripped, the distance count stays one per unique edge).
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
37
|
+
* stripped, the distance count stays one per unique edge). The result is a
|
|
38
|
+
* clearance-exact inset region: the ring's interior minus every point within
|
|
39
|
+
* `distances[i]` of edge i's segment. Distant boundary segments remain
|
|
40
|
+
* effective across notches; different distances produce circumscribed
|
|
41
|
+
* clearance arcs. There is no
|
|
43
42
|
* `miterLimit` parameter, deliberately: miters and bevels only approximate the
|
|
44
43
|
* clearance arc, and a bevel would claim points inside the required distance.
|
|
45
44
|
*
|
|
46
45
|
* `holes` are excluded interior rings, each grown outward by its own per-edge
|
|
47
46
|
* distances — the region keeps clear of a hole's edges exactly as it keeps
|
|
48
|
-
* clear of the
|
|
47
|
+
* clear of the outer boundary, so a hole can split the region or swallow it.
|
|
49
48
|
*
|
|
50
49
|
* Returns CW-outer / CCW-hole regions (canonical start vertex), possibly
|
|
51
50
|
* SEVERAL when a deep inset (or a hole) splits a waisted ring into disjoint
|
|
@@ -57,7 +56,7 @@ export interface OffsetHole {
|
|
|
57
56
|
*
|
|
58
57
|
* @param ring closed ring points as `[x,y,z, …]` (Y is carried through).
|
|
59
58
|
* @param distances inward inset distance per edge, metres, each >= 0
|
|
60
|
-
* (0
|
|
59
|
+
* (0 keeps that boundary edge in place).
|
|
61
60
|
* @param holes excluded interior rings with their own per-edge distances.
|
|
62
61
|
*/
|
|
63
62
|
export declare function offsetRingVariable(ring: number[] | Float64Array, distances: number[] | Float64Array, holes?: OffsetHole[]): OffsetRegion[];
|
|
@@ -71,7 +70,7 @@ export interface OffsetPolyline {
|
|
|
71
70
|
* Merge a GROUP of separate polylines (a crossing T / X / L overlap) into one clean
|
|
72
71
|
* region by nonzero-winding union of their mitered bands — the overlapping strokes
|
|
73
72
|
* merge into a single region with mitered/bevelled corners, no internal edges.
|
|
74
|
-
* Returns CW-outer / CCW-hole regions (one or more); empty if
|
|
73
|
+
* Returns CW-outer / CCW-hole regions (one or more); empty if no region remains.
|
|
75
74
|
* No CSG. Used to render/extrude an overlapping crossing as one joined mass.
|
|
76
75
|
*/
|
|
77
76
|
export declare function offsetPolylineGroupRegions(polylines: OffsetPolyline[]): OffsetRegion[];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { OGAnalyticBrep } from "../../opengeometry/pkg/opengeometry.js";
|
|
3
|
+
import type { AnalyticAccuracy, AnalyticFrame } from "../shapes/analytic-solid.js";
|
|
4
|
+
export type AnalyticCurveOptions = {
|
|
5
|
+
ogid?: string;
|
|
6
|
+
frame?: AnalyticFrame;
|
|
7
|
+
accuracy?: AnalyticAccuracy;
|
|
8
|
+
startAngle: number;
|
|
9
|
+
sweepAngle: number;
|
|
10
|
+
deflection?: number;
|
|
11
|
+
color?: THREE.ColorRepresentation;
|
|
12
|
+
} & ({
|
|
13
|
+
kind: "arc";
|
|
14
|
+
radius: number;
|
|
15
|
+
} | {
|
|
16
|
+
kind: "ellipticalArc";
|
|
17
|
+
majorRadius: number;
|
|
18
|
+
minorRadius: number;
|
|
19
|
+
});
|
|
20
|
+
export interface AnalyticCurveStats {
|
|
21
|
+
requestedDeflection: number;
|
|
22
|
+
achievedDeflection: number;
|
|
23
|
+
segmentCount: number;
|
|
24
|
+
revision: bigint;
|
|
25
|
+
}
|
|
26
|
+
export declare class AnalyticCurve extends THREE.Group {
|
|
27
|
+
readonly ogid: string;
|
|
28
|
+
readonly line: THREE.LineSegments<THREE.BufferGeometry, THREE.LineBasicMaterial>;
|
|
29
|
+
protected kernel: OGAnalyticBrep;
|
|
30
|
+
private segmentEdges;
|
|
31
|
+
private disposed;
|
|
32
|
+
get color(): THREE.Color;
|
|
33
|
+
set color(value: THREE.ColorRepresentation);
|
|
34
|
+
constructor(options: AnalyticCurveOptions);
|
|
35
|
+
getBrepSerialized(): string;
|
|
36
|
+
getBrepData(): Record<string, unknown>;
|
|
37
|
+
protected replaceDefinition(options: AnalyticCurveOptions): AnalyticCurveStats;
|
|
38
|
+
edgeIdForSegment(segment: number): number | undefined;
|
|
39
|
+
retessellate(deflection: number): AnalyticCurveStats;
|
|
40
|
+
dispose(): void;
|
|
41
|
+
private checkActive;
|
|
42
|
+
}
|
package/src/primitives/arc.d.ts
CHANGED
|
@@ -1,65 +1,36 @@
|
|
|
1
|
-
import { Vector3 } from "../../opengeometry/pkg/opengeometry.js";
|
|
2
1
|
import * as THREE from "three";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { Vector3 } from "../../opengeometry/pkg/opengeometry.js";
|
|
3
|
+
import { AnalyticCurve, type AnalyticCurveStats } from "./analytic-curve.js";
|
|
4
|
+
import type { AnalyticAccuracy } from "../shapes/analytic-solid.js";
|
|
6
5
|
export interface IArcOptions {
|
|
6
|
+
ogid?: string;
|
|
7
|
+
center?: Vector3;
|
|
8
|
+
radius?: number;
|
|
9
|
+
startAngle?: number;
|
|
10
|
+
sweepAngle?: number;
|
|
11
|
+
deflection?: number;
|
|
12
|
+
accuracy?: AnalyticAccuracy;
|
|
13
|
+
color?: THREE.ColorRepresentation;
|
|
14
|
+
}
|
|
15
|
+
export type ArcConfigUpdate = Partial<Omit<IArcOptions, "ogid">>;
|
|
16
|
+
interface NormalizedArcOptions {
|
|
7
17
|
ogid?: string;
|
|
8
18
|
center: Vector3;
|
|
9
19
|
radius: number;
|
|
10
20
|
startAngle: number;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
width?: number;
|
|
16
|
-
translation?: Vector3;
|
|
17
|
-
rotation?: Vector3;
|
|
18
|
-
scale?: Vector3;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Placement updates accepted by `Arc`.
|
|
22
|
-
*/
|
|
23
|
-
export interface ArcPlacementOptions {
|
|
24
|
-
translation?: Vector3;
|
|
25
|
-
rotation?: Vector3;
|
|
26
|
-
scale?: Vector3;
|
|
21
|
+
sweepAngle: number;
|
|
22
|
+
deflection: number;
|
|
23
|
+
accuracy?: AnalyticAccuracy;
|
|
24
|
+
color: THREE.ColorRepresentation;
|
|
27
25
|
}
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export type ArcConfigUpdate = Partial<Omit<IArcOptions, "translation" | "rotation" | "scale">>;
|
|
32
|
-
/**
|
|
33
|
-
* Alias for `Arc` placement updates.
|
|
34
|
-
*/
|
|
35
|
-
export type ArcPlacementUpdate = ArcPlacementOptions;
|
|
36
|
-
/**
|
|
37
|
-
* Arc wrapper backed by the kernel OGArc primitive.
|
|
38
|
-
*/
|
|
39
|
-
export declare class Arc extends THREE.Line {
|
|
40
|
-
ogid: string;
|
|
41
|
-
options: IArcOptions;
|
|
42
|
-
private arc;
|
|
43
|
-
private fatLine;
|
|
44
|
-
set color(color: number);
|
|
26
|
+
/** Authoritative circular edge with transient deflection tessellation. */
|
|
27
|
+
export declare class Arc extends AnalyticCurve {
|
|
28
|
+
options: Readonly<NormalizedArcOptions>;
|
|
45
29
|
constructor(options?: IArcOptions);
|
|
46
|
-
validateOptions(): void;
|
|
47
|
-
setConfig(options: ArcConfigUpdate): void;
|
|
48
30
|
getAnchor(): Vector3;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
setScale(scale: Vector3): void;
|
|
54
|
-
getConfig(): IArcOptions;
|
|
55
|
-
getPlacement(): import("../editor.js").ParametricPlacement;
|
|
56
|
-
getEditCapabilities(): import("../editor.js").ParametricEditCapabilities;
|
|
57
|
-
canConvertToFreeform(): boolean;
|
|
58
|
-
toFreeform(id?: string): import("../freeform.js").FreeformGeometry;
|
|
59
|
-
private getCurrentPositions;
|
|
60
|
-
private updateRenderStyle;
|
|
61
|
-
private generateGeometry;
|
|
62
|
-
getBrep(): any;
|
|
63
|
-
discardGeometry(): void;
|
|
64
|
-
private writePositionsToGeometry;
|
|
31
|
+
getConfig(): Readonly<NormalizedArcOptions>;
|
|
32
|
+
setConfig(update: ArcConfigUpdate): AnalyticCurveStats;
|
|
33
|
+
getBrep(): Record<string, unknown>;
|
|
34
|
+
retessellate(deflection: number): AnalyticCurveStats;
|
|
65
35
|
}
|
|
36
|
+
export {};
|