@bitbybit-dev/base 1.4.1 → 1.5.0-rc.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/lib/api/GlobalCDNProvider.js +1 -1
- package/lib/api/color-space.d.ts +14 -0
- package/lib/api/color-space.js +24 -0
- package/lib/api/index.d.ts +2 -0
- package/lib/api/index.js +2 -0
- package/lib/api/inputs/base-inputs.d.ts +382 -5
- package/lib/api/inputs/base-inputs.js +0 -3
- package/lib/api/inputs/color-inputs.d.ts +1 -1
- package/lib/api/inputs/color-inputs.js +0 -1
- package/lib/api/inputs/dates-inputs.js +0 -1
- package/lib/api/inputs/frame-inputs.d.ts +1 -1
- package/lib/api/inputs/inputs.js +0 -1
- package/lib/api/inputs/io-inputs.d.ts +1 -1
- package/lib/api/inputs/line-inputs.d.ts +1 -1
- package/lib/api/inputs/lists-inputs.js +0 -1
- package/lib/api/inputs/logic-inputs.d.ts +1 -1
- package/lib/api/inputs/logic-inputs.js +0 -1
- package/lib/api/inputs/math-inputs.js +0 -1
- package/lib/api/inputs/mesh-inputs.d.ts +29 -1
- package/lib/api/inputs/mesh-inputs.js +25 -1
- package/lib/api/inputs/point-inputs.d.ts +30 -1
- package/lib/api/inputs/point-inputs.js +28 -0
- package/lib/api/inputs/polyline-inputs.d.ts +1 -1
- package/lib/api/inputs/transforms-inputs.d.ts +1 -1
- package/lib/api/inputs/vector-inputs.d.ts +1 -1
- package/lib/api/kernel-calls/describe-failure.d.ts +3 -2
- package/lib/api/kernel-calls/describe-failure.js +9 -17
- package/lib/api/kernel-calls/failure-message.d.ts +1 -1
- package/lib/api/kernel-calls/hashing.d.ts +14 -0
- package/lib/api/kernel-calls/hashing.js +47 -0
- package/lib/api/kernel-calls/index.d.ts +3 -0
- package/lib/api/kernel-calls/index.js +3 -0
- package/lib/api/kernel-calls/input-rules.d.ts +1 -1
- package/lib/api/kernel-calls/input-rules.js +10 -5
- package/lib/api/kernel-calls/input-validation.d.ts +3 -3
- package/lib/api/kernel-calls/input-validation.js +24 -14
- package/lib/api/kernel-calls/kernel-steps.d.ts +19 -0
- package/lib/api/kernel-calls/kernel-steps.js +19 -0
- package/lib/api/kernel-calls/resolve-dto.d.ts +5 -3
- package/lib/api/kernel-calls/resolve-dto.js +9 -4
- package/lib/api/kernel-calls/unknown-values.d.ts +12 -0
- package/lib/api/kernel-calls/unknown-values.js +16 -0
- package/lib/api/kernel-calls/with-defaults.d.ts +1 -1
- package/lib/api/models/point/hex-grid-data.d.ts +1 -1
- package/lib/api/models/text/vector-char-data.d.ts +1 -1
- package/lib/api/models/text/vector-text-data.d.ts +1 -1
- package/lib/api/recipes/checker-types.d.ts +14 -0
- package/lib/api/recipes/checker-types.js +1 -0
- package/lib/api/recipes/index.d.ts +4 -0
- package/lib/api/recipes/index.js +3 -0
- package/lib/api/recipes/limits.constants.d.ts +23 -0
- package/lib/api/recipes/limits.constants.js +23 -0
- package/lib/api/recipes/recipe-types.d.ts +48 -0
- package/lib/api/recipes/recipe-types.js +1 -0
- package/lib/api/recipes/sources.d.ts +16 -0
- package/lib/api/recipes/sources.js +23 -0
- package/lib/api/recipes/surface-mesh.d.ts +16 -0
- package/lib/api/recipes/surface-mesh.js +86 -0
- package/lib/api/recipes/validate.d.ts +36 -0
- package/lib/api/recipes/validate.js +427 -0
- package/lib/api/resolved-inputs/index.d.ts +3 -0
- package/lib/api/services/color.d.ts +1 -1
- package/lib/api/services/frame.d.ts +3 -95
- package/lib/api/services/frame.js +24 -135
- package/lib/api/services/geometry-helper.d.ts +1 -1
- package/lib/api/services/helpers/arcs.d.ts +6 -0
- package/lib/api/services/helpers/arcs.js +30 -0
- package/lib/api/services/helpers/crc32.d.ts +1 -0
- package/lib/api/services/helpers/crc32.js +21 -0
- package/lib/api/services/helpers/dxf/dxf-generator.d.ts +0 -83
- package/lib/api/services/helpers/dxf/dxf-generator.js +5 -86
- package/lib/api/services/helpers/frame-axes.d.ts +9 -1
- package/lib/api/services/helpers/frame-axes.js +34 -0
- package/lib/api/services/helpers/helper-types.d.ts +34 -0
- package/lib/api/services/helpers/helper-types.js +1 -0
- package/lib/api/services/helpers/inflate.constants.d.ts +41 -0
- package/lib/api/services/helpers/inflate.constants.js +41 -0
- package/lib/api/services/helpers/inflate.d.ts +3 -0
- package/lib/api/services/helpers/inflate.js +228 -0
- package/lib/api/services/helpers/matrices.constants.d.ts +2 -0
- package/lib/api/services/helpers/matrices.constants.js +2 -0
- package/lib/api/services/helpers/matrices.d.ts +9 -1
- package/lib/api/services/helpers/matrices.js +18 -0
- package/lib/api/services/helpers/mesh-measures.d.ts +1 -0
- package/lib/api/services/helpers/mesh-measures.js +28 -0
- package/lib/api/services/helpers/mesh-normals.d.ts +2 -0
- package/lib/api/services/helpers/mesh-normals.js +118 -26
- package/lib/api/services/helpers/mesh-primitives.constants.d.ts +2 -0
- package/lib/api/services/helpers/mesh-primitives.constants.js +12 -0
- package/lib/api/services/helpers/mesh-primitives.d.ts +3 -0
- package/lib/api/services/helpers/mesh-primitives.js +46 -0
- package/lib/api/services/helpers/nurbs.d.ts +7 -0
- package/lib/api/services/helpers/nurbs.js +50 -0
- package/lib/api/services/helpers/paths.d.ts +8 -0
- package/lib/api/services/helpers/paths.js +96 -0
- package/lib/api/services/helpers/polygons.d.ts +8 -0
- package/lib/api/services/helpers/polygons.js +59 -0
- package/lib/api/services/helpers/surface-triangulation.d.ts +6 -0
- package/lib/api/services/helpers/surface-triangulation.js +298 -0
- package/lib/api/services/helpers/triangulation.d.ts +2 -0
- package/lib/api/services/helpers/triangulation.js +295 -0
- package/lib/api/services/helpers/vectors.d.ts +18 -0
- package/lib/api/services/helpers/vectors.js +17 -0
- package/lib/api/services/helpers/zip.constants.d.ts +34 -0
- package/lib/api/services/helpers/zip.constants.js +34 -0
- package/lib/api/services/helpers/zip.d.ts +4 -0
- package/lib/api/services/helpers/zip.js +89 -0
- package/lib/api/services/line.d.ts +3 -3
- package/lib/api/services/mesh.d.ts +37 -2
- package/lib/api/services/mesh.js +60 -3
- package/lib/api/services/point.d.ts +22 -10
- package/lib/api/services/point.js +42 -13
- package/lib/api/services/polyline.d.ts +39 -4
- package/lib/api/services/polyline.js +56 -6
- package/lib/api/services/text.d.ts +2 -2
- package/lib/api/services/text.js +10 -5
- package/lib/api/services/transforms.d.ts +3 -9
- package/lib/api/services/transforms.js +0 -6
- package/lib/api/services/vector.d.ts +2 -2
- package/lib/api/services/vector.js +2 -5
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns one sRGB-encoded color channel, from 0 to 1, into linear light, as glTF, XCAF and the
|
|
3
|
+
* renderers' lighting expect it.
|
|
4
|
+
* @param channel - The encoded channel, from 0 to 1
|
|
5
|
+
* @returns The linear channel, from 0 to 1
|
|
6
|
+
*/
|
|
7
|
+
export declare function srgbToLinear(channel: number): number;
|
|
8
|
+
/**
|
|
9
|
+
* Turns one linear-light color channel, from 0 to 1, back into its sRGB encoding, the inverse of
|
|
10
|
+
* `srgbToLinear`.
|
|
11
|
+
* @param channel - The linear channel, from 0 to 1
|
|
12
|
+
* @returns The encoded channel, from 0 to 1
|
|
13
|
+
*/
|
|
14
|
+
export declare function linearToSrgb(channel: number): number;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const ENCODED_KNEE = 0.04045;
|
|
2
|
+
const LINEAR_KNEE = 0.0031308;
|
|
3
|
+
const LINEAR_SLOPE = 12.92;
|
|
4
|
+
const CURVE_OFFSET = 0.055;
|
|
5
|
+
const CURVE_SCALE = 1.055;
|
|
6
|
+
const CURVE_EXPONENT = 2.4;
|
|
7
|
+
/**
|
|
8
|
+
* Turns one sRGB-encoded color channel, from 0 to 1, into linear light, as glTF, XCAF and the
|
|
9
|
+
* renderers' lighting expect it.
|
|
10
|
+
* @param channel - The encoded channel, from 0 to 1
|
|
11
|
+
* @returns The linear channel, from 0 to 1
|
|
12
|
+
*/
|
|
13
|
+
export function srgbToLinear(channel) {
|
|
14
|
+
return channel <= ENCODED_KNEE ? channel / LINEAR_SLOPE : Math.pow(((channel + CURVE_OFFSET) / CURVE_SCALE), CURVE_EXPONENT);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Turns one linear-light color channel, from 0 to 1, back into its sRGB encoding, the inverse of
|
|
18
|
+
* `srgbToLinear`.
|
|
19
|
+
* @param channel - The linear channel, from 0 to 1
|
|
20
|
+
* @returns The encoded channel, from 0 to 1
|
|
21
|
+
*/
|
|
22
|
+
export function linearToSrgb(channel) {
|
|
23
|
+
return channel <= LINEAR_KNEE ? channel * LINEAR_SLOPE : CURVE_SCALE * Math.pow(channel, (1 / CURVE_EXPONENT)) - CURVE_OFFSET;
|
|
24
|
+
}
|
package/lib/api/index.d.ts
CHANGED
package/lib/api/index.js
CHANGED
|
@@ -142,21 +142,23 @@ export declare namespace Base {
|
|
|
142
142
|
end: Base.Point3;
|
|
143
143
|
};
|
|
144
144
|
/**
|
|
145
|
-
* A connected chain of points in space, optionally closed, with an optional color
|
|
146
|
-
*
|
|
145
|
+
* A connected chain of points in space, optionally closed, with an optional color: a hex text
|
|
146
|
+
* such as `#ff0000`, or `[r, g, b]` values from 0 to 1. Closing it turns the chain into an
|
|
147
|
+
* outline that can become a face.
|
|
147
148
|
*/
|
|
148
149
|
type Polyline3 = {
|
|
149
150
|
points: Base.Point3[];
|
|
150
151
|
isClosed?: boolean;
|
|
151
|
-
color?: number[];
|
|
152
|
+
color?: string | number[];
|
|
152
153
|
};
|
|
153
154
|
/**
|
|
154
|
-
* A connected chain of points in the plane, optionally closed, with an optional color
|
|
155
|
+
* A connected chain of points in the plane, optionally closed, with an optional color: a hex
|
|
156
|
+
* text such as `#ff0000`, or `[r, g, b]` values from 0 to 1.
|
|
155
157
|
*/
|
|
156
158
|
type Polyline2 = {
|
|
157
159
|
points: Base.Point2[];
|
|
158
160
|
isClosed?: boolean;
|
|
159
|
-
color?: number[];
|
|
161
|
+
color?: string | number[];
|
|
160
162
|
};
|
|
161
163
|
/**
|
|
162
164
|
* A 3x3 transformation matrix as 9 numbers, for transforms in the plane.
|
|
@@ -178,6 +180,381 @@ export declare namespace Base {
|
|
|
178
180
|
* combined transform. A method that takes a list gives one result, not one per matrix.
|
|
179
181
|
*/
|
|
180
182
|
type TransformMatrixes = TransformMatrix[];
|
|
183
|
+
/**
|
|
184
|
+
* A run of numbers in one of a recipe's buffers: where it starts and how many numbers it holds.
|
|
185
|
+
* @beta
|
|
186
|
+
*/
|
|
187
|
+
type RecipeRange = [number, number];
|
|
188
|
+
/**
|
|
189
|
+
* The numbers a recipe's nodes point into: coordinates in `f64`, triangle indices in `i32`.
|
|
190
|
+
* @beta
|
|
191
|
+
*/
|
|
192
|
+
interface RecipeBuffers {
|
|
193
|
+
/**
|
|
194
|
+
* Coordinates: flat `x, y` pairs for polygons, `x, y, z` triples for triangle positions and
|
|
195
|
+
* sixteen numbers for each frame of a loft. Every number in it is a coordinate, finite and
|
|
196
|
+
* between minus and plus one billion.
|
|
197
|
+
*/
|
|
198
|
+
f64: Float64Array;
|
|
199
|
+
/**
|
|
200
|
+
* Triangle corners as positions counted from 0, three per triangle.
|
|
201
|
+
*/
|
|
202
|
+
i32: Int32Array;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* A flat region in the XY plane: everything its boundary encloses, less everything any of its
|
|
206
|
+
* holes encloses. The boundary and each hole are a range of `x, y` pairs without the first point
|
|
207
|
+
* repeated, in either winding; a boundary that crosses itself keeps every loop it makes.
|
|
208
|
+
* @beta
|
|
209
|
+
*/
|
|
210
|
+
interface RecipePolygonNode {
|
|
211
|
+
/**
|
|
212
|
+
* Always `polygon`.
|
|
213
|
+
*/
|
|
214
|
+
op: "polygon";
|
|
215
|
+
/**
|
|
216
|
+
* The boundary, clockwise or counterclockwise.
|
|
217
|
+
*/
|
|
218
|
+
points: RecipeRange;
|
|
219
|
+
/**
|
|
220
|
+
* The holes, clockwise or counterclockwise; they may overlap each other or reach past the
|
|
221
|
+
* boundary, and only what lies inside the boundary is cut away.
|
|
222
|
+
*/
|
|
223
|
+
holes: RecipeRange[];
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* A flat disc in the XY plane. How many straight sides approximate it is left to the kernel that
|
|
227
|
+
* builds the recipe.
|
|
228
|
+
* @beta
|
|
229
|
+
*/
|
|
230
|
+
interface RecipeCircleNode {
|
|
231
|
+
/**
|
|
232
|
+
* Always `circle`.
|
|
233
|
+
*/
|
|
234
|
+
op: "circle";
|
|
235
|
+
/**
|
|
236
|
+
* The centre, as `[x, y]`.
|
|
237
|
+
*/
|
|
238
|
+
center: Point2;
|
|
239
|
+
/**
|
|
240
|
+
* The radius, above zero.
|
|
241
|
+
*/
|
|
242
|
+
radius: number;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* A solid made by sweeping a polygon or circle node along a direction.
|
|
246
|
+
* @beta
|
|
247
|
+
*/
|
|
248
|
+
interface RecipeExtrudeNode {
|
|
249
|
+
/**
|
|
250
|
+
* Always `extrude`.
|
|
251
|
+
*/
|
|
252
|
+
op: "extrude";
|
|
253
|
+
/**
|
|
254
|
+
* The index of the polygon or circle node to sweep.
|
|
255
|
+
*/
|
|
256
|
+
profile: number;
|
|
257
|
+
/**
|
|
258
|
+
* The direction of the sweep, which must not lie in the XY plane.
|
|
259
|
+
*/
|
|
260
|
+
direction: Vector3;
|
|
261
|
+
/**
|
|
262
|
+
* How far to sweep along `direction`, which is normalised first, above zero.
|
|
263
|
+
*/
|
|
264
|
+
depth: number;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Everything on one side of a plane: the side `normal` points to. Used only as a tool of a
|
|
268
|
+
* difference node, to cut a solid by the plane.
|
|
269
|
+
* @beta
|
|
270
|
+
*/
|
|
271
|
+
interface RecipeHalfSpaceNode {
|
|
272
|
+
/**
|
|
273
|
+
* Always `halfSpace`.
|
|
274
|
+
*/
|
|
275
|
+
op: "halfSpace";
|
|
276
|
+
/**
|
|
277
|
+
* A point on the plane.
|
|
278
|
+
*/
|
|
279
|
+
origin: Point3;
|
|
280
|
+
/**
|
|
281
|
+
* The plane's normal, pointing into the half-space.
|
|
282
|
+
*/
|
|
283
|
+
normal: Vector3;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* A solid with other solids or half-spaces cut away.
|
|
287
|
+
* @beta
|
|
288
|
+
*/
|
|
289
|
+
interface RecipeDifferenceNode {
|
|
290
|
+
/**
|
|
291
|
+
* Always `difference`.
|
|
292
|
+
*/
|
|
293
|
+
op: "difference";
|
|
294
|
+
/**
|
|
295
|
+
* The index of the solid to cut.
|
|
296
|
+
*/
|
|
297
|
+
of: number;
|
|
298
|
+
/**
|
|
299
|
+
* The indices of what is cut away, all at once.
|
|
300
|
+
*/
|
|
301
|
+
tools: number[];
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* A node moved, turned or scaled by a matrix.
|
|
305
|
+
* @beta
|
|
306
|
+
*/
|
|
307
|
+
interface RecipeTransformNode {
|
|
308
|
+
/**
|
|
309
|
+
* Always `transform`.
|
|
310
|
+
*/
|
|
311
|
+
op: "transform";
|
|
312
|
+
/**
|
|
313
|
+
* The index of the node to transform.
|
|
314
|
+
*/
|
|
315
|
+
of: number;
|
|
316
|
+
/**
|
|
317
|
+
* Sixteen numbers in column-major order, with 0, 0, 0, 1 as the bottom row: a move, a turn,
|
|
318
|
+
* a mirror and a scale, never a projection.
|
|
319
|
+
*/
|
|
320
|
+
matrix: TransformMatrix;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* A host solid with openings cut through it, such as a wall with its doors' and windows' holes.
|
|
324
|
+
* The same as a difference, kept apart so an executor can cut openings through flat hosts in 2D.
|
|
325
|
+
* @beta
|
|
326
|
+
*/
|
|
327
|
+
interface RecipeVoidsNode {
|
|
328
|
+
/**
|
|
329
|
+
* Always `voids`.
|
|
330
|
+
*/
|
|
331
|
+
op: "voids";
|
|
332
|
+
/**
|
|
333
|
+
* The index of the host solid.
|
|
334
|
+
*/
|
|
335
|
+
host: number;
|
|
336
|
+
/**
|
|
337
|
+
* The indices of the opening solids.
|
|
338
|
+
*/
|
|
339
|
+
openings: number[];
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* A triangle mesh: positions and the triangles between them.
|
|
343
|
+
* @beta
|
|
344
|
+
*/
|
|
345
|
+
interface RecipeTrianglesNode {
|
|
346
|
+
/**
|
|
347
|
+
* Always `triangles`.
|
|
348
|
+
*/
|
|
349
|
+
op: "triangles";
|
|
350
|
+
/**
|
|
351
|
+
* A range of `x, y, z` triples in `f64`.
|
|
352
|
+
*/
|
|
353
|
+
positions: RecipeRange;
|
|
354
|
+
/**
|
|
355
|
+
* A range of `i32` indices into the positions, three per triangle.
|
|
356
|
+
*/
|
|
357
|
+
indices: RecipeRange;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Several solids taken together as one, filling the space any of them fills. Parts that
|
|
361
|
+
* overlap may come back joined into one solid, depending on the kernel that builds it.
|
|
362
|
+
* @beta
|
|
363
|
+
*/
|
|
364
|
+
interface RecipeCompoundNode {
|
|
365
|
+
/**
|
|
366
|
+
* Always `compound`.
|
|
367
|
+
*/
|
|
368
|
+
op: "compound";
|
|
369
|
+
/**
|
|
370
|
+
* The indices of the solids.
|
|
371
|
+
*/
|
|
372
|
+
of: number[];
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Several solids joined into one, filling the space any of them fills, with no faces left where
|
|
376
|
+
* they meet.
|
|
377
|
+
* @beta
|
|
378
|
+
*/
|
|
379
|
+
interface RecipeUnionNode {
|
|
380
|
+
/**
|
|
381
|
+
* Always `union`.
|
|
382
|
+
*/
|
|
383
|
+
op: "union";
|
|
384
|
+
/**
|
|
385
|
+
* The indices of the solids, at least one.
|
|
386
|
+
*/
|
|
387
|
+
of: number[];
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* The space every one of several solids fills.
|
|
391
|
+
* @beta
|
|
392
|
+
*/
|
|
393
|
+
interface RecipeIntersectionNode {
|
|
394
|
+
/**
|
|
395
|
+
* Always `intersection`.
|
|
396
|
+
*/
|
|
397
|
+
op: "intersection";
|
|
398
|
+
/**
|
|
399
|
+
* The indices of the solids, at least two.
|
|
400
|
+
*/
|
|
401
|
+
of: number[];
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* A solid made by turning a polygon or circle node about an axis in the XY plane, such as a pipe
|
|
405
|
+
* bend or a round column's capital. The profile must lie on one side of the axis.
|
|
406
|
+
* @beta
|
|
407
|
+
*/
|
|
408
|
+
interface RecipeRevolveNode {
|
|
409
|
+
/**
|
|
410
|
+
* Always `revolve`.
|
|
411
|
+
*/
|
|
412
|
+
op: "revolve";
|
|
413
|
+
/**
|
|
414
|
+
* The index of the polygon or circle node to turn.
|
|
415
|
+
*/
|
|
416
|
+
profile: number;
|
|
417
|
+
/**
|
|
418
|
+
* A point on the axis, as `[x, y]`.
|
|
419
|
+
*/
|
|
420
|
+
origin: Point2;
|
|
421
|
+
/**
|
|
422
|
+
* The axis direction, as `[x, y]`; not a zero vector.
|
|
423
|
+
*/
|
|
424
|
+
direction: Vector2;
|
|
425
|
+
/**
|
|
426
|
+
* How far to turn, in radians, above zero and at most a whole turn. The turn follows the
|
|
427
|
+
* right-hand rule about `direction`.
|
|
428
|
+
*/
|
|
429
|
+
angle: number;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* A solid made by placing polygon or circle nodes one after another by frames and joining each to
|
|
433
|
+
* the next by straight sides, closed at both ends: a profile swept along a path when one profile
|
|
434
|
+
* is placed by many frames, or a taper from one profile to another.
|
|
435
|
+
* @beta
|
|
436
|
+
*/
|
|
437
|
+
interface RecipeLoftNode {
|
|
438
|
+
/**
|
|
439
|
+
* Always `loft`.
|
|
440
|
+
*/
|
|
441
|
+
op: "loft";
|
|
442
|
+
/**
|
|
443
|
+
* The indices of the polygon or circle nodes: one, placed by every frame, or one per frame.
|
|
444
|
+
* Profiles that differ should have as many corners in each loop, so a mesh kernel can join
|
|
445
|
+
* them corner to corner.
|
|
446
|
+
*/
|
|
447
|
+
profiles: number[];
|
|
448
|
+
/**
|
|
449
|
+
* A range of `f64` holding sixteen numbers per frame, at least two frames: each a column-major
|
|
450
|
+
* matrix with 0, 0, 0, 1 as its bottom row, placing a profile's XY plane.
|
|
451
|
+
*/
|
|
452
|
+
frames: RecipeRange;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* One step of a recipe. A node refers only to nodes before it, by their position in the list.
|
|
456
|
+
* @beta
|
|
457
|
+
*/
|
|
458
|
+
type RecipeNode = RecipePolygonNode | RecipeCircleNode | RecipeExtrudeNode | RecipeHalfSpaceNode | RecipeDifferenceNode | RecipeTransformNode | RecipeVoidsNode | RecipeTrianglesNode | RecipeCompoundNode | RecipeUnionNode | RecipeIntersectionNode | RecipeRevolveNode | RecipeLoftNode;
|
|
459
|
+
/**
|
|
460
|
+
* A value a recipe carries through to its results untouched.
|
|
461
|
+
* @beta
|
|
462
|
+
*/
|
|
463
|
+
type RecipeTagValue = string | number | boolean | number[];
|
|
464
|
+
/**
|
|
465
|
+
* What a recipe builds: one node, placed by a matrix, labelled by a tag. Several roots may place
|
|
466
|
+
* the same node, so a repeated part is described once.
|
|
467
|
+
* @beta
|
|
468
|
+
*/
|
|
469
|
+
interface RecipeRoot {
|
|
470
|
+
/**
|
|
471
|
+
* The index of the node to build.
|
|
472
|
+
*/
|
|
473
|
+
node: number;
|
|
474
|
+
/**
|
|
475
|
+
* Where the result is placed: sixteen numbers in column-major order, with 0, 0, 0, 1 as the
|
|
476
|
+
* bottom row.
|
|
477
|
+
*/
|
|
478
|
+
matrix: TransformMatrix;
|
|
479
|
+
/**
|
|
480
|
+
* Labels handed back with the result unchanged, such as an element's `globalId`.
|
|
481
|
+
*/
|
|
482
|
+
tag: Record<string, RecipeTagValue>;
|
|
483
|
+
/**
|
|
484
|
+
* The index of the group the result belongs to, such as the storey an element stands on;
|
|
485
|
+
* left out for a result that belongs to none.
|
|
486
|
+
*/
|
|
487
|
+
group?: number | undefined;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* A named group of a recipe's results, such as a storey or an assembly of parts, which may lie
|
|
491
|
+
* in another group. An executor that builds a structure, such as an assembly document, nests its
|
|
492
|
+
* results by their groups; one that only builds shapes ignores them.
|
|
493
|
+
*
|
|
494
|
+
* Experimental: the recipe format may still change before it is declared stable.
|
|
495
|
+
* @beta
|
|
496
|
+
*/
|
|
497
|
+
interface RecipeGroup {
|
|
498
|
+
/**
|
|
499
|
+
* What the group is called, such as `Ground floor`.
|
|
500
|
+
*/
|
|
501
|
+
name: string;
|
|
502
|
+
/**
|
|
503
|
+
* The index of the group this one lies in, which comes earlier in the list; left out for a
|
|
504
|
+
* group at the top.
|
|
505
|
+
*/
|
|
506
|
+
parent?: number | undefined;
|
|
507
|
+
/**
|
|
508
|
+
* Labels handed back with the group unchanged, such as a storey's `globalId`.
|
|
509
|
+
*/
|
|
510
|
+
tag: Record<string, RecipeTagValue>;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Solids described as data rather than built: a list of steps (polygons, extrusions, turns and
|
|
514
|
+
* lofts, cuts and unions, transforms, meshes) and the results to build from them. Every number is already resolved, so
|
|
515
|
+
* a recipe has no variables or expressions; how finely circles are divided is left to the kernel
|
|
516
|
+
* that builds it.
|
|
517
|
+
*
|
|
518
|
+
* Experimental: the recipe format may still change before it is declared stable.
|
|
519
|
+
* @beta
|
|
520
|
+
*/
|
|
521
|
+
interface Recipe {
|
|
522
|
+
/**
|
|
523
|
+
* Always `bitbybit.recipe`.
|
|
524
|
+
*/
|
|
525
|
+
format: "bitbybit.recipe";
|
|
526
|
+
/**
|
|
527
|
+
* The recipe format's version, 1.
|
|
528
|
+
*/
|
|
529
|
+
version: 1;
|
|
530
|
+
/**
|
|
531
|
+
* How many millimetres one unit of the recipe is, for whoever reads the results: the
|
|
532
|
+
* coordinates are in the recipe's own units, and an executor builds in them unscaled.
|
|
533
|
+
*/
|
|
534
|
+
millimetresPerUnit: number;
|
|
535
|
+
/**
|
|
536
|
+
* The distance below which two positions count as the same, in the recipe's units, as the
|
|
537
|
+
* recipe's source measured it. An executor may use it where it compares positions, or not.
|
|
538
|
+
*/
|
|
539
|
+
tolerance: number;
|
|
540
|
+
/**
|
|
541
|
+
* The numbers the nodes point into.
|
|
542
|
+
*/
|
|
543
|
+
buffers: RecipeBuffers;
|
|
544
|
+
/**
|
|
545
|
+
* The steps, each referring only to steps before it.
|
|
546
|
+
*/
|
|
547
|
+
nodes: RecipeNode[];
|
|
548
|
+
/**
|
|
549
|
+
* The results to build.
|
|
550
|
+
*/
|
|
551
|
+
roots: RecipeRoot[];
|
|
552
|
+
/**
|
|
553
|
+
* The groups the results belong to, each after the group it lies in; left out when the
|
|
554
|
+
* results are not grouped.
|
|
555
|
+
*/
|
|
556
|
+
groups?: RecipeGroup[] | undefined;
|
|
557
|
+
}
|
|
181
558
|
/**
|
|
182
559
|
* Horizontal alignment of content against its anchor: left, center or right.
|
|
183
560
|
*/
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export var Base;
|
|
7
7
|
(function (Base) {
|
|
8
|
-
// ============================================================================
|
|
9
|
-
// Alignment Enums
|
|
10
|
-
// ============================================================================
|
|
11
8
|
/**
|
|
12
9
|
* Horizontal alignment of content against its anchor: left, center or right.
|
|
13
10
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Base } from "./base-inputs";
|
|
1
|
+
import type { Base } from "./base-inputs";
|
|
2
2
|
/**
|
|
3
3
|
* Parameters for frames: the origin, normal and direction a frame is built from, the frames, points
|
|
4
4
|
* and vectors converted between a frame and the world, and the counts and spacings of frame
|
package/lib/api/inputs/inputs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Base } from "./base-inputs";
|
|
1
|
+
import type { Base } from "./base-inputs";
|
|
2
2
|
/**
|
|
3
3
|
* Parameters for reading and writing files: the data or shape to export, the target format and its
|
|
4
4
|
* options, the file name, and the settings that control how imported content is interpreted.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Base } from "./base-inputs";
|
|
1
|
+
import type { Base } from "./base-inputs";
|
|
2
2
|
/**
|
|
3
3
|
* Parameters for straight line segments: the start and end points that define one, the options for
|
|
4
4
|
* creating many at once from point lists, and the settings for measuring, reversing, transforming and
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
|
-
// tslint:disable-next-line: no-namespace
|
|
3
2
|
/**
|
|
4
3
|
* Parameters for array handling: the list to act on plus the index, count, depth, comparison or
|
|
5
4
|
* grouping key an operation needs. Geometry calls take and return lists constantly, so these turn up
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Base } from "./base-inputs";
|
|
1
|
+
import type { Base } from "./base-inputs";
|
|
2
2
|
/**
|
|
3
3
|
* Parameters for boolean logic and control flow: the operands of comparisons and and/or/not, the
|
|
4
4
|
* branches of a conditional selection, and the gate values that visual scripts use where code would
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
|
-
// tslint:disable-next-line: no-namespace
|
|
3
2
|
/**
|
|
4
3
|
* Parameters for boolean logic and control flow: the operands of comparisons and and/or/not, the
|
|
5
4
|
* branches of a conditional selection, and the gate values that visual scripts use where code would
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
|
-
// tslint:disable-next-line: no-namespace
|
|
3
2
|
/**
|
|
4
3
|
* Parameters for numeric helpers: the operands of arithmetic and trigonometry, the source and target
|
|
5
4
|
* ranges for remapping a value, rounding and clamping bounds, interpolation factors, and the seed for
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Base } from "./base-inputs";
|
|
1
|
+
import type { Base } from "./base-inputs";
|
|
2
2
|
/**
|
|
3
3
|
* Parameters for polygonal mesh geometry: vertex, index and normal data, the options for building and
|
|
4
4
|
* inspecting a mesh, and the settings that control conversion between the mesh representations the
|
|
@@ -103,4 +103,32 @@ export declare namespace Mesh {
|
|
|
103
103
|
*/
|
|
104
104
|
tolerance?: number | undefined;
|
|
105
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* A flat outline and the holes cut through it, for `mesh.triangulatePolygon`.
|
|
108
|
+
*/
|
|
109
|
+
class PolygonWithHolesDto {
|
|
110
|
+
constructor(points?: Base.Point3[], holes?: Base.Point3[][]);
|
|
111
|
+
/**
|
|
112
|
+
* The corners of the outline in order, all in one plane; the last need not repeat the first.
|
|
113
|
+
* @default undefined
|
|
114
|
+
*/
|
|
115
|
+
points: Base.Point3[];
|
|
116
|
+
/**
|
|
117
|
+
* The holes, each a list of corners in the outline's plane and inside the outline.
|
|
118
|
+
* @default undefined
|
|
119
|
+
* @optional true
|
|
120
|
+
*/
|
|
121
|
+
holes?: Base.Point3[][] | undefined;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* A triangle mesh, for `mesh.signedVolume` and other methods that read one.
|
|
125
|
+
*/
|
|
126
|
+
class MeshDto {
|
|
127
|
+
constructor(mesh?: Base.Mesh3);
|
|
128
|
+
/**
|
|
129
|
+
* The mesh, as a list of triangles.
|
|
130
|
+
* @default undefined
|
|
131
|
+
*/
|
|
132
|
+
mesh: Base.Mesh3;
|
|
133
|
+
}
|
|
106
134
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// tslint:disable-next-line: no-namespace
|
|
2
1
|
/**
|
|
3
2
|
* Parameters for polygonal mesh geometry: vertex, index and normal data, the options for building and
|
|
4
3
|
* inspecting a mesh, and the settings that control conversion between the mesh representations the
|
|
@@ -103,4 +102,29 @@ export var Mesh;
|
|
|
103
102
|
}
|
|
104
103
|
}
|
|
105
104
|
Mesh.MeshMeshToleranceDto = MeshMeshToleranceDto;
|
|
105
|
+
/**
|
|
106
|
+
* A flat outline and the holes cut through it, for `mesh.triangulatePolygon`.
|
|
107
|
+
*/
|
|
108
|
+
class PolygonWithHolesDto {
|
|
109
|
+
constructor(points, holes) {
|
|
110
|
+
if (points !== undefined) {
|
|
111
|
+
this.points = points;
|
|
112
|
+
}
|
|
113
|
+
if (holes !== undefined) {
|
|
114
|
+
this.holes = holes;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
Mesh.PolygonWithHolesDto = PolygonWithHolesDto;
|
|
119
|
+
/**
|
|
120
|
+
* A triangle mesh, for `mesh.signedVolume` and other methods that read one.
|
|
121
|
+
*/
|
|
122
|
+
class MeshDto {
|
|
123
|
+
constructor(mesh) {
|
|
124
|
+
if (mesh !== undefined) {
|
|
125
|
+
this.mesh = mesh;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
Mesh.MeshDto = MeshDto;
|
|
106
130
|
})(Mesh || (Mesh = {}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Base } from "./base-inputs";
|
|
1
|
+
import type { Base } from "./base-inputs";
|
|
2
2
|
/**
|
|
3
3
|
* Parameters for creating and working with points: single points, points spread along a line or a
|
|
4
4
|
* curve, points in rectangular and hexagonal grids, spirals and other structured sets, plus the
|
|
@@ -759,4 +759,33 @@ export declare namespace Point {
|
|
|
759
759
|
*/
|
|
760
760
|
pointsOnGround?: boolean | undefined;
|
|
761
761
|
}
|
|
762
|
+
/**
|
|
763
|
+
* Three points on a circular arc and how finely to divide it, for `point.arcThroughThreePoints`.
|
|
764
|
+
*/
|
|
765
|
+
class ArcThroughThreePointsDto {
|
|
766
|
+
constructor(start?: Base.Point3, middle?: Base.Point3, end?: Base.Point3, segments?: number);
|
|
767
|
+
/**
|
|
768
|
+
* Where the arc starts.
|
|
769
|
+
* @default undefined
|
|
770
|
+
*/
|
|
771
|
+
start: Base.Point3;
|
|
772
|
+
/**
|
|
773
|
+
* A point the arc passes through on its way, which decides the side it bulges to.
|
|
774
|
+
* @default undefined
|
|
775
|
+
*/
|
|
776
|
+
middle: Base.Point3;
|
|
777
|
+
/**
|
|
778
|
+
* Where the arc ends.
|
|
779
|
+
* @default undefined
|
|
780
|
+
*/
|
|
781
|
+
end: Base.Point3;
|
|
782
|
+
/**
|
|
783
|
+
* How many equal steps the arc is divided into; more steps follow the circle more closely.
|
|
784
|
+
* @default 16
|
|
785
|
+
* @minimum 1
|
|
786
|
+
* @maximum Infinity
|
|
787
|
+
* @step 1
|
|
788
|
+
*/
|
|
789
|
+
segments?: number | undefined;
|
|
790
|
+
}
|
|
762
791
|
}
|