@bitbybit-dev/base 1.3.2 → 1.4.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.
Files changed (77) hide show
  1. package/README.md +1 -1
  2. package/lib/api/GlobalCDNProvider.js +1 -1
  3. package/lib/api/index.d.ts +2 -0
  4. package/lib/api/index.js +2 -0
  5. package/lib/api/inputs/base-inputs.d.ts +10 -4
  6. package/lib/api/inputs/color-inputs.d.ts +24 -23
  7. package/lib/api/inputs/color-inputs.js +1 -0
  8. package/lib/api/inputs/dates-inputs.d.ts +16 -16
  9. package/lib/api/inputs/frame-inputs.d.ts +515 -0
  10. package/lib/api/inputs/frame-inputs.js +617 -0
  11. package/lib/api/inputs/index.d.ts +1 -0
  12. package/lib/api/inputs/index.js +1 -0
  13. package/lib/api/inputs/io-inputs.d.ts +3 -3
  14. package/lib/api/inputs/io-inputs.js +1 -1
  15. package/lib/api/inputs/lists-inputs.d.ts +23 -23
  16. package/lib/api/inputs/logic-inputs.d.ts +11 -11
  17. package/lib/api/inputs/math-inputs.d.ts +49 -49
  18. package/lib/api/inputs/math-inputs.js +4 -4
  19. package/lib/api/inputs/mesh-inputs.d.ts +3 -3
  20. package/lib/api/inputs/mesh-inputs.js +3 -3
  21. package/lib/api/inputs/point-inputs.d.ts +39 -38
  22. package/lib/api/inputs/point-inputs.js +6 -5
  23. package/lib/api/inputs/polyline-inputs.d.ts +5 -4
  24. package/lib/api/inputs/polyline-inputs.js +3 -3
  25. package/lib/api/inputs/text-inputs.d.ts +34 -33
  26. package/lib/api/inputs/text-inputs.js +15 -12
  27. package/lib/api/inputs/transforms-inputs.d.ts +16 -16
  28. package/lib/api/inputs/vector-inputs.d.ts +26 -25
  29. package/lib/api/inputs/vector-inputs.js +2 -1
  30. package/lib/api/kernel-calls/call-by-path.d.ts +12 -0
  31. package/lib/api/kernel-calls/call-by-path.js +36 -0
  32. package/lib/api/kernel-calls/constraints.d.ts +53 -0
  33. package/lib/api/kernel-calls/constraints.js +21 -0
  34. package/lib/api/kernel-calls/describe-failure.d.ts +32 -0
  35. package/lib/api/kernel-calls/describe-failure.js +164 -0
  36. package/lib/api/kernel-calls/errors.d.ts +55 -0
  37. package/lib/api/kernel-calls/errors.js +42 -0
  38. package/lib/api/kernel-calls/failure-message.d.ts +18 -0
  39. package/lib/api/kernel-calls/failure-message.js +36 -0
  40. package/lib/api/kernel-calls/index.d.ts +10 -0
  41. package/lib/api/kernel-calls/index.js +10 -0
  42. package/lib/api/kernel-calls/input-rules.d.ts +67 -0
  43. package/lib/api/kernel-calls/input-rules.js +135 -0
  44. package/lib/api/kernel-calls/input-validation.d.ts +130 -0
  45. package/lib/api/kernel-calls/input-validation.js +221 -0
  46. package/lib/api/kernel-calls/rehydrate.d.ts +16 -0
  47. package/lib/api/kernel-calls/rehydrate.js +38 -0
  48. package/lib/api/kernel-calls/resolve-dto.d.ts +59 -0
  49. package/lib/api/kernel-calls/resolve-dto.js +61 -0
  50. package/lib/api/kernel-calls/with-defaults.d.ts +16 -0
  51. package/lib/api/kernel-calls/with-defaults.js +53 -0
  52. package/lib/api/resolved-inputs/index.d.ts +304 -0
  53. package/lib/api/resolved-inputs/index.js +1 -0
  54. package/lib/api/services/color.js +43 -26
  55. package/lib/api/services/dates.js +53 -33
  56. package/lib/api/services/frame.d.ts +670 -0
  57. package/lib/api/services/frame.js +1040 -0
  58. package/lib/api/services/helpers/dxf/dxf-generator.d.ts +2 -3
  59. package/lib/api/services/helpers/dxf/dxf-generator.js +27 -37
  60. package/lib/api/services/helpers/dxf/dxf.js +10 -4
  61. package/lib/api/services/helpers/frame-axes.d.ts +36 -0
  62. package/lib/api/services/helpers/frame-axes.js +57 -0
  63. package/lib/api/services/helpers/matrices.d.ts +17 -0
  64. package/lib/api/services/helpers/matrices.js +51 -0
  65. package/lib/api/services/index.d.ts +1 -0
  66. package/lib/api/services/index.js +1 -0
  67. package/lib/api/services/line.js +15 -12
  68. package/lib/api/services/lists.js +174 -136
  69. package/lib/api/services/logic.js +44 -34
  70. package/lib/api/services/math.js +127 -82
  71. package/lib/api/services/mesh.js +20 -13
  72. package/lib/api/services/point.js +62 -46
  73. package/lib/api/services/polyline.js +22 -18
  74. package/lib/api/services/text.js +81 -46
  75. package/lib/api/services/transforms.js +38 -25
  76. package/lib/api/services/vector.js +37 -22
  77. package/package.json +1 -1
@@ -0,0 +1,670 @@
1
+ import * as Inputs from "../inputs";
2
+ import { GeometryHelper } from "./geometry-helper";
3
+ import { MathBitByBit } from "./math";
4
+ import { Vector } from "./vector";
5
+ /**
6
+ * Frames: a frame is a point with three axes at right angles, written as its `origin`, its `normal`
7
+ * (the Z axis) and its `direction` (the X axis), the Y axis following from those two. Frames place
8
+ * things: a shape lands on one, points convert between one and the world, and frame patterns lay
9
+ * out copies. Every method returns new values and never changes its inputs.
10
+ */
11
+ export declare class Frame {
12
+ private readonly vector;
13
+ private readonly math;
14
+ private readonly geometryHelper;
15
+ constructor(vector: Vector, math: MathBitByBit, geometryHelper: GeometryHelper);
16
+ /**
17
+ * Builds a frame from where it sits, where its Z axis points and roughly where its X axis
18
+ * points.
19
+ *
20
+ * `direction` is turned square to `normal` and both are scaled to length 1, so they only have
21
+ * to be roughly right. A `normal` of zero length or a `direction` along it throws.
22
+ * @param inputs - The origin, the normal and the rough X direction
23
+ * @returns A new frame
24
+ * @group create
25
+ * @shortname frame
26
+ * @drawable true
27
+ * @example
28
+ * ```typescript
29
+ * const tilted = bitbybit.frame.create({ origin: [0, 5, 0], normal: [0, 1, 1], direction: [1, 0, 0] });
30
+ * ```
31
+ */
32
+ create(inputs: Inputs.Frame.CreateFrameDto): Inputs.Base.Frame;
33
+ /**
34
+ * Gives the world frame: its origin at zero, its X, Y and Z axes along the world's.
35
+ *
36
+ * Placing something on the world frame leaves it where it is, and it is the frame the other
37
+ * methods use when one is left out.
38
+ * @returns The world frame
39
+ * @group create
40
+ * @shortname world
41
+ * @drawable true
42
+ * @example
43
+ * ```typescript
44
+ * const world = bitbybit.frame.world();
45
+ * const raised = bitbybit.frame.offset({ frame: world, distance: 5 });
46
+ * ```
47
+ */
48
+ world(): Inputs.Base.Frame;
49
+ /**
50
+ * Builds a frame lying in the XY plane: its X axis along the world X, its Y axis along the
51
+ * world Y and its normal along the world Z.
52
+ * @param inputs - Where the frame sits
53
+ * @returns A new frame
54
+ * @group create
55
+ * @shortname xy
56
+ * @drawable true
57
+ * @example
58
+ * ```typescript
59
+ * const floor = bitbybit.frame.xy({ origin: [0, 0, 2] });
60
+ * ```
61
+ */
62
+ xy(inputs: Inputs.Frame.OriginDto): Inputs.Base.Frame;
63
+ /**
64
+ * Builds a frame lying in the YZ plane: its X axis along the world Y, its Y axis along the
65
+ * world Z and its normal along the world X.
66
+ * @param inputs - Where the frame sits
67
+ * @returns A new frame
68
+ * @group create
69
+ * @shortname yz
70
+ * @drawable true
71
+ * @example
72
+ * ```typescript
73
+ * const side = bitbybit.frame.yz({ origin: [3, 0, 0] });
74
+ * ```
75
+ */
76
+ yz(inputs: Inputs.Frame.OriginDto): Inputs.Base.Frame;
77
+ /**
78
+ * Builds a frame lying in the ZX plane, the ground when Y points up: its X axis along the world
79
+ * Z, its Y axis along the world X and its normal along the world Y.
80
+ * @param inputs - Where the frame sits
81
+ * @returns A new frame
82
+ * @group create
83
+ * @shortname zx
84
+ * @drawable true
85
+ * @example
86
+ * ```typescript
87
+ * const ground = bitbybit.frame.zx({ origin: [0, 0, 0] });
88
+ * ```
89
+ */
90
+ zx(inputs: Inputs.Frame.OriginDto): Inputs.Base.Frame;
91
+ /**
92
+ * Builds a frame from three points: where it sits, a point its X axis runs toward and a point
93
+ * on the side its Y axis points to.
94
+ *
95
+ * The normal follows by the right-hand rule. `xPoint` at `origin`, or three points on one line,
96
+ * throws.
97
+ * @param inputs - The origin, a point along the X axis and a point in the plane
98
+ * @returns A new frame
99
+ * @group create
100
+ * @shortname from three points
101
+ * @drawable true
102
+ * @example
103
+ * ```typescript
104
+ * const frame = bitbybit.frame.fromThreePoints({ origin: [0, 0, 0], xPoint: [4, 0, 0], planePoint: [0, 0, -3] });
105
+ * ```
106
+ */
107
+ fromThreePoints(inputs: Inputs.Frame.ThreePointsDto): Inputs.Base.Frame;
108
+ /**
109
+ * Builds a frame from a point and a normal, choosing its X axis by a fixed rule.
110
+ *
111
+ * The same normal always gives the same X axis: square to the normal and to the world axis the
112
+ * normal leans on least. A normal of zero length throws.
113
+ * @param inputs - The origin and the normal
114
+ * @returns A new frame
115
+ * @group create
116
+ * @shortname from point and normal
117
+ * @drawable true
118
+ * @example
119
+ * ```typescript
120
+ * const onSlope = bitbybit.frame.fromPointAndNormal({ origin: [2, 1, 0], normal: [0, 1, 1] });
121
+ * ```
122
+ */
123
+ fromPointAndNormal(inputs: Inputs.Frame.PointAndNormalDto): Inputs.Base.Frame;
124
+ /**
125
+ * Fits a frame to points that lie on or near one plane.
126
+ *
127
+ * It sits at their average. The normal follows their order by the right-hand rule, and X runs
128
+ * along their widest spread, toward the first point; with no widest spread, as around a square,
129
+ * X points at the first point. Fewer than three points, or nearly collinear ones, throw.
130
+ * @param inputs - The points to fit
131
+ * @returns A new frame in the plane that fits the points best
132
+ * @group create
133
+ * @shortname best fit
134
+ * @drawable true
135
+ * @example
136
+ * ```typescript
137
+ * const frame = bitbybit.frame.bestFit({ points: [[0, 0, 0], [4, 0.1, 0], [4, 3, 0.1], [0, 3, 0]] });
138
+ * ```
139
+ */
140
+ bestFit(inputs: Inputs.Frame.BestFitDto): Inputs.Base.Frame;
141
+ /**
142
+ * Reads where a frame sits: the point its three axes start from.
143
+ * @param inputs - The frame to read
144
+ * @returns The origin
145
+ * @group read
146
+ * @shortname origin
147
+ * @drawable true
148
+ */
149
+ origin(inputs: Inputs.Frame.FrameDto): Inputs.Base.Point3;
150
+ /**
151
+ * Reads where a frame's Z axis points, as a vector of length 1.
152
+ * @param inputs - The frame to read
153
+ * @returns The normal
154
+ * @group read
155
+ * @shortname normal
156
+ * @drawable false
157
+ */
158
+ normal(inputs: Inputs.Frame.FrameDto): Inputs.Base.Vector3;
159
+ /**
160
+ * Reads where a frame's X axis points, as a vector of length 1 square to the normal.
161
+ * @param inputs - The frame to read
162
+ * @returns The X direction
163
+ * @group read
164
+ * @shortname direction
165
+ * @drawable false
166
+ */
167
+ direction(inputs: Inputs.Frame.FrameDto): Inputs.Base.Vector3;
168
+ /**
169
+ * Reads where a frame's Y axis points: the normal crossed with the direction, as a vector of
170
+ * length 1.
171
+ * @param inputs - The frame to read
172
+ * @returns The Y direction
173
+ * @group read
174
+ * @shortname y direction
175
+ * @drawable false
176
+ */
177
+ yDirection(inputs: Inputs.Frame.FrameDto): Inputs.Base.Vector3;
178
+ /**
179
+ * Moves a frame by a vector in world coordinates, keeping the directions of its axes.
180
+ * @param inputs - The frame and the vector to move it by
181
+ * @returns A new frame
182
+ * @group change
183
+ * @shortname translate
184
+ * @drawable true
185
+ * @example
186
+ * ```typescript
187
+ * const moved = bitbybit.frame.translate({ frame: bitbybit.frame.world(), translation: [2, 0, 1] });
188
+ * ```
189
+ */
190
+ translate(inputs: Inputs.Frame.TranslateDto): Inputs.Base.Frame;
191
+ /**
192
+ * Moves frames by one vector in world coordinates, as `translate` moves one; their axes keep
193
+ * their directions.
194
+ * @param inputs - The frames and the vector to move them by
195
+ * @returns New frames, in the same order
196
+ * @group change
197
+ * @shortname translate frames
198
+ * @drawable true
199
+ * @example
200
+ * ```typescript
201
+ * const floor = bitbybit.frame.grid({ countX: 3, countY: 3, spacingX: 2, spacingY: 2, centered: true });
202
+ * const ceiling = bitbybit.frame.translateFrames({ frames: floor, translation: [0, 0, 3] });
203
+ * ```
204
+ */
205
+ translateFrames(inputs: Inputs.Frame.TranslateFramesDto): Inputs.Base.Frame[];
206
+ /**
207
+ * Moves a frame along its own normal, keeping the directions of its axes.
208
+ *
209
+ * A negative distance moves it against the normal.
210
+ * @param inputs - The frame and the distance in model units
211
+ * @returns A new frame
212
+ * @group change
213
+ * @shortname offset
214
+ * @drawable true
215
+ * @example
216
+ * ```typescript
217
+ * const lid = bitbybit.frame.offset({ frame: bitbybit.frame.zx({ origin: [0, 0, 0] }), distance: 10 });
218
+ * ```
219
+ */
220
+ offset(inputs: Inputs.Frame.OffsetDto): Inputs.Base.Frame;
221
+ /**
222
+ * Moves each frame along its own normal by the same distance, as `offset` moves one; their
223
+ * axes keep their directions.
224
+ *
225
+ * Frames facing different ways move different ways: a negative distance moves each against its
226
+ * own normal.
227
+ * @param inputs - The frames and the distance in model units
228
+ * @returns New frames, in the same order
229
+ * @group change
230
+ * @shortname offset frames
231
+ * @drawable true
232
+ * @example
233
+ * ```typescript
234
+ * const ring = bitbybit.frame.polar({ count: 8, radius: 5, angle: 360, startAngle: 0, rotate: true });
235
+ * const raised = bitbybit.frame.offsetFrames({ frames: ring, distance: 2 });
236
+ * ```
237
+ */
238
+ offsetFrames(inputs: Inputs.Frame.OffsetFramesDto): Inputs.Base.Frame[];
239
+ /**
240
+ * Turns a frame about one of its own axes, through its origin.
241
+ *
242
+ * The angle is in degrees; positive is counter-clockwise when that axis points toward you.
243
+ * @param inputs - The frame, the axis to turn about and the angle
244
+ * @returns A new frame
245
+ * @group change
246
+ * @shortname rotate
247
+ * @drawable true
248
+ * @example
249
+ * ```typescript
250
+ * const tilted = bitbybit.frame.rotate({ frame: bitbybit.frame.world(), axis: Bit.Inputs.Frame.frameAxisEnum.x, angle: 30 });
251
+ * ```
252
+ */
253
+ rotate(inputs: Inputs.Frame.RotateDto): Inputs.Base.Frame;
254
+ /**
255
+ * Turns each frame about one of its own axes, through its own origin, as `rotate` turns one.
256
+ *
257
+ * The angle is in degrees; positive is counter-clockwise when that axis points toward you.
258
+ * @param inputs - The frames, the axis to turn each about and the angle
259
+ * @returns New frames, in the same order
260
+ * @group change
261
+ * @shortname rotate frames
262
+ * @drawable true
263
+ * @example
264
+ * ```typescript
265
+ * const row = bitbybit.frame.grid({ countX: 4, countY: 1, spacingX: 2, spacingY: 2, centered: true });
266
+ * const tilted = bitbybit.frame.rotateFrames({ frames: row, axis: Bit.Inputs.Frame.frameAxisEnum.x, angle: 30 });
267
+ * ```
268
+ */
269
+ rotateFrames(inputs: Inputs.Frame.RotateFramesDto): Inputs.Base.Frame[];
270
+ /**
271
+ * Turns a frame over: its normal points the other way and its Y axis with it, its origin and X
272
+ * axis stay.
273
+ * @param inputs - The frame to turn over
274
+ * @returns A new frame
275
+ * @group change
276
+ * @shortname flip
277
+ * @drawable true
278
+ * @example
279
+ * ```typescript
280
+ * const underside = bitbybit.frame.flip({ frame: bitbybit.frame.zx({ origin: [0, 0, 0] }) });
281
+ * ```
282
+ */
283
+ flip(inputs: Inputs.Frame.FrameDto): Inputs.Base.Frame;
284
+ /**
285
+ * Turns each frame over, as `flip` turns one: its normal and Y axis point the other way, its
286
+ * origin and X axis stay.
287
+ * @param inputs - The frames to turn over
288
+ * @returns New frames, in the same order
289
+ * @group change
290
+ * @shortname flip frames
291
+ * @drawable true
292
+ * @example
293
+ * ```typescript
294
+ * const tops = bitbybit.frame.grid({ countX: 2, countY: 2, spacingX: 3, spacingY: 3, centered: true });
295
+ * const bottoms = bitbybit.frame.flipFrames({ frames: tops });
296
+ * ```
297
+ */
298
+ flipFrames(inputs: Inputs.Frame.FramesDto): Inputs.Base.Frame[];
299
+ /**
300
+ * Places a frame given in another frame's coordinates into the world: a frame within a frame.
301
+ *
302
+ * `child` is read as if `parent` were the world, so a `child` at the origin sits on `parent`
303
+ * and one lifted along Z rises along the parent's normal.
304
+ * @param inputs - The parent frame and the child frame given in its coordinates
305
+ * @returns The child frame in world coordinates
306
+ * @group frame in frame
307
+ * @shortname frame to world
308
+ * @drawable true
309
+ * @example
310
+ * ```typescript
311
+ * const table = bitbybit.frame.zx({ origin: [0, 1, 0] });
312
+ * const onTable = bitbybit.frame.frameToWorld({ parent: table, child: bitbybit.frame.xy({ origin: [0.5, 0.2, 0] }) });
313
+ * ```
314
+ */
315
+ frameToWorld(inputs: Inputs.Frame.ChildFrameDto): Inputs.Base.Frame;
316
+ /**
317
+ * Places frames given in one parent frame's coordinates into the world, as `frameToWorld`
318
+ * places one: every child sits on `parent` as it would sit on the world.
319
+ * @param inputs - The parent frame and the frames given in its coordinates
320
+ * @returns The frames in world coordinates, in the same order
321
+ * @group frame in frame
322
+ * @shortname frames to world
323
+ * @drawable true
324
+ * @example
325
+ * ```typescript
326
+ * const table = bitbybit.frame.zx({ origin: [0, 1, 0] });
327
+ * const spots = bitbybit.frame.grid({ countX: 3, countY: 2, spacingX: 0.4, spacingY: 0.4, centered: true });
328
+ * const onTable = bitbybit.frame.framesToWorld({ parent: table, children: spots });
329
+ * ```
330
+ */
331
+ framesToWorld(inputs: Inputs.Frame.ChildFramesDto): Inputs.Base.Frame[];
332
+ /**
333
+ * Describes a frame given in world coordinates in another frame's coordinates, the reverse of
334
+ * `frameToWorld`.
335
+ *
336
+ * The result is where `child` sits and how it turns as seen from `parent`, as if `parent` were
337
+ * the world.
338
+ * @param inputs - The parent frame and the child frame in world coordinates
339
+ * @returns The child frame in the parent's coordinates
340
+ * @group frame in frame
341
+ * @shortname frame to local
342
+ * @drawable true
343
+ * @example
344
+ * ```typescript
345
+ * const table = bitbybit.frame.zx({ origin: [0, 1, 0] });
346
+ * const seenFromTable = bitbybit.frame.frameToLocal({ parent: table, child: bitbybit.frame.world() });
347
+ * ```
348
+ */
349
+ frameToLocal(inputs: Inputs.Frame.ChildFrameDto): Inputs.Base.Frame;
350
+ /**
351
+ * Describes frames given in world coordinates in one parent frame's coordinates, the reverse
352
+ * of `framesToWorld`, as `frameToLocal` describes one.
353
+ * @param inputs - The parent frame and the frames in world coordinates
354
+ * @returns The frames in the parent's coordinates, in the same order
355
+ * @group frame in frame
356
+ * @shortname frames to local
357
+ * @drawable true
358
+ * @example
359
+ * ```typescript
360
+ * const table = bitbybit.frame.zx({ origin: [0, 1, 0] });
361
+ * const seen = bitbybit.frame.framesToLocal({ parent: table, children: [bitbybit.frame.world(), bitbybit.frame.yz({ origin: [2, 0, 0] })] });
362
+ * ```
363
+ */
364
+ framesToLocal(inputs: Inputs.Frame.ChildFramesDto): Inputs.Base.Frame[];
365
+ /**
366
+ * Converts a point given in a frame's coordinates into world coordinates.
367
+ *
368
+ * `[1, 2, 3]` becomes the point 1 along the frame's X axis, 2 along its Y axis and 3 along its
369
+ * normal, from its origin.
370
+ * @param inputs - The frame and the point in its coordinates
371
+ * @returns The point in world coordinates
372
+ * @group coordinates
373
+ * @shortname point to world
374
+ * @drawable true
375
+ * @example
376
+ * ```typescript
377
+ * const corner = bitbybit.frame.pointToWorld({ frame: bitbybit.frame.zx({ origin: [0, 2, 0] }), point: [1, 1, 0] });
378
+ * ```
379
+ */
380
+ pointToWorld(inputs: Inputs.Frame.FramePointDto): Inputs.Base.Point3;
381
+ /**
382
+ * Converts a point given in world coordinates into a frame's coordinates, the reverse of
383
+ * `pointToWorld`.
384
+ *
385
+ * The third coordinate of the result is the point's signed distance from the frame's plane.
386
+ * @param inputs - The frame and the point in world coordinates
387
+ * @returns The point in the frame's coordinates
388
+ * @group coordinates
389
+ * @shortname point to local
390
+ * @drawable true
391
+ * @example
392
+ * ```typescript
393
+ * const local = bitbybit.frame.pointToLocal({ frame: bitbybit.frame.zx({ origin: [0, 2, 0] }), point: [1, 5, 1] });
394
+ * ```
395
+ */
396
+ pointToLocal(inputs: Inputs.Frame.FramePointDto): Inputs.Base.Point3;
397
+ /**
398
+ * Converts points given in a frame's coordinates into world coordinates, as `pointToWorld` does
399
+ * for one.
400
+ * @param inputs - The frame and the points in its coordinates
401
+ * @returns The points in world coordinates, in the same order
402
+ * @group coordinates
403
+ * @shortname points to world
404
+ * @drawable true
405
+ * @example
406
+ * ```typescript
407
+ * const square = bitbybit.frame.pointsToWorld({ frame: bitbybit.frame.yz({ origin: [3, 0, 0] }), points: [[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]] });
408
+ * ```
409
+ */
410
+ pointsToWorld(inputs: Inputs.Frame.FramePointsDto): Inputs.Base.Point3[];
411
+ /**
412
+ * Converts points given in world coordinates into a frame's coordinates, as `pointToLocal` does
413
+ * for one.
414
+ * @param inputs - The frame and the points in world coordinates
415
+ * @returns The points in the frame's coordinates, in the same order
416
+ * @group coordinates
417
+ * @shortname points to local
418
+ * @drawable true
419
+ * @example
420
+ * ```typescript
421
+ * const flat = bitbybit.frame.pointsToLocal({ frame: bitbybit.frame.yz({ origin: [3, 0, 0] }), points: [[3, 0, 0], [3, 1, 0], [3, 1, 1]] });
422
+ * ```
423
+ */
424
+ pointsToLocal(inputs: Inputs.Frame.FramePointsDto): Inputs.Base.Point3[];
425
+ /**
426
+ * Turns a vector given along a frame's axes into one along the world axes; the frame's origin
427
+ * plays no part.
428
+ * @param inputs - The frame and the vector along its axes
429
+ * @returns The vector along the world axes
430
+ * @group coordinates
431
+ * @shortname vector to world
432
+ * @drawable false
433
+ * @example
434
+ * ```typescript
435
+ * const up = bitbybit.frame.vectorToWorld({ frame: bitbybit.frame.zx({ origin: [0, 0, 0] }), vector: [0, 0, 1] });
436
+ * ```
437
+ */
438
+ vectorToWorld(inputs: Inputs.Frame.FrameVectorDto): Inputs.Base.Vector3;
439
+ /**
440
+ * Turns a vector given along the world axes into one along a frame's axes, the reverse of
441
+ * `vectorToWorld`.
442
+ * @param inputs - The frame and the vector along the world axes
443
+ * @returns The vector along the frame's axes
444
+ * @group coordinates
445
+ * @shortname vector to local
446
+ * @drawable false
447
+ * @example
448
+ * ```typescript
449
+ * const local = bitbybit.frame.vectorToLocal({ frame: bitbybit.frame.zx({ origin: [0, 0, 0] }), vector: [0, 1, 0] });
450
+ * ```
451
+ */
452
+ vectorToLocal(inputs: Inputs.Frame.FrameVectorDto): Inputs.Base.Vector3;
453
+ /**
454
+ * Gives the transformation that moves anything from the world frame onto a frame.
455
+ *
456
+ * It takes the world origin to the frame's origin and the world axes to the frame's axes, and
457
+ * comes as a list holding one matrix, the form every transformation input takes.
458
+ * @param inputs - The frame
459
+ * @returns The transformation onto the frame
460
+ * @group matrices
461
+ * @shortname to matrix
462
+ * @drawable false
463
+ * @example
464
+ * ```typescript
465
+ * const onFrame = bitbybit.frame.toMatrix({ frame: bitbybit.frame.zx({ origin: [0, 2, 0] }) });
466
+ * const moved = bitbybit.point.transformPoints({ points: [[1, 0, 0]], transformation: onFrame });
467
+ * ```
468
+ */
469
+ toMatrix(inputs: Inputs.Frame.FrameDto): Inputs.Base.TransformMatrixes;
470
+ /**
471
+ * Reads the frame a transformation puts the world frame on: where it moves the world origin
472
+ * and where it turns the world X and Z axes.
473
+ *
474
+ * Scaling is dropped, a shear keeps the Z axis and squares X to it, and a mirror keeps X and Z
475
+ * with the Y axis that follows from them. A perspective part throws.
476
+ * @param inputs - The transformation
477
+ * @returns A new frame
478
+ * @group matrices
479
+ * @shortname from matrix
480
+ * @drawable true
481
+ * @example
482
+ * ```typescript
483
+ * const turned = bitbybit.transforms.rotationCenterAxis({ center: [0, 0, 0], axis: [0, 1, 0], angle: 45 });
484
+ * const frame = bitbybit.frame.fromMatrix({ transformation: turned });
485
+ * ```
486
+ */
487
+ fromMatrix(inputs: Inputs.Frame.TransformationDto): Inputs.Base.Frame;
488
+ /**
489
+ * Gives the transformation that carries anything placed on one frame onto another, turning it
490
+ * the same way.
491
+ *
492
+ * Left out, `from` is the world frame, which makes this `toMatrix` of `to`. The result is a list
493
+ * holding one matrix.
494
+ * @param inputs - The frame to move onto and the frame to move from
495
+ * @returns The transformation from `from` onto `to`
496
+ * @group matrices
497
+ * @shortname matrix from to
498
+ * @drawable false
499
+ * @example
500
+ * ```typescript
501
+ * const from = bitbybit.frame.xy({ origin: [0, 0, 0] });
502
+ * const to = bitbybit.frame.zx({ origin: [0, 3, 0] });
503
+ * const carry = bitbybit.frame.matrixFromTo({ to, from });
504
+ * ```
505
+ */
506
+ matrixFromTo(inputs: Inputs.Frame.FromToDto): Inputs.Base.TransformMatrixes;
507
+ /**
508
+ * Lays out a rectangular grid of frames in a frame's plane, each turned the same way as that
509
+ * frame.
510
+ *
511
+ * The frames come row by row, along X first. Left out, `frame` is the world frame, so the grid
512
+ * lies in the XY plane.
513
+ * @param inputs - The frame to follow, the counts and spacings, and whether to center the grid
514
+ * @returns The frames of the grid
515
+ * @group patterns
516
+ * @shortname grid
517
+ * @drawable true
518
+ * @example
519
+ * ```typescript
520
+ * const spots = bitbybit.frame.grid({ frame: bitbybit.frame.zx({ origin: [0, 0, 0] }), countX: 4, countY: 3, spacingX: 2, spacingY: 2, centered: true });
521
+ * ```
522
+ */
523
+ grid(inputs: Inputs.Frame.GridDto): Inputs.Base.Frame[];
524
+ /**
525
+ * Lays out a ring of frames around a frame's normal, in its plane.
526
+ *
527
+ * Each is `frame` turned by its angle about the normal and moved out by `radius` along its
528
+ * turned X axis. A full turn spaces them evenly, a smaller `angle` puts one at each end, and a
529
+ * larger one throws. Left out, `frame` is the world frame.
530
+ * @param inputs - The frame to turn around, the count, radius, angles and whether frames turn
531
+ * @returns The frames of the ring, in the direction of the angle
532
+ * @group patterns
533
+ * @shortname polar
534
+ * @drawable true
535
+ * @example
536
+ * ```typescript
537
+ * const bolts = bitbybit.frame.polar({ frame: bitbybit.frame.zx({ origin: [0, 0, 0] }), count: 8, radius: 5, angle: 360, startAngle: 0, rotate: true });
538
+ * ```
539
+ */
540
+ polar(inputs: Inputs.Frame.PolarDto): Inputs.Base.Frame[];
541
+ /**
542
+ * Lays out a honeycomb of frames in a frame's plane, one at each hexagon's center, turned as
543
+ * that frame is.
544
+ *
545
+ * The hexagons have corners toward the frame's Y axis and flat sides toward X. Rows run along X,
546
+ * every second shifted by half a hexagon, and frames come row by row. Left out, `frame` is the
547
+ * world frame.
548
+ * @param inputs - The frame to follow, the counts, the hexagon size and whether to center it
549
+ * @returns The frames of the honeycomb
550
+ * @group patterns
551
+ * @shortname hex grid
552
+ * @drawable true
553
+ * @example
554
+ * ```typescript
555
+ * const cells = bitbybit.frame.hexGrid({ frame: bitbybit.frame.zx({ origin: [0, 0, 0] }), countX: 5, countY: 4, radius: 1, centered: true });
556
+ * ```
557
+ */
558
+ hexGrid(inputs: Inputs.Frame.HexGridDto): Inputs.Base.Frame[];
559
+ /**
560
+ * The widest spread's axis, pointing toward the first point, or with its largest component
561
+ * positive when the first point lies across it.
562
+ * @ignore true
563
+ */
564
+ private alongWidest;
565
+ /**
566
+ * Where the first point lies from the center, in the fitted plane, or the next point that does
567
+ * not sit on the center: the X axis of points that spread evenly every way in their plane.
568
+ * @ignore true
569
+ */
570
+ private towardFirstPoint;
571
+ /**
572
+ * @ignore true
573
+ */
574
+ private translated;
575
+ /**
576
+ * @ignore true
577
+ */
578
+ private offsetBy;
579
+ /**
580
+ * The axes turned about one of their own by `angle` radians, through their origin.
581
+ * @ignore true
582
+ */
583
+ private turned;
584
+ /**
585
+ * @ignore true
586
+ */
587
+ private flipped;
588
+ /**
589
+ * @ignore true
590
+ */
591
+ private childToWorld;
592
+ /**
593
+ * @ignore true
594
+ */
595
+ private childToLocal;
596
+ /**
597
+ * The vector `u` along `x`, `v` along `y` and `w` along `z` of the axes, from their origin.
598
+ * @ignore true
599
+ */
600
+ private along;
601
+ /**
602
+ * The same vector read against the axes: its components along `x`, `y` and `z`.
603
+ * @ignore true
604
+ */
605
+ private against;
606
+ /**
607
+ * `first` scaled by `a` plus `second` scaled by `b`.
608
+ * @ignore true
609
+ */
610
+ private combined;
611
+ /**
612
+ * Flips a unit vector whose largest component is negative, so a sign the data leaves open is
613
+ * decided the same way every time. Components within 1e-12 of each other count as equal and the
614
+ * first of them decides, so rounding cannot tip the choice; OCCT's frames break the tie the
615
+ * same way.
616
+ * @ignore true
617
+ */
618
+ private withLargestPositive;
619
+ /**
620
+ * The column-major matrix carrying the `from` axes onto the `to` axes.
621
+ * @ignore true
622
+ */
623
+ private matrixBetween;
624
+ /**
625
+ * The axes of a frame a caller handed in, squared, or an error naming the input at fault.
626
+ * @ignore true
627
+ */
628
+ private axesOf;
629
+ /**
630
+ * The axes of every frame in a list a caller handed in, or an error naming the list and the
631
+ * position at fault.
632
+ * @ignore true
633
+ */
634
+ private axesOfEach;
635
+ /**
636
+ * @ignore true
637
+ */
638
+ private axisOf;
639
+ /**
640
+ * An origin with a unit normal and a unit X axis square to it, or an error with the message for
641
+ * the part that cannot be squared, naming `property`, or that part when none is given.
642
+ * @ignore true
643
+ */
644
+ private squared;
645
+ /**
646
+ * The frame the axes describe, as new arrays.
647
+ * @ignore true
648
+ */
649
+ private frameOf;
650
+ /**
651
+ * @ignore true
652
+ */
653
+ private pointOf;
654
+ /**
655
+ * @ignore true
656
+ */
657
+ private vectorOf;
658
+ /**
659
+ * @ignore true
660
+ */
661
+ private pointsOf;
662
+ /**
663
+ * @ignore true
664
+ */
665
+ private numberOf;
666
+ /**
667
+ * @ignore true
668
+ */
669
+ private countOf;
670
+ }