@metamesh/modeling 0.0.0-stage → 0.7.0
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/CHANGELOG.md +111 -0
- package/LICENSE +200 -0
- package/README.md +376 -2
- package/THIRD_PARTY_NOTICES.md +153 -0
- package/dist/api/engine.d.ts +71 -0
- package/dist/api/geometry.d.ts +3136 -0
- package/dist/api/index.d.ts +2087 -0
- package/dist/api/text.d.ts +93 -0
- package/dist/engine/construction-operations.js +189 -0
- package/dist/engine/execution.js +227 -0
- package/dist/engine/export-3mf.js +100 -0
- package/dist/engine/extrusion-finishing.js +82 -0
- package/dist/engine/finalization.js +214 -0
- package/dist/engine/index.js +83 -0
- package/dist/engine/inspection-operations.js +52 -0
- package/dist/engine/kernel/LICENSE +201 -0
- package/dist/engine/kernel/manifold.js +2 -0
- package/dist/engine/kernel/manifold.wasm +0 -0
- package/dist/engine/loft-operations.js +156 -0
- package/dist/engine/mechanical-operations.js +51 -0
- package/dist/engine/modeling-context.js +38 -0
- package/dist/engine/native/adapter.js +20 -0
- package/dist/engine/native/context.js +209 -0
- package/dist/engine/native/copied-views.js +46 -0
- package/dist/engine/native/index.js +13 -0
- package/dist/engine/native/operations.js +115 -0
- package/dist/engine/native/ownership.js +98 -0
- package/dist/engine/native/regions.js +138 -0
- package/dist/engine/native/scoped-primitives.js +127 -0
- package/dist/engine/native/scoped-threads.js +34 -0
- package/dist/engine/native/threads.js +52 -0
- package/dist/engine/native/transforms.js +111 -0
- package/dist/engine/operation-environment.js +20 -0
- package/dist/engine/pattern-operations.js +36 -0
- package/dist/engine/pattern-placements.js +176 -0
- package/dist/engine/primitive-anchors.js +70 -0
- package/dist/engine/primitive-correspondence.js +74 -0
- package/dist/engine/primitive-operations.js +151 -0
- package/dist/engine/primitive-profile-types.js +1 -0
- package/dist/engine/primitive-profiles.js +250 -0
- package/dist/engine/profile-mesh.js +279 -0
- package/dist/engine/section-operations.js +93 -0
- package/dist/engine/shape-anchors.js +88 -0
- package/dist/engine/transform-operations.js +225 -0
- package/dist/engine/types.js +1 -0
- package/dist/geometry/anchors.js +226 -0
- package/dist/geometry/curves/evaluation.js +162 -0
- package/dist/geometry/curves/sampling.js +266 -0
- package/dist/geometry/curves/types.js +1 -0
- package/dist/geometry/cylinder.js +117 -0
- package/dist/geometry/edge-finishing.js +160 -0
- package/dist/geometry/errors.js +76 -0
- package/dist/geometry/extrusion.js +150 -0
- package/dist/geometry/heightfield.js +115 -0
- package/dist/geometry/index.js +42 -0
- package/dist/geometry/loft-correspondence.js +204 -0
- package/dist/geometry/loft-geometry.js +184 -0
- package/dist/geometry/loft-options.js +56 -0
- package/dist/geometry/loft-simple-mesh.js +92 -0
- package/dist/geometry/loft-triangulation.js +64 -0
- package/dist/geometry/loft.js +95 -0
- package/dist/geometry/math/vector3.js +71 -0
- package/dist/geometry/mechanical/gear-motion.js +94 -0
- package/dist/geometry/mechanical/gears.js +484 -0
- package/dist/geometry/mechanical/index.js +13 -0
- package/dist/geometry/mechanical/standards.js +67 -0
- package/dist/geometry/mechanical/thread-helices.js +44 -0
- package/dist/geometry/mechanical/thread-mesh-plan.js +358 -0
- package/dist/geometry/mechanical/thread-mesh.js +142 -0
- package/dist/geometry/mechanical/thread-profiles.js +373 -0
- package/dist/geometry/mechanical/thread-solids.js +230 -0
- package/dist/geometry/mechanical/thread-surface.js +433 -0
- package/dist/geometry/mechanical/threads.js +138 -0
- package/dist/geometry/mesh-edge-table.js +126 -0
- package/dist/geometry/mesh-planar.js +408 -0
- package/dist/geometry/mesh-quality.js +396 -0
- package/dist/geometry/mesh-signature.js +137 -0
- package/dist/geometry/mesh.js +283 -0
- package/dist/geometry/model-limits.js +50 -0
- package/dist/geometry/numeric.js +11 -0
- package/dist/geometry/paths/frames.js +118 -0
- package/dist/geometry/paths/helix.js +49 -0
- package/dist/geometry/paths/path.js +32 -0
- package/dist/geometry/paths/planar.js +135 -0
- package/dist/geometry/paths/resampling.js +125 -0
- package/dist/geometry/polygon-clipping.js +52 -0
- package/dist/geometry/primitive-options.js +1 -0
- package/dist/geometry/primitive-resolution.js +17 -0
- package/dist/geometry/primitive-resolvers.js +235 -0
- package/dist/geometry/profiles/matched.js +192 -0
- package/dist/geometry/profiles/open-profile.js +137 -0
- package/dist/geometry/profiles/profiles.js +91 -0
- package/dist/geometry/profiles/rectangle.js +249 -0
- package/dist/geometry/profiles/shapes.js +41 -0
- package/dist/geometry/profiles/span-sampling.js +28 -0
- package/dist/geometry/profiles/types.js +1 -0
- package/dist/geometry/profiles/validation.js +20 -0
- package/dist/geometry/regions.js +371 -0
- package/dist/geometry/resolution.js +236 -0
- package/dist/geometry/revolve/revolve-mesh.js +129 -0
- package/dist/geometry/sampling-limits.js +29 -0
- package/dist/geometry/stroke-path.js +181 -0
- package/dist/geometry/svg/errors.js +23 -0
- package/dist/geometry/svg/fill.js +172 -0
- package/dist/geometry/svg/index.js +1 -0
- package/dist/geometry/svg/matrix.js +130 -0
- package/dist/geometry/svg/parser.js +536 -0
- package/dist/geometry/svg/path.js +349 -0
- package/dist/geometry/svg/types.js +1 -0
- package/dist/geometry/svg-import.js +662 -0
- package/dist/geometry/sweeps/options.js +28 -0
- package/dist/geometry/sweeps/orientation.js +106 -0
- package/dist/geometry/sweeps/stations.js +161 -0
- package/dist/geometry/sweeps/sweep-closed.js +96 -0
- package/dist/geometry/sweeps/sweep-mesh.js +30 -0
- package/dist/geometry/sweeps/sweep-open.js +76 -0
- package/dist/geometry/sweeps/validation.js +116 -0
- package/dist/geometry/text-contours.js +32 -0
- package/dist/geometry/text-layout.js +1 -0
- package/dist/geometry/tolerance.js +53 -0
- package/dist/geometry/transform-geometry.js +41 -0
- package/dist/geometry/transform3.js +340 -0
- package/dist/geometry/types.js +1 -0
- package/dist/index.js +1 -0
- package/dist/model/execution-binding.js +30 -0
- package/dist/model/operations.js +154 -0
- package/dist/model/options.js +1 -0
- package/dist/model/types.js +1 -0
- package/dist/text/index.js +58 -0
- package/dist/text/vector-text-layout.js +279 -0
- package/package.json +100 -3
|
@@ -0,0 +1,3136 @@
|
|
|
1
|
+
/** Pure geometry foundations without host initialization. @packageDocumentation */
|
|
2
|
+
|
|
3
|
+
/** ACME 29-degree included-angle profile. */
|
|
4
|
+
export declare interface AcmeThreadProfileSpec extends ThreadProfileBaseSpec {
|
|
5
|
+
/** Selects the 29-degree ACME profile family. */
|
|
6
|
+
readonly kind: "acme";
|
|
7
|
+
/**
|
|
8
|
+
* Radial depth in millimetres.
|
|
9
|
+
* @defaultValue `pitch / 2`
|
|
10
|
+
*/
|
|
11
|
+
readonly depth?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Adds two finite XYZ vectors component-wise.
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* add3([1, 2, 3], [4, 5, 6]); // [5, 7, 9]
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const add3: (a: Vec3, b: Vec3) => Vec3;
|
|
22
|
+
|
|
23
|
+
/** Controls full-circle sampling that must satisfy one or more topology alignments. */
|
|
24
|
+
export declare interface AlignedCircularSegmentsOptions {
|
|
25
|
+
/**
|
|
26
|
+
* Non-empty alignment factors. Every value must be a positive safe integer; the returned count
|
|
27
|
+
* is divisible by their checked least common multiple.
|
|
28
|
+
*/
|
|
29
|
+
readonly alignTo: readonly number[];
|
|
30
|
+
/** Explicit sampling allocation ceilings. */
|
|
31
|
+
readonly limits?: Partial<GeometrySamplingLimits>;
|
|
32
|
+
/**
|
|
33
|
+
* Additional full-circle segment floor, as a safe integer of at least three.
|
|
34
|
+
* @defaultValue `3`
|
|
35
|
+
*/
|
|
36
|
+
readonly minimumSegments?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Exact full-circle segment count.
|
|
39
|
+
*
|
|
40
|
+
* This takes precedence over `resolution.circularSegments` and adaptive sampling, and must
|
|
41
|
+
* already satisfy every alignment factor and `minimumSegments`.
|
|
42
|
+
*/
|
|
43
|
+
readonly segments?: number;
|
|
44
|
+
/** Operation-level physical tessellation policy over the active model-wide policy. */
|
|
45
|
+
readonly resolution?: GeometryResolution;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Validates and measures a mesh in one position and one triangle traversal.
|
|
50
|
+
*
|
|
51
|
+
* Bounds, area in square model units and signed volume in cubic model units are computed without
|
|
52
|
+
* copying or changing the input buffers. Volume is meaningful for consistently wound closed
|
|
53
|
+
* geometry; `requireClosed` checks oriented edge closure. Optional indexed topology counts require
|
|
54
|
+
* every position vertex to be referenced and do not establish freedom from self-intersections.
|
|
55
|
+
* Results and nested bounds are immutable snapshots. Caller-owned mutable meshes are freshly
|
|
56
|
+
* inspected on every call, never cached.
|
|
57
|
+
*/
|
|
58
|
+
export declare function analyzeTriangleMesh(mesh: TriangleMesh, options?: TriangleMeshAnalysisOptions): TriangleMeshAnalysis;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Measures triangle shape, edge topology, vertex concentration, and connected planar patches.
|
|
62
|
+
*
|
|
63
|
+
* Positions are never welded: valence and manifold status describe the supplied indexed topology.
|
|
64
|
+
* Degenerate triangles are reported rather than rejected, while malformed buffers, non-finite
|
|
65
|
+
* positions, missing vertex references, and the configured complexity limit throw.
|
|
66
|
+
*
|
|
67
|
+
* @param mesh - Indexed triangle mesh in arbitrary consistent model units.
|
|
68
|
+
* @param options - Scale-aware tolerance and analysis budget.
|
|
69
|
+
* @returns A deterministic report without mutating or copying the mesh.
|
|
70
|
+
*/
|
|
71
|
+
export declare function analyzeTriangleMeshQuality(mesh: TriangleMesh, options?: TriangleMeshQualityOptions): TriangleMeshQualityReport;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* An attachment pose on a solid or assembly.
|
|
75
|
+
*
|
|
76
|
+
* `direction` is the outward attachment normal. `up` controls roll and must not
|
|
77
|
+
* be parallel to `direction`; anchor construction projects and normalizes it.
|
|
78
|
+
*/
|
|
79
|
+
export declare interface Anchor3 {
|
|
80
|
+
/** Unit outward normal used as the anchor's local +Z direction. */
|
|
81
|
+
readonly direction: Vec3;
|
|
82
|
+
/** World-space attachment position. */
|
|
83
|
+
readonly position: Vec3;
|
|
84
|
+
/** Roll guide projected into the plane perpendicular to `direction`. */
|
|
85
|
+
readonly up: Vec3;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Converts an anchor into a right-handed frame with direction as local +Z.
|
|
90
|
+
*
|
|
91
|
+
* @param anchor - Anchor created by {@link createAnchor3} or equivalent valid data.
|
|
92
|
+
* @param tolerance - Optional comparison overrides.
|
|
93
|
+
* @returns A normalized right-handed frame at the anchor position.
|
|
94
|
+
*/
|
|
95
|
+
export declare function anchorFrame3(anchor: Anchor3, tolerance?: GeometryToleranceOptions): Frame3;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Applies only the linear component of an affine transform to a direction.
|
|
99
|
+
*
|
|
100
|
+
* The result is not normalized, preserving scale information.
|
|
101
|
+
*
|
|
102
|
+
* @param transform - Valid row-major affine transform.
|
|
103
|
+
* @param direction - Finite XYZ direction.
|
|
104
|
+
* @returns A fresh transformed direction.
|
|
105
|
+
*/
|
|
106
|
+
export declare function applyTransformDirection3(transform: Transform3, direction: Vec3): Vec3;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Applies an affine transform to a point, including translation.
|
|
110
|
+
*
|
|
111
|
+
* @param transform - Valid row-major affine transform.
|
|
112
|
+
* @param point - Finite XYZ point.
|
|
113
|
+
* @returns A fresh transformed point.
|
|
114
|
+
*/
|
|
115
|
+
export declare function applyTransformPoint3(transform: Transform3, point: Vec3): Vec3;
|
|
116
|
+
|
|
117
|
+
/** Planar circular arc with counterclockwise degree angles. */
|
|
118
|
+
export declare interface ArcCurve2 {
|
|
119
|
+
/** Selects a circular arc in the XY plane. */
|
|
120
|
+
readonly kind: "arc";
|
|
121
|
+
/** Circle center in millimetres. */
|
|
122
|
+
readonly center: Vec2;
|
|
123
|
+
/** Positive circular radius in millimetres. */
|
|
124
|
+
readonly radius: number;
|
|
125
|
+
/** Initial angle in degrees; defaults to zero. */
|
|
126
|
+
readonly startDegrees?: number;
|
|
127
|
+
/** Nonzero signed sweep in degrees, bounded to one complete turn. */
|
|
128
|
+
readonly sweepDegrees: number;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Spatial circular arc in the plane of two orthogonal unit directions. */
|
|
132
|
+
export declare interface ArcCurve3 {
|
|
133
|
+
/** Selects a circular arc in the supplied plane. */
|
|
134
|
+
readonly kind: "arc";
|
|
135
|
+
/** Circle center in millimetres. */
|
|
136
|
+
readonly center: Vec3;
|
|
137
|
+
/** Positive circular radius in millimetres. */
|
|
138
|
+
readonly radius: number;
|
|
139
|
+
/** Orthogonal unit direction at zero degrees. */
|
|
140
|
+
readonly xAxis: Vec3;
|
|
141
|
+
/** Orthogonal unit direction at positive ninety degrees. */
|
|
142
|
+
readonly yAxis: Vec3;
|
|
143
|
+
/** Initial angle in degrees; defaults to zero. */
|
|
144
|
+
readonly startDegrees?: number;
|
|
145
|
+
/** Nonzero signed sweep in degrees, bounded to one complete turn. */
|
|
146
|
+
readonly sweepDegrees: number;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Builds the transform that moves a source anchor onto a target anchor.
|
|
151
|
+
*
|
|
152
|
+
* The default `opposed` alignment points the source outward normal against the
|
|
153
|
+
* target outward normal, producing face-to-face mating. A positive gap moves the
|
|
154
|
+
* attachment point along the target's outward direction. Spin is applied after
|
|
155
|
+
* alignment around the final source direction.
|
|
156
|
+
*
|
|
157
|
+
* @param source - Anchor expressed in the moving object's local coordinates.
|
|
158
|
+
* @param target - Desired anchor pose in destination coordinates.
|
|
159
|
+
* @param options - Alignment, gap, spin, and tolerance policy.
|
|
160
|
+
* @returns A frozen affine transform for the moving object.
|
|
161
|
+
* @throws {@link GeometryError} For invalid anchors or non-finite options.
|
|
162
|
+
*/
|
|
163
|
+
export declare function attachTransform(source: Anchor3, target: Anchor3, options?: AttachTransformOptions): Transform3;
|
|
164
|
+
|
|
165
|
+
/** Options controlling how one anchor is attached to another. */
|
|
166
|
+
export declare interface AttachTransformOptions {
|
|
167
|
+
/** Align outward directions face-to-face (`opposed`) or in parallel (`same`). */
|
|
168
|
+
readonly alignment?: "opposed" | "same";
|
|
169
|
+
/** Separation along the target anchor's outward direction in model units. */
|
|
170
|
+
readonly gap?: number;
|
|
171
|
+
/** Additional right-handed roll about the attached direction, in radians. */
|
|
172
|
+
readonly spinRadians?: number;
|
|
173
|
+
/** Optional numeric comparison overrides. */
|
|
174
|
+
readonly tolerance?: GeometryToleranceOptions;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* One explicitly unit-labelled right-handed axis-angle rotation.
|
|
179
|
+
*/
|
|
180
|
+
export declare type AxisAngleRotation3 = {
|
|
181
|
+
/** Finite right-handed angle in degrees. */
|
|
182
|
+
readonly degrees: number;
|
|
183
|
+
/** Excluded when the angle is expressed in degrees. */
|
|
184
|
+
readonly radians?: never;
|
|
185
|
+
} | {
|
|
186
|
+
/** Finite right-handed angle in radians. */
|
|
187
|
+
readonly radians: number;
|
|
188
|
+
/** Excluded when the angle is expressed in radians. */
|
|
189
|
+
readonly degrees?: never;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
/** Axis-aligned bounds in two-dimensional model space. */
|
|
193
|
+
export declare interface Bounds2 {
|
|
194
|
+
/** Inclusive maximum X/Y coordinates. */
|
|
195
|
+
readonly max: Vec2;
|
|
196
|
+
/** Inclusive minimum X/Y coordinates. */
|
|
197
|
+
readonly min: Vec2;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** Axis-aligned bounds in three-dimensional model space. */
|
|
201
|
+
export declare interface Bounds3 {
|
|
202
|
+
/** Inclusive maximum X/Y/Z coordinates. */
|
|
203
|
+
readonly max: Vec3;
|
|
204
|
+
/** Inclusive minimum X/Y/Z coordinates. */
|
|
205
|
+
readonly min: Vec3;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** Creates an outward face-center anchor using the same local origin convention as box().
|
|
209
|
+
* @remarks origin applies an explicit translation. For rotated components, transform the
|
|
210
|
+
* resulting anchor frame explicitly; no anchor is inherited from a Boolean result.
|
|
211
|
+
*/
|
|
212
|
+
export declare function boxAnchor3(options: BoxAnchorOptions): Anchor3;
|
|
213
|
+
|
|
214
|
+
/** Named face on an axis-aligned box. */
|
|
215
|
+
export declare type BoxAnchorFace = "back" | "bottom" | "front" | "left" | "right" | "top";
|
|
216
|
+
|
|
217
|
+
/** Box dimensions and construction origin for one named face anchor. */
|
|
218
|
+
export declare interface BoxAnchorOptions {
|
|
219
|
+
/** XYZ dimensions, or one uniform dimension, in millimetres. */
|
|
220
|
+
readonly size: number | Vec3;
|
|
221
|
+
/** Named outward face whose center is the attachment point. */
|
|
222
|
+
readonly face: BoxAnchorFace;
|
|
223
|
+
/** Centers the box around its construction origin; defaults to true, matching box(). */
|
|
224
|
+
readonly center?: boolean;
|
|
225
|
+
/** Construction origin; centered-box center or noncentered minimum corner. Defaults to zero. */
|
|
226
|
+
readonly origin?: Vec3;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** Box edges use +Z top, +Y front and +X right; vertical names list front/back first. */
|
|
230
|
+
export declare type BoxEdge = "top-front" | "top-back" | "top-left" | "top-right" | "bottom-front" | "bottom-back" | "bottom-left" | "bottom-right" | "front-left" | "front-right" | "back-left" | "back-right";
|
|
231
|
+
|
|
232
|
+
/** Named individual edges or top/bottom rims and all four vertical edges. */
|
|
233
|
+
export declare type BoxEdgeSelection = BoxEdge | "top" | "bottom" | "vertical";
|
|
234
|
+
|
|
235
|
+
/** Independent treatments for disjoint named edge selections; overlapping selections fail. */
|
|
236
|
+
export declare type BoxEdgeTreatments = Readonly<Partial<Record<BoxEdgeSelection, EdgeTreatment>>>;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Dimensions, placement, and uniform or independently selected finishing for an axis-aligned box.
|
|
240
|
+
*/
|
|
241
|
+
export declare interface BoxOptions extends PrimitivePlacement {
|
|
242
|
+
/** Explicit sampling ceilings for edge treatments, bounded by the host policy. */
|
|
243
|
+
readonly limits?: Partial<GeometrySamplingLimits>;
|
|
244
|
+
/**
|
|
245
|
+
* Centers the box on the XYZ origin when `true`; otherwise its minimum corner is at the origin.
|
|
246
|
+
* @defaultValue `true`
|
|
247
|
+
*/
|
|
248
|
+
readonly center?: boolean;
|
|
249
|
+
/** Positive uniform size or explicit `[X, Y, Z]` extents in millimetres. */
|
|
250
|
+
readonly size: number | Vec3;
|
|
251
|
+
/** Uniform treatment or independent disjoint nominal edge/group treatments. */
|
|
252
|
+
readonly treatment?: EdgeTreatment | BoxEdgeTreatments;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Builds closed thread-ridge components with every profile locked to the
|
|
257
|
+
* shaft's radial/axial frame. The mesh is intended for union with its
|
|
258
|
+
* minor-envelope cylinder and never owns WASM objects.
|
|
259
|
+
*/
|
|
260
|
+
export declare function buildHelicalThreadRidgeMesh(options: HelicalThreadRidgeMeshOptions): TriangleMesh;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Builds one closed threaded cylinder without a ridge/core Boolean seam.
|
|
264
|
+
*
|
|
265
|
+
* Each circular facet includes its exact phase-shifted profile breakpoints, including duplicate-Z
|
|
266
|
+
* samples for vertical flanks and blunt transitions. Adjacent variable grids are stitched as a
|
|
267
|
+
* monotone strip, with optional intermediate rows bounded by physical `maxSegmentLength`. A
|
|
268
|
+
* conservative pre-allocation estimate rejects excessive meshes before constructing position
|
|
269
|
+
* arrays.
|
|
270
|
+
*/
|
|
271
|
+
export declare function buildHelicalThreadSolidMesh(options: HelicalThreadSolidMeshOptions): TriangleMesh;
|
|
272
|
+
|
|
273
|
+
/** Axial side carrying the near-normal pressure flank of a buttress thread. */
|
|
274
|
+
export declare type ButtressPressureFlankSide = "negative" | "positive";
|
|
275
|
+
|
|
276
|
+
/** Asymmetric printable buttress profile with 7/45-degree flanks. */
|
|
277
|
+
export declare interface ButtressThreadProfileSpec extends ThreadProfileBaseSpec {
|
|
278
|
+
/** Selects the asymmetric printable buttress profile family. */
|
|
279
|
+
readonly kind: "buttress";
|
|
280
|
+
/**
|
|
281
|
+
* Radial depth in millimetres.
|
|
282
|
+
* @defaultValue `0.66271 * pitch`
|
|
283
|
+
*/
|
|
284
|
+
readonly depth?: number;
|
|
285
|
+
/**
|
|
286
|
+
* Axial side of each tooth carrying the 7-degree pressure flank. The opposite side uses the
|
|
287
|
+
* 45-degree clearance flank.
|
|
288
|
+
* @defaultValue `"positive"`
|
|
289
|
+
*/
|
|
290
|
+
readonly pressureFlankSide?: ButtressPressureFlankSide;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* A planar edge or corner chamfer with equal or independent surface setbacks.
|
|
295
|
+
*/
|
|
296
|
+
export declare interface ChamferedEdgeTreatment {
|
|
297
|
+
/** Selects a straight bevel between adjoining surfaces. */
|
|
298
|
+
readonly kind: "chamfer";
|
|
299
|
+
/** Positive tangent setbacks in millimetres, equal or [first surface, second surface]; selected treatments must fit without overlap. */
|
|
300
|
+
readonly distance: number | readonly [first: number, second: number];
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Creates an immutable centered CCW circle with +X seam and vertex or face radial sizing.
|
|
305
|
+
*
|
|
306
|
+
* @example Explicit circular point data
|
|
307
|
+
* ```ts
|
|
308
|
+
* circleLoop({ diameter: 20, segments: 32 });
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
export declare const circleLoop: (options: CircleLoopOptions) => Loop2;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Circular profile dimensions with exactly one radius or diameter and explicit sampling.
|
|
315
|
+
*/
|
|
316
|
+
export declare type CircleLoopOptions = CircularPrimitiveOptions & RadialSizingOptions & ({
|
|
317
|
+
/** Positive nominal radius in millimetres; mutually exclusive with diameter. */
|
|
318
|
+
readonly radius: number;
|
|
319
|
+
/** Full diameter is unavailable when radius is supplied. */
|
|
320
|
+
readonly diameter?: never;
|
|
321
|
+
} | {
|
|
322
|
+
/** Positive full diameter in millimetres; mutually exclusive with radius. */
|
|
323
|
+
readonly diameter: number;
|
|
324
|
+
/** Radius is unavailable when diameter is supplied. */
|
|
325
|
+
readonly radius?: never;
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Tessellation controls shared by circular primitives across Geometry entry points.
|
|
330
|
+
*/
|
|
331
|
+
export declare interface CircularPrimitiveOptions {
|
|
332
|
+
/** Explicit sampling ceilings; bound modeling operations may only lower the host policy. */
|
|
333
|
+
readonly limits?: Partial<GeometrySamplingLimits>;
|
|
334
|
+
/**
|
|
335
|
+
* Exact circumferential segment count from three through the configured safety limit.
|
|
336
|
+
*
|
|
337
|
+
* This local topology override takes precedence over {@link CircularPrimitiveOptions.resolution}
|
|
338
|
+
* and any active model-wide resolution policy.
|
|
339
|
+
*/
|
|
340
|
+
readonly segments?: number;
|
|
341
|
+
/** Operation-level physical tessellation policy over the active model-wide policy. */
|
|
342
|
+
readonly resolution?: GeometryResolution;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/** Close, normal, and loose metric clearance-hole diameters in millimetres. */
|
|
346
|
+
export declare interface ClearanceHoleDimensions {
|
|
347
|
+
/** Close-fit clearance-hole diameter. */
|
|
348
|
+
readonly close: number;
|
|
349
|
+
/** Loose-fit clearance-hole diameter. */
|
|
350
|
+
readonly loose: number;
|
|
351
|
+
/** Normal-fit clearance-hole diameter. */
|
|
352
|
+
readonly normal: number;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** Common clearance-hole fit categories, ordered from smallest to largest. */
|
|
356
|
+
export declare type ClearanceHoleFit = "close" | "normal" | "loose";
|
|
357
|
+
|
|
358
|
+
/** Compensated major/minor envelopes and the policy values used. */
|
|
359
|
+
export declare interface CompensatedThreadDiameters {
|
|
360
|
+
/** Axial backlash from the selected policy. */
|
|
361
|
+
readonly axialBacklash: number;
|
|
362
|
+
/** Compensated major diameter in millimetres. */
|
|
363
|
+
readonly majorDiameter: number;
|
|
364
|
+
/** Compensated minor diameter in millimetres. */
|
|
365
|
+
readonly minorDiameter: number;
|
|
366
|
+
/** Signed radial shift: negative for male inset, positive for female outset. */
|
|
367
|
+
readonly radialShift: number;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Applies role-specific radial compensation while preserving thread depth.
|
|
372
|
+
*
|
|
373
|
+
* Male envelopes move inward by the policy inset; female envelopes move
|
|
374
|
+
* outward by the policy outset. Combining both parts produces the sum of those
|
|
375
|
+
* allowances as radial mating clearance.
|
|
376
|
+
*/
|
|
377
|
+
export declare function compensateThreadDiameters(options: ThreadCompensationOptions): CompensatedThreadDiameters;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Applies axial fit allowance to a validated periodic profile.
|
|
381
|
+
*
|
|
382
|
+
* Male crests/ridges narrow by the requested backlash; female cutter ridges
|
|
383
|
+
* widen by it. Periodic root endpoints remain fixed so pitch and lead do not
|
|
384
|
+
* change. The returned profile is a new deeply immutable value.
|
|
385
|
+
*/
|
|
386
|
+
export declare function compensateThreadProfileAxially(profile: ThreadProfile, axialBacklash: number, role: "female" | "male"): ThreadProfile;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Applies printable axial fit plus the conservative phase allowance required by circular facets.
|
|
390
|
+
*
|
|
391
|
+
* One triangulated facet spans `pitch * starts / circularSegments` axially. A directed zipper
|
|
392
|
+
* triangle can expose either end of that complete span when independently faceted parts rotate.
|
|
393
|
+
* This helper distributes the full conservative flank clearance between the male crest and female
|
|
394
|
+
* root according to their available flat widths, and rejects a resolution that cannot represent
|
|
395
|
+
* it exactly.
|
|
396
|
+
*/
|
|
397
|
+
export declare function compensateThreadProfileForFaceting(profile: ThreadProfile, axialBacklash: number, role: "female" | "male", starts: number, circularSegments: number): ThreadProfile;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Composes two affine transforms without mutating either matrix.
|
|
401
|
+
*
|
|
402
|
+
* `composeTransform3(after, before)` applies `before` first and `after` second.
|
|
403
|
+
*
|
|
404
|
+
* @param after - Transform applied second.
|
|
405
|
+
* @param before - Transform applied first.
|
|
406
|
+
* @returns A new frozen transform equal to `after * before`.
|
|
407
|
+
*/
|
|
408
|
+
export declare function composeTransform3(after: Transform3, before: Transform3): Transform3;
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Builds rotation-minimizing frames for a non-duplicated closed path.
|
|
412
|
+
*
|
|
413
|
+
* Centered cyclic tangents are parallel-transported around the loop. The seam
|
|
414
|
+
* holonomy is measured by transporting the last normal back to the first
|
|
415
|
+
* tangent, then its residual rotation is distributed uniformly over all path
|
|
416
|
+
* intervals. This avoids a single visible seam or an accumulated frame flip.
|
|
417
|
+
* The maxPathPoints ceiling (default100000) bounds path points and frames.
|
|
418
|
+
*/
|
|
419
|
+
export declare const computeClosedParallelTransportFrames: (path: readonly Vec3[], initialNormal?: Vec3, limits?: Partial<GeometrySamplingLimits>) => readonly PathFrame[];
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Builds rotation-minimizing frames by parallel-transporting the previous normal.
|
|
423
|
+
* This avoids the sudden profile flips produced by picking a fresh up-vector per ring.
|
|
424
|
+
* Paths exceeding maxPathPoints (default 100000) reject before frame allocation or guide evaluation.
|
|
425
|
+
*/
|
|
426
|
+
export declare const computeParallelTransportFrames: (path: readonly Vec3[], initialNormal?: Vec3, normalGuide?: PathNormalGuide, limits?: Partial<GeometrySamplingLimits>) => readonly PathFrame[];
|
|
427
|
+
|
|
428
|
+
/** One sampled component retaining contour identities and logical point correspondence. */
|
|
429
|
+
export declare interface CorrespondingComponent {
|
|
430
|
+
/** Stable canonical lowercase identity; unique within the containing topology or output. */
|
|
431
|
+
readonly id: string;
|
|
432
|
+
/** Counterclockwise outer contour. */
|
|
433
|
+
readonly outer: CorrespondingContour;
|
|
434
|
+
/** Clockwise hole contours belonging to this component. */
|
|
435
|
+
readonly holes: readonly CorrespondingContour[];
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/** A sampled contour retaining logical slots, including intentionally collapsed spans. */
|
|
439
|
+
export declare interface CorrespondingContour {
|
|
440
|
+
/** Stable canonical lowercase identity; unique within the containing topology or output. */
|
|
441
|
+
readonly id: string;
|
|
442
|
+
/** Ordered sampled points in millimetres; closing vertices are implicit. */
|
|
443
|
+
readonly points: Loop2;
|
|
444
|
+
/** One span identity per point; indices correspond between every matched family member. */
|
|
445
|
+
readonly spans: readonly string[];
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/** Shared logical contour sampling suitable for a loft or hollow sweep. */
|
|
449
|
+
export declare interface CorrespondingProfile {
|
|
450
|
+
/** Ordered components with explicit contour identities. */
|
|
451
|
+
readonly components: readonly CorrespondingComponent[];
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/** One already matched profile at an explicit height or right-handed spatial frame. */
|
|
455
|
+
export declare type CorrespondingProfileStation = LoftPlacement & {
|
|
456
|
+
/** Already corresponding filled contours with authoritative landmark slots. */
|
|
457
|
+
readonly profile: CorrespondingProfile;
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Constructs a normalized immutable attachment anchor.
|
|
462
|
+
*
|
|
463
|
+
* `up` is projected onto the plane perpendicular to `direction`, removing small
|
|
464
|
+
* input drift while preserving its roll intent.
|
|
465
|
+
*
|
|
466
|
+
* @param position - Finite anchor point in model coordinates.
|
|
467
|
+
* @param direction - Non-zero outward attachment normal.
|
|
468
|
+
* @param up - Non-parallel roll reference; defaults to +Y.
|
|
469
|
+
* @param tolerance - Optional comparison overrides.
|
|
470
|
+
* @returns A frozen anchor with unit, orthogonal direction and up vectors.
|
|
471
|
+
* @throws {@link GeometryError} For non-finite or degenerate inputs.
|
|
472
|
+
*/
|
|
473
|
+
export declare function createAnchor3(position: Vec3, direction: Vec3, up?: Vec3, tolerance?: GeometryToleranceOptions): Anchor3;
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Creates a periodic thread profile for the shaft-locked helical mesher.
|
|
477
|
+
*
|
|
478
|
+
* The open path spans one pitch. Radial zero is the major envelope; negative
|
|
479
|
+
* values point toward the shaft. Custom paths must be finite, axially
|
|
480
|
+
* non-decreasing, periodic at their endpoints, and reach radial zero.
|
|
481
|
+
*
|
|
482
|
+
* @example Printable triangular thread profile
|
|
483
|
+
* ```ts
|
|
484
|
+
* createThreadProfile({ kind: "triangular", pitch: 1.75 });
|
|
485
|
+
* ```
|
|
486
|
+
*/
|
|
487
|
+
export declare function createThreadProfile(spec: ThreadProfileSpec): ThreadProfile;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Creates an order-independent regression signature for a manufacturing mesh.
|
|
491
|
+
*
|
|
492
|
+
* The input must be non-empty, closed, consistently wound, and have no unreferenced vertices.
|
|
493
|
+
* Vertex and triangle order do not affect the fingerprint; winding, quantized geometry, and
|
|
494
|
+
* connectivity metrics do. The fingerprint is a regression aid, not a cryptographic digest.
|
|
495
|
+
*
|
|
496
|
+
* @param mesh - Closed oriented mesh to measure without mutation.
|
|
497
|
+
* @param options - Absolute quantization and complexity limits.
|
|
498
|
+
* @returns Compact counts, bounds, volume, topology, tolerances, and canonical fingerprint.
|
|
499
|
+
* @throws {@link GeometryError} When validation, topology, tolerance, or complexity checks fail.
|
|
500
|
+
*/
|
|
501
|
+
export declare function createTriangleMeshSignature(mesh: TriangleMesh, options?: TriangleMeshSignatureOptions): TriangleMeshSignature;
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Returns the right-handed cross product.
|
|
505
|
+
* @example
|
|
506
|
+
* ```ts
|
|
507
|
+
* cross3([1, 0, 0], [0, 1, 0]); // [0, 0, 1]
|
|
508
|
+
* ```
|
|
509
|
+
*/
|
|
510
|
+
export declare const cross3: (a: Vec3, b: Vec3) => Vec3;
|
|
511
|
+
|
|
512
|
+
/** Planar cubic Bézier with explicit endpoint and control coordinates. */
|
|
513
|
+
export declare interface CubicBezierCurve2 {
|
|
514
|
+
/** Selects a cubic Bézier through two endpoints and two controls. */
|
|
515
|
+
readonly kind: "cubic";
|
|
516
|
+
/** Initial XY point in millimetres. */
|
|
517
|
+
readonly start: Vec2;
|
|
518
|
+
/** First XY control point in millimetres. */
|
|
519
|
+
readonly control1: Vec2;
|
|
520
|
+
/** Second XY control point in millimetres. */
|
|
521
|
+
readonly control2: Vec2;
|
|
522
|
+
/** Final XY point in millimetres. */
|
|
523
|
+
readonly end: Vec2;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Spatial cubic Bézier with explicit endpoint and control coordinates.
|
|
528
|
+
*/
|
|
529
|
+
export declare interface CubicBezierCurve3 {
|
|
530
|
+
/** Selects a cubic Bézier through two endpoints and two controls. */
|
|
531
|
+
readonly kind: "cubic";
|
|
532
|
+
/** Initial XYZ point in millimetres. */
|
|
533
|
+
readonly start: Vec3;
|
|
534
|
+
/** First XYZ control point in millimetres. */
|
|
535
|
+
readonly control1: Vec3;
|
|
536
|
+
/** Second XYZ control point in millimetres. */
|
|
537
|
+
readonly control2: Vec3;
|
|
538
|
+
/** Final XYZ point in millimetres. */
|
|
539
|
+
readonly end: Vec3;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/** Returns cumulative arc length for finite points under maxPathPoints (default 100000); rejects overflowing length. */
|
|
543
|
+
export declare const cumulativePathLengths: (path: readonly Vec3[], limits?: Partial<GeometrySamplingLimits>) => readonly number[];
|
|
544
|
+
|
|
545
|
+
/** Reusable planar curve definition. */
|
|
546
|
+
export declare type Curve2 = LineCurve2 | ArcCurve2 | CubicBezierCurve2;
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Reusable spatial curve definition.
|
|
550
|
+
*/
|
|
551
|
+
export declare type Curve3 = LineCurve3 | ArcCurve3 | CubicBezierCurve3;
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Explicit physical sampling and allocation policy for reusable curves.
|
|
555
|
+
*/
|
|
556
|
+
export declare interface CurveSamplingOptions {
|
|
557
|
+
/** Exact segment count overrides physical criteria; curve parameters are spaced uniformly. */
|
|
558
|
+
readonly segments?: number;
|
|
559
|
+
/** Millimetre sampling policy; circularSegments applies only to arcs. */
|
|
560
|
+
readonly resolution?: GeometryResolution;
|
|
561
|
+
/** Output vertex ceiling of at least two; may only lower limits.maxPathPoints. */
|
|
562
|
+
readonly maximumVertices?: number;
|
|
563
|
+
/** Explicit sampling ceilings; omitted values use package defaults without ambient state. */
|
|
564
|
+
readonly limits?: Partial<GeometrySamplingLimits>;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/** Caller-defined periodic axial/radial profile in millimetres. */
|
|
568
|
+
export declare interface CustomThreadProfileSpec extends ThreadProfileBaseSpec {
|
|
569
|
+
/** Selects a caller-defined periodic profile. */
|
|
570
|
+
readonly kind: "custom";
|
|
571
|
+
/**
|
|
572
|
+
* Open path spanning exactly `[-pitch/2, pitch/2]`, with both endpoints on the minor envelope,
|
|
573
|
+
* one connected ridge, one contiguous crest, and radial zero at the major envelope.
|
|
574
|
+
*/
|
|
575
|
+
readonly points: readonly Vec2[];
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/** Creates a cap-center or radial-side anchor using cylinder()'s construction origin.
|
|
579
|
+
* @remarks Both centered and noncentered cylinders extend along +Z. Side angle uses degrees;
|
|
580
|
+
* origin applies an explicit translation, and arbitrary component transforms remain explicit.
|
|
581
|
+
*/
|
|
582
|
+
export declare function cylinderAnchor3(options: CylinderAnchorOptions): Anchor3;
|
|
583
|
+
|
|
584
|
+
/** Named face on a cylinder parallel to +Z. */
|
|
585
|
+
export declare type CylinderAnchorFace = "bottom" | "side" | "top";
|
|
586
|
+
|
|
587
|
+
/** Cylinder dimensions and construction origin for one named face anchor. */
|
|
588
|
+
export declare interface CylinderAnchorOptions {
|
|
589
|
+
/** Constant cylinder radius in millimetres. */
|
|
590
|
+
readonly radius: number;
|
|
591
|
+
/** Full axial height in millimetres. */
|
|
592
|
+
readonly height: number;
|
|
593
|
+
/** Named outward face; side anchors lie halfway up the cylinder. */
|
|
594
|
+
readonly face: CylinderAnchorFace;
|
|
595
|
+
/** Side angle counter-clockwise from +X, in degrees; defaults to zero. */
|
|
596
|
+
readonly angleDegrees?: number;
|
|
597
|
+
/** Centers the cylinder along Z; defaults to true, matching cylinder(). */
|
|
598
|
+
readonly center?: boolean;
|
|
599
|
+
/** Construction origin; centered-axis midpoint or noncentered bottom axis. Defaults to zero. */
|
|
600
|
+
readonly origin?: Vec3;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Dimensions, placement, independent end finishing, and tessellation for a Z-axis cylinder or frustum.
|
|
605
|
+
*/
|
|
606
|
+
export declare type CylinderOptions = CircularPrimitiveOptions & RadialSizingOptions & PrimitivePlacement & {
|
|
607
|
+
/**
|
|
608
|
+
* Centers the solid on the Z origin when `true`; otherwise its bottom is at `Z = 0`.
|
|
609
|
+
* @defaultValue `true`
|
|
610
|
+
*/
|
|
611
|
+
readonly center?: boolean;
|
|
612
|
+
/** Independent end treatments; first setback is cap inset and second follows the sloped side. */
|
|
613
|
+
readonly ends?: EndTreatments;
|
|
614
|
+
/** Total height along +Z in millimetres. */
|
|
615
|
+
readonly height: number;
|
|
616
|
+
} & ({
|
|
617
|
+
/** Positive uniform radius or nonnegative `[bottom, top]` radii in millimetres; one must be positive. */
|
|
618
|
+
readonly radius: number | readonly [bottom: number, top: number];
|
|
619
|
+
/** Full diameter is unavailable when radius is supplied. */
|
|
620
|
+
readonly diameter?: never;
|
|
621
|
+
} | {
|
|
622
|
+
/** Positive uniform diameter or nonnegative `[bottom, top]` diameters in millimetres; one must be positive. */
|
|
623
|
+
readonly diameter: number | readonly [bottom: number, top: number];
|
|
624
|
+
/** Radius is unavailable when diameter is supplied. */
|
|
625
|
+
readonly radius?: never;
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Resolved transverse pitch-plane dimensions for one cylindrical gear.
|
|
630
|
+
*/
|
|
631
|
+
export declare interface CylindricalGearDimensions {
|
|
632
|
+
/** Addendum above the pitch circle, in millimetres. */
|
|
633
|
+
readonly addendum: number;
|
|
634
|
+
/** Angular pitch between adjacent teeth, in radians. */
|
|
635
|
+
readonly angularPitch: number;
|
|
636
|
+
/** Tangential backlash applied to this gear, in millimetres. */
|
|
637
|
+
readonly backlash: number;
|
|
638
|
+
/** Base-circle radius used by the involute, in millimetres. */
|
|
639
|
+
readonly baseRadius: number;
|
|
640
|
+
/** Dedendum below the pitch circle, in millimetres. */
|
|
641
|
+
readonly dedendum: number;
|
|
642
|
+
/** Signed helix angle, in radians. */
|
|
643
|
+
readonly helixAngleRadians: number;
|
|
644
|
+
/** Caller-supplied normal module, in millimetres. */
|
|
645
|
+
readonly module: number;
|
|
646
|
+
/** Minimum physical tooth count for this unshifted full-depth external profile. */
|
|
647
|
+
readonly minimumToothCountWithoutUndercut: number;
|
|
648
|
+
/** Outside radius at the tooth tips, in millimetres. */
|
|
649
|
+
readonly outsideRadius: number;
|
|
650
|
+
/** Pitch-circle radius, in millimetres. */
|
|
651
|
+
readonly pitchRadius: number;
|
|
652
|
+
/** Normal pressure angle, in radians. */
|
|
653
|
+
readonly pressureAngleRadians: number;
|
|
654
|
+
/** Root radius at the bottom lands, in millimetres. */
|
|
655
|
+
readonly rootRadius: number;
|
|
656
|
+
/** Integer number of teeth. */
|
|
657
|
+
readonly toothCount: number;
|
|
658
|
+
/** Tangential tooth thickness at the pitch circle, in millimetres. */
|
|
659
|
+
readonly toothThicknessAtPitch: number;
|
|
660
|
+
/** Module measured in the transverse pitch plane, in millimetres. */
|
|
661
|
+
readonly transverseModule: number;
|
|
662
|
+
/** Pressure angle measured in the transverse pitch plane, in radians. */
|
|
663
|
+
readonly transversePressureAngleRadians: number;
|
|
664
|
+
/** Helical equivalent spur tooth count, `toothCount / cos³(helixAngle)`. */
|
|
665
|
+
readonly virtualToothCount: number;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Whether two cylindrical gears mesh on their outside teeth or as a pinion inside a ring.
|
|
670
|
+
*/
|
|
671
|
+
export declare type CylindricalGearMeshKind = "external" | "internal";
|
|
672
|
+
|
|
673
|
+
/** Sampling controls for a complete non-duplicated gear outline. */
|
|
674
|
+
export declare interface CylindricalGearOutlineOptions {
|
|
675
|
+
/** Exact samples per involute flank, at least two, within the aggregate profile ceiling. */
|
|
676
|
+
readonly flankSamples?: number;
|
|
677
|
+
/** Exact samples along each bottom land, at least one, within selected circular/profile ceilings. */
|
|
678
|
+
readonly rootArcSamples?: number;
|
|
679
|
+
/** Explicit profile and circular allocation ceilings. */
|
|
680
|
+
readonly limits?: Partial<GeometrySamplingLimits>;
|
|
681
|
+
/** Explicit physical sampling policy for adaptive defaults. */
|
|
682
|
+
readonly resolution?: GeometryResolution;
|
|
683
|
+
/** Exact samples along each tooth tip, at least one, within selected circular/profile ceilings. */
|
|
684
|
+
readonly tipArcSamples?: number;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Pitch solution for a coordinated cylindrical gear pair.
|
|
689
|
+
*/
|
|
690
|
+
export declare interface CylindricalGearPairDimensions {
|
|
691
|
+
/** Nominal distance between the two +Z gear axes, in millimetres. */
|
|
692
|
+
readonly centerDistance: number;
|
|
693
|
+
/** Resolved driver dimensions. */
|
|
694
|
+
readonly driver: CylindricalGearDimensions;
|
|
695
|
+
/** `-1` for opposite external rotation and `1` for same-direction internal rotation. */
|
|
696
|
+
readonly drivenDirection: -1 | 1;
|
|
697
|
+
/** Resolved driven dimensions. */
|
|
698
|
+
readonly driven: CylindricalGearDimensions;
|
|
699
|
+
/** Absolute driven-to-driver tooth-count ratio. */
|
|
700
|
+
readonly ratio: number;
|
|
701
|
+
/** Helix angle required on the driven member for conjugate teeth, in degrees. */
|
|
702
|
+
readonly requiredDrivenHelixAngleDegrees: number;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/** Sampling controls for one coupled internal-gear tooth cycle. */
|
|
706
|
+
export declare interface CylindricalGearPairMotionOptions {
|
|
707
|
+
/** Optional deterministic outline sampling overrides. */
|
|
708
|
+
readonly outline?: CylindricalGearOutlineOptions;
|
|
709
|
+
/** Coupled poses sampled over one driver tooth pitch. Defaults to 24. */
|
|
710
|
+
readonly samples?: number;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/** Maximum sampled planar overlap for an external pinion inside an internal ring. */
|
|
714
|
+
export declare interface CylindricalGearPairMotionReport {
|
|
715
|
+
/** Driver phase at the maximum overlap, in radians. */
|
|
716
|
+
readonly driverPhaseRadians: number;
|
|
717
|
+
/** Maximum pinion area lying inside ring material, in square millimetres. */
|
|
718
|
+
readonly maximumOverlapArea: number;
|
|
719
|
+
/** Number of evenly spaced coupled poses inspected. */
|
|
720
|
+
readonly samples: number;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Inputs for resolving a coordinated cylindrical gear pair.
|
|
725
|
+
*/
|
|
726
|
+
export declare interface CylindricalGearPairSpec {
|
|
727
|
+
/** Driving gear or pinion. */
|
|
728
|
+
readonly driver: CylindricalGearSpec;
|
|
729
|
+
/** Driven external gear or internal ring gear. */
|
|
730
|
+
readonly driven: CylindricalGearSpec;
|
|
731
|
+
/** External/external or external/internal mesh. */
|
|
732
|
+
readonly mesh: CylindricalGearMeshKind;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Nominal dimensions for a standard full-depth cylindrical involute gear.
|
|
737
|
+
*
|
|
738
|
+
* Lengths use millimetres. `module` and `pressureAngleDegrees` are measured in
|
|
739
|
+
* the normal plane; a non-zero signed helix angle is converted to transverse
|
|
740
|
+
* pitch-plane dimensions. Positive and negative helix angles identify
|
|
741
|
+
* opposite hands but produce the same 2D pitch geometry.
|
|
742
|
+
*/
|
|
743
|
+
export declare interface CylindricalGearSpec {
|
|
744
|
+
/** Tangential tooth-thickness reduction at the pitch circle, in millimetres. */
|
|
745
|
+
readonly backlash?: number;
|
|
746
|
+
/** Dedendum clearance as a multiple of normal module; defaults to `0.25`. */
|
|
747
|
+
readonly clearanceFactor?: number;
|
|
748
|
+
/** Signed helix angle in degrees; zero creates a spur pitch system. */
|
|
749
|
+
readonly helixAngleDegrees?: number;
|
|
750
|
+
/** Normal module in millimetres per tooth. */
|
|
751
|
+
readonly module: number;
|
|
752
|
+
/** Normal pressure angle in degrees; defaults to 20 degrees. */
|
|
753
|
+
readonly pressureAngleDegrees?: number;
|
|
754
|
+
/** Integer tooth count from 6 through 1,000; external profiles also enforce the no-undercut limit. */
|
|
755
|
+
readonly toothCount: number;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/** Default absolute, relative, and angular tolerances for millimetre-scale models. */
|
|
759
|
+
export declare const DEFAULT_GEOMETRY_TOLERANCE: Readonly<{
|
|
760
|
+
/** Default absolute distance floor in model units. */
|
|
761
|
+
absolute: 1e-9;
|
|
762
|
+
/** Default angular comparison threshold in radians. */
|
|
763
|
+
angular: 1e-10;
|
|
764
|
+
/** Default dimensionless model-scale multiplier. */
|
|
765
|
+
relative: 1e-12;
|
|
766
|
+
}>;
|
|
767
|
+
|
|
768
|
+
/** Conservative defaults; trusted callers can supply larger explicit ceilings. */
|
|
769
|
+
export declare const defaultGeometrySamplingLimits: GeometrySamplingLimits;
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* Places an exact item count at equal arc-length intervals along a sampled path.
|
|
773
|
+
*
|
|
774
|
+
* Coordinates are unit-agnostic. Closed paths must omit their duplicated seam;
|
|
775
|
+
* open paths include both endpoints when `count` is greater than one.
|
|
776
|
+
* Coordinates and total length must be finite. Input points and output placements are each
|
|
777
|
+
* limited by maxPathPoints (default 100000); exact counts exceeding that ceiling reject before length calculation.
|
|
778
|
+
*/
|
|
779
|
+
export declare const distributeAlongPath: (path: readonly Vec3[], count: number, closed: boolean, limits?: Partial<GeometrySamplingLimits>) => readonly PathPlacement[];
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* Returns the scalar dot product.
|
|
783
|
+
* @example
|
|
784
|
+
* ```ts
|
|
785
|
+
* dot3([1, 0, 0], [0, 1, 0]); // 0
|
|
786
|
+
* ```
|
|
787
|
+
*/
|
|
788
|
+
export declare const dot3: (a: Vec3, b: Vec3) => number;
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* Uniform finishing vocabulary shared by applicable solid edges and profile corners.
|
|
792
|
+
*/
|
|
793
|
+
export declare type EdgeTreatment = ChamferedEdgeTreatment | RoundedEdgeTreatment | SmoothEdgeTreatment | ProfiledEdgeTreatment;
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* Creates an immutable centered CCW ellipse with +X seam within the selected sampling ceiling.
|
|
797
|
+
*
|
|
798
|
+
* @example Ellipse by full dimensions
|
|
799
|
+
* ```ts
|
|
800
|
+
* ellipseLoop({ size: [30, 20] });
|
|
801
|
+
* ```
|
|
802
|
+
*/
|
|
803
|
+
export declare function ellipseLoop(options: EllipseLoopOptions): Loop2;
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Ellipse dimensions with exactly one XY radii or full-size tuple and explicit sampling.
|
|
807
|
+
*/
|
|
808
|
+
export declare type EllipseLoopOptions = CircularPrimitiveOptions & ({
|
|
809
|
+
/** Positive XY radii in millimetres; mutually exclusive with size. */
|
|
810
|
+
readonly radius: Vec2;
|
|
811
|
+
/** Full XY extents are unavailable when radius is supplied. */
|
|
812
|
+
readonly size?: never;
|
|
813
|
+
} | {
|
|
814
|
+
/** Positive full XY extents in millimetres; mutually exclusive with radius. */
|
|
815
|
+
readonly size: Vec2;
|
|
816
|
+
/** XY radii are unavailable when size is supplied. */
|
|
817
|
+
readonly radius?: never;
|
|
818
|
+
});
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* Independent inward finishing on primitive or straight convex extrusion ends.
|
|
822
|
+
*/
|
|
823
|
+
export declare interface EndTreatments {
|
|
824
|
+
/** Bottom cap and adjoining side; omitted leaves the end untreated. */
|
|
825
|
+
readonly bottom?: EdgeTreatment;
|
|
826
|
+
/** Top cap and adjoining side; omitted leaves the end untreated. */
|
|
827
|
+
readonly top?: EdgeTreatment;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* Creates an immutable right-handed XYZ Euler rotation transform.
|
|
832
|
+
*
|
|
833
|
+
* Rotations are applied about global X first, then Y, then Z. This matches the
|
|
834
|
+
* degree-based Euler convention used by the Manifold adapters.
|
|
835
|
+
*
|
|
836
|
+
* @param rotationDegrees - Finite `[x, y, z]` rotation angles in degrees.
|
|
837
|
+
* @returns A frozen row-major transform.
|
|
838
|
+
* @throws {@link GeometryError} When an angle is non-finite.
|
|
839
|
+
*/
|
|
840
|
+
export declare function eulerTransform3(rotationDegrees: Vec3): Transform3;
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* Linearly extrudes one simple profile along +Z with robust ear-clipped caps.
|
|
844
|
+
*
|
|
845
|
+
* @example Extrude point data without an engine
|
|
846
|
+
* ```ts
|
|
847
|
+
* const outline = rectangleLoop({ size: [30, 20], treatment: { kind: "round", radius: 3 } });
|
|
848
|
+
* extrudeMesh(outline, { height: 8 });
|
|
849
|
+
* ```
|
|
850
|
+
*/
|
|
851
|
+
export declare function extrudeMesh(profile: Loop2, options: ExtrudeOptions): TriangleMesh;
|
|
852
|
+
|
|
853
|
+
/**
|
|
854
|
+
* Dimensions and sampling shared by native and pure +Z extrusion.
|
|
855
|
+
*/
|
|
856
|
+
export declare interface ExtrudeOptions extends ExtrusionSamplingOptions {
|
|
857
|
+
/** Positive extrusion height in millimetres. */
|
|
858
|
+
readonly height: number;
|
|
859
|
+
/** Center the extrusion on Z; otherwise its bottom is at zero. Defaults to false. */
|
|
860
|
+
readonly center?: boolean;
|
|
861
|
+
/** Independent inward end treatments on straight convex single-contour extrusions. */
|
|
862
|
+
readonly ends?: EndTreatments;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
/** Shared sampling controls for a twisted or scaled linear extrusion. */
|
|
866
|
+
export declare interface ExtrusionSamplingOptions {
|
|
867
|
+
/** Exact number of intermediate profiles, nonnegative; overrides physical sampling. */
|
|
868
|
+
readonly divisions?: number;
|
|
869
|
+
/** Explicit output and sampling allocation ceilings. */
|
|
870
|
+
readonly limits?: Partial<ModelingLimits>;
|
|
871
|
+
/** Operation-level physical policy over the nearest model scope. */
|
|
872
|
+
readonly resolution?: GeometryResolution;
|
|
873
|
+
/** Finite uniform or XY scale of the top profile; defaults to one. */
|
|
874
|
+
readonly scaleTop?: number | Vec2;
|
|
875
|
+
/** Finite rotation of the top profile about +Z, in degrees; defaults to zero. */
|
|
876
|
+
readonly twistDegrees?: number;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
/** A right-handed orthonormal coordinate frame expressed in world coordinates. */
|
|
880
|
+
export declare interface Frame3 {
|
|
881
|
+
/** World-space origin of the local frame. */
|
|
882
|
+
readonly origin: Vec3;
|
|
883
|
+
/** Unit vector defining the local +X axis. */
|
|
884
|
+
readonly xAxis: Vec3;
|
|
885
|
+
/** Unit vector defining the local +Y axis. */
|
|
886
|
+
readonly yAxis: Vec3;
|
|
887
|
+
/** Unit vector defining the local +Z axis. */
|
|
888
|
+
readonly zAxis: Vec3;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* Converts a right-handed orthonormal frame into a local-to-world transform.
|
|
893
|
+
*
|
|
894
|
+
* @param frame - Frame whose axes become the transform columns.
|
|
895
|
+
* @param tolerance - Optional orthonormality comparison overrides.
|
|
896
|
+
* @returns A frozen rigid transform.
|
|
897
|
+
* @throws {@link GeometryError} When axes are non-unit, non-orthogonal, or left-handed.
|
|
898
|
+
*/
|
|
899
|
+
export declare function frameTransform3(frame: Frame3, tolerance?: GeometryToleranceOptions): Transform3;
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* Error raised when a geometry precondition or invariant is not satisfied.
|
|
903
|
+
*
|
|
904
|
+
* Callers may use `code` for coarse recovery decisions. Human-facing details
|
|
905
|
+
* remain in `message`; messages are descriptive but are not a stable API.
|
|
906
|
+
*
|
|
907
|
+
* @example
|
|
908
|
+
* ```ts
|
|
909
|
+
* const error = new GeometryError("INVALID_ARGUMENT", "Radius must be positive.", {
|
|
910
|
+
* operation: "example",
|
|
911
|
+
* details: { radius: 0 },
|
|
912
|
+
* });
|
|
913
|
+
* ```
|
|
914
|
+
*/
|
|
915
|
+
export declare class GeometryError extends Error {
|
|
916
|
+
/** Machine-readable failure category. */
|
|
917
|
+
readonly code: GeometryErrorCode;
|
|
918
|
+
/** Operation and scalar facts associated with the failure. */
|
|
919
|
+
readonly context: GeometryErrorContext;
|
|
920
|
+
/**
|
|
921
|
+
* Creates a geometry error with a stable category, operation, and descriptive message.
|
|
922
|
+
*
|
|
923
|
+
* @param code - Machine-readable failure category.
|
|
924
|
+
* @param message - Human-readable diagnostic message.
|
|
925
|
+
* @param context - Operation and optional scalar facts. Defaults to `{ operation: "geometry" }`.
|
|
926
|
+
*/
|
|
927
|
+
constructor(code: GeometryErrorCode, message: string, context?: GeometryErrorContext);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
/** Stable categories for invalid inputs, topology, allocation, and runtime failures. */
|
|
931
|
+
export declare type GeometryErrorCode = "COMPLEXITY_LIMIT" | "DEGENERATE_GEOMETRY" | "INVALID_ARGUMENT" | "INVALID_MESH" | "INVALID_TOPOLOGY" | "INVALID_TOLERANCE" | "NON_FINITE_VALUE" | "SELF_INTERSECTION" | "SINGULAR_TRANSFORM" | "UNSUPPORTED_RUNTIME";
|
|
932
|
+
|
|
933
|
+
/** Serializable context attached to a geometry failure. */
|
|
934
|
+
export declare interface GeometryErrorContext {
|
|
935
|
+
/** Optional scalar facts useful for diagnostics without parsing the message. */
|
|
936
|
+
readonly details?: Readonly<Record<string, boolean | number | string>>;
|
|
937
|
+
/** Stable operation name, such as `normalizeLoop2` or `extrude`. */
|
|
938
|
+
readonly operation: string;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Tessellation policy for sampled geometry measured in millimetres.
|
|
943
|
+
*/
|
|
944
|
+
export declare interface GeometryResolution {
|
|
945
|
+
/** Optional exact full-circle segment count, of at least three, bounded by the selected circular ceiling. */
|
|
946
|
+
readonly circularSegments?: number;
|
|
947
|
+
/** Maximum radial chord error in millimetres; defaults to 0.05. */
|
|
948
|
+
readonly maxChordError?: number;
|
|
949
|
+
/** Optional maximum sampled edge length in millimetres. */
|
|
950
|
+
readonly maxSegmentLength?: number;
|
|
951
|
+
/** Upper safety bound for a full circle; defaults to the selected maxCircularSegments (512 by default). */
|
|
952
|
+
readonly maximumSegments?: number;
|
|
953
|
+
/** Lower full-circle segment count; defaults to 16 or a lower selected circular ceiling. */
|
|
954
|
+
readonly minimumSegments?: number;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/** Explicit allocation ceilings for pure sampling and host-owned modeling operations. */
|
|
958
|
+
export declare interface GeometrySamplingLimits {
|
|
959
|
+
/** Maximum points in one sampled path or placement/frame result. */
|
|
960
|
+
readonly maxPathPoints: number;
|
|
961
|
+
/** Maximum aggregate points in one sampled profile or Section. */
|
|
962
|
+
readonly maxProfilePoints: number;
|
|
963
|
+
/** Maximum points in one profile swept along a path. */
|
|
964
|
+
readonly maxSweepProfilePoints: number;
|
|
965
|
+
/** Maximum segments around one complete circle. */
|
|
966
|
+
readonly maxCircularSegments: number;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
/** Optional overrides for MetaMesh's geometry comparison policy. */
|
|
970
|
+
export declare interface GeometryToleranceOptions {
|
|
971
|
+
/** Absolute distance floor in model units. Must be finite and greater than zero. */
|
|
972
|
+
readonly absolute?: number;
|
|
973
|
+
/** Angular comparison threshold in radians. Must be finite and greater than zero. */
|
|
974
|
+
readonly angular?: number;
|
|
975
|
+
/** Dimensionless scale multiplier. Must be finite and non-negative. */
|
|
976
|
+
readonly relative?: number;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
/** Returns one recommended metric clearance-hole diameter in millimetres. */
|
|
980
|
+
export declare function getMetricClearanceHole(size: MetricFastenerSize, fit?: ClearanceHoleFit): number;
|
|
981
|
+
|
|
982
|
+
/** Returns the immutable standards record for one supported metric size. */
|
|
983
|
+
export declare function getMetricFastenerStandard(size: MetricFastenerSize): MetricFastenerStandard;
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* Builds a closed indexed solid from a regularly sampled top, matched boundary walls, and flat base.
|
|
987
|
+
* Heights are evaluated once per grid point after allocation preflight. Physical XY sizes and all
|
|
988
|
+
* output coordinates must fit Float32 storage. Shared wall vertices prevent cracks at the base.
|
|
989
|
+
*
|
|
990
|
+
* @example Sample a closed wavy mesh
|
|
991
|
+
* ```ts
|
|
992
|
+
* heightfieldMesh({
|
|
993
|
+
* size: [30, 20], segments: [24, 16],
|
|
994
|
+
* height: ([x, y]) => 3 + Math.cos(x / 5) * Math.cos(y / 5),
|
|
995
|
+
* });
|
|
996
|
+
* ```
|
|
997
|
+
*/
|
|
998
|
+
export declare function heightfieldMesh(options: HeightfieldOptions, limits?: HeightfieldMeshLimits): TriangleMesh;
|
|
999
|
+
|
|
1000
|
+
/** Trusted output ceilings for pure construction; omitted fields use engine defaults. */
|
|
1001
|
+
export declare type HeightfieldMeshLimits = Partial<Pick<ModelingLimits, "maxVertices" | "maxTriangles" | "maxBytes">>;
|
|
1002
|
+
|
|
1003
|
+
/** A regularly sampled, closed heightfield above a flat base, in millimetres. */
|
|
1004
|
+
export declare interface HeightfieldOptions {
|
|
1005
|
+
/** Positive XY footprint. */
|
|
1006
|
+
readonly size: Vec2;
|
|
1007
|
+
/** Exact positive integer X/Y interval counts. */
|
|
1008
|
+
readonly segments: readonly [x: number, y: number];
|
|
1009
|
+
/** Absolute top Z at the supplied XY point. Every sample must be above baseZ. */
|
|
1010
|
+
readonly height: (point: Vec2) => number;
|
|
1011
|
+
/** Flat bottom Z. Defaults to zero. */
|
|
1012
|
+
readonly baseZ?: number;
|
|
1013
|
+
/** Lower-left footprint XY. Omitted centers the footprint on XY. */
|
|
1014
|
+
readonly origin?: Vec2;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
/** Predictable regular-grid allocation facts; this does not evaluate the height callback. */
|
|
1018
|
+
export declare interface HeightfieldPreflight {
|
|
1019
|
+
/** Number of grid points and height callback evaluations. */
|
|
1020
|
+
readonly sampleCount: number;
|
|
1021
|
+
/** Number of allocated XYZ vertices. */
|
|
1022
|
+
readonly vertexCount: number;
|
|
1023
|
+
/** Number of allocated indexed triangles. */
|
|
1024
|
+
readonly triangleCount: number;
|
|
1025
|
+
/** Total bytes of Float32 positions and Uint32 indices. */
|
|
1026
|
+
readonly byteCount: number;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
/** Runtime-neutral options for the dedicated helical ridge mesher. */
|
|
1030
|
+
export declare interface HelicalThreadRidgeMeshOptions {
|
|
1031
|
+
/**
|
|
1032
|
+
* Optional bottom/top ridge-end treatments. Standalone ridges honor the requested boundaries;
|
|
1033
|
+
* BOSL2-style non-cut lead-in scaling is available on complete thread solids.
|
|
1034
|
+
*/
|
|
1035
|
+
readonly ends?: ThreadEndTreatmentOptions;
|
|
1036
|
+
/** Helix direction. Default: `right`. */
|
|
1037
|
+
readonly handedness?: ThreadHandedness;
|
|
1038
|
+
/** Total threaded axial length in millimetres. */
|
|
1039
|
+
readonly length: number;
|
|
1040
|
+
/** Explicit output and circular allocation ceilings. */
|
|
1041
|
+
readonly limits?: Partial<ModelingLimits>;
|
|
1042
|
+
/** Nominal major diameter before any caller-owned fit compensation. */
|
|
1043
|
+
readonly majorDiameter: number;
|
|
1044
|
+
/** Angular offset of the first start in degrees. Default: `0`. */
|
|
1045
|
+
readonly phaseDegrees?: number;
|
|
1046
|
+
/** Validated periodic profile repeated around the shaft. */
|
|
1047
|
+
readonly profile: ThreadProfile;
|
|
1048
|
+
/** Optional circular-resolution policy. */
|
|
1049
|
+
readonly resolution?: GeometryResolution;
|
|
1050
|
+
/** Number of evenly phased starts. Default: `1`. */
|
|
1051
|
+
readonly starts?: number;
|
|
1052
|
+
/** Optional numerical tolerance overrides. */
|
|
1053
|
+
readonly tolerance?: GeometryToleranceOptions;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
/** Options for a complete threaded-cylinder mesh; base semantics match the ridge builder. */
|
|
1057
|
+
export declare interface HelicalThreadSolidMeshOptions extends HelicalThreadRidgeMeshOptions {
|
|
1058
|
+
/** Apply a 45-degree radial bevel at the lower target face. */
|
|
1059
|
+
readonly bevelBottom?: boolean;
|
|
1060
|
+
/** Lower bevel size override. Takes precedence over `bevelSize`. */
|
|
1061
|
+
readonly bevelBottomSize?: number;
|
|
1062
|
+
/** Distance of each bevel target face inward from the corresponding mesh end. */
|
|
1063
|
+
readonly bevelOffset?: number;
|
|
1064
|
+
/** `inset` trims an external rod; `outset` expands an internal cutter. */
|
|
1065
|
+
readonly bevelMode?: "inset" | "outset";
|
|
1066
|
+
/** Axial and radial bevel size. Defaults to the profile depth. */
|
|
1067
|
+
readonly bevelSize?: number;
|
|
1068
|
+
/** Apply a 45-degree radial bevel at the upper target face. */
|
|
1069
|
+
readonly bevelTop?: boolean;
|
|
1070
|
+
/** Upper bevel size override. Takes precedence over `bevelSize`. */
|
|
1071
|
+
readonly bevelTopSize?: number;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
/** Conservative allocation facts resolved before constructing a direct thread solid mesh. */
|
|
1075
|
+
export declare interface HelicalThreadSolidMeshPreflight {
|
|
1076
|
+
/** Uniform axial intervals required only by a requested physical segment-length limit. */
|
|
1077
|
+
readonly axialIntervals: number;
|
|
1078
|
+
/** Start-aligned full-circle segment count used by the surface mesh. */
|
|
1079
|
+
readonly circularSegments: number;
|
|
1080
|
+
/** Conservative surface-row count across profile breaks, ends, and bevel stations. */
|
|
1081
|
+
readonly estimatedRows: number;
|
|
1082
|
+
/** Conservative triangle count used by the selected output allocation policy. */
|
|
1083
|
+
readonly estimatedTriangles: number;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
/** Identity transform, safe to share because it is frozen. */
|
|
1087
|
+
export declare const IDENTITY_TRANSFORM3: Transform3;
|
|
1088
|
+
|
|
1089
|
+
/** Options for a compensated internal-thread subtraction tool along +Z. */
|
|
1090
|
+
export declare interface InternalThreadCutterOptions extends Omit<HelicalThreadRidgeMeshOptions, "majorDiameter">, ThreadBevelOptions {
|
|
1091
|
+
/** Printable fit or caller-calibrated allowances. Default: `normal`. */
|
|
1092
|
+
readonly fit?: PrintableThreadFit | PrintableThreadFitPolicy;
|
|
1093
|
+
/** Nominal major diameter before female compensation and faceting correction. */
|
|
1094
|
+
readonly nominalMajorDiameter: number;
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
/**
|
|
1098
|
+
* Inverts a finite, non-singular affine transform.
|
|
1099
|
+
*
|
|
1100
|
+
* @param transform - Transform to invert.
|
|
1101
|
+
* @returns A new frozen transform whose composition with the input is identity.
|
|
1102
|
+
*/
|
|
1103
|
+
export declare function inverseTransform3(transform: Transform3): Transform3;
|
|
1104
|
+
|
|
1105
|
+
/**
|
|
1106
|
+
* Recognizes structured geometry errors from separately bundled Modeling copies in the same realm.
|
|
1107
|
+
* Ordinary errors and unmarked code-shaped objects are rejected. The marker is execution-local and
|
|
1108
|
+
* does not survive structured cloning; worker protocols carry their own serialized error envelope.
|
|
1109
|
+
*/
|
|
1110
|
+
export declare function isGeometryError(value: unknown): value is GeometryError;
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1113
|
+
* Concatenates meshes into one indexed mesh without welding coincident vertices.
|
|
1114
|
+
*
|
|
1115
|
+
* Inputs are validated and never mutated. Face order and winding remain stable.
|
|
1116
|
+
*
|
|
1117
|
+
* @param meshes - One or more meshes to concatenate.
|
|
1118
|
+
* @returns Fresh typed arrays with indices offset to their source vertex ranges.
|
|
1119
|
+
* @throws {@link GeometryError} When no mesh is supplied or an input is invalid.
|
|
1120
|
+
*/
|
|
1121
|
+
export declare function joinTriangleMeshes(meshes: readonly TriangleMesh[]): TriangleMesh;
|
|
1122
|
+
|
|
1123
|
+
/** Returns Euclidean vector length in the vector's coordinate units. */
|
|
1124
|
+
export declare const length3: (vector: Vec3) => number;
|
|
1125
|
+
|
|
1126
|
+
/** Linearly interpolates two vectors; `t` is dimensionless and may extrapolate. */
|
|
1127
|
+
export declare const lerp3: (a: Vec3, b: Vec3, t: number) => Vec3;
|
|
1128
|
+
|
|
1129
|
+
/** Straight planar curve in millimetres. */
|
|
1130
|
+
export declare interface LineCurve2 {
|
|
1131
|
+
/** Selects straight interpolation between the two endpoints. */
|
|
1132
|
+
readonly kind: "line";
|
|
1133
|
+
/** Initial XY point in millimetres. */
|
|
1134
|
+
readonly start: Vec2;
|
|
1135
|
+
/** Final XY point in millimetres. */
|
|
1136
|
+
readonly end: Vec2;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
/** Straight spatial curve in millimetres. */
|
|
1140
|
+
export declare interface LineCurve3 {
|
|
1141
|
+
/** Selects straight interpolation between the two endpoints. */
|
|
1142
|
+
readonly kind: "line";
|
|
1143
|
+
/** Initial XYZ point in millimetres. */
|
|
1144
|
+
readonly start: Vec3;
|
|
1145
|
+
/** Final XYZ point in millimetres. */
|
|
1146
|
+
readonly end: Vec3;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
/** Deterministic ordered edge subdivision or bounded geometric vertex association. */
|
|
1150
|
+
export declare type LoftCorrespondence = "direct" | "reindex" | "fast-distance" | "distance";
|
|
1151
|
+
|
|
1152
|
+
/**
|
|
1153
|
+
* Lofts simple point loops at z heights or explicit right-handed frames, in input order.
|
|
1154
|
+
*
|
|
1155
|
+
* An explicit correspondence method is required. CCW-normalized loops retain their
|
|
1156
|
+
* seam and original vertices; unequal counts gain subdivisions or repeated fan slots.
|
|
1157
|
+
* Both ends use ear-clipped caps, supporting concave profiles without center fans.
|
|
1158
|
+
* Intermediate slices interpolate placed world vertices, never frame axes.
|
|
1159
|
+
* Transformed coordinates must fit finite Float32 mesh storage.
|
|
1160
|
+
*
|
|
1161
|
+
* @example Loft with explicit point correspondence
|
|
1162
|
+
* ```ts
|
|
1163
|
+
* const bottom = rectangleLoop({ size: [20, 12] });
|
|
1164
|
+
* const top = rectangleLoop({ size: [30, 20], treatment: { kind: "round", radius: 3 } });
|
|
1165
|
+
* loftMesh([{ profile: bottom, z: 0 }, { profile: top, z: 30 }], { correspondence: "reindex" });
|
|
1166
|
+
* ```
|
|
1167
|
+
*/
|
|
1168
|
+
export declare function loftMesh(stations: readonly LoftMeshStation[], options: LoftOptions): TriangleMesh;
|
|
1169
|
+
|
|
1170
|
+
/** One point-data profile at a height or explicit right-handed spatial frame. */
|
|
1171
|
+
export declare type LoftMeshStation = LoftPlacement & {
|
|
1172
|
+
/** Ordered finite XY boundary points with an implicit closing edge. */
|
|
1173
|
+
readonly profile: Loop2;
|
|
1174
|
+
};
|
|
1175
|
+
|
|
1176
|
+
/**
|
|
1177
|
+
* Shared controls for native and pure lofts. Point data and arbitrary Sections require explicit correspondence.
|
|
1178
|
+
*/
|
|
1179
|
+
export declare interface LoftOptions {
|
|
1180
|
+
/** One method or one per consecutive station gap. Omitted preserves known landmarks, including circle/ellipse-to-rectangle corners, or maps other unlike primitive seams directly. */
|
|
1181
|
+
readonly correspondence?: LoftCorrespondence | readonly LoftCorrespondence[];
|
|
1182
|
+
/** Extra points follow edge length or distribute equally across existing segments. Defaults to perimeter for direct/reindex, or segments when any distance method is selected; distance methods require segments. */
|
|
1183
|
+
readonly distribution?: "perimeter" | "segments";
|
|
1184
|
+
/** Positive integer point-density multiplier, uniformly or per input profile. Original vertices are retained. Defaults to one. */
|
|
1185
|
+
readonly refine?: number | readonly number[];
|
|
1186
|
+
/** Nonnegative count of world-linearly interpolated profiles, uniformly or per gap. Defaults to zero. */
|
|
1187
|
+
readonly slices?: number | readonly number[];
|
|
1188
|
+
/** Physical curve policy for retained primitives, and maximum edge length for point data. Exact primitive curve counts take precedence. */
|
|
1189
|
+
readonly resolution?: GeometryResolution;
|
|
1190
|
+
/** Explicit output and sampling budgets; native operations may only lower host ceilings. */
|
|
1191
|
+
readonly limits?: Partial<ModelingLimits>;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
/**
|
|
1195
|
+
* A horizontal XY station height, or an explicit right-handed spatial frame, never both.
|
|
1196
|
+
*/
|
|
1197
|
+
export declare type LoftPlacement = {
|
|
1198
|
+
/** Horizontal XY station height in millimetres. */
|
|
1199
|
+
readonly z: number;
|
|
1200
|
+
/** Excluded when a horizontal height is supplied. */
|
|
1201
|
+
readonly frame?: never;
|
|
1202
|
+
} | {
|
|
1203
|
+
/** Right-handed orthonormal station frame in world coordinates. */
|
|
1204
|
+
readonly frame: Frame3;
|
|
1205
|
+
/** Excluded when an explicit spatial frame is supplied. */
|
|
1206
|
+
readonly z?: never;
|
|
1207
|
+
};
|
|
1208
|
+
|
|
1209
|
+
/**
|
|
1210
|
+
* A closed two-dimensional boundary whose first point is not repeated at the end.
|
|
1211
|
+
*
|
|
1212
|
+
* Polygon exteriors are counter-clockwise and holes are clockwise. Algorithms
|
|
1213
|
+
* may reject duplicate adjacent points or fewer than three effective vertices.
|
|
1214
|
+
*/
|
|
1215
|
+
export declare type Loop2 = readonly Vec2[];
|
|
1216
|
+
|
|
1217
|
+
/** Returns true when a point lies inside or on the boundary of a loop. */
|
|
1218
|
+
export declare function loopContainsPoint(loop: Loop2, point: Vec2): boolean;
|
|
1219
|
+
|
|
1220
|
+
/**
|
|
1221
|
+
* Explicitly matches identified component/contour/span topology across a family.
|
|
1222
|
+
* Every paired span uses the maximum physical subdivision count requested by any member.
|
|
1223
|
+
* Cubics share a checked uniform parameter grid, including grids selected by exact paired requests.
|
|
1224
|
+
* Input order and winding are preserved. Collapsed spans retain repeated logical slots, which
|
|
1225
|
+
* the engine maps to shared physical vertices while omitting degenerate faces.
|
|
1226
|
+
*
|
|
1227
|
+
* @example Match named rectangle landmarks
|
|
1228
|
+
* ```ts
|
|
1229
|
+
* matchProfiles([
|
|
1230
|
+
* rectangleProfile({ size: [20, 12] }),
|
|
1231
|
+
* rectangleProfile({ size: [30, 20], treatment: { kind: "round", radius: 3 } }),
|
|
1232
|
+
* ]);
|
|
1233
|
+
* ```
|
|
1234
|
+
*/
|
|
1235
|
+
export declare function matchProfiles(profiles: readonly Profile[], options?: MatchProfilesOptions): readonly CorrespondingProfile[];
|
|
1236
|
+
|
|
1237
|
+
/** Explicit family sampling settings; omitted values use physical package defaults. */
|
|
1238
|
+
export declare interface MatchProfilesOptions {
|
|
1239
|
+
/** Local physical sampling policy; exact interval counts take precedence. */
|
|
1240
|
+
readonly resolution?: GeometryResolution;
|
|
1241
|
+
/** Explicit per-profile and circular ceilings; the family also has a one-million-slot work bound. */
|
|
1242
|
+
readonly limits?: Partial<GeometrySamplingLimits>;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
/**
|
|
1246
|
+
* Measures sampled kinematic interference over one tooth cycle of an internal gear pair.
|
|
1247
|
+
*
|
|
1248
|
+
* The driver and ring rotate in the same direction at their resolved tooth-count ratio. Each
|
|
1249
|
+
* sampled pinion outline is subtracted from the ring's center-and-space opening; remaining area is
|
|
1250
|
+
* solid overlap. This catches involute, tip, and trimming interference that a single assembled pose
|
|
1251
|
+
* misses. It is a deterministic model check, not a certified gear-rating calculation.
|
|
1252
|
+
*/
|
|
1253
|
+
export declare function measureInternalCylindricalGearPairMotion(spec: CylindricalGearPairSpec, options?: CylindricalGearPairMotionOptions): CylindricalGearPairMotionReport;
|
|
1254
|
+
|
|
1255
|
+
/**
|
|
1256
|
+
* Measures bounds, surface area, and signed volume without changing the mesh.
|
|
1257
|
+
*
|
|
1258
|
+
* Signed volume is meaningful for a consistently wound closed mesh. Set
|
|
1259
|
+
* `requireClosed` when measurements will be used as manufacturing assertions.
|
|
1260
|
+
*
|
|
1261
|
+
* @param mesh - Mesh to validate and measure.
|
|
1262
|
+
* @param options - Validation policy applied before measurement.
|
|
1263
|
+
* @returns Immutable deterministic scalar and bounds measurements.
|
|
1264
|
+
*/
|
|
1265
|
+
export declare function measureTriangleMesh(mesh: TriangleMesh, options?: TriangleMeshValidationOptions): TriangleMeshMeasurements;
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* Axis-aligned bounds of a non-empty triangle mesh.
|
|
1269
|
+
*/
|
|
1270
|
+
export declare interface MeshBounds {
|
|
1271
|
+
/** Inclusive minimum XYZ coordinates. */
|
|
1272
|
+
readonly min: Vec3;
|
|
1273
|
+
/** Inclusive maximum XYZ coordinates. */
|
|
1274
|
+
readonly max: Vec3;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
/**
|
|
1278
|
+
* Computes axis-aligned bounds for a non-empty mesh.
|
|
1279
|
+
*
|
|
1280
|
+
* @param mesh - Mesh whose finite complete vertices will be measured.
|
|
1281
|
+
* @returns Fresh immutable minimum and maximum XYZ tuples.
|
|
1282
|
+
* @throws {@link GeometryError} When the mesh is structurally invalid.
|
|
1283
|
+
*/
|
|
1284
|
+
export declare const meshBounds: (mesh: TriangleMesh) => MeshBounds;
|
|
1285
|
+
|
|
1286
|
+
/**
|
|
1287
|
+
* Curated metric modeling dimensions for clearance holes, regular hex nuts,
|
|
1288
|
+
* and socket-head cap screws.
|
|
1289
|
+
*
|
|
1290
|
+
* Values are nominal reference dimensions intended for parametric envelopes.
|
|
1291
|
+
* Manufacturing tolerances, coatings, and printer compensation remain caller
|
|
1292
|
+
* responsibilities.
|
|
1293
|
+
*/
|
|
1294
|
+
export declare const METRIC_FASTENER_STANDARDS: Readonly<{
|
|
1295
|
+
/** Nominal M2 coarse-thread modeling dimensions. */
|
|
1296
|
+
M2: MetricFastenerStandard;
|
|
1297
|
+
/** Nominal M2.5 coarse-thread modeling dimensions. */
|
|
1298
|
+
"M2.5": MetricFastenerStandard;
|
|
1299
|
+
/** Nominal M3 coarse-thread modeling dimensions. */
|
|
1300
|
+
M3: MetricFastenerStandard;
|
|
1301
|
+
/** Nominal M4 coarse-thread modeling dimensions. */
|
|
1302
|
+
M4: MetricFastenerStandard;
|
|
1303
|
+
/** Nominal M5 coarse-thread modeling dimensions. */
|
|
1304
|
+
M5: MetricFastenerStandard;
|
|
1305
|
+
/** Nominal M6 coarse-thread modeling dimensions. */
|
|
1306
|
+
M6: MetricFastenerStandard;
|
|
1307
|
+
/** Nominal M8 coarse-thread modeling dimensions. */
|
|
1308
|
+
M8: MetricFastenerStandard;
|
|
1309
|
+
/** Nominal M10 coarse-thread modeling dimensions. */
|
|
1310
|
+
M10: MetricFastenerStandard;
|
|
1311
|
+
/** Nominal M12 coarse-thread modeling dimensions. */
|
|
1312
|
+
M12: MetricFastenerStandard;
|
|
1313
|
+
}>;
|
|
1314
|
+
|
|
1315
|
+
/** Metric fastener sizes included in the first mechanical standards table. */
|
|
1316
|
+
export declare type MetricFastenerSize = "M2" | "M2.5" | "M3" | "M4" | "M5" | "M6" | "M8" | "M10" | "M12";
|
|
1317
|
+
|
|
1318
|
+
/** Small immutable metric fastener record for modeling common mating features. */
|
|
1319
|
+
export declare interface MetricFastenerStandard {
|
|
1320
|
+
/** Coarse thread pitch in millimetres. */
|
|
1321
|
+
readonly coarsePitch: number;
|
|
1322
|
+
/** Recommended clearance-hole diameters. */
|
|
1323
|
+
readonly clearanceHoles: ClearanceHoleDimensions;
|
|
1324
|
+
/** Regular hex-nut envelope. */
|
|
1325
|
+
readonly hexNut: MetricHexNutDimensions;
|
|
1326
|
+
/** Nominal fastener diameter in millimetres. */
|
|
1327
|
+
readonly nominalDiameter: number;
|
|
1328
|
+
/** Socket-head cap screw envelope and drive size. */
|
|
1329
|
+
readonly socketCapHead: MetricSocketCapHeadDimensions;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
/** Regular hex-nut envelope dimensions in millimetres. */
|
|
1333
|
+
export declare interface MetricHexNutDimensions {
|
|
1334
|
+
/** Nominal wrench size across flats. */
|
|
1335
|
+
readonly acrossFlats: number;
|
|
1336
|
+
/** Nominal full-nut thickness. */
|
|
1337
|
+
readonly thickness: number;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
/** Socket-head cap screw head and drive dimensions in millimetres. */
|
|
1341
|
+
export declare interface MetricSocketCapHeadDimensions {
|
|
1342
|
+
/** Nominal cylindrical head diameter. */
|
|
1343
|
+
readonly diameter: number;
|
|
1344
|
+
/** Nominal head height. */
|
|
1345
|
+
readonly height: number;
|
|
1346
|
+
/** Nominal internal hex key size across flats. */
|
|
1347
|
+
readonly hexKey: number;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* Returns the smallest unshifted full-depth external tooth count that avoids rack-cutter undercut.
|
|
1352
|
+
*
|
|
1353
|
+
* The normal-plane limit is `2 / sin²(alpha_n)`. Helical gears use the standard virtual tooth
|
|
1354
|
+
* count `z_v = z / cos³(beta)`, so increasing helix angle can reduce the physical tooth count.
|
|
1355
|
+
*/
|
|
1356
|
+
export declare function minimumCylindricalGearToothCountWithoutUndercut(spec?: Readonly<Pick<CylindricalGearSpec, "helixAngleDegrees" | "pressureAngleDegrees">>): number;
|
|
1357
|
+
|
|
1358
|
+
/** Aggregate manufacturing output ceilings selected by a trusted host. */
|
|
1359
|
+
export declare interface ModelingLimits extends GeometrySamplingLimits {
|
|
1360
|
+
/** Maximum number of named finalized parts. */
|
|
1361
|
+
readonly maxParts: number;
|
|
1362
|
+
/** Maximum aggregate output vertex count. */
|
|
1363
|
+
readonly maxVertices: number;
|
|
1364
|
+
/** Maximum aggregate output triangle count. */
|
|
1365
|
+
readonly maxTriangles: number;
|
|
1366
|
+
/** Maximum unique transferable output backing-buffer bytes. */
|
|
1367
|
+
readonly maxBytes: number;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
/** Normalizes a finite vector and rejects nonfinite lengths or lengths at or below `epsilon`. */
|
|
1371
|
+
export declare const normalize3: (vector: Vec3, epsilon?: number) => Vec3;
|
|
1372
|
+
|
|
1373
|
+
/**
|
|
1374
|
+
* Cleans and validates one closed loop.
|
|
1375
|
+
*
|
|
1376
|
+
* Adjacent duplicates and a repeated seam point are removed. Coordinates must
|
|
1377
|
+
* be finite, the effective loop must contain at least three points, and the
|
|
1378
|
+
* result must be simple and have non-zero area. Previously validated immutable results may be
|
|
1379
|
+
* returned unchanged when their winding and tolerance policy match.
|
|
1380
|
+
*/
|
|
1381
|
+
export declare function normalizeLoop2(input: readonly Vec2[], counterClockwise: boolean, tolerance?: GeometryToleranceOptions): Loop2;
|
|
1382
|
+
|
|
1383
|
+
/**
|
|
1384
|
+
* Validates explicit polygon topology and normalizes its winding.
|
|
1385
|
+
*
|
|
1386
|
+
* Exteriors become CCW and holes clockwise. Every hole must lie strictly
|
|
1387
|
+
* within its exterior and boundaries may not intersect. Previously validated immutable results
|
|
1388
|
+
* may be returned unchanged under the same tolerance policy.
|
|
1389
|
+
*/
|
|
1390
|
+
export declare function normalizePolygon2(polygon: Polygon2, tolerance?: GeometryToleranceOptions): Polygon2;
|
|
1391
|
+
|
|
1392
|
+
/**
|
|
1393
|
+
* Validates a disjoint explicit region and returns immutable normalized data.
|
|
1394
|
+
* Previously validated immutable results may be returned unchanged under the same tolerance policy.
|
|
1395
|
+
*/
|
|
1396
|
+
export declare function normalizeRegion2(region: Region2, tolerance?: GeometryToleranceOptions): Region2;
|
|
1397
|
+
|
|
1398
|
+
/** An open radius/height outline; consumers own closure, mounting geometry, and wall policy. */
|
|
1399
|
+
export declare interface OpenProfileCurve {
|
|
1400
|
+
/** Initial radius/height anchor. */
|
|
1401
|
+
readonly start: OpenProfilePoint;
|
|
1402
|
+
/** Ordered chain of 1–31 straight or cubic segments. */
|
|
1403
|
+
readonly segments: readonly OpenProfileSegment[];
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
/** Radius and upward height in millimetres, or in units converted by sampling scales. */
|
|
1407
|
+
export declare interface OpenProfilePoint {
|
|
1408
|
+
/** Nonnegative distance from the revolution axis. */
|
|
1409
|
+
readonly radius: number;
|
|
1410
|
+
/** Upward axial coordinate; anchors progress strictly upward. */
|
|
1411
|
+
readonly height: number;
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
/** One straight or cubic segment of an open, upward-progressing radius/height outline. */
|
|
1415
|
+
export declare type OpenProfileSegment = {
|
|
1416
|
+
/** Straight segment discriminator. */
|
|
1417
|
+
readonly type: "line";
|
|
1418
|
+
/** Next strictly higher anchor. */
|
|
1419
|
+
readonly end: OpenProfilePoint;
|
|
1420
|
+
} | {
|
|
1421
|
+
/** Cubic Bézier segment discriminator. */
|
|
1422
|
+
readonly type: "cubic";
|
|
1423
|
+
/** Outgoing control, with height between the start and second control. */
|
|
1424
|
+
readonly control1: OpenProfilePoint;
|
|
1425
|
+
/** Incoming control, with height between the first control and end. */
|
|
1426
|
+
readonly control2: OpenProfilePoint;
|
|
1427
|
+
/** Next strictly higher anchor. */
|
|
1428
|
+
readonly end: OpenProfilePoint;
|
|
1429
|
+
};
|
|
1430
|
+
|
|
1431
|
+
/**
|
|
1432
|
+
* Improves pathological planar triangulation with bounded legal diagonal flips.
|
|
1433
|
+
*
|
|
1434
|
+
* The operation changes indices only: it never moves, adds, welds, or removes vertices; never
|
|
1435
|
+
* crosses a coplanar-patch boundary; and never changes the face count. Each accepted flip improves
|
|
1436
|
+
* a deterministic ordering of triangle angles, aspect ratio, diagonal locality, and local
|
|
1437
|
+
* incidence/valence concentration. Unsupported input or a failed final integrity check returns the
|
|
1438
|
+
* exact original mesh object. Malformed buffers and the configured analysis complexity limit throw.
|
|
1439
|
+
*
|
|
1440
|
+
* @param mesh - Closed, consistently wound indexed triangle mesh in arbitrary consistent units.
|
|
1441
|
+
* @param options - Patch eligibility, numeric tolerance, and deterministic work bounds.
|
|
1442
|
+
* @returns Optimized connectivity and before/after diagnostics, or an unchanged safe fallback.
|
|
1443
|
+
*/
|
|
1444
|
+
export declare function optimizePlanarPatches(mesh: TriangleMesh, options?: PlanarMeshOptimizationOptions): PlanarMeshOptimizationResult;
|
|
1445
|
+
|
|
1446
|
+
/** An ordered, open sequence of two-dimensional points. */
|
|
1447
|
+
export declare type Path2 = readonly Vec2[];
|
|
1448
|
+
|
|
1449
|
+
/**
|
|
1450
|
+
* An ordered, open sequence of three-dimensional points.
|
|
1451
|
+
*/
|
|
1452
|
+
export declare type Path3 = readonly Vec3[];
|
|
1453
|
+
|
|
1454
|
+
/** Orthonormal right-handed frame sampled along a path. */
|
|
1455
|
+
export declare interface PathFrame {
|
|
1456
|
+
/** Unit path tangent. */
|
|
1457
|
+
readonly tangent: Vec3;
|
|
1458
|
+
/** Unit transported profile X axis. */
|
|
1459
|
+
readonly normal: Vec3;
|
|
1460
|
+
/** Unit profile Y axis equal to tangent × normal. */
|
|
1461
|
+
readonly binormal: Vec3;
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
/**
|
|
1465
|
+
* Returns total sampled 3D path length, or zero for an empty path.
|
|
1466
|
+
*/
|
|
1467
|
+
export declare const pathLength: (path: readonly Vec3[], limits?: Partial<GeometrySamplingLimits>) => number;
|
|
1468
|
+
|
|
1469
|
+
/**
|
|
1470
|
+
* Supplies a profile-X orientation guide for each original normalized sweep station.
|
|
1471
|
+
*
|
|
1472
|
+
* @param point - Current XYZ path point in model units.
|
|
1473
|
+
* @param index - Zero-based index of `point` in the normalized authored sweep path.
|
|
1474
|
+
* @returns A finite guide vector that is not parallel to the local path tangent.
|
|
1475
|
+
*/
|
|
1476
|
+
export declare type PathNormalGuide = (point: Vec3, index: number) => Vec3;
|
|
1477
|
+
|
|
1478
|
+
/** Position and unit tangent for one path-distributed item. */
|
|
1479
|
+
export declare interface PathPlacement {
|
|
1480
|
+
/** Interpolated point on the sampled path. */
|
|
1481
|
+
readonly position: Vec3;
|
|
1482
|
+
/** Unit tangent of the path segment containing the placement. */
|
|
1483
|
+
readonly tangent: Vec3;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
/** Stable reason why planar optimization returned the original mesh unchanged. */
|
|
1487
|
+
export declare type PlanarMeshOptimizationFallbackReason = "candidate-boundary-changed" | "candidate-measurements-changed" | "candidate-not-closed-oriented-manifold" | "candidate-quality-regressed" | "input-not-closed-oriented-manifold";
|
|
1488
|
+
|
|
1489
|
+
/** Options controlling bounded, connectivity-only optimization of planar triangle patches. */
|
|
1490
|
+
export declare interface PlanarMeshOptimizationOptions extends TriangleMeshQualityOptions {
|
|
1491
|
+
/**
|
|
1492
|
+
* Maximum attempted edge evaluations. By default this is twenty times the initial candidate
|
|
1493
|
+
* edge count, capped at `1000000`.
|
|
1494
|
+
*/
|
|
1495
|
+
readonly maximumFlipAttempts?: number;
|
|
1496
|
+
/** Maximum times one edge may be reconsidered after neighbouring flips. Defaults to `12`. */
|
|
1497
|
+
readonly maximumEdgeRevisits?: number;
|
|
1498
|
+
/** Maximum triangles allowed in one selected patch. Defaults to `50000`. */
|
|
1499
|
+
readonly maximumPatchTriangleCount?: number;
|
|
1500
|
+
/** Maximum cumulative triangles across selected patches. Defaults to `200000`. */
|
|
1501
|
+
readonly maximumProcessedTriangleCount?: number;
|
|
1502
|
+
/** Minimum triangles required before a planar patch is eligible. Defaults to `8`. */
|
|
1503
|
+
readonly minimumPatchTriangleCount?: number;
|
|
1504
|
+
/** Select patches whose worst normalized aspect ratio exceeds this value. Defaults to `12`. */
|
|
1505
|
+
readonly triggerMaximumAspectRatio?: number;
|
|
1506
|
+
/** Select patches whose largest per-vertex triangle share exceeds this ratio. Defaults to `0.2`. */
|
|
1507
|
+
readonly triggerMaximumFanRatio?: number;
|
|
1508
|
+
/** Select patches whose largest vertex triangle incidence exceeds this value. Defaults to `16`. */
|
|
1509
|
+
readonly triggerMaximumVertexTriangleIncidence?: number;
|
|
1510
|
+
/** Select patches whose smallest interior angle is below this many degrees. Defaults to `8`. */
|
|
1511
|
+
readonly triggerMinimumAngleDegrees?: number;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
/** Outcome of bounded planar-patch optimization, including before/after diagnostics. */
|
|
1515
|
+
export declare interface PlanarMeshOptimizationResult {
|
|
1516
|
+
/** Quality report for the returned mesh; equal to `before` on unchanged or fallback results. */
|
|
1517
|
+
readonly after: TriangleMeshQualityReport;
|
|
1518
|
+
/** Quality report for the supplied mesh. */
|
|
1519
|
+
readonly before: TriangleMeshQualityReport;
|
|
1520
|
+
/** Whether a work bound stopped evaluation while eligible work remained. */
|
|
1521
|
+
readonly budgetExhausted: boolean;
|
|
1522
|
+
/** Whether the returned mesh has different triangle connectivity. */
|
|
1523
|
+
readonly changed: boolean;
|
|
1524
|
+
/** Safety reason when candidate validation rejected optimization or input topology was unsupported. */
|
|
1525
|
+
readonly fallbackReason?: PlanarMeshOptimizationFallbackReason;
|
|
1526
|
+
/** Number of accepted legal diagonal flips. */
|
|
1527
|
+
readonly flipCount: number;
|
|
1528
|
+
/** Returned mesh; unchanged results preserve the exact input object. */
|
|
1529
|
+
readonly mesh: TriangleMesh;
|
|
1530
|
+
/** Number of planar patches in which at least one edge was flipped. */
|
|
1531
|
+
readonly optimizedPatchCount: number;
|
|
1532
|
+
/** Number of triggered patches omitted because a configured triangle bound would be exceeded. */
|
|
1533
|
+
readonly skippedPatchCount: number;
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
/** Quality measurements for one edge-connected coplanar triangle patch. */
|
|
1537
|
+
export declare interface PlanarPatchQuality {
|
|
1538
|
+
/** Number of edges separating this patch from another plane or the mesh boundary. */
|
|
1539
|
+
readonly boundaryEdgeCount: number;
|
|
1540
|
+
/** Number of connected boundary loops; holes contribute additional loops. */
|
|
1541
|
+
readonly boundaryLoopCount: number;
|
|
1542
|
+
/** Maximum ratio of one vertex's incident patch triangles to the patch triangle count. */
|
|
1543
|
+
readonly fanRatio: number;
|
|
1544
|
+
/** Lowest source triangle index in this deterministic patch. */
|
|
1545
|
+
readonly firstTriangleIndex: number;
|
|
1546
|
+
/** Stable zero-based patch identifier in first-triangle order. */
|
|
1547
|
+
readonly id: number;
|
|
1548
|
+
/** Number of edges shared by two triangles within this patch. */
|
|
1549
|
+
readonly internalEdgeCount: number;
|
|
1550
|
+
/** Largest normalized triangle aspect ratio; an equilateral triangle has ratio `1`. */
|
|
1551
|
+
readonly maximumTriangleAspectRatio: number;
|
|
1552
|
+
/** Largest number of patch triangles incident to one vertex. */
|
|
1553
|
+
readonly maximumVertexTriangleIncidence: number;
|
|
1554
|
+
/** Largest number of distinct patch neighbours connected to one vertex. */
|
|
1555
|
+
readonly maximumVertexValence: number;
|
|
1556
|
+
/** Smallest interior triangle angle in degrees. */
|
|
1557
|
+
readonly minimumTriangleAngleDegrees: number;
|
|
1558
|
+
/** Consistently wound unit normal for the patch plane. */
|
|
1559
|
+
readonly normal: Vec3;
|
|
1560
|
+
/** Plane offset in `dot(normal, position) = planeOffset` form, in model units. */
|
|
1561
|
+
readonly planeOffset: number;
|
|
1562
|
+
/** Total patch area in squared model units. */
|
|
1563
|
+
readonly surfaceArea: number;
|
|
1564
|
+
/** Number of triangles in this patch. */
|
|
1565
|
+
readonly triangleCount: number;
|
|
1566
|
+
/** Number of distinct indexed vertices referenced by this patch. */
|
|
1567
|
+
readonly vertexCount: number;
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
/**
|
|
1571
|
+
* One bounded two-dimensional polygon.
|
|
1572
|
+
*
|
|
1573
|
+
* `outer` is counter-clockwise and each hole is clockwise. Boundary arrays omit
|
|
1574
|
+
* their duplicated closing point. Holes must lie inside `outer` and must not
|
|
1575
|
+
* intersect each other or the exterior.
|
|
1576
|
+
*/
|
|
1577
|
+
export declare interface Polygon2 {
|
|
1578
|
+
/** Clockwise interior boundaries, each omitting its duplicated closing point. */
|
|
1579
|
+
readonly holes: readonly Loop2[];
|
|
1580
|
+
/** Counter-clockwise exterior boundary, omitting its duplicated closing point. */
|
|
1581
|
+
readonly outer: Loop2;
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
/**
|
|
1585
|
+
* Equal arc-length sampling of an open path or an implicitly closed loop.
|
|
1586
|
+
*/
|
|
1587
|
+
export declare interface PolylineResamplingOptions extends CurveSamplingOptions {
|
|
1588
|
+
/** Exact equal arc-length intervals; closed paths require at least three. */
|
|
1589
|
+
readonly segments?: number;
|
|
1590
|
+
/** Includes the closing edge without repeating the first output point; defaults to false. */
|
|
1591
|
+
readonly closed?: boolean;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
/** Checks regular-grid dimensions and bounds allocation before evaluating any height samples. */
|
|
1595
|
+
export declare function preflightHeightfield(options: HeightfieldOptions, limits?: HeightfieldMeshLimits): HeightfieldPreflight;
|
|
1596
|
+
|
|
1597
|
+
/**
|
|
1598
|
+
* Validates a direct thread solid and returns its conservative allocation estimate without
|
|
1599
|
+
* constructing vertex or index buffers.
|
|
1600
|
+
*/
|
|
1601
|
+
export declare function preflightHelicalThreadSolidMesh(options: HelicalThreadSolidMeshOptions): HelicalThreadSolidMeshPreflight;
|
|
1602
|
+
|
|
1603
|
+
/** Preflights the exact extended mesh used by the internal thread cutter constructor. */
|
|
1604
|
+
export declare function preflightInternalThreadCutter(options: InternalThreadCutterOptions): HelicalThreadSolidMeshPreflight;
|
|
1605
|
+
|
|
1606
|
+
/**
|
|
1607
|
+
* Preflights bounded SVG geometry without browser or Manifold dependencies.
|
|
1608
|
+
*
|
|
1609
|
+
* @param svg - Complete SVG XML source, limited to 256 KiB of UTF-8.
|
|
1610
|
+
* @param options - Physical flattening and viewport-origin controls.
|
|
1611
|
+
* @returns The canonical normalized region plus bounded source, topology, and safe-repair facts.
|
|
1612
|
+
*/
|
|
1613
|
+
export declare function preflightSvgRegion(svg: string, options?: SvgImportOptions): SvgRegionPreflight;
|
|
1614
|
+
|
|
1615
|
+
/**
|
|
1616
|
+
* Resolves a nut's exact body/cutter chamfer and preflights its extended thread mesh without
|
|
1617
|
+
* allocating Manifold WASM objects.
|
|
1618
|
+
*/
|
|
1619
|
+
export declare function preflightThreadedNut(options: ThreadedNutOptions): ThreadedNutPreflight;
|
|
1620
|
+
|
|
1621
|
+
/** Preflights the exact compensated direct mesh used by the threaded rod constructor. */
|
|
1622
|
+
export declare function preflightThreadedRod(options: ThreadedRodOptions): HelicalThreadSolidMeshPreflight;
|
|
1623
|
+
|
|
1624
|
+
/** Placement shared by solid and filled-section factories. */
|
|
1625
|
+
export declare interface PrimitivePlacement {
|
|
1626
|
+
/** Applied after local construction; Section placement must preserve the XY plane. */
|
|
1627
|
+
readonly placement?: PrimitivePlacementOptions;
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
/** Maps an explicit or named shape-local attachment anchor onto a world-space anchor. */
|
|
1631
|
+
export declare interface PrimitivePlacementOptions {
|
|
1632
|
+
/** Shape-local source frame or a named primitive anchor such as bottom. */
|
|
1633
|
+
readonly source: Anchor3 | string;
|
|
1634
|
+
/** World-space target frame in millimetres. */
|
|
1635
|
+
readonly target: Anchor3;
|
|
1636
|
+
/** Align outward directions face-to-face or in parallel. Defaults to opposed. */
|
|
1637
|
+
readonly alignment?: "opposed" | "same";
|
|
1638
|
+
/** Finite separation along the target direction in millimetres. Defaults to zero. */
|
|
1639
|
+
readonly gap?: number;
|
|
1640
|
+
/** Finite additional roll around the attached direction in degrees. Defaults to zero. */
|
|
1641
|
+
readonly spinDegrees?: number;
|
|
1642
|
+
/** Explicit numeric comparison overrides for anchor normalization. */
|
|
1643
|
+
readonly tolerance?: GeometryToleranceOptions;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
/**
|
|
1647
|
+
* Conservative baseline print-fit policies in millimetres.
|
|
1648
|
+
*
|
|
1649
|
+
* These are modeling defaults, not manufacturing guarantees. A caller should
|
|
1650
|
+
* calibrate them for its printer, material, layer height, and thread scale.
|
|
1651
|
+
*/
|
|
1652
|
+
export declare const PRINTABLE_THREAD_FIT_POLICIES: Readonly<{
|
|
1653
|
+
/** Small baseline clearance for calibrated, accurate printers. */
|
|
1654
|
+
tight: PrintableThreadFitPolicy;
|
|
1655
|
+
/** General-purpose baseline clearance. */
|
|
1656
|
+
normal: PrintableThreadFitPolicy;
|
|
1657
|
+
/** Generous baseline clearance for rougher prints or easy assembly. */
|
|
1658
|
+
loose: PrintableThreadFitPolicy;
|
|
1659
|
+
}>;
|
|
1660
|
+
|
|
1661
|
+
/**
|
|
1662
|
+
* Named baseline fit policies for calibrated FDM-style printed threads.
|
|
1663
|
+
*/
|
|
1664
|
+
export declare type PrintableThreadFit = "tight" | "normal" | "loose";
|
|
1665
|
+
|
|
1666
|
+
/**
|
|
1667
|
+
* Explicit radial and axial allowances for a mating printed thread pair.
|
|
1668
|
+
*
|
|
1669
|
+
* Male and female radial values are applied independently, so their sum is the
|
|
1670
|
+
* assembled radial clearance. Values are millimetres and intentionally do not
|
|
1671
|
+
* encode printer, material, or process calibration.
|
|
1672
|
+
*/
|
|
1673
|
+
export declare interface PrintableThreadFitPolicy {
|
|
1674
|
+
/** Nominal axial backlash available between opposing flanks. */
|
|
1675
|
+
readonly axialBacklash: number;
|
|
1676
|
+
/** Radial increase applied to an internal thread envelope. */
|
|
1677
|
+
readonly femaleRadialOutset: number;
|
|
1678
|
+
/** Radial reduction applied to an external thread envelope. */
|
|
1679
|
+
readonly maleRadialInset: number;
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
/** An explicit component/contour/span topology, before shared family sampling. */
|
|
1683
|
+
export declare interface Profile {
|
|
1684
|
+
/** Ordered components with explicit contour identities. */
|
|
1685
|
+
readonly components: readonly ProfileComponent2[];
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
/** One component and its explicitly identified holes. */
|
|
1689
|
+
export declare interface ProfileComponent2 {
|
|
1690
|
+
/** Stable canonical lowercase identity; unique within the containing topology or output. */
|
|
1691
|
+
readonly id: string;
|
|
1692
|
+
/** Counterclockwise outer contour. */
|
|
1693
|
+
readonly outer: ProfileContour2;
|
|
1694
|
+
/** Clockwise hole contours belonging to this component. */
|
|
1695
|
+
readonly holes: readonly ProfileContour2[];
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
/** Ordered, closed spans. Outer winding is CCW and hole winding is CW. */
|
|
1699
|
+
export declare interface ProfileContour2 {
|
|
1700
|
+
/** Stable canonical lowercase identity; unique within the containing topology or output. */
|
|
1701
|
+
readonly id: string;
|
|
1702
|
+
/** Ordered identified spans; the last endpoint meets the first start. */
|
|
1703
|
+
readonly spans: readonly ProfileSpan2[];
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
/** A deliberately sampled, inward-only corner profile with exact polyline geometry. */
|
|
1707
|
+
export declare interface ProfiledEdgeTreatment {
|
|
1708
|
+
/** Selects an explicit corner profile; no analytic curve is inferred from its samples. */
|
|
1709
|
+
readonly kind: "profile";
|
|
1710
|
+
/**
|
|
1711
|
+
* Millimetre setbacks on adjoining surfaces, from [positive, 0] to [0, positive].
|
|
1712
|
+
* First coordinates decrease and second coordinates increase. Cylinder/extrusion ends use
|
|
1713
|
+
* cap inset first, side setback second; planar corners use incoming then outgoing edges.
|
|
1714
|
+
*/
|
|
1715
|
+
readonly profile: readonly Vec2[];
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
/** An identified line, circular arc, or cubic Bézier between corresponding landmarks. */
|
|
1719
|
+
export declare type ProfileSpan2 = {
|
|
1720
|
+
/** Stable canonical lowercase identity; unique within the containing topology or output. */
|
|
1721
|
+
readonly id: string;
|
|
1722
|
+
/** Optional exact span interval count; the family uses the largest requested count. */
|
|
1723
|
+
readonly segments?: number;
|
|
1724
|
+
/** Optional span-local physical sampling over the family's resolution; exact intervals take precedence. */
|
|
1725
|
+
readonly resolution?: GeometryResolution;
|
|
1726
|
+
} & ({
|
|
1727
|
+
/** Selects a straight span. */
|
|
1728
|
+
readonly kind: "line";
|
|
1729
|
+
/** Start point in millimetres. */
|
|
1730
|
+
readonly start: Vec2;
|
|
1731
|
+
/** End point in millimetres. */
|
|
1732
|
+
readonly end: Vec2;
|
|
1733
|
+
} | {
|
|
1734
|
+
/** Selects the geometric curve or span family. */
|
|
1735
|
+
readonly kind: "arc";
|
|
1736
|
+
/** Center point in millimetres. */
|
|
1737
|
+
readonly center: Vec2;
|
|
1738
|
+
/** Circular radius in millimetres. */
|
|
1739
|
+
readonly radius: number;
|
|
1740
|
+
/** Initial counterclockwise angle in degrees. */
|
|
1741
|
+
readonly startDegrees: number;
|
|
1742
|
+
/** Signed counterclockwise angular sweep in degrees. */
|
|
1743
|
+
readonly sweepDegrees: number;
|
|
1744
|
+
} | {
|
|
1745
|
+
/** Selects a cubic Bézier span with the same coordinates as CubicBezierCurve2. */
|
|
1746
|
+
readonly kind: "cubic";
|
|
1747
|
+
/** Start point in millimetres. */
|
|
1748
|
+
readonly start: Vec2;
|
|
1749
|
+
/** First control point in millimetres. */
|
|
1750
|
+
readonly control1: Vec2;
|
|
1751
|
+
/** Second control point in millimetres. */
|
|
1752
|
+
readonly control2: Vec2;
|
|
1753
|
+
/** End point in millimetres. */
|
|
1754
|
+
readonly end: Vec2;
|
|
1755
|
+
});
|
|
1756
|
+
|
|
1757
|
+
/** Removes the component parallel to a normalized plane normal. */
|
|
1758
|
+
export declare const projectOntoPlane3: (vector: Vec3, normal: Vec3) => Vec3;
|
|
1759
|
+
|
|
1760
|
+
/** Resolved pitch-line dimensions for a finite rack segment. */
|
|
1761
|
+
export declare interface RackPitchDimensions {
|
|
1762
|
+
/** Tooth height above the pitch line, in millimetres. */
|
|
1763
|
+
readonly addendum: number;
|
|
1764
|
+
/** Tooth root depth below the pitch line, in millimetres. */
|
|
1765
|
+
readonly dedendum: number;
|
|
1766
|
+
/** Signed helix angle, in radians. */
|
|
1767
|
+
readonly helixAngleRadians: number;
|
|
1768
|
+
/** Total pitch-line length for the requested tooth count, in millimetres. */
|
|
1769
|
+
readonly length: number;
|
|
1770
|
+
/** Transverse linear pitch between teeth, in millimetres. */
|
|
1771
|
+
readonly pitch: number;
|
|
1772
|
+
/** Transverse pressure angle, in radians. */
|
|
1773
|
+
readonly pressureAngleRadians: number;
|
|
1774
|
+
/** Tangential tooth thickness at the pitch line, in millimetres. */
|
|
1775
|
+
readonly toothThicknessAtPitch: number;
|
|
1776
|
+
/** Number of complete teeth represented by the segment. */
|
|
1777
|
+
readonly toothCount: number;
|
|
1778
|
+
/** Normal module supplied by the caller, in millimetres. */
|
|
1779
|
+
readonly module: number;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
/** Normal-plane inputs for a finite rack pitch segment. */
|
|
1783
|
+
export declare interface RackPitchSpec {
|
|
1784
|
+
/** Tangential tooth-thickness reduction at the pitch line, in millimetres. */
|
|
1785
|
+
readonly backlash?: number;
|
|
1786
|
+
/** Dedendum clearance as a multiple of normal module; defaults to `0.25`. */
|
|
1787
|
+
readonly clearanceFactor?: number;
|
|
1788
|
+
/** Signed helix angle in degrees; zero creates a straight rack. */
|
|
1789
|
+
readonly helixAngleDegrees?: number;
|
|
1790
|
+
/** Normal module in millimetres per tooth. */
|
|
1791
|
+
readonly module: number;
|
|
1792
|
+
/** Normal pressure angle in degrees; defaults to 20 degrees. */
|
|
1793
|
+
readonly pressureAngleDegrees?: number;
|
|
1794
|
+
/** Number of complete rack teeth represented by the segment. */
|
|
1795
|
+
readonly toothCount: number;
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
/**
|
|
1799
|
+
* Radial dimensions refer to polygon vertices or compensate faceting to meet polygon faces.
|
|
1800
|
+
*/
|
|
1801
|
+
export declare type RadialSizing = "vertex" | "face";
|
|
1802
|
+
|
|
1803
|
+
/**
|
|
1804
|
+
* Nominal radial sizing shared by circular and regular polygon construction.
|
|
1805
|
+
*/
|
|
1806
|
+
export declare interface RadialSizingOptions {
|
|
1807
|
+
/** Explicit sampling ceilings; bound modeling operations may only lower the host policy. */
|
|
1808
|
+
readonly limits?: Partial<GeometrySamplingLimits>;
|
|
1809
|
+
/** Vertex sizing is inscribed; face sizing circumscribes the nominal radius. Defaults to vertex. */
|
|
1810
|
+
readonly sizing?: RadialSizing;
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
/** A rectangle corner, including an explicitly untreated corner in a treatment tuple. */
|
|
1814
|
+
export declare type RectangleCornerTreatment = EdgeTreatment | {
|
|
1815
|
+
/** Leaves this corner untreated. */
|
|
1816
|
+
readonly kind: "square";
|
|
1817
|
+
};
|
|
1818
|
+
|
|
1819
|
+
/** Corner treatments ordered top-right, top-left, bottom-left, bottom-right. */
|
|
1820
|
+
export declare type RectangleCornerTreatments = readonly [
|
|
1821
|
+
topRight: RectangleCornerTreatment,
|
|
1822
|
+
topLeft: RectangleCornerTreatment,
|
|
1823
|
+
bottomLeft: RectangleCornerTreatment,
|
|
1824
|
+
bottomRight: RectangleCornerTreatment
|
|
1825
|
+
];
|
|
1826
|
+
|
|
1827
|
+
/**
|
|
1828
|
+
* Creates an immutable CCW rectangle loop. Round radius zero is square; tangent saturated endpoints occur once.
|
|
1829
|
+
*
|
|
1830
|
+
* @example Rounded rectangle outline
|
|
1831
|
+
* ```ts
|
|
1832
|
+
* rectangleLoop({ size: [30, 20], treatment: { kind: "round", radius: 3 } });
|
|
1833
|
+
* ```
|
|
1834
|
+
*/
|
|
1835
|
+
export declare function rectangleLoop(options: RectangleLoopOptions): Loop2;
|
|
1836
|
+
|
|
1837
|
+
/**
|
|
1838
|
+
* Shared rectangle dimensions, origin and uniform or per-corner treatment.
|
|
1839
|
+
*/
|
|
1840
|
+
export declare interface RectangleLoopOptions {
|
|
1841
|
+
/** Positive uniform size or explicit XY extents in millimetres. */
|
|
1842
|
+
readonly size: number | Vec2;
|
|
1843
|
+
/** Center on XY; otherwise the minimum corner is the origin. Defaults to true. */
|
|
1844
|
+
readonly center?: boolean;
|
|
1845
|
+
/** Uniform treatment or four corner treatments. Exact round segments describe a complete circle and must divide by four. */
|
|
1846
|
+
readonly treatment?: EdgeTreatment | RectangleCornerTreatments;
|
|
1847
|
+
/** Explicit sampling ceiling for the complete output profile. */
|
|
1848
|
+
readonly limits?: Partial<GeometrySamplingLimits>;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
/**
|
|
1852
|
+
* Creates an identified rectangle whose edge/corner spans survive zero and saturated round radii. Outer winding is CCW.
|
|
1853
|
+
*
|
|
1854
|
+
* @example Retain rectangle landmarks
|
|
1855
|
+
* ```ts
|
|
1856
|
+
* rectangleProfile({ size: [30, 20], treatment: { kind: "round", radius: 3 } });
|
|
1857
|
+
* ```
|
|
1858
|
+
*/
|
|
1859
|
+
export declare function rectangleProfile(options: RectangleProfileOptions): Profile;
|
|
1860
|
+
|
|
1861
|
+
/** Shared rectangle options with an identified component for explicit profile families. */
|
|
1862
|
+
export declare interface RectangleProfileOptions extends RectangleLoopOptions {
|
|
1863
|
+
/** Canonical component identity of at most 64 characters. Defaults to body. */
|
|
1864
|
+
readonly id?: string;
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
/** A two-dimensional region represented by disjoint filled polygons. */
|
|
1868
|
+
export declare type Region2 = readonly Polygon2[];
|
|
1869
|
+
|
|
1870
|
+
/**
|
|
1871
|
+
* Returns the total filled area of a normalized region in square millimetres.
|
|
1872
|
+
*
|
|
1873
|
+
* Each polygon contributes its outer-loop area minus the areas of its holes. An empty region has
|
|
1874
|
+
* zero area. Call {@link normalizeRegion2} first when input winding or topology is not already
|
|
1875
|
+
* canonical.
|
|
1876
|
+
*
|
|
1877
|
+
* @param region - Normalized disjoint polygons with CCW outers and clockwise holes.
|
|
1878
|
+
* @returns Total filled area in square millimetres.
|
|
1879
|
+
*/
|
|
1880
|
+
export declare function regionArea(region: Region2): number;
|
|
1881
|
+
|
|
1882
|
+
/** Returns finite axis-aligned bounds for a non-empty region. */
|
|
1883
|
+
export declare function regionBounds(region: Region2): Bounds2;
|
|
1884
|
+
|
|
1885
|
+
/**
|
|
1886
|
+
* Creates a centered CCW point loop with vertex or face radial sizing and an implicit seam.
|
|
1887
|
+
*
|
|
1888
|
+
* @example Hexagon sized to its faces
|
|
1889
|
+
* ```ts
|
|
1890
|
+
* regularPolygonLoop({ radius: 10, sides: 6, sizing: "face" });
|
|
1891
|
+
* ```
|
|
1892
|
+
*/
|
|
1893
|
+
export declare const regularPolygonLoop: (options: RegularPolygonLoopOptions) => readonly Vec2[];
|
|
1894
|
+
|
|
1895
|
+
/** Exact regular polygon dimensions and counterclockwise degree rotation. */
|
|
1896
|
+
export declare interface RegularPolygonLoopOptions extends RadialSizingOptions {
|
|
1897
|
+
/** Positive nominal radius in millimetres, interpreted according to sizing. */
|
|
1898
|
+
readonly radius: number;
|
|
1899
|
+
/** Exact side count from three through the selected profile sampling ceiling. */
|
|
1900
|
+
readonly sides: number;
|
|
1901
|
+
/** Counterclockwise rotation in degrees; defaults to zero with a vertex on +X. */
|
|
1902
|
+
readonly rotationDegrees?: number;
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
/** Resamples a planar polyline with the same point, tangent, seam and budget guarantees as 3D.
|
|
1906
|
+
* @remarks Only final 2D output vectors are copied and frozen. No immutable 3D intermediate is built.
|
|
1907
|
+
* @example
|
|
1908
|
+
* ```ts
|
|
1909
|
+
* const loop = resamplePolyline2([[0,0],[5,0],[5,5],[0,5]], {closed: true, segments: 20});
|
|
1910
|
+
* ```
|
|
1911
|
+
*/
|
|
1912
|
+
export declare function resamplePolyline2(path: readonly Vec2[], options?: PolylineResamplingOptions): SampledCurve2;
|
|
1913
|
+
|
|
1914
|
+
/**
|
|
1915
|
+
* Resamples a spatial polyline at equal arc lengths with directed outgoing tangents.
|
|
1916
|
+
* @remarks Open paths retain both endpoints; closed paths include the closing edge and omit the
|
|
1917
|
+
* repeated seam. Repeated adjacent inputs and explicit closing duplicates are removed. Physical
|
|
1918
|
+
* maxSegmentLength bounds arc-length intervals; exact counts override that policy. Output edges
|
|
1919
|
+
* may bridge original corners. Sampling never silently lowers the requested detail to fit its budget.
|
|
1920
|
+
* @example
|
|
1921
|
+
* ```ts
|
|
1922
|
+
* const path = resamplePolyline3([[0,0,0],[10,0,0],[10,10,0]], {segments: 8});
|
|
1923
|
+
* ```
|
|
1924
|
+
*/
|
|
1925
|
+
export declare function resamplePolyline3(path: readonly Vec3[], options?: PolylineResamplingOptions): SampledCurve3;
|
|
1926
|
+
|
|
1927
|
+
/**
|
|
1928
|
+
* Resolves a deterministic full-circle count aligned to reusable topology factors.
|
|
1929
|
+
*
|
|
1930
|
+
* `alignTo` must be non-empty and contain only positive safe integers. Its checked least common
|
|
1931
|
+
* multiple defines the alignment grid. An exact `segments` value wins over
|
|
1932
|
+
* `resolution.circularSegments` and adaptive sampling, but is never rounded: it must already be
|
|
1933
|
+
* aligned and meet `minimumSegments`. Adaptive counts are rounded upward and fail with
|
|
1934
|
+
* `COMPLEXITY_LIMIT` when the aligned result exceeds the configured safety cap.
|
|
1935
|
+
*
|
|
1936
|
+
* @param radius - Positive circle radius in millimetres used for adaptive physical sampling.
|
|
1937
|
+
* @param options - Required alignment factors plus optional floor, exact count, and resolution.
|
|
1938
|
+
* @returns An aligned full-circle segment count.
|
|
1939
|
+
* @throws {@link GeometryError} when radius, alignment factors, segment floors, or resolution are
|
|
1940
|
+
* invalid, or alignment exceeds safe integer or configured complexity limits.
|
|
1941
|
+
* @see {@link resolveCircularSegments}
|
|
1942
|
+
*
|
|
1943
|
+
* @example
|
|
1944
|
+
* ```ts
|
|
1945
|
+
* const alignedSegments = resolveAlignedCircularSegments(20, { alignTo: [4, 6] });
|
|
1946
|
+
* ```
|
|
1947
|
+
*/
|
|
1948
|
+
export declare function resolveAlignedCircularSegments(radius: number, options: AlignedCircularSegmentsOptions): number;
|
|
1949
|
+
|
|
1950
|
+
/**
|
|
1951
|
+
* Resolves the number of segments needed for a circular arc.
|
|
1952
|
+
*
|
|
1953
|
+
* Full-circle limits and exact circular counts are scaled to the requested angular span, matching
|
|
1954
|
+
* the reusable BOSL2-style convention while retaining at least one segment.
|
|
1955
|
+
*
|
|
1956
|
+
* @param radius - Arc radius in millimetres.
|
|
1957
|
+
* @param angleDegrees - Non-zero signed sweep angle no greater than 360 degrees in magnitude.
|
|
1958
|
+
* @param policy - Optional operation-level policy over the active model scope.
|
|
1959
|
+
* @returns Segment count for the requested arc span.
|
|
1960
|
+
* @throws {@link GeometryError} when radius, angle, or resolution policy is invalid, or the
|
|
1961
|
+
* corresponding full-circle tolerance exceeds the configured safety limit.
|
|
1962
|
+
* @see {@link resolveCircularSegments}
|
|
1963
|
+
*
|
|
1964
|
+
* @example
|
|
1965
|
+
* ```ts
|
|
1966
|
+
* const quarterTurnSegments = resolveArcSegments(10, 90);
|
|
1967
|
+
* ```
|
|
1968
|
+
*/
|
|
1969
|
+
export declare function resolveArcSegments(radius: number, angleDegrees: number, policy?: GeometryResolution, limits?: Partial<GeometrySamplingLimits>): number;
|
|
1970
|
+
|
|
1971
|
+
/**
|
|
1972
|
+
* Resolves a deterministic full-circle segment count for one radius.
|
|
1973
|
+
*
|
|
1974
|
+
* An exact `circularSegments` value wins. Otherwise the smallest regular polygon satisfying both
|
|
1975
|
+
* physical error criteria is used. A safety cap that would violate either criterion raises
|
|
1976
|
+
* `COMPLEXITY_LIMIT` rather than silently reducing quality.
|
|
1977
|
+
*
|
|
1978
|
+
* @param radius - Circle radius in millimetres.
|
|
1979
|
+
* @param policy - Optional operation-level policy under explicit sampling ceilings.
|
|
1980
|
+
* @returns Full-circle segment count.
|
|
1981
|
+
* @throws {@link GeometryError} when radius or policy is invalid, or the requested tolerance
|
|
1982
|
+
* exceeds the configured segment safety limit.
|
|
1983
|
+
* @see {@link resolveArcSegments}
|
|
1984
|
+
* @see {@link resolveAlignedCircularSegments}
|
|
1985
|
+
*
|
|
1986
|
+
* @example
|
|
1987
|
+
* ```ts
|
|
1988
|
+
* const circleSegments = resolveCircularSegments(25, { maxChordError: 0.05 });
|
|
1989
|
+
* ```
|
|
1990
|
+
*/
|
|
1991
|
+
export declare function resolveCircularSegments(radius: number, policy?: GeometryResolution, limits?: Partial<GeometrySamplingLimits>): number;
|
|
1992
|
+
|
|
1993
|
+
/**
|
|
1994
|
+
* Resolves a validated unshifted full-depth external cylindrical gear.
|
|
1995
|
+
*
|
|
1996
|
+
* The gear axis is +Z and the returned radii describe its XY pitch plane. Inputs below the
|
|
1997
|
+
* pressure- and helix-dependent no-undercut tooth count are rejected because profile shift is not
|
|
1998
|
+
* currently supported.
|
|
1999
|
+
*/
|
|
2000
|
+
export declare function resolveCylindricalGear(spec: CylindricalGearSpec): CylindricalGearDimensions;
|
|
2001
|
+
|
|
2002
|
+
/**
|
|
2003
|
+
* Resolves ratio, center distance, and helix relationship for a gear pair.
|
|
2004
|
+
*
|
|
2005
|
+
* Both gears must use the same normal module, pressure angle, and helix-angle
|
|
2006
|
+
* magnitude. An external pair uses opposite helix hands; an internal pair uses
|
|
2007
|
+
* the same hand. The function validates those conjugate pitch invariants.
|
|
2008
|
+
*/
|
|
2009
|
+
export declare function resolveCylindricalGearPair(spec: CylindricalGearPairSpec): CylindricalGearPairDimensions;
|
|
2010
|
+
|
|
2011
|
+
/** Fully resolved tolerances for one operation and model scale. */
|
|
2012
|
+
export declare interface ResolvedGeometryTolerance {
|
|
2013
|
+
/** Configured absolute distance floor in model units. */
|
|
2014
|
+
readonly absolute: number;
|
|
2015
|
+
/** Configured angular threshold in radians. */
|
|
2016
|
+
readonly angular: number;
|
|
2017
|
+
/** Effective squared-distance threshold for area and cross-product comparisons. */
|
|
2018
|
+
readonly area: number;
|
|
2019
|
+
/** Effective distance threshold for the supplied model scale. */
|
|
2020
|
+
readonly linear: number;
|
|
2021
|
+
/** Configured dimensionless scale multiplier. */
|
|
2022
|
+
readonly relative: number;
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
/**
|
|
2026
|
+
* Resolves intermediate profile copies for linear extrusion from physical curve resolution.
|
|
2027
|
+
*
|
|
2028
|
+
* Accepts one XY loop or a filled XY region, including every hole and disconnected component.
|
|
2029
|
+
* Exact `divisions`, including zero, override physical sampling. Otherwise chord error bounds
|
|
2030
|
+
* the triangulated side surface, including rotation across each profile edge. Optional segment
|
|
2031
|
+
* length bounds station travel including Z. Straight extrusions need no intermediate copies by default.
|
|
2032
|
+
* Exceeding the selected maxPathPoints ceiling raises `COMPLEXITY_LIMIT` instead of reducing fidelity.
|
|
2033
|
+
*
|
|
2034
|
+
* @param profile - Ordered XY millimetre contours with implicit closing edges.
|
|
2035
|
+
* @param height - Positive extrusion height in millimetres.
|
|
2036
|
+
* @param options - Twist, scale, exact divisions, and physical resolution controls.
|
|
2037
|
+
* @returns Number of intermediate copies, excluding the two end profiles.
|
|
2038
|
+
*/
|
|
2039
|
+
export declare function resolveExtrusionDivisions(profile: Loop2 | Region2, height: number, options?: ExtrusionSamplingOptions): number;
|
|
2040
|
+
|
|
2041
|
+
/** Resolves finite positive safe-integer allocation ceilings without ambient state. */
|
|
2042
|
+
export declare function resolveGeometrySamplingLimits(overrides?: Partial<GeometrySamplingLimits>): GeometrySamplingLimits;
|
|
2043
|
+
|
|
2044
|
+
/**
|
|
2045
|
+
* Resolves comparison tolerances for a characteristic model scale.
|
|
2046
|
+
*
|
|
2047
|
+
* The effective linear tolerance is `max(absolute, relative * abs(scale))`.
|
|
2048
|
+
* Supplying a scale of zero therefore retains the absolute floor. The function
|
|
2049
|
+
* returns a new frozen value with finite distance and area thresholds and never mutates `options`.
|
|
2050
|
+
*
|
|
2051
|
+
* @param scale - Finite characteristic size in model units.
|
|
2052
|
+
* @param options - Optional policy overrides.
|
|
2053
|
+
* @returns A complete tolerance policy including the scale-resolved distance.
|
|
2054
|
+
* @throws {@link GeometryError} When a scale or override is invalid.
|
|
2055
|
+
*/
|
|
2056
|
+
export declare function resolveGeometryTolerance(scale?: number, options?: GeometryToleranceOptions): ResolvedGeometryTolerance;
|
|
2057
|
+
|
|
2058
|
+
/** Resolves and validates a named or caller-defined print-fit policy. */
|
|
2059
|
+
export declare function resolvePrintableThreadFitPolicy(fit?: PrintableThreadFit | PrintableThreadFitPolicy): PrintableThreadFitPolicy;
|
|
2060
|
+
|
|
2061
|
+
/** Resolves a rack segment that is conjugate with the same normal cylindrical pitch system. */
|
|
2062
|
+
export declare function resolveRackPitch(spec: RackPitchSpec): RackPitchDimensions;
|
|
2063
|
+
|
|
2064
|
+
/**
|
|
2065
|
+
* Resolves a role-independent, start-aligned facet count from the larger female mating envelope.
|
|
2066
|
+
*
|
|
2067
|
+
* An exact `circularSegments` value must already be divisible by `starts`; it is never silently
|
|
2068
|
+
* raised. Adaptive policies align upward and fail if that would exceed `maximumSegments`.
|
|
2069
|
+
*/
|
|
2070
|
+
export declare function resolveThreadCircularSegments(options: ThreadCircularSegmentsOptions): number;
|
|
2071
|
+
|
|
2072
|
+
/**
|
|
2073
|
+
* Returns a copy of a mesh with every triangle winding reversed.
|
|
2074
|
+
*
|
|
2075
|
+
* @param mesh - Mesh to copy and reverse.
|
|
2076
|
+
* @returns Fresh position and index buffers; the input remains unchanged.
|
|
2077
|
+
*/
|
|
2078
|
+
export declare function reverseTriangleMesh(mesh: TriangleMesh): TriangleMesh;
|
|
2079
|
+
|
|
2080
|
+
/**
|
|
2081
|
+
* Revolves a non-duplicated closed `[radius, z]` profile around +Z.
|
|
2082
|
+
*
|
|
2083
|
+
* The profile is ordered counter-clockwise when radius points right and Z
|
|
2084
|
+
* points up. Angular and profile seams wrap by index. A profile point on the
|
|
2085
|
+
* axis is emitted once and joined as a triangle fan, avoiding coincident seam
|
|
2086
|
+
* vertices and zero-area quads. Profile edges that lie entirely on the axis
|
|
2087
|
+
* collapse to the solid's interior and are intentionally omitted.
|
|
2088
|
+
* Profile coordinates must fit finite Float32 mesh storage.
|
|
2089
|
+
*
|
|
2090
|
+
* @param profile - Closed CCW `[radius, z]` profile without a duplicated seam point.
|
|
2091
|
+
* @param options - Optional physical or exact circumferential sampling controls. Defaults to `{}`.
|
|
2092
|
+
* @returns A closed indexed triangle mesh revolved counter-clockwise around +Z.
|
|
2093
|
+
*
|
|
2094
|
+
* @example Partial revolution with end caps
|
|
2095
|
+
* ```ts
|
|
2096
|
+
* // Each point is [radius, Z]; the profile seam is implicit.
|
|
2097
|
+
* revolveMesh([[0, 0], [12, 0], [8, 20], [0, 20]], { revolveDegrees: 270 });
|
|
2098
|
+
* ```
|
|
2099
|
+
*/
|
|
2100
|
+
export declare const revolveMesh: (profile: readonly Vec2[], options?: RevolveOptions) => TriangleMesh;
|
|
2101
|
+
|
|
2102
|
+
/**
|
|
2103
|
+
* Circumferential sampling and degree sweep shared by pure and filled revolution.
|
|
2104
|
+
*/
|
|
2105
|
+
export declare interface RevolveOptions extends CircularPrimitiveOptions {
|
|
2106
|
+
/**
|
|
2107
|
+
* Positive angular sweep no greater than 360 degrees; partial revolutions have end caps.
|
|
2108
|
+
* Segment counts describe a complete circle and scale to this angular span. Native filled
|
|
2109
|
+
* revolutions require at least three sweep intervals: adaptive sampling refines to that floor,
|
|
2110
|
+
* while exact counts that imply fewer intervals reject. Pure revolveMesh supports one interval.
|
|
2111
|
+
*/
|
|
2112
|
+
readonly revolveDegrees?: number;
|
|
2113
|
+
/** Explicit output and sampling allocation ceilings. */
|
|
2114
|
+
readonly limits?: Partial<ModelingLimits>;
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
/** Rotates a vector right-handed around an axis by `angle` radians. */
|
|
2118
|
+
export declare const rotateAroundAxis3: (vector: Vec3, axis: Vec3, angle: number) => Vec3;
|
|
2119
|
+
|
|
2120
|
+
/**
|
|
2121
|
+
* Creates a right-handed axis-angle rotation transform.
|
|
2122
|
+
*
|
|
2123
|
+
* @param axis - Rotation axis; normalization is performed internally.
|
|
2124
|
+
* @param angle - Finite right-handed angle with exactly one explicit unit.
|
|
2125
|
+
* @param tolerance - Optional zero-length comparison overrides.
|
|
2126
|
+
* @returns A frozen row-major transform.
|
|
2127
|
+
*/
|
|
2128
|
+
export declare function rotationTransform3(axis: Vec3, angle: AxisAngleRotation3, tolerance?: GeometryToleranceOptions): Transform3;
|
|
2129
|
+
|
|
2130
|
+
/**
|
|
2131
|
+
* Replaces each vertex of a non-duplicated closed polyline with a sampled
|
|
2132
|
+
* quadratic corner in the same coordinate system as the input.
|
|
2133
|
+
*
|
|
2134
|
+
* `radius` is the desired tangent distance for a right angle and is capped to
|
|
2135
|
+
* 45% of adjacent segment lengths to prevent neighboring corners from crossing.
|
|
2136
|
+
* The returned path does not duplicate its closing point.
|
|
2137
|
+
* Coordinates and radius must be finite; input and output are each limited by maxPathPoints (default 100000).
|
|
2138
|
+
*/
|
|
2139
|
+
export declare const roundClosedPolylinePath: (points: readonly Vec3[], radius: number, segmentsPerCorner: number, limits?: Partial<GeometrySamplingLimits>) => readonly Vec3[];
|
|
2140
|
+
|
|
2141
|
+
/**
|
|
2142
|
+
* A circular edge or corner roundover with explicit physical sampling.
|
|
2143
|
+
*/
|
|
2144
|
+
export declare interface RoundedEdgeTreatment extends CircularPrimitiveOptions {
|
|
2145
|
+
/** Selects circular corners or spherical all-edge roundovers. */
|
|
2146
|
+
readonly kind: "round";
|
|
2147
|
+
/** Radius in millimetres. Rectangles permit zero through half their smallest dimension; boxes require a positive smaller radius. */
|
|
2148
|
+
readonly radius: number;
|
|
2149
|
+
}
|
|
2150
|
+
|
|
2151
|
+
/** Samples a planar curve with the same guarantees and policy as spatial sampling.
|
|
2152
|
+
* @remarks Private spatial scratch math is shared, while only final planar vectors are copied and
|
|
2153
|
+
* frozen. At stationary tangents, outgoing secants are preferred and endpoints use a backward fallback.
|
|
2154
|
+
* @example
|
|
2155
|
+
* ```ts
|
|
2156
|
+
* const turn = sampleCurve2({kind: "arc", center: [0,0], radius: 10, sweepDegrees: 90});
|
|
2157
|
+
* ```
|
|
2158
|
+
*/
|
|
2159
|
+
export declare function sampleCurve2(curve: Curve2, options?: CurveSamplingOptions): SampledCurve2;
|
|
2160
|
+
|
|
2161
|
+
/**
|
|
2162
|
+
* Samples a spatial curve, preserving endpoints and directed unit tangents.
|
|
2163
|
+
* @remarks Exact counts use uniform curve parameters, not equal physical distances. Adaptive cubics
|
|
2164
|
+
* bound the full control hull. Full-circle arcs repeat their endpoint; closed polylines do not.
|
|
2165
|
+
* @example
|
|
2166
|
+
* ```ts
|
|
2167
|
+
* const path = sampleCurve3({kind: "cubic", start: [0,0,0], control1: [5,0,0], control2: [5,5,5], end: [10,5,5]});
|
|
2168
|
+
* ```
|
|
2169
|
+
*/
|
|
2170
|
+
export declare function sampleCurve3(curve: Curve3, options?: CurveSamplingOptions): SampledCurve3;
|
|
2171
|
+
|
|
2172
|
+
/**
|
|
2173
|
+
* Samples a complete external involute gear boundary in the XY plane.
|
|
2174
|
+
*
|
|
2175
|
+
* The returned loop is counter-clockwise, closed implicitly without a repeated
|
|
2176
|
+
* seam point, and contains no holes. Its center is the origin and its axis is
|
|
2177
|
+
* +Z. Bore, hub, keyway, twist, and face-width choices remain generator-owned.
|
|
2178
|
+
*/
|
|
2179
|
+
export declare function sampleCylindricalGearOutline(spec: CylindricalGearSpec, options?: CylindricalGearOutlineOptions): Loop2;
|
|
2180
|
+
|
|
2181
|
+
/** Immutable planar points and corresponding directed unit tangents. */
|
|
2182
|
+
export declare interface SampledCurve2 {
|
|
2183
|
+
/** Curves retain both endpoints, including full-circle seams; closed resampling omits its seam. */
|
|
2184
|
+
readonly points: readonly Vec2[];
|
|
2185
|
+
/** Directed unit vectors; stationary derivatives use the nearest usable direction. */
|
|
2186
|
+
readonly tangents: readonly Vec2[];
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2189
|
+
/**
|
|
2190
|
+
* Immutable spatial points and corresponding directed unit tangents.
|
|
2191
|
+
*/
|
|
2192
|
+
export declare interface SampledCurve3 {
|
|
2193
|
+
/** Curves retain both endpoints, including full-circle seams; closed resampling omits its seam. */
|
|
2194
|
+
readonly points: readonly Vec3[];
|
|
2195
|
+
/** Directed unit vectors; stationary derivatives use the nearest usable direction. */
|
|
2196
|
+
readonly tangents: readonly Vec3[];
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
/** Sampled paths plus conventional pitch and lead measurements. */
|
|
2200
|
+
export declare interface SampledThreadHelices {
|
|
2201
|
+
/** Axial advance over one revolution, equal to `pitch * starts`. */
|
|
2202
|
+
readonly lead: number;
|
|
2203
|
+
/** One immutable sampled path for each thread start. */
|
|
2204
|
+
readonly paths: readonly Path3[];
|
|
2205
|
+
/** Adjacent axial thread spacing in millimetres. */
|
|
2206
|
+
readonly pitch: number;
|
|
2207
|
+
/** Number of revolutions represented by each path. */
|
|
2208
|
+
readonly turns: number;
|
|
2209
|
+
}
|
|
2210
|
+
|
|
2211
|
+
/**
|
|
2212
|
+
* Creates `segments + 1` points including exact helix endpoints from finite positive dimensions.
|
|
2213
|
+
* Integrated weights must remain finite. The maxPathPoints ceiling defaults to 100000; excessive
|
|
2214
|
+
* exact counts reject before evaluating axial weights or allocating sample arrays.
|
|
2215
|
+
*/
|
|
2216
|
+
export declare const sampleHelix: ({ turns, radius, height, segments, limits, axialWeight, }: SampleHelixOptions) => readonly Vec3[];
|
|
2217
|
+
|
|
2218
|
+
/** Options for a sampled +Z helix with millimetre dimensions. */
|
|
2219
|
+
export declare interface SampleHelixOptions {
|
|
2220
|
+
/** Number of complete rotations around +Z. */
|
|
2221
|
+
readonly turns: number;
|
|
2222
|
+
/** Explicit output allocation ceilings. */
|
|
2223
|
+
readonly limits?: Partial<GeometrySamplingLimits>;
|
|
2224
|
+
/** Constant radial distance from the +Z axis. */
|
|
2225
|
+
readonly radius: number;
|
|
2226
|
+
/** Total axial advance from the first point to the last. */
|
|
2227
|
+
readonly height: number;
|
|
2228
|
+
/** Number of sampled line segments; the result contains one additional endpoint. */
|
|
2229
|
+
readonly segments: number;
|
|
2230
|
+
/**
|
|
2231
|
+
* Relative axial advance at a normalized turn position. Values are integrated
|
|
2232
|
+
* and normalized, so the final endpoint is always exactly `height`.
|
|
2233
|
+
*/
|
|
2234
|
+
readonly axialWeight?: (t: number) => number;
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
/**
|
|
2238
|
+
* Samples the center opening and tooth spaces used to subtract an internal ring gear.
|
|
2239
|
+
*
|
|
2240
|
+
* Internal tooth tips lie one addendum below the pitch radius and their roots lie one
|
|
2241
|
+
* dedendum above it. At the pitch circle, positive backlash widens each sampled space
|
|
2242
|
+
* tangentially. The returned CCW loop encloses the center and is intended to be reversed
|
|
2243
|
+
* when used as a region hole.
|
|
2244
|
+
*/
|
|
2245
|
+
export declare function sampleInternalCylindricalGearSpaceOutline(spec: CylindricalGearSpec, options?: CylindricalGearOutlineOptions): Loop2;
|
|
2246
|
+
|
|
2247
|
+
/**
|
|
2248
|
+
* Samples 1–31 line/cubic segments into a deeply immutable open [radius,height] polyline.
|
|
2249
|
+
* Anchors must progress strictly upward; nonnegative-radius cubic controls must have ordered
|
|
2250
|
+
* heights between their endpoints. Cubics use de Casteljau subdivision with a conservative
|
|
2251
|
+
* control-hull chord-error bound. Lines also obey the optional physical edge-length ceiling.
|
|
2252
|
+
* Neither normalized coordinates nor editor metadata are required. Endpoints are retained once;
|
|
2253
|
+
* no axis closure, winding normalization, or manufacturing repair is performed.
|
|
2254
|
+
*
|
|
2255
|
+
* @param curve - Open outline in millimetres unless the positive scales convert its coordinates.
|
|
2256
|
+
* @param options - Physical resolution and output budget; defaults to 4096 vertices.
|
|
2257
|
+
* @returns Frozen open polyline in millimetres, ordered from lowest to highest anchor.
|
|
2258
|
+
* @throws {@link GeometryError} for invalid coordinates, order, scale, or exceeded subdivision budget.
|
|
2259
|
+
*
|
|
2260
|
+
* @example
|
|
2261
|
+
* ```ts
|
|
2262
|
+
* const side = sampleOpenProfile({
|
|
2263
|
+
* start: { radius: 0.5, height: 0 },
|
|
2264
|
+
* segments: [{ type: "line", end: { radius: 1, height: 1 } }],
|
|
2265
|
+
* }, { radiusScale: 12, heightScale: 30 });
|
|
2266
|
+
* ```
|
|
2267
|
+
*/
|
|
2268
|
+
export declare function sampleOpenProfile(curve: OpenProfileCurve, options?: SampleOpenProfileOptions): readonly Vec2[];
|
|
2269
|
+
|
|
2270
|
+
/** Physical scaling and bounded adaptive subdivision for an open profile. */
|
|
2271
|
+
export declare interface SampleOpenProfileOptions {
|
|
2272
|
+
/** Positive radius scale; use the desired maximum radius for normalized coordinates. Defaults to 1. */
|
|
2273
|
+
readonly radiusScale?: number;
|
|
2274
|
+
/** Positive height scale; use the desired total height for normalized coordinates. Defaults to 1. */
|
|
2275
|
+
readonly heightScale?: number;
|
|
2276
|
+
/** Shared physical policy, evaluated after scaling; exact circular counts do not affect curves. */
|
|
2277
|
+
readonly resolution?: GeometryResolution;
|
|
2278
|
+
/** Maximum output vertex count within maxProfilePoints. Defaults to the smaller of 4096 and that ceiling. */
|
|
2279
|
+
readonly maximumVertices?: number;
|
|
2280
|
+
/** Explicit profile and circular allocation ceilings. */
|
|
2281
|
+
readonly limits?: Partial<GeometrySamplingLimits>;
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
/**
|
|
2285
|
+
* Samples the open top boundary of a finite rack in its XY pitch plane.
|
|
2286
|
+
*
|
|
2287
|
+
* X follows rack travel, Y is tooth height, and the pitch line is `Y = 0`.
|
|
2288
|
+
* The path begins and ends on the root line, omits duplicate adjacent points,
|
|
2289
|
+
* and leaves base thickness, mounting features, extrusion, and helical sweep to
|
|
2290
|
+
* the owning generator.
|
|
2291
|
+
*/
|
|
2292
|
+
export declare function sampleRackToothPath(spec: RackPitchSpec, limits?: Partial<GeometrySamplingLimits>): Path2;
|
|
2293
|
+
|
|
2294
|
+
/**
|
|
2295
|
+
* Samples a prepared text layout without shaping text again or loading a font.
|
|
2296
|
+
*
|
|
2297
|
+
* @param layout - Immutable millimetre paths and measurements retained from text preparation.
|
|
2298
|
+
* @param resolution - Explicit curve sampling policy; omitted uses the pure default policy.
|
|
2299
|
+
* @param limits - Explicit profile and circular allocation ceilings.
|
|
2300
|
+
* @returns Frozen contours with original glyph winding and no repeated closing vertex.
|
|
2301
|
+
* @throws GeometryError for empty outlines, invalid paths or policies, over 1000 paths or selected sampling ceilings.
|
|
2302
|
+
*/
|
|
2303
|
+
export declare function sampleTextContours(layout: VectorTextLayout, resolution?: GeometryResolution, limits?: Partial<GeometrySamplingLimits>): readonly Loop2[];
|
|
2304
|
+
|
|
2305
|
+
/**
|
|
2306
|
+
* Samples evenly phased thread helices with finite `lead = pitch * starts`.
|
|
2307
|
+
* All starts together respect maxPathPoints (default 100000); excessive counts fail before allocation.
|
|
2308
|
+
*/
|
|
2309
|
+
export declare function sampleThreadHelices(options: ThreadHelixOptions): SampledThreadHelices;
|
|
2310
|
+
|
|
2311
|
+
/**
|
|
2312
|
+
* Multiplies a vector by a dimensionless scalar.
|
|
2313
|
+
* @example
|
|
2314
|
+
* ```ts
|
|
2315
|
+
* scale3([1, 2, 3], 2); // [2, 4, 6]
|
|
2316
|
+
* ```
|
|
2317
|
+
*/
|
|
2318
|
+
export declare const scale3: (vector: Vec3, scale: number) => Vec3;
|
|
2319
|
+
|
|
2320
|
+
/**
|
|
2321
|
+
* Creates an immutable axis-aligned scale transform.
|
|
2322
|
+
*
|
|
2323
|
+
* Negative components are reflections. Zero components are rejected because
|
|
2324
|
+
* they collapse volume and cannot be inverted.
|
|
2325
|
+
*
|
|
2326
|
+
* @param factors - Finite, non-zero XYZ scale factors.
|
|
2327
|
+
* @returns A frozen row-major transform.
|
|
2328
|
+
*/
|
|
2329
|
+
export declare function scaleTransform3(factors: Vec3): Transform3;
|
|
2330
|
+
|
|
2331
|
+
/** Returns the signed area of a non-duplicated loop; positive means CCW. */
|
|
2332
|
+
export declare function signedAreaLoop2(loop: Loop2): number;
|
|
2333
|
+
|
|
2334
|
+
/** A cubic corner transition with zero curvature at its straight tangent joins. */
|
|
2335
|
+
export declare interface SmoothEdgeTreatment {
|
|
2336
|
+
/** Selects continuous-curvature cubic rounding, rather than a circular radius. */
|
|
2337
|
+
readonly kind: "smooth";
|
|
2338
|
+
/** Positive tangent setbacks, equal or [first, second], in millimetres. */
|
|
2339
|
+
readonly distance: number | readonly [first: number, second: number];
|
|
2340
|
+
/** Exact cubic interval count, positive; overrides physical sampling. */
|
|
2341
|
+
readonly segments?: number;
|
|
2342
|
+
/** Physical chord/edge-length sampling; circularSegments does not describe a cubic. */
|
|
2343
|
+
readonly resolution?: GeometryResolution;
|
|
2344
|
+
/** Explicit sampling ceilings, bounded by the host policy. */
|
|
2345
|
+
readonly limits?: Partial<GeometrySamplingLimits>;
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2348
|
+
/**
|
|
2349
|
+
* Exactly one radius or diameter, placement, and tessellation for an origin-centered sphere.
|
|
2350
|
+
*/
|
|
2351
|
+
export declare type SphereOptions = CircularPrimitiveOptions & PrimitivePlacement & ({
|
|
2352
|
+
/** Positive radius in millimetres; mutually exclusive with diameter. */
|
|
2353
|
+
readonly radius: number;
|
|
2354
|
+
/** Full diameter is unavailable when radius is supplied. */
|
|
2355
|
+
readonly diameter?: never;
|
|
2356
|
+
} | {
|
|
2357
|
+
/** Positive full diameter in millimetres; mutually exclusive with radius. */
|
|
2358
|
+
readonly diameter: number;
|
|
2359
|
+
/** Radius is unavailable when diameter is supplied. */
|
|
2360
|
+
readonly radius?: never;
|
|
2361
|
+
});
|
|
2362
|
+
|
|
2363
|
+
/** Square profile with equal crest and root widths. */
|
|
2364
|
+
export declare interface SquareThreadProfileSpec extends ThreadProfileBaseSpec {
|
|
2365
|
+
/** Selects the square profile family. */
|
|
2366
|
+
readonly kind: "square";
|
|
2367
|
+
/**
|
|
2368
|
+
* Radial depth in millimetres.
|
|
2369
|
+
* @defaultValue `pitch / 2`
|
|
2370
|
+
*/
|
|
2371
|
+
readonly depth?: number;
|
|
2372
|
+
}
|
|
2373
|
+
|
|
2374
|
+
/**
|
|
2375
|
+
* Creates a centered CCW alternating-radius star within the selected profile sampling ceiling.
|
|
2376
|
+
*
|
|
2377
|
+
* @example Five-point outline
|
|
2378
|
+
* ```ts
|
|
2379
|
+
* starLoop(12, 5, 6);
|
|
2380
|
+
* ```
|
|
2381
|
+
*/
|
|
2382
|
+
export declare const starLoop: (outerRadius: number, points: number, innerRadius?: number, limits?: Partial<GeometrySamplingLimits>) => readonly Vec2[];
|
|
2383
|
+
|
|
2384
|
+
/** End-cap treatment for an open stroked path. */
|
|
2385
|
+
export declare type StrokePathCap = "butt" | "round" | "square";
|
|
2386
|
+
|
|
2387
|
+
/** Join treatment where adjacent stroked path segments meet. */
|
|
2388
|
+
export declare type StrokePathJoin = "bevel" | "miter" | "round";
|
|
2389
|
+
|
|
2390
|
+
/**
|
|
2391
|
+
* Converts a sampled millimetre path into the filled region covered by a centered stroke.
|
|
2392
|
+
*
|
|
2393
|
+
* Closed paths omit a duplicated seam point. Zero-length sampled segments are ignored, while the
|
|
2394
|
+
* effective path must still contain visible length. Round caps and joins use deterministic physical
|
|
2395
|
+
* resolution. Bevels fill the outer corner triangle; miters extend the outer edges to their
|
|
2396
|
+
* intersection, falling back to bevels above SVG's default miter limit of 4.
|
|
2397
|
+
*/
|
|
2398
|
+
export declare function strokePathRegion(path: Path2, options: StrokePathRegionOptions): Region2;
|
|
2399
|
+
|
|
2400
|
+
/** Physical stroke and topology controls for {@link strokePathRegion}. */
|
|
2401
|
+
export declare interface StrokePathRegionOptions {
|
|
2402
|
+
/** Explicit path, circular and expanded-profile allocation ceilings. */
|
|
2403
|
+
readonly limits?: Partial<GeometrySamplingLimits>;
|
|
2404
|
+
/** Treat the path as a closed non-duplicated loop. Default: `false`. */
|
|
2405
|
+
readonly closed?: boolean;
|
|
2406
|
+
/** End-cap treatment for an open path. Ignored for closed paths. Default: `butt`. */
|
|
2407
|
+
readonly cap?: StrokePathCap;
|
|
2408
|
+
/** Corner treatment; miters exceeding SVG's default limit of 4 become bevels. Default: `miter`. */
|
|
2409
|
+
readonly join?: StrokePathJoin;
|
|
2410
|
+
/** Physical tessellation policy for round caps and joins. */
|
|
2411
|
+
readonly resolution?: GeometryResolution;
|
|
2412
|
+
/** Positive total stroke width in millimetres, centered on the sampled path. */
|
|
2413
|
+
readonly width: number;
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
/**
|
|
2417
|
+
* Subtracts `b` from `a`.
|
|
2418
|
+
* @example
|
|
2419
|
+
* ```ts
|
|
2420
|
+
* subtract3([4, 5, 6], [1, 2, 3]); // [3, 3, 3]
|
|
2421
|
+
* ```
|
|
2422
|
+
*/
|
|
2423
|
+
export declare const subtract3: (a: Vec3, b: Vec3) => Vec3;
|
|
2424
|
+
|
|
2425
|
+
/** Sampling controls for deterministic SVG-to-region conversion. */
|
|
2426
|
+
export declare interface SvgImportOptions {
|
|
2427
|
+
/** Explicit profile and circular allocation ceilings; bounded SVG source/work limits remain fixed. */
|
|
2428
|
+
readonly limits?: Partial<GeometrySamplingLimits>;
|
|
2429
|
+
/** Exact segments for a complete ellipse or round stroke feature. */
|
|
2430
|
+
readonly circularSegments?: number;
|
|
2431
|
+
/** Operation-level physical tessellation policy over the active model-wide policy. */
|
|
2432
|
+
readonly resolution?: GeometryResolution;
|
|
2433
|
+
/**
|
|
2434
|
+
* `"center"` places the viewport center at the origin. `"document"` places its converted
|
|
2435
|
+
* lower-left corner at the origin. Default: `"center"`.
|
|
2436
|
+
*/
|
|
2437
|
+
readonly origin?: "center" | "document";
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
/** Exact normalized SVG region plus bounded source, geometry, and safe-repair diagnostics. */
|
|
2441
|
+
export declare interface SvgRegionPreflight {
|
|
2442
|
+
/** Physical and final-topology measurements of `region`. */
|
|
2443
|
+
readonly geometry: SvgRegionPreflightGeometryMetrics;
|
|
2444
|
+
/** Appearance-preserving cleanup observed during parsing and normalization. */
|
|
2445
|
+
readonly repairs: SvgRegionPreflightRepairs;
|
|
2446
|
+
/** Canonical millimetre, Y-up geometry. */
|
|
2447
|
+
readonly region: Region2;
|
|
2448
|
+
/** Bounded source and flattening complexity measurements. */
|
|
2449
|
+
readonly source: SvgRegionPreflightSourceMetrics;
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
/** Physical and final-topology facts for a normalized imported SVG region. */
|
|
2453
|
+
export declare interface SvgRegionPreflightGeometryMetrics {
|
|
2454
|
+
/** Filled area in square millimetres. */
|
|
2455
|
+
readonly area: number;
|
|
2456
|
+
/** Millimetre bounds, or `null` when no painted region remains. */
|
|
2457
|
+
readonly bounds: Bounds2 | null;
|
|
2458
|
+
/** Disconnected filled polygons in the final region. */
|
|
2459
|
+
readonly components: number;
|
|
2460
|
+
/** Exterior and hole boundary count in the final region. */
|
|
2461
|
+
readonly contours: number;
|
|
2462
|
+
/** Interior boundary count in the final region. */
|
|
2463
|
+
readonly holes: number;
|
|
2464
|
+
/** Shortest final boundary edge in millimetres, or `null` for an empty region. */
|
|
2465
|
+
readonly minEdgeLength: number | null;
|
|
2466
|
+
/** Final boundary edges shorter than the conservative 0.01 mm indicator. */
|
|
2467
|
+
readonly shortEdges: number;
|
|
2468
|
+
/** Components with less than 0.01 square millimetres of filled area. */
|
|
2469
|
+
readonly tinyIslands: number;
|
|
2470
|
+
/** Non-duplicated boundary vertices in the final normalized region. */
|
|
2471
|
+
readonly vertices: number;
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
/** Visible, appearance-preserving cleanup counters from bounded SVG import. */
|
|
2475
|
+
export declare interface SvgRegionPreflightRepairs {
|
|
2476
|
+
/** Graphics elements with neither a visible fill nor a positive-width visible stroke. */
|
|
2477
|
+
readonly invisibleElements: number;
|
|
2478
|
+
/** Open filled subpaths closed by SVG fill semantics without closing their strokes. */
|
|
2479
|
+
readonly implicitFilledClosures: number;
|
|
2480
|
+
/** Visibly painted elements whose fill and stroke both resolved to empty geometry. */
|
|
2481
|
+
readonly emptyElements: number;
|
|
2482
|
+
/** Consecutive repeated flattened vertices discarded before topology resolution. */
|
|
2483
|
+
readonly removedDuplicateVertices: number;
|
|
2484
|
+
/** Explicit repeated seam vertices removed from otherwise closed contours. */
|
|
2485
|
+
readonly removedSeamVertices: number;
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
/** Bounded source-complexity facts collected while parsing one SVG document. */
|
|
2489
|
+
export declare interface SvgRegionPreflightSourceMetrics {
|
|
2490
|
+
/** UTF-8 source size, capped at 256 KiB before parsing. */
|
|
2491
|
+
readonly bytes: number;
|
|
2492
|
+
/** Renderable shape elements, capped at 500; containers and metadata are excluded. */
|
|
2493
|
+
readonly elements: number;
|
|
2494
|
+
/** Flattened vertices emitted before fill, stroke, and clipping operations. */
|
|
2495
|
+
readonly emittedVertices: number;
|
|
2496
|
+
/** Path endpoints and control vertices parsed before adaptive flattening. */
|
|
2497
|
+
readonly parsedVertices: number;
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2500
|
+
/**
|
|
2501
|
+
* Sweeps one explicitly ordered point loop, with caps or a geometrically matching closed seam.
|
|
2502
|
+
*
|
|
2503
|
+
* @example Sweep point data along a bent path
|
|
2504
|
+
* ```ts
|
|
2505
|
+
* const profile = rectangleLoop({ size: [6, 3] });
|
|
2506
|
+
* sweepMesh(profile, [[0, 0, 0], [0, 0, 15], [10, 0, 25]], {
|
|
2507
|
+
* orientation: { kind: "transport", initialNormal: [0, 1, 0] },
|
|
2508
|
+
* });
|
|
2509
|
+
* ```
|
|
2510
|
+
*/
|
|
2511
|
+
export declare function sweepMesh(profile: Loop2, path: readonly Vec3[], options?: SweepOptions): TriangleMesh;
|
|
2512
|
+
|
|
2513
|
+
/**
|
|
2514
|
+
* Controls shared by pure mesh construction and filled modeling sweeps.
|
|
2515
|
+
*/
|
|
2516
|
+
export declare interface SweepOptions {
|
|
2517
|
+
/** Join the path's last station to its first. Open paths retain watertight end caps. */
|
|
2518
|
+
readonly closed?: boolean;
|
|
2519
|
+
/** Explicit output and sampling allocation ceilings. */
|
|
2520
|
+
readonly limits?: Partial<ModelingLimits>;
|
|
2521
|
+
/** Explicit frame policy; default transport minimizes rotations, initially projecting +X then +Y then +Z. */
|
|
2522
|
+
readonly orientation?: SweepOrientation;
|
|
2523
|
+
/** Physical sampling of nonzero twist; inserted stations retain authored station controls. */
|
|
2524
|
+
readonly resolution?: GeometryResolution;
|
|
2525
|
+
/** Total additional profile rotation in degrees, with progression selected by twistBy. */
|
|
2526
|
+
readonly twistDegrees?: number;
|
|
2527
|
+
/** Twist advances by physical path length (default), or normalized authored station position, including a closed seam gap. */
|
|
2528
|
+
readonly twistBy?: "length" | "stations";
|
|
2529
|
+
/** Positive uniform/XY scale, or one XY pair per path station. Defaults to one. */
|
|
2530
|
+
readonly scale?: number | Vec2 | readonly Vec2[];
|
|
2531
|
+
/** Corresponding point-index advance at a rotationally equivalent closed seam. */
|
|
2532
|
+
readonly seamProfileOffset?: number;
|
|
2533
|
+
}
|
|
2534
|
+
|
|
2535
|
+
/**
|
|
2536
|
+
* Explicit profile-X frame policy; all normals are directed, and selected singular policies reject.
|
|
2537
|
+
*/
|
|
2538
|
+
export declare type SweepOrientation = {
|
|
2539
|
+
/** Minimizes frame rotation by parallel transport. */
|
|
2540
|
+
readonly kind: "transport";
|
|
2541
|
+
/** Initial profile +X guide, projected perpendicular to the first tangent. */
|
|
2542
|
+
readonly initialNormal?: Vec3;
|
|
2543
|
+
} | {
|
|
2544
|
+
/** Projects one fixed world-space normal at every path station. */
|
|
2545
|
+
readonly kind: "fixed-normal";
|
|
2546
|
+
/** Directed profile +X guide; must not be parallel to any local tangent. */
|
|
2547
|
+
readonly normal: Vec3;
|
|
2548
|
+
} | {
|
|
2549
|
+
/** Uses an explicitly directed normal callback at each original normalized station. */
|
|
2550
|
+
readonly kind: "guide";
|
|
2551
|
+
/** Finite profile +X guide callback, evaluated once per original path station. */
|
|
2552
|
+
readonly normal: PathNormalGuide;
|
|
2553
|
+
} | {
|
|
2554
|
+
/** Uses sampled curvature normals; zero-curvature stations reject. */
|
|
2555
|
+
readonly kind: "frenet";
|
|
2556
|
+
};
|
|
2557
|
+
|
|
2558
|
+
/** End bevel controls shared by threaded rods and cutters. */
|
|
2559
|
+
export declare interface ThreadBevelOptions {
|
|
2560
|
+
/** Apply a 45-degree bevel at Z=0. */
|
|
2561
|
+
readonly bevelBottom?: boolean;
|
|
2562
|
+
/**
|
|
2563
|
+
* Axial bevel extent in millimetres. Active blunt ends default to one sixth of the compensated
|
|
2564
|
+
* male minor radius or female major radius; other ends default to the profile depth.
|
|
2565
|
+
*/
|
|
2566
|
+
readonly bevelSize?: number;
|
|
2567
|
+
/** Apply a 45-degree bevel at Z=length. */
|
|
2568
|
+
readonly bevelTop?: boolean;
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
/** Inputs for resolving one shared circular facet count for a mating thread pair. */
|
|
2572
|
+
export declare interface ThreadCircularSegmentsOptions {
|
|
2573
|
+
/** Explicit circular allocation ceiling for the shared mating grid. */
|
|
2574
|
+
readonly limits?: Partial<GeometrySamplingLimits>;
|
|
2575
|
+
/** Printable fit whose larger compensated female envelope governs tessellation. */
|
|
2576
|
+
readonly fit?: PrintableThreadFit | PrintableThreadFitPolicy;
|
|
2577
|
+
/** Nominal major diameter before role-specific compensation. */
|
|
2578
|
+
readonly nominalMajorDiameter: number;
|
|
2579
|
+
/**
|
|
2580
|
+
* Maximum active female face outset beyond the compensated major envelope, in millimetres.
|
|
2581
|
+
* This keeps a compensated male/female pair on one role-independent grid when an internal
|
|
2582
|
+
* cutter has an enlarged entrance bevel. Default: `0`.
|
|
2583
|
+
*/
|
|
2584
|
+
readonly maximumRadialOutset?: number;
|
|
2585
|
+
/** Validated mating profile whose pitch and flank capacities govern tessellation. */
|
|
2586
|
+
readonly profile: ThreadProfile;
|
|
2587
|
+
/** Physical or exact circular resolution policy. */
|
|
2588
|
+
readonly resolution?: GeometryResolution;
|
|
2589
|
+
/** Number of phased starts. Default: `1`. */
|
|
2590
|
+
readonly starts?: number;
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
/** Options for compensating nominal male or female thread diameters. */
|
|
2594
|
+
export declare interface ThreadCompensationOptions {
|
|
2595
|
+
/** Named policy or explicit caller-calibrated allowances. */
|
|
2596
|
+
readonly fit?: PrintableThreadFit | PrintableThreadFitPolicy;
|
|
2597
|
+
/** Nominal sharp or truncated major diameter in millimetres. */
|
|
2598
|
+
readonly nominalMajorDiameter: number;
|
|
2599
|
+
/** Male or female geometry being compensated. */
|
|
2600
|
+
readonly role: ThreadRole;
|
|
2601
|
+
/** Radial depth from major to minor envelope in millimetres. */
|
|
2602
|
+
readonly threadDepth: number;
|
|
2603
|
+
/** Optional numerical tolerance overrides. */
|
|
2604
|
+
readonly tolerance?: GeometryToleranceOptions;
|
|
2605
|
+
}
|
|
2606
|
+
|
|
2607
|
+
/** Nut-edge bevel selection. */
|
|
2608
|
+
export declare type ThreadedNutBevel = "automatic" | "both" | "inside" | "none" | "outside";
|
|
2609
|
+
|
|
2610
|
+
/**
|
|
2611
|
+
* Options for a compensated nut with an internal thread.
|
|
2612
|
+
*/
|
|
2613
|
+
export declare interface ThreadedNutOptions extends Omit<InternalThreadCutterOptions, "bevelBottom" | "bevelSize" | "bevelTop" | "length"> {
|
|
2614
|
+
/** Nut body bevel selection. Default: `automatic`. */
|
|
2615
|
+
readonly bevel?: ThreadedNutBevel;
|
|
2616
|
+
/** Optional physical policy for a round body, independent of the thread's matched facet grid. */
|
|
2617
|
+
readonly bodyResolution?: GeometryResolution;
|
|
2618
|
+
/** 45-degree body chamfer extent. Default: `min(profile.depth, thickness/4)`. */
|
|
2619
|
+
readonly chamferSize?: number;
|
|
2620
|
+
/** Leave the bottom outside edge flat for build-plate adhesion. Default: `false`. */
|
|
2621
|
+
readonly flushBuildPlateBottom?: boolean;
|
|
2622
|
+
/** Nut body shape. */
|
|
2623
|
+
readonly shape: ThreadedNutShape;
|
|
2624
|
+
/** Nut thickness along +Z in millimetres. */
|
|
2625
|
+
readonly thickness: number;
|
|
2626
|
+
/** Across-flats width for hex/square or diameter for round, in millimetres. */
|
|
2627
|
+
readonly width: number;
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2630
|
+
/** Allocation-free body, cutter, and end-face facts resolved for a threaded nut. */
|
|
2631
|
+
export declare interface ThreadedNutPreflight {
|
|
2632
|
+
/** Polygon segment count used by the nut body. */
|
|
2633
|
+
readonly bodySegments: number;
|
|
2634
|
+
/** Shared 45-degree chamfer size applied to the selected body and cutter edges. */
|
|
2635
|
+
readonly chamferSize: number;
|
|
2636
|
+
/** Maximum compensated cutter radius at either requested face. */
|
|
2637
|
+
readonly cutterFaceRadius: number;
|
|
2638
|
+
/** Minimum nut-body inradius across the requested top and bottom faces. */
|
|
2639
|
+
readonly minimumBodyFaceInradius: number;
|
|
2640
|
+
/** Smallest radial wall left between the body and cutter at either requested face. */
|
|
2641
|
+
readonly minimumFaceWall: number;
|
|
2642
|
+
/** Conservative allocation facts for the exact extended internal-thread cutter mesh. */
|
|
2643
|
+
readonly thread: HelicalThreadSolidMeshPreflight;
|
|
2644
|
+
/** Start-aligned circular facet count used by the compensated thread cutter. */
|
|
2645
|
+
readonly threadCircularSegments: number;
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
/**
|
|
2649
|
+
* Supported printable nut body shapes.
|
|
2650
|
+
*/
|
|
2651
|
+
export declare type ThreadedNutShape = "hex" | "round" | "square";
|
|
2652
|
+
|
|
2653
|
+
/**
|
|
2654
|
+
* Options for a compensated external threaded rod along +Z.
|
|
2655
|
+
*/
|
|
2656
|
+
export declare interface ThreadedRodOptions extends Omit<HelicalThreadRidgeMeshOptions, "majorDiameter">, ThreadBevelOptions {
|
|
2657
|
+
/** Printable fit or caller-calibrated allowances. Default: `normal`. */
|
|
2658
|
+
readonly fit?: PrintableThreadFit | PrintableThreadFitPolicy;
|
|
2659
|
+
/** Nominal major diameter before male compensation. */
|
|
2660
|
+
readonly nominalMajorDiameter: number;
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
/** End shape of a generated helical ridge. */
|
|
2664
|
+
export declare type ThreadEndStyle = "blunt" | "standard" | "tapered";
|
|
2665
|
+
|
|
2666
|
+
/** Axial end controls for a generated ridge. */
|
|
2667
|
+
export declare interface ThreadEndTreatmentOptions {
|
|
2668
|
+
/**
|
|
2669
|
+
* Ridge shape at the lower working boundary. `blunt` ends at full profile height, `standard`
|
|
2670
|
+
* clips the periodic profile at the face, and `tapered` ramps out from the minor envelope.
|
|
2671
|
+
* @defaultValue `"blunt"`
|
|
2672
|
+
*/
|
|
2673
|
+
readonly bottom?: ThreadEndStyle;
|
|
2674
|
+
/**
|
|
2675
|
+
* Non-negative unthreaded envelope length reserved at each non-standard end, in millimetres.
|
|
2676
|
+
* Active blunt bevels may raise this reservation to the effective bevel size.
|
|
2677
|
+
* @defaultValue `0`
|
|
2678
|
+
*/
|
|
2679
|
+
readonly endLength?: number;
|
|
2680
|
+
/**
|
|
2681
|
+
* Radial envelope toward which a blunt lead-in collapses.
|
|
2682
|
+
* @defaultValue `"minor"`
|
|
2683
|
+
*/
|
|
2684
|
+
readonly leadInEnvelope?: ThreadLeadInEnvelope;
|
|
2685
|
+
/**
|
|
2686
|
+
* Physical circumferential lead-in length in millimetres.
|
|
2687
|
+
* @defaultValue The profile depth.
|
|
2688
|
+
*/
|
|
2689
|
+
readonly leadInLength?: number;
|
|
2690
|
+
/**
|
|
2691
|
+
* Cross-section scaling curve used by blunt ends. `cut` switches abruptly to the full profile.
|
|
2692
|
+
* @defaultValue `"cut"`
|
|
2693
|
+
*/
|
|
2694
|
+
readonly leadInShape?: ThreadLeadInShape;
|
|
2695
|
+
/**
|
|
2696
|
+
* Ridge shape at the upper working boundary. `blunt` ends at full profile height, `standard`
|
|
2697
|
+
* clips the periodic profile at the face, and `tapered` ramps into the minor envelope.
|
|
2698
|
+
* @defaultValue `"blunt"`
|
|
2699
|
+
*/
|
|
2700
|
+
readonly top?: ThreadEndStyle;
|
|
2701
|
+
}
|
|
2702
|
+
|
|
2703
|
+
/**
|
|
2704
|
+
* Direction in which a conventional helical thread advances around +Z.
|
|
2705
|
+
*/
|
|
2706
|
+
export declare type ThreadHandedness = "left" | "right";
|
|
2707
|
+
|
|
2708
|
+
/** Conventional helix options: `pitch` is adjacent spacing and lead is `pitch * starts`. */
|
|
2709
|
+
export declare interface ThreadHelixOptions {
|
|
2710
|
+
/** Helix direction. Default: `right`. */
|
|
2711
|
+
readonly handedness?: ThreadHandedness;
|
|
2712
|
+
/** Explicit aggregate path allocation ceilings across all starts. */
|
|
2713
|
+
readonly limits?: Partial<GeometrySamplingLimits>;
|
|
2714
|
+
/** Total sampled axial length in millimetres. */
|
|
2715
|
+
readonly length: number;
|
|
2716
|
+
/** Angular offset of the first start in degrees. Default: `0`. */
|
|
2717
|
+
readonly phaseDegrees?: number;
|
|
2718
|
+
/** Adjacent axial thread spacing in millimetres. */
|
|
2719
|
+
readonly pitch: number;
|
|
2720
|
+
/** Radial distance from the +Z axis in millimetres. */
|
|
2721
|
+
readonly radius: number;
|
|
2722
|
+
/** Angular sampling density for each revolution. Default: `32`. */
|
|
2723
|
+
readonly segmentsPerTurn?: number;
|
|
2724
|
+
/** Number of evenly phased helices. Default: `1`. */
|
|
2725
|
+
readonly starts?: number;
|
|
2726
|
+
/** Optional numerical tolerance overrides. */
|
|
2727
|
+
readonly tolerance?: GeometryToleranceOptions;
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2730
|
+
/** Radial envelope toward which a blunt lead-in collapses. */
|
|
2731
|
+
export declare type ThreadLeadInEnvelope = "major" | "minor";
|
|
2732
|
+
|
|
2733
|
+
/** BOSL2-compatible cross-section scaling curve for a blunt thread lead-in. */
|
|
2734
|
+
export declare type ThreadLeadInShape = "cut" | "linear" | "smooth" | "sqrt";
|
|
2735
|
+
|
|
2736
|
+
/**
|
|
2737
|
+
* A validated immutable periodic thread profile in `[axial, radial]` millimetres.
|
|
2738
|
+
*/
|
|
2739
|
+
export declare interface ThreadProfile {
|
|
2740
|
+
/** Axial width of the flat at the major envelope. */
|
|
2741
|
+
readonly crestFlatWidth: number;
|
|
2742
|
+
/** Radial distance from the major envelope to the root. */
|
|
2743
|
+
readonly depth: number;
|
|
2744
|
+
/** Profile family that produced this validated profile. */
|
|
2745
|
+
readonly kind: ThreadProfileSpec["kind"];
|
|
2746
|
+
/** Adjacent axial thread spacing in millimetres. */
|
|
2747
|
+
readonly pitch: number;
|
|
2748
|
+
/** Immutable open `[axial, radial]` path spanning one pitch. */
|
|
2749
|
+
readonly points: readonly Vec2[];
|
|
2750
|
+
/** Axial width of the flat at the minor envelope. */
|
|
2751
|
+
readonly rootFlatWidth: number;
|
|
2752
|
+
}
|
|
2753
|
+
|
|
2754
|
+
/** Fields shared by all thread profile specifications. */
|
|
2755
|
+
export declare interface ThreadProfileBaseSpec {
|
|
2756
|
+
/** Adjacent axial thread spacing in millimetres. */
|
|
2757
|
+
readonly pitch: number;
|
|
2758
|
+
/** Optional numerical tolerance overrides. */
|
|
2759
|
+
readonly tolerance?: GeometryToleranceOptions;
|
|
2760
|
+
}
|
|
2761
|
+
|
|
2762
|
+
/**
|
|
2763
|
+
* Supported built-in and caller-defined thread profiles.
|
|
2764
|
+
*/
|
|
2765
|
+
export declare type ThreadProfileSpec = AcmeThreadProfileSpec | ButtressThreadProfileSpec | CustomThreadProfileSpec | SquareThreadProfileSpec | TrapezoidalThreadProfileSpec | TriangularThreadProfileSpec;
|
|
2766
|
+
|
|
2767
|
+
/** Whether compensation is being applied to an external or internal thread. */
|
|
2768
|
+
export declare type ThreadRole = "male" | "female";
|
|
2769
|
+
|
|
2770
|
+
/**
|
|
2771
|
+
* Dimensions and independent ring/profile tessellation for a torus around the Z axis.
|
|
2772
|
+
*/
|
|
2773
|
+
export declare interface TorusOptions extends PrimitivePlacement {
|
|
2774
|
+
/** Explicit sampling ceilings, bounded by the host policy. */
|
|
2775
|
+
readonly limits?: Partial<GeometrySamplingLimits>;
|
|
2776
|
+
/** Radius from the Z axis to the profile center, in millimetres; greater than `minorRadius`. */
|
|
2777
|
+
readonly majorRadius: number;
|
|
2778
|
+
/** Exact segment count around the Z axis; omitted uses adaptive resolution. */
|
|
2779
|
+
readonly majorSegments?: number;
|
|
2780
|
+
/** Radius of the swept circular profile in millimetres. */
|
|
2781
|
+
readonly minorRadius: number;
|
|
2782
|
+
/** Exact segment count around the swept profile; omitted uses adaptive resolution. */
|
|
2783
|
+
readonly minorSegments?: number;
|
|
2784
|
+
/** Operation-level physical tessellation policy over the active model-wide policy. */
|
|
2785
|
+
readonly resolution?: GeometryResolution;
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
/**
|
|
2789
|
+
* A row-major affine 4x4 matrix applied to column vectors.
|
|
2790
|
+
*
|
|
2791
|
+
* Translation occupies indices 3, 7, and 11. The final row must be
|
|
2792
|
+
* `[0, 0, 0, 1]` within the active geometry tolerance.
|
|
2793
|
+
*/
|
|
2794
|
+
export declare type Transform3 = readonly [
|
|
2795
|
+
m00: number,
|
|
2796
|
+
m01: number,
|
|
2797
|
+
m02: number,
|
|
2798
|
+
m03: number,
|
|
2799
|
+
m10: number,
|
|
2800
|
+
m11: number,
|
|
2801
|
+
m12: number,
|
|
2802
|
+
m13: number,
|
|
2803
|
+
m20: number,
|
|
2804
|
+
m21: number,
|
|
2805
|
+
m22: number,
|
|
2806
|
+
m23: number,
|
|
2807
|
+
m30: number,
|
|
2808
|
+
m31: number,
|
|
2809
|
+
m32: number,
|
|
2810
|
+
m33: number
|
|
2811
|
+
];
|
|
2812
|
+
|
|
2813
|
+
/**
|
|
2814
|
+
* Returns the determinant of a transform's linear 3x3 component.
|
|
2815
|
+
*
|
|
2816
|
+
* A negative result identifies a reflection; zero is rejected as singular.
|
|
2817
|
+
*
|
|
2818
|
+
* @param transform - Valid affine transform.
|
|
2819
|
+
* @returns Signed linear determinant.
|
|
2820
|
+
*/
|
|
2821
|
+
export declare function transformDeterminant3(transform: Transform3): number;
|
|
2822
|
+
|
|
2823
|
+
/**
|
|
2824
|
+
* Transforms a closed loop and preserves its original winding convention.
|
|
2825
|
+
*
|
|
2826
|
+
* Reflections reverse the point order automatically through normalization.
|
|
2827
|
+
*/
|
|
2828
|
+
export declare function transformLoop2(loop: Loop2, transform: Transform3, tolerance?: GeometryToleranceOptions): Loop2;
|
|
2829
|
+
|
|
2830
|
+
/** Applies an XY-plane-preserving affine transform to a 2D path. */
|
|
2831
|
+
export declare function transformPath2(path: Path2, transform: Transform3, tolerance?: GeometryToleranceOptions): Path2;
|
|
2832
|
+
|
|
2833
|
+
/** Applies an affine transform to a 3D path without mutating its points. */
|
|
2834
|
+
export declare function transformPath3(path: Path3, transform: Transform3): Path3;
|
|
2835
|
+
|
|
2836
|
+
/** Transforms an explicit outer/hole region with reflection-safe winding correction. */
|
|
2837
|
+
export declare function transformRegion2(region: Region2, transform: Transform3, tolerance?: GeometryToleranceOptions): Region2;
|
|
2838
|
+
|
|
2839
|
+
/**
|
|
2840
|
+
* Applies an affine transform to a mesh and preserves outward face orientation.
|
|
2841
|
+
*
|
|
2842
|
+
* A transform with a negative linear determinant reflects space, so this helper
|
|
2843
|
+
* automatically reverses every triangle. Singular transforms are rejected.
|
|
2844
|
+
*
|
|
2845
|
+
* @param mesh - Mesh to transform without mutation.
|
|
2846
|
+
* @param transform - Row-major affine transform.
|
|
2847
|
+
* @returns A mesh with fresh transformed positions and copied or reversed indices.
|
|
2848
|
+
*/
|
|
2849
|
+
export declare function transformTriangleMesh(mesh: TriangleMesh, transform: Transform3): TriangleMesh;
|
|
2850
|
+
|
|
2851
|
+
/**
|
|
2852
|
+
* Creates an immutable translation transform.
|
|
2853
|
+
*
|
|
2854
|
+
* @param offset - Finite XYZ translation in model units.
|
|
2855
|
+
* @returns A frozen row-major transform.
|
|
2856
|
+
*/
|
|
2857
|
+
export declare function translationTransform3(offset: Vec3): Transform3;
|
|
2858
|
+
|
|
2859
|
+
/** Trapezoidal thread profile with a configurable included angle. */
|
|
2860
|
+
export declare interface TrapezoidalThreadProfileSpec extends ThreadProfileBaseSpec {
|
|
2861
|
+
/** Selects the trapezoidal profile family. */
|
|
2862
|
+
readonly kind: "trapezoidal";
|
|
2863
|
+
/**
|
|
2864
|
+
* Radial depth in millimetres.
|
|
2865
|
+
* @defaultValue `pitch / 2`
|
|
2866
|
+
*/
|
|
2867
|
+
readonly depth?: number;
|
|
2868
|
+
/**
|
|
2869
|
+
* Included flank angle in degrees. Use `90` for printable 45-degree slopes.
|
|
2870
|
+
* @defaultValue `30`
|
|
2871
|
+
*/
|
|
2872
|
+
readonly threadAngle?: number;
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2875
|
+
/**
|
|
2876
|
+
* A topology-preserving indexed triangle mesh with XYZ vertex positions.
|
|
2877
|
+
*/
|
|
2878
|
+
export declare interface TriangleMesh {
|
|
2879
|
+
/** Three unsigned vertex indices per triangle. */
|
|
2880
|
+
readonly indices: Uint32Array;
|
|
2881
|
+
/** Flat XYZ coordinates, three finite values per vertex. */
|
|
2882
|
+
readonly positions: Float32Array;
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2885
|
+
/**
|
|
2886
|
+
* Measurements and optional edge-connected topology from one validated mesh traversal.
|
|
2887
|
+
*/
|
|
2888
|
+
export declare interface TriangleMeshAnalysis extends TriangleMeshMeasurements {
|
|
2889
|
+
/** Number of referenced edge-connected components when `includeTopology` is requested. */
|
|
2890
|
+
readonly connectedComponentCount?: number;
|
|
2891
|
+
/** Number of distinct indexed undirected edges when `includeTopology` is requested. */
|
|
2892
|
+
readonly edgeCount?: number;
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
/**
|
|
2896
|
+
* Validation and optional connectivity controls for a shared mesh analysis.
|
|
2897
|
+
*/
|
|
2898
|
+
export declare interface TriangleMeshAnalysisOptions extends TriangleMeshValidationOptions {
|
|
2899
|
+
/** Compute indexed edge/component counts and reject unreferenced vertices; defaults to false. */
|
|
2900
|
+
readonly includeTopology?: boolean;
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
/**
|
|
2904
|
+
* Geometric measurements derived from a validated, non-empty triangle mesh.
|
|
2905
|
+
*/
|
|
2906
|
+
export declare interface TriangleMeshMeasurements {
|
|
2907
|
+
/** Axis-aligned bounds. */
|
|
2908
|
+
readonly bounds: MeshBounds;
|
|
2909
|
+
/** Signed enclosed volume; positive values correspond to outward winding. */
|
|
2910
|
+
readonly signedVolume: number;
|
|
2911
|
+
/** Sum of all triangle areas in squared model units. */
|
|
2912
|
+
readonly surfaceArea: number;
|
|
2913
|
+
/** Number of indexed triangles. */
|
|
2914
|
+
readonly triangleCount: number;
|
|
2915
|
+
/** Number of distinct entries in the position buffer. */
|
|
2916
|
+
readonly vertexCount: number;
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
/** Options controlling bounded triangle-mesh quality analysis. */
|
|
2920
|
+
export declare interface TriangleMeshQualityOptions {
|
|
2921
|
+
/** Maximum number of triangles inspected. Defaults to `200000`. */
|
|
2922
|
+
readonly maximumTriangleCount?: number;
|
|
2923
|
+
/** Numeric comparison overrides; model coordinates are interpreted in their existing units. */
|
|
2924
|
+
readonly tolerance?: GeometryToleranceOptions;
|
|
2925
|
+
}
|
|
2926
|
+
|
|
2927
|
+
/** Structural, topological, and planar-patch measurements for one indexed triangle mesh. */
|
|
2928
|
+
export declare interface TriangleMeshQualityReport {
|
|
2929
|
+
/** Number of duplicate triangles beyond their first unordered occurrence. */
|
|
2930
|
+
readonly duplicateTriangleCount: number;
|
|
2931
|
+
/** Number of two-face edges whose incident triangles use the same direction. */
|
|
2932
|
+
readonly inconsistentWindingEdgeCount: number;
|
|
2933
|
+
/** Whether the mesh has valid faces and exactly two oppositely wound faces at every edge. */
|
|
2934
|
+
readonly isClosedOrientedManifold: boolean;
|
|
2935
|
+
/** Largest normalized triangle aspect ratio; an equilateral triangle has ratio `1`. */
|
|
2936
|
+
readonly maximumTriangleAspectRatio: number;
|
|
2937
|
+
/** Largest number of triangles incident to one indexed vertex. */
|
|
2938
|
+
readonly maximumVertexTriangleIncidence: number;
|
|
2939
|
+
/** Largest number of distinct neighbours connected to one indexed vertex. */
|
|
2940
|
+
readonly maximumVertexValence: number;
|
|
2941
|
+
/** Smallest interior triangle angle in degrees. */
|
|
2942
|
+
readonly minimumTriangleAngleDegrees: number;
|
|
2943
|
+
/** Number of triangles at or below the scale-aware zero-area threshold. */
|
|
2944
|
+
readonly nearZeroAreaTriangleCount: number;
|
|
2945
|
+
/** Number of edges with more than two incident triangles. */
|
|
2946
|
+
readonly nonManifoldEdgeCount: number;
|
|
2947
|
+
/** Number of edges with exactly one incident triangle. */
|
|
2948
|
+
readonly openEdgeCount: number;
|
|
2949
|
+
/** Edge-connected coplanar patches in deterministic first-triangle order. */
|
|
2950
|
+
readonly planarPatches: readonly PlanarPatchQuality[];
|
|
2951
|
+
/** Signed enclosed volume in cubic model units; positive values indicate outward winding. */
|
|
2952
|
+
readonly signedVolume: number;
|
|
2953
|
+
/** Total triangle area in squared model units. */
|
|
2954
|
+
readonly surfaceArea: number;
|
|
2955
|
+
/** Number of indexed triangles. */
|
|
2956
|
+
readonly triangleCount: number;
|
|
2957
|
+
/** Number of entries in the position buffer. */
|
|
2958
|
+
readonly vertexCount: number;
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
/** Immutable deterministic measurements for a closed, oriented triangle mesh. */
|
|
2962
|
+
export declare interface TriangleMeshSignature {
|
|
2963
|
+
/** Axis-aligned bounds quantized by `tolerances.position`. */
|
|
2964
|
+
readonly bounds: MeshBounds;
|
|
2965
|
+
/** Number of edge-connected closed components. */
|
|
2966
|
+
readonly connectedComponentCount: number;
|
|
2967
|
+
/** Total orientable genus across all connected components. */
|
|
2968
|
+
readonly genus: number;
|
|
2969
|
+
/** Order-independent hash of quantized vertices and oriented triangles. */
|
|
2970
|
+
readonly fingerprint: string;
|
|
2971
|
+
/** Signed enclosed volume quantized by `tolerances.signedVolume`. */
|
|
2972
|
+
readonly signedVolume: number;
|
|
2973
|
+
/** Quantization used to make the signature stable across insignificant numeric drift. */
|
|
2974
|
+
readonly tolerances: TriangleMeshSignatureTolerances;
|
|
2975
|
+
/** Number of indexed triangles. */
|
|
2976
|
+
readonly triangleCount: number;
|
|
2977
|
+
/** Number of referenced position-buffer vertices. */
|
|
2978
|
+
readonly vertexCount: number;
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
/** Options controlling deterministic triangle-mesh regression signatures. */
|
|
2982
|
+
export declare interface TriangleMeshSignatureOptions {
|
|
2983
|
+
/** Maximum accepted triangle count. Defaults to 200,000. */
|
|
2984
|
+
readonly maximumTriangleCount?: number;
|
|
2985
|
+
/** Position and bounds quantization in model units. Defaults to `1e-5`. */
|
|
2986
|
+
readonly positionTolerance?: number;
|
|
2987
|
+
/** Signed-volume quantization in cubic model units. Defaults to `1e-4`. */
|
|
2988
|
+
readonly volumeTolerance?: number;
|
|
2989
|
+
}
|
|
2990
|
+
|
|
2991
|
+
/** Absolute tolerances recorded in a triangle-mesh regression signature. */
|
|
2992
|
+
export declare interface TriangleMeshSignatureTolerances {
|
|
2993
|
+
/** Position and bounds quantization in model units. */
|
|
2994
|
+
readonly position: number;
|
|
2995
|
+
/** Signed-volume quantization in cubic model units. */
|
|
2996
|
+
readonly signedVolume: number;
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2999
|
+
/** Options controlling structural and manufacturing validation of a mesh. */
|
|
3000
|
+
export declare interface TriangleMeshValidationOptions {
|
|
3001
|
+
/** Permit an empty position and index buffer. Defaults to `false`. */
|
|
3002
|
+
readonly allowEmpty?: boolean;
|
|
3003
|
+
/** Require two oppositely wound faces per edge; geometric self-intersections are not detected. */
|
|
3004
|
+
readonly requireClosed?: boolean;
|
|
3005
|
+
/** Numeric comparison overrides used for zero-area triangle detection. */
|
|
3006
|
+
readonly tolerance?: GeometryToleranceOptions;
|
|
3007
|
+
}
|
|
3008
|
+
|
|
3009
|
+
/**
|
|
3010
|
+
* ISO/UTS-like 60-degree truncated triangular profile.
|
|
3011
|
+
*/
|
|
3012
|
+
export declare interface TriangularThreadProfileSpec extends ThreadProfileBaseSpec {
|
|
3013
|
+
/** Selects the 60-degree triangular profile family. */
|
|
3014
|
+
readonly kind: "triangular";
|
|
3015
|
+
/**
|
|
3016
|
+
* Crest width divided by pitch.
|
|
3017
|
+
* @defaultValue `1 / 8`
|
|
3018
|
+
*/
|
|
3019
|
+
readonly crestFlatRatio?: number;
|
|
3020
|
+
/**
|
|
3021
|
+
* Root width divided by pitch.
|
|
3022
|
+
* @defaultValue `1 / 4`
|
|
3023
|
+
*/
|
|
3024
|
+
readonly rootFlatRatio?: number;
|
|
3025
|
+
}
|
|
3026
|
+
|
|
3027
|
+
/** Ear-clips one normalized simple CCW loop into stable local vertex indices. */
|
|
3028
|
+
export declare function triangulateLoop2(loop: Loop2): Uint32Array;
|
|
3029
|
+
|
|
3030
|
+
/**
|
|
3031
|
+
* Dimensions, placement, and tessellation for a hollow Z-axis tube.
|
|
3032
|
+
*/
|
|
3033
|
+
export declare interface TubeOptions extends CircularPrimitiveOptions, PrimitivePlacement {
|
|
3034
|
+
/**
|
|
3035
|
+
* Centers the tube on the Z origin when `true`; otherwise its bottom is at `Z = 0`.
|
|
3036
|
+
* @defaultValue `true`
|
|
3037
|
+
*/
|
|
3038
|
+
readonly center?: boolean;
|
|
3039
|
+
/** Total height along Z in millimetres. */
|
|
3040
|
+
readonly height: number;
|
|
3041
|
+
/** Positive inner radius in millimetres. */
|
|
3042
|
+
readonly innerRadius: number;
|
|
3043
|
+
/** Outer radius in millimetres; greater than {@link TubeOptions.innerRadius}. */
|
|
3044
|
+
readonly outerRadius: number;
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
/**
|
|
3048
|
+
* Validates that a transform is finite, affine, and non-singular.
|
|
3049
|
+
*
|
|
3050
|
+
* @param transform - Row-major matrix to validate.
|
|
3051
|
+
* @param tolerance - Optional comparison overrides.
|
|
3052
|
+
* @returns The original transform after successful validation.
|
|
3053
|
+
* @throws {@link GeometryError} For non-finite, non-affine, or singular matrices.
|
|
3054
|
+
*/
|
|
3055
|
+
export declare function validateTransform3(transform: Transform3, tolerance?: GeometryToleranceOptions): Transform3;
|
|
3056
|
+
|
|
3057
|
+
/**
|
|
3058
|
+
* Validates mesh buffers, indices, triangle area, and optionally closed topology.
|
|
3059
|
+
*
|
|
3060
|
+
* Closed validation requires each edge to occur exactly twice with opposite
|
|
3061
|
+
* directions, rejecting boundary and non-manifold edges. Validation does not
|
|
3062
|
+
* mutate or copy the mesh. This establishes edge connectivity, not the absence
|
|
3063
|
+
* of geometric self-intersections between faces.
|
|
3064
|
+
*
|
|
3065
|
+
* @param mesh - Mesh to inspect.
|
|
3066
|
+
* @param options - Empty-mesh, topology, and tolerance policy.
|
|
3067
|
+
* @returns The original mesh after successful validation.
|
|
3068
|
+
* @throws {@link GeometryError} When any requested invariant fails.
|
|
3069
|
+
*/
|
|
3070
|
+
export declare function validateTriangleMesh(mesh: TriangleMesh, options?: TriangleMeshValidationOptions): TriangleMesh;
|
|
3071
|
+
|
|
3072
|
+
/** A two-dimensional Cartesian vector or point. */
|
|
3073
|
+
export declare type Vec2 = readonly [x: number, y: number];
|
|
3074
|
+
|
|
3075
|
+
/** A three-dimensional Cartesian vector or point. */
|
|
3076
|
+
export declare type Vec3 = readonly [x: number, y: number, z: number];
|
|
3077
|
+
|
|
3078
|
+
/** Exact curve bounds in millimetres; positive Y points upward. */
|
|
3079
|
+
export declare interface VectorTextBounds {
|
|
3080
|
+
/** Minimum X and Y of visible outlines, including accents, descenders, and overhangs. */
|
|
3081
|
+
readonly min: readonly [number, number];
|
|
3082
|
+
/** Maximum X and Y of visible outlines. */
|
|
3083
|
+
readonly max: readonly [number, number];
|
|
3084
|
+
}
|
|
3085
|
+
|
|
3086
|
+
/**
|
|
3087
|
+
* Immutable vector layout with no browser, font parser, or kernel ownership.
|
|
3088
|
+
*/
|
|
3089
|
+
export declare interface VectorTextLayout {
|
|
3090
|
+
/** Nonzero-filled path data in millimetres, positive Y upward; empty for text with no ink. */
|
|
3091
|
+
readonly paths: readonly string[];
|
|
3092
|
+
/** Exact measurements of these paths and their logical text layout. */
|
|
3093
|
+
readonly metrics: VectorTextMetrics;
|
|
3094
|
+
}
|
|
3095
|
+
|
|
3096
|
+
/**
|
|
3097
|
+
* Horizontal multiline text, bounded to 512 UTF-16 units and 16 lines without wrapping.
|
|
3098
|
+
*/
|
|
3099
|
+
export declare interface VectorTextLayoutOptions extends VectorTextOptions {
|
|
3100
|
+
/** Place each line's advance at the origin; defaults to left. Ink overhang is preserved. */
|
|
3101
|
+
readonly align?: "left" | "center" | "right";
|
|
3102
|
+
/** Baseline spacing in ems, 0.5–5; omitted uses the selected face's natural vertical metrics. */
|
|
3103
|
+
readonly lineHeight?: number;
|
|
3104
|
+
/** Place the first baseline or the complete ink bounds at Y=0; defaults to baseline. */
|
|
3105
|
+
readonly verticalAlign?: "baseline" | "top" | "center" | "bottom";
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3108
|
+
/** Text measurements from the same immutable layout that supplies geometry and SVG outlines. */
|
|
3109
|
+
export declare interface VectorTextMetrics {
|
|
3110
|
+
/** Visible curve bounds after alignment, or null when the text has no ink. */
|
|
3111
|
+
readonly bounds: VectorTextBounds | null;
|
|
3112
|
+
/** Unaligned pen displacement: final line advance and negative baseline displacement, in mm. */
|
|
3113
|
+
readonly advance: readonly [number, number];
|
|
3114
|
+
/** Maximum line advance in millimetres, including spaces; distinct from visible ink width. */
|
|
3115
|
+
readonly logicalWidth: number;
|
|
3116
|
+
/** Selected font's ascender distance above a baseline in millimetres, independent of the text. */
|
|
3117
|
+
readonly ascent: number;
|
|
3118
|
+
/** Selected font's descender distance below a baseline in millimetres, a non-negative value. */
|
|
3119
|
+
readonly descent: number;
|
|
3120
|
+
/** Actual distance between baselines in millimetres. */
|
|
3121
|
+
readonly lineHeight: number;
|
|
3122
|
+
/** Number of lines, including empty and trailing lines; empty text occupies one line. */
|
|
3123
|
+
readonly lineCount: number;
|
|
3124
|
+
}
|
|
3125
|
+
|
|
3126
|
+
/** Shaping controls for a prepared exact font face; all lengths are in millimetres. */
|
|
3127
|
+
export declare interface VectorTextOptions {
|
|
3128
|
+
/** Em size in millimetres, greater than zero and at most 10000; not the visible glyph height. */
|
|
3129
|
+
readonly fontSize: number;
|
|
3130
|
+
/** Actual static or variable weight, 1–1000; defaults to the prepared face's static weight. */
|
|
3131
|
+
readonly fontWeight?: number;
|
|
3132
|
+
/** Tracking between glyph clusters in millimetres, -100–100; defaults to zero. */
|
|
3133
|
+
readonly letterSpacing?: number;
|
|
3134
|
+
}
|
|
3135
|
+
|
|
3136
|
+
export { }
|