opengeometry 2.0.11 → 2.0.14

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 (44) hide show
  1. package/analytic-worker.js +90 -0
  2. package/index.d.ts +16 -1
  3. package/index.js +3222 -3057
  4. package/index.js.map +1 -1
  5. package/opengeometry/pkg/opengeometry.d.ts +362 -224
  6. package/opengeometry/pkg/opengeometry.js +982 -298
  7. package/opengeometry/pkg/opengeometry_bg.wasm +0 -0
  8. package/opengeometry/pkg/opengeometry_bg.wasm.d.ts +251 -198
  9. package/opengeometry_bg.wasm +0 -0
  10. package/opengeometry_bg.wasm.d.ts +251 -198
  11. package/package.json +2 -1
  12. package/src/editor/types.d.ts +1 -1
  13. package/src/examples/booleans.d.ts +3 -2
  14. package/src/examples/editor-modes.d.ts +4 -8
  15. package/src/examples/index.d.ts +1 -0
  16. package/src/examples/offset-ring-variable.d.ts +13 -0
  17. package/src/examples/shapes.d.ts +1 -1
  18. package/src/examples/wall-from-offsets.d.ts +7 -14
  19. package/src/export/analytic-ifc.d.ts +61 -0
  20. package/src/freeform/geometry.d.ts +2 -0
  21. package/src/freeform/index.d.ts +1 -1
  22. package/src/operations/analytic-errors.d.ts +8 -0
  23. package/src/operations/boolean.d.ts +9 -141
  24. package/src/operations/index.d.ts +2 -4
  25. package/src/operations/loft.d.ts +13 -0
  26. package/src/operations/offset-regions.d.ts +36 -0
  27. package/src/primitives/analytic-curve.d.ts +42 -0
  28. package/src/primitives/arc.d.ts +26 -55
  29. package/src/primitives/elliptical_arc.d.ts +38 -0
  30. package/src/primitives/index.d.ts +1 -0
  31. package/src/rendering/analytic-lod.d.ts +32 -0
  32. package/src/rendering/analytic-tessellation.d.ts +32 -0
  33. package/src/shapes/analytic-pattern.d.ts +36 -0
  34. package/src/shapes/analytic-solid.d.ts +288 -0
  35. package/src/shapes/cuboid.d.ts +40 -54
  36. package/src/shapes/cylinder.d.ts +26 -70
  37. package/src/shapes/opening.d.ts +19 -82
  38. package/src/shapes/polygon.d.ts +4 -5
  39. package/src/shapes/solid.d.ts +0 -8
  40. package/src/shapes/sphere.d.ts +18 -73
  41. package/src/shapes/sweep.d.ts +0 -5
  42. package/src/shapes/wedge.d.ts +0 -5
  43. package/src/toolkit/index.d.ts +0 -4
  44. package/src/toolkit/wall.d.ts +0 -40
@@ -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.
@@ -1,26 +1,19 @@
1
1
  import * as THREE from "three";
2
- import { Cuboid } from "../shapes/cuboid.js";
3
2
  import { Polyline } from "../primitives/polyline.js";
3
+ import { AnalyticSolid } from "../shapes/analytic-solid.js";
4
4
  import { Polygon } from "../shapes/polygon.js";
5
5
  export interface WallFromOffsetsOptions {
6
- /**
7
- * Number of doors to subtract from the extruded wall. Doors are placed at
8
- * evenly distributed centerline-segment midpoints. Default `0` (no cuts).
9
- */
10
- doorCount?: number;
11
- /**
12
- * Cutter overshoot in millimeters. The debt sheet's `#6a` symptom is at
13
- * 1mm; default 1mm so callers exercise the snap-tolerance regime by default
14
- * when cuts are enabled.
15
- */
16
- overshootMm?: number;
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;
17
10
  /**
18
11
  * Wall extrusion height in meters. Default `2.6` to match the example HTML.
19
12
  */
20
13
  height?: number;
21
14
  }
22
15
  /**
23
- * Renders a human-readable description for a typed `BooleanError` (or any
16
+ * Renders a human-readable description for an analytic geometry error (or any
24
17
  * other thrown value). Used by the example HTML to surface kernel failures
25
18
  * in a status panel without losing the structured payload.
26
19
  */
@@ -34,7 +27,7 @@ export declare function createWallFromOffsetsExample(scene: THREE.Scene, options
34
27
  rightOffset: import("../primitives/polyline.js").IOffsetResult;
35
28
  cutResult: {
36
29
  wall: THREE.Object3D;
37
- cutters: Cuboid[];
30
+ cutters: AnalyticSolid[];
38
31
  } | null;
39
32
  cutError: unknown;
40
33
  };
@@ -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;
@@ -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;
@@ -1,148 +1,16 @@
1
1
  import * as THREE from "three";
2
- import { type CreateFreeformGeometryOptions, type FreeformGeometry } from "../freeform.js";
3
- /**
4
- * Accepted operand formats for boolean helpers.
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
- * Computes a kernel-backed boolean union and returns a renderable result mesh.
125
- *
126
- * Accepts wrapper objects directly, including `Solid`, `Cuboid`, `Opening`,
127
- * and other shapes that expose BRep accessors.
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,9 +2,7 @@
2
2
  * Kernel-backed boolean helpers and renderable result mesh.
3
3
  */
4
4
  export * from "./boolean.js";
5
- export * from "./boolean-errors.js";
5
+ export * from "./analytic-errors.js";
6
6
  export * from "./extrude.js";
7
- /**
8
- * Analytic polyline offset → filled regions (single + group).
9
- */
7
+ export * from "./loft.js";
10
8
  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;
@@ -25,6 +25,42 @@ 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 (an easement island, a
29
+ * protected tree pit): its closed ring `[x,y,z, …]` plus one clearance
30
+ * distance per hole edge. The inset GROWS the hole by its distances. */
31
+ export interface OffsetHole {
32
+ ring: number[] | Float64Array;
33
+ distances: number[] | Float64Array;
34
+ }
35
+ /**
36
+ * Inset a CLOSED ring inward with one distance per edge (edge i =
37
+ * `ring[i] → ring[i+1]`; an explicit closing duplicate point is accepted and
38
+ * stripped, the distance count stays one per unique edge). Built for setback
39
+ * envelopes: the result is the CLEARANCE-EXACT buildable region — the ring's
40
+ * interior minus every point within `distances[i]` of edge i's SEGMENT, so
41
+ * distant lot lines are honoured across notches and corners where distances
42
+ * differ become circumscribed clearance arcs (conservative). There is no
43
+ * `miterLimit` parameter, deliberately: miters and bevels only approximate the
44
+ * clearance arc, and a bevel would claim points inside the required distance.
45
+ *
46
+ * `holes` are excluded interior rings, each grown outward by its own per-edge
47
+ * distances — the region keeps clear of a hole's edges exactly as it keeps
48
+ * clear of the lot lines, so a hole can split the region or swallow it.
49
+ *
50
+ * Returns CW-outer / CCW-hole regions (canonical start vertex), possibly
51
+ * SEVERAL when a deep inset (or a hole) splits a waisted ring into disjoint
52
+ * lobes, and an EMPTY array when the inset collapses or the outer ring is
53
+ * degenerate (< 3 unique points, zero area, self-intersecting). THROWS on
54
+ * malformed arguments: a distance count that does not match an edge count, a
55
+ * negative / non-finite distance, or a degenerate hole — those are caller
56
+ * bugs, not geometry.
57
+ *
58
+ * @param ring closed ring points as `[x,y,z, …]` (Y is carried through).
59
+ * @param distances inward inset distance per edge, metres, each >= 0
60
+ * (0 = the edge stays in place, e.g. lot-line construction).
61
+ * @param holes excluded interior rings with their own per-edge distances.
62
+ */
63
+ export declare function offsetRingVariable(ring: number[] | Float64Array, distances: number[] | Float64Array, holes?: OffsetHole[]): OffsetRegion[];
28
64
  /** One polyline in an offset group: centreline `[x,y,z, …]`, stroke width, closed flag. */
29
65
  export interface OffsetPolyline {
30
66
  centreline: number[];
@@ -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
+ }
@@ -1,65 +1,36 @@
1
- import { Vector3 } from "../../opengeometry/pkg/opengeometry.js";
2
1
  import * as THREE from "three";
3
- /**
4
- * Construction options for an arc or full-circle primitive.
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
- endAngle: number;
12
- segments: number;
13
- color: number;
14
- fatLines?: boolean;
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
- * Partial config payload accepted by `Arc.setConfig(...)`.
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
- setPlacement(placement: ArcPlacementUpdate): void;
50
- setTransform(translation: Vector3, rotation: Vector3, scale: Vector3): void;
51
- setTranslation(translation: Vector3): void;
52
- setRotation(rotation: Vector3): void;
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 {};
@@ -0,0 +1,38 @@
1
+ import * as THREE from "three";
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";
5
+ export interface IEllipticalArcOptions {
6
+ ogid?: string;
7
+ center?: Vector3;
8
+ majorRadius?: number;
9
+ minorRadius?: number;
10
+ startAngle?: number;
11
+ sweepAngle?: number;
12
+ deflection?: number;
13
+ accuracy?: AnalyticAccuracy;
14
+ color?: THREE.ColorRepresentation;
15
+ }
16
+ export type EllipticalArcConfigUpdate = Partial<Omit<IEllipticalArcOptions, "ogid">>;
17
+ interface NormalizedEllipticalArcOptions {
18
+ ogid?: string;
19
+ center: Vector3;
20
+ majorRadius: number;
21
+ minorRadius: number;
22
+ startAngle: number;
23
+ sweepAngle: number;
24
+ deflection: number;
25
+ accuracy?: AnalyticAccuracy;
26
+ color: THREE.ColorRepresentation;
27
+ }
28
+ /** Authoritative elliptical edge with transient deflection tessellation. */
29
+ export declare class EllipticalArc extends AnalyticCurve {
30
+ options: Readonly<NormalizedEllipticalArcOptions>;
31
+ constructor(options?: IEllipticalArcOptions);
32
+ getAnchor(): Vector3;
33
+ getConfig(): Readonly<NormalizedEllipticalArcOptions>;
34
+ setConfig(update: EllipticalArcConfigUpdate): AnalyticCurveStats;
35
+ getBrep(): Record<string, unknown>;
36
+ retessellate(deflection: number): AnalyticCurveStats;
37
+ }
38
+ export {};
@@ -6,3 +6,4 @@ export * from './polyline.js';
6
6
  export * from './arc.js';
7
7
  export * from './rectangle.js';
8
8
  export * from './curve.js';
9
+ export * from "./elliptical_arc.js";
@@ -0,0 +1,32 @@
1
+ import * as THREE from "three";
2
+ import type { AnalyticSolid, AnalyticTessellationStats } from "../shapes/analytic-solid.js";
3
+ import { AnalyticTessellationWorker } from "./analytic-tessellation.js";
4
+ export declare function deflectionBucket(target: number, previous?: number): number;
5
+ export declare function worldUnitsPerPixel(camera: THREE.PerspectiveCamera | THREE.OrthographicCamera, depth: number, physicalHeight: number): number;
6
+ export interface AnalyticLodOptions {
7
+ fixedDeflection?: number;
8
+ onUpdate?: (solid: AnalyticSolid, statistics: AnalyticTessellationStats) => void;
9
+ onError?: (solid: AnalyticSolid, error: Error) => void;
10
+ }
11
+ /** Register authored changes explicitly; camera meshes never refresh a scene's authored BRep snapshots. */
12
+ export declare class AnalyticLodController {
13
+ private readonly worker;
14
+ private readonly options;
15
+ private readonly entries;
16
+ private readonly cameraState;
17
+ private lastMotion;
18
+ private lastSchedule;
19
+ private initialized;
20
+ private closed;
21
+ private refining;
22
+ private fixedDeflection?;
23
+ constructor(worker: AnalyticTessellationWorker, options?: AnalyticLodOptions);
24
+ setDeflection(deflection?: number): void;
25
+ register(solid: AnalyticSolid): Promise<void>;
26
+ unregister(solid: AnalyticSolid): Promise<void>;
27
+ update(camera: THREE.PerspectiveCamera | THREE.OrthographicCamera, physicalHeight: number, now?: number, motion?: boolean): void;
28
+ /** Explicit export refinement; a resource or precision failure rejects and retains each body's prior mesh. */
29
+ refine(deflection: number): Promise<void>;
30
+ dispose(): void;
31
+ }
32
+ export declare function uniformScale(matrix: THREE.Matrix4): number;
@@ -0,0 +1,32 @@
1
+ export interface AnalyticTessellationData {
2
+ positions: Float64Array;
3
+ normals: Float32Array;
4
+ indices: Uint32Array;
5
+ triangleFaceIds: Uint32Array;
6
+ outlinePositions: Float64Array;
7
+ outlineEdgeIds: Uint32Array;
8
+ revision: bigint;
9
+ achievedDeflection: number;
10
+ }
11
+ export declare const GEOMETRY_DEFLECTION_SHARE = 0.75;
12
+ export interface AnalyticWorkerOptions {
13
+ workerURL: string | URL;
14
+ kernelURL: string | URL;
15
+ wasmURL: string | URL;
16
+ }
17
+ export declare class AnalyticTessellationWorker {
18
+ private readonly worker;
19
+ private readonly pending;
20
+ private readonly generations;
21
+ private readonly ready;
22
+ private serial;
23
+ private closed;
24
+ constructor(options: AnalyticWorkerOptions);
25
+ setModel(handle: string, serialized: string): Promise<void>;
26
+ tessellate(handle: string, deflection: number): Promise<AnalyticTessellationData>;
27
+ cancel(handle: string): number;
28
+ removeModel(handle: string): Promise<void>;
29
+ dispose(): void;
30
+ private send;
31
+ private fail;
32
+ }
@@ -0,0 +1,36 @@
1
+ import * as THREE from "three";
2
+ import { AnalyticSolid } from "./analytic-solid.js";
3
+ export interface AnalyticPatternInstance {
4
+ id?: string;
5
+ matrix: THREE.Matrix4;
6
+ }
7
+ export interface AnalyticPatternHit {
8
+ pattern: AnalyticPattern;
9
+ instanceIndex: number;
10
+ instanceId: string;
11
+ source: AnalyticSolid;
12
+ faceId?: number;
13
+ }
14
+ /**
15
+ * Renders many rigid placements of one authoritative analytic body. The source
16
+ * owns the BRep; instances own only identity and placement matrices.
17
+ */
18
+ export declare class AnalyticPattern extends THREE.Group {
19
+ readonly source: AnalyticSolid;
20
+ readonly surface: THREE.InstancedMesh<THREE.BufferGeometry, THREE.Material>;
21
+ readonly instanceIds: readonly string[];
22
+ private disposed;
23
+ constructor(source: AnalyticSolid, instances: readonly AnalyticPatternInstance[]);
24
+ get count(): number;
25
+ setInstanceMatrix(index: number, matrix: THREE.Matrix4): void;
26
+ resolveIntersection(intersection: THREE.Intersection): AnalyticPatternHit | undefined;
27
+ dispose(): void;
28
+ private checkActive;
29
+ }
30
+ export declare function linearPattern(source: AnalyticSolid, count: number, spacing: THREE.Vector3): AnalyticPattern;
31
+ export declare function rectangularPattern(source: AnalyticSolid, counts: readonly [number, number], spacing: readonly [THREE.Vector3, THREE.Vector3]): AnalyticPattern;
32
+ export declare function circularPattern(source: AnalyticSolid, count: number, radius: number, options?: {
33
+ startAngle?: number;
34
+ sweepAngle?: number;
35
+ rotateInstances?: boolean;
36
+ }): AnalyticPattern;