@bitbybit-dev/base 1.2.0 → 1.3.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.
Files changed (55) hide show
  1. package/lib/api/GlobalCDNProvider.js +1 -1
  2. package/lib/api/inputs/base-inputs.d.ts +13 -12
  3. package/lib/api/inputs/color-inputs.d.ts +97 -48
  4. package/lib/api/inputs/color-inputs.js +95 -46
  5. package/lib/api/inputs/dates-inputs.d.ts +67 -26
  6. package/lib/api/inputs/dates-inputs.js +57 -16
  7. package/lib/api/inputs/io-inputs.d.ts +13 -15
  8. package/lib/api/inputs/io-inputs.js +7 -8
  9. package/lib/api/inputs/line-inputs.d.ts +88 -33
  10. package/lib/api/inputs/line-inputs.js +61 -11
  11. package/lib/api/inputs/lists-inputs.d.ts +207 -96
  12. package/lib/api/inputs/lists-inputs.js +153 -45
  13. package/lib/api/inputs/logic-inputs.d.ts +52 -22
  14. package/lib/api/inputs/logic-inputs.js +41 -12
  15. package/lib/api/inputs/math-inputs.d.ts +113 -52
  16. package/lib/api/inputs/math-inputs.js +112 -51
  17. package/lib/api/inputs/mesh-inputs.d.ts +30 -11
  18. package/lib/api/inputs/mesh-inputs.js +21 -3
  19. package/lib/api/inputs/point-inputs.d.ts +240 -107
  20. package/lib/api/inputs/point-inputs.js +199 -73
  21. package/lib/api/inputs/polyline-inputs.d.ts +68 -28
  22. package/lib/api/inputs/polyline-inputs.js +48 -13
  23. package/lib/api/inputs/text-inputs.d.ts +117 -46
  24. package/lib/api/inputs/text-inputs.js +111 -41
  25. package/lib/api/inputs/transforms-inputs.d.ts +65 -23
  26. package/lib/api/inputs/transforms-inputs.js +64 -22
  27. package/lib/api/inputs/vector-inputs.d.ts +154 -76
  28. package/lib/api/inputs/vector-inputs.js +132 -57
  29. package/lib/api/models/point/hex-grid-data.d.ts +1 -1
  30. package/lib/api/models/point/hex-grid-data.js +1 -1
  31. package/lib/api/services/color.d.ts +149 -70
  32. package/lib/api/services/color.js +149 -70
  33. package/lib/api/services/dates.d.ts +313 -150
  34. package/lib/api/services/dates.js +313 -150
  35. package/lib/api/services/line.d.ts +138 -68
  36. package/lib/api/services/line.js +138 -68
  37. package/lib/api/services/lists.d.ts +357 -177
  38. package/lib/api/services/lists.js +357 -177
  39. package/lib/api/services/logic.d.ts +98 -45
  40. package/lib/api/services/logic.js +98 -45
  41. package/lib/api/services/math.d.ts +363 -211
  42. package/lib/api/services/math.js +363 -211
  43. package/lib/api/services/mesh.d.ts +73 -31
  44. package/lib/api/services/mesh.js +73 -31
  45. package/lib/api/services/point.d.ts +367 -147
  46. package/lib/api/services/point.js +367 -147
  47. package/lib/api/services/polyline.d.ts +146 -71
  48. package/lib/api/services/polyline.js +146 -71
  49. package/lib/api/services/text.d.ts +320 -165
  50. package/lib/api/services/text.js +320 -165
  51. package/lib/api/services/transforms.d.ts +145 -58
  52. package/lib/api/services/transforms.js +145 -58
  53. package/lib/api/services/vector.d.ts +381 -156
  54. package/lib/api/services/vector.js +381 -156
  55. package/package.json +1 -1
@@ -2,114 +2,148 @@ import { Base } from "./base-inputs";
2
2
  import { Math } from "./math-inputs";
3
3
  /**
4
4
  * Parameters for vector arithmetic: the operands for addition, subtraction, scaling, dot and cross
5
- * products, normalisation, angle and distance measurement, projection and interpolation. Vectors are
5
+ * products, normalization, angle and distance measurement, projection and interpolation. Vectors are
6
6
  * number arrays, so these DTOs mostly carry one or two of them plus a scalar.
7
7
  */
8
8
  export declare namespace Vector {
9
+ /**
10
+ * Two vectors for the pairwise operations of `vector`: `add`, `sub`, `dot`, `cross`, `dist`,
11
+ * `angleBetween` and the rest. Both need the same number of entries; where order matters,
12
+ * `first` is the left operand.
13
+ */
9
14
  class TwoVectorsDto {
10
15
  constructor(first?: number[], second?: number[]);
11
16
  /**
12
- * First vector
17
+ * First vector. Where order matters it is the left operand: the one subtracted from in
18
+ * `sub`, the left side of the product in `cross`.
13
19
  * @default undefined
14
20
  */
15
21
  first: number[];
16
22
  /**
17
- * Second vector
23
+ * Second vector, with the same number of entries as `first`.
18
24
  * @default undefined
19
25
  */
20
26
  second: number[];
21
27
  }
28
+ /**
29
+ * A list of booleans for `vector.all`, which tells whether every one of them is true.
30
+ */
22
31
  class VectorBoolDto {
23
32
  constructor(vector?: boolean[]);
24
33
  /**
25
- * Vector of booleans
34
+ * The booleans to check.
26
35
  * @default undefined
27
36
  */
28
37
  vector: boolean[];
29
38
  }
39
+ /**
40
+ * Vectors to filter with `vector.removeAllDuplicateVectors`, and how close two vectors must be
41
+ * to count as the same.
42
+ */
30
43
  class RemoveAllDuplicateVectorsDto {
31
44
  constructor(vectors?: number[][], tolerance?: number);
32
45
  /**
33
- * Vectors array
46
+ * The vectors to filter; their order is kept.
34
47
  * @default undefined
35
48
  */
36
49
  vectors: number[][];
37
50
  /**
38
- * Tolerance value
51
+ * Two vectors count as the same when every entry differs by less than this.
39
52
  * @default 1e-7
40
53
  * @minimum 0
41
54
  * @maximum Infinity
42
55
  */
43
56
  tolerance: number;
44
57
  }
58
+ /**
59
+ * Vectors to filter with `vector.removeConsecutiveDuplicateVectors`: only a vector that repeats
60
+ * its predecessor is dropped, and optionally a last vector that repeats the first.
61
+ */
45
62
  class RemoveConsecutiveDuplicateVectorsDto {
46
63
  constructor(vectors?: number[][], checkFirstAndLast?: boolean, tolerance?: number);
47
64
  /**
48
- * Vectors array
65
+ * The vectors to filter; their order is kept.
49
66
  * @default undefined
50
67
  */
51
68
  vectors: number[][];
52
69
  /**
53
- * Check first and last vectors
70
+ * When true, a last vector that repeats the first is dropped as well, which closes a loop
71
+ * of points cleanly.
54
72
  * @default false
55
73
  */
56
74
  checkFirstAndLast: boolean;
57
75
  /**
58
- * Tolerance value
76
+ * Two vectors count as the same when every entry differs by less than this.
59
77
  * @default 1e-7
60
78
  * @minimum 0
61
79
  * @maximum Infinity
62
80
  */
63
81
  tolerance: number;
64
82
  }
83
+ /**
84
+ * Two vectors to compare with `vector.vectorsTheSame`, and how close their entries must be.
85
+ */
65
86
  class VectorsTheSameDto {
66
87
  constructor(vec1?: number[], vec2?: number[], tolerance?: number);
67
88
  /**
68
- * First vector
89
+ * First vector to compare.
69
90
  * @default undefined
70
91
  */
71
92
  vec1: number[];
72
93
  /**
73
- * Second vector
94
+ * Second vector; a different length means the two are never the same.
74
95
  * @default undefined
75
96
  */
76
97
  vec2: number[];
77
98
  /**
78
- * Tolerance value
99
+ * Entries count as equal when they differ by less than this.
79
100
  * @default 1e-7
80
101
  * @minimum 0
81
102
  * @maximum Infinity
82
103
  */
83
104
  tolerance: number;
84
105
  }
106
+ /**
107
+ * One vector of any length for the single-vector methods of `vector`: `sum`, `min`, `max`,
108
+ * `norm`, `neg`, `finite`, `isZero` and the others.
109
+ */
85
110
  class VectorDto {
86
111
  constructor(vector?: number[]);
87
112
  /**
88
- * Vector array of numbers
113
+ * The vector, as a list of numbers.
89
114
  * @default undefined
90
115
  */
91
116
  vector: number[];
92
117
  }
118
+ /**
119
+ * A list of number strings for `vector.parseNumbers`, which turns each into a number.
120
+ */
93
121
  class VectorStringDto {
94
122
  constructor(vector?: string[]);
95
123
  /**
96
- * Vector array of stringified numbers
124
+ * The strings to parse, such as `["1", "2.5"]`.
97
125
  * @default undefined
98
126
  */
99
127
  vector: string[];
100
128
  }
129
+ /**
130
+ * One 3D vector for `vector.length`, `vector.lengthSq` and `vector.normalized`.
131
+ */
101
132
  class Vector3Dto {
102
133
  constructor(vector?: Base.Vector3);
103
134
  /**
104
- * Vector array of 3 numbers
135
+ * The vector as `[x, y, z]`.
105
136
  * @default undefined
106
137
  */
107
138
  vector: Base.Vector3;
108
139
  }
140
+ /**
141
+ * The end of the range `vector.range` lists, which runs from 0 up to but not including it.
142
+ */
109
143
  class RangeMaxDto {
110
144
  constructor(max?: number);
111
145
  /**
112
- * Maximum range boundary
146
+ * The end of the range; it is not included, so 5 gives `[0, 1, 2, 3, 4]`.
113
147
  * @default 10
114
148
  * @minimum -Infinity
115
149
  * @maximum Infinity
@@ -117,10 +151,13 @@ export declare namespace Vector {
117
151
  */
118
152
  max: number;
119
153
  }
154
+ /**
155
+ * The three values `vector.vectorXYZ` puts together into `[x, y, z]`.
156
+ */
120
157
  class VectorXYZDto {
121
158
  constructor(x?: number, y?: number, z?: number);
122
159
  /**
123
- * X value of vector
160
+ * The X value, the first entry.
124
161
  * @default 0
125
162
  * @minimum -Infinity
126
163
  * @maximum Infinity
@@ -128,7 +165,7 @@ export declare namespace Vector {
128
165
  */
129
166
  x: number;
130
167
  /**
131
- * Y value of vector
168
+ * The Y value, the second entry; Y is up.
132
169
  * @default 0
133
170
  * @minimum -Infinity
134
171
  * @maximum Infinity
@@ -136,7 +173,7 @@ export declare namespace Vector {
136
173
  */
137
174
  y: number;
138
175
  /**
139
- * Z value of vector
176
+ * The Z value, the third entry.
140
177
  * @default 0
141
178
  * @minimum -Infinity
142
179
  * @maximum Infinity
@@ -144,10 +181,13 @@ export declare namespace Vector {
144
181
  */
145
182
  z: number;
146
183
  }
184
+ /**
185
+ * The two values `vector.vectorXY` puts together into `[x, y]`.
186
+ */
147
187
  class VectorXYDto {
148
188
  constructor(x?: number, y?: number);
149
189
  /**
150
- * X value of vector
190
+ * The X value, the first entry.
151
191
  * @default 0
152
192
  * @minimum -Infinity
153
193
  * @maximum Infinity
@@ -155,7 +195,7 @@ export declare namespace Vector {
155
195
  */
156
196
  x: number;
157
197
  /**
158
- * Y value of vector
198
+ * The Y value, the second entry.
159
199
  * @default 0
160
200
  * @minimum -Infinity
161
201
  * @maximum Infinity
@@ -163,10 +203,15 @@ export declare namespace Vector {
163
203
  */
164
204
  y: number;
165
205
  }
206
+ /**
207
+ * A start, an end and a step for `vector.span`, which lists every number from `min` to `max` in
208
+ * steps of `step`.
209
+ */
166
210
  class SpanDto {
167
211
  constructor(step?: number, min?: number, max?: number);
168
212
  /**
169
- * Step of the span
213
+ * Distance between neighboring numbers; the last number is `max` only when a step lands on
214
+ * it.
170
215
  * @default 0.1
171
216
  * @minimum -Infinity
172
217
  * @maximum Infinity
@@ -174,26 +219,30 @@ export declare namespace Vector {
174
219
  */
175
220
  step: number;
176
221
  /**
177
- * Min value of the span
178
- * @default 0
179
- * @minimum -Infinity
180
- * @maximum Infinity
181
- * @step 1
182
- */
222
+ * The first number of the span.
223
+ * @default 0
224
+ * @minimum -Infinity
225
+ * @maximum Infinity
226
+ * @step 1
227
+ */
183
228
  min: number;
184
229
  /**
185
- * Max value of the span
186
- * @default 1
187
- * @minimum -Infinity
188
- * @maximum Infinity
189
- * @step 1
190
- */
230
+ * The end of the span; included when a step lands on it.
231
+ * @default 1
232
+ * @minimum -Infinity
233
+ * @maximum Infinity
234
+ * @step 1
235
+ */
191
236
  max: number;
192
237
  }
238
+ /**
239
+ * A start, an end, a count and an easing curve for `vector.spanEaseItems`, which spaces the
240
+ * numbers unevenly along the curve.
241
+ */
193
242
  class SpanEaseItemsDto {
194
243
  constructor(nrItems?: number, min?: number, max?: number, ease?: Math.easeEnum);
195
244
  /**
196
- * Nr of items in the span
245
+ * How many numbers to produce, including `min` and `max`; at least 2.
197
246
  * @default 100
198
247
  * @minimum 2
199
248
  * @maximum Infinity
@@ -201,36 +250,41 @@ export declare namespace Vector {
201
250
  */
202
251
  nrItems: number;
203
252
  /**
204
- * Min value of the span
205
- * @default 0
206
- * @minimum -Infinity
207
- * @maximum Infinity
208
- * @step 1
209
- */
253
+ * The first number.
254
+ * @default 0
255
+ * @minimum -Infinity
256
+ * @maximum Infinity
257
+ * @step 1
258
+ */
210
259
  min: number;
211
260
  /**
212
- * Max value of the span
213
- * @default 1
214
- * @minimum -Infinity
215
- * @maximum Infinity
216
- * @step 1
217
- */
261
+ * The last number.
262
+ * @default 1
263
+ * @minimum -Infinity
264
+ * @maximum Infinity
265
+ * @step 1
266
+ */
218
267
  max: number;
219
268
  /**
220
- * Ease type
221
- * @default easeInSine
222
- */
269
+ * The easing curve that spaces the numbers: an `easeIn` curve bunches them near `min`, an
270
+ * `easeOut` curve near `max`, an `easeInOut` curve at both ends.
271
+ * @default easeInSine
272
+ */
223
273
  ease: Math.easeEnum;
224
274
  /**
225
- * Indicates wether only intervals should be outputed. This will output step lengths between the values.
275
+ * When true, the result holds the gaps between neighboring numbers instead of the numbers
276
+ * themselves; the first entry is `min`.
226
277
  * @default false
227
278
  */
228
279
  intervals: boolean;
229
280
  }
281
+ /**
282
+ * A start, an end and a count for `vector.spanLinearItems`, which spaces the numbers evenly.
283
+ */
230
284
  class SpanLinearItemsDto {
231
285
  constructor(nrItems?: number, min?: number, max?: number);
232
286
  /**
233
- * Nr of items in the span
287
+ * How many numbers to produce, including `min` and `max`; at least 2.
234
288
  * @default 100
235
289
  * @minimum 2
236
290
  * @maximum Infinity
@@ -238,31 +292,36 @@ export declare namespace Vector {
238
292
  */
239
293
  nrItems: number;
240
294
  /**
241
- * Min value of the span
242
- * @default 0
243
- * @minimum -Infinity
244
- * @maximum Infinity
245
- * @step 1
246
- */
295
+ * The first number.
296
+ * @default 0
297
+ * @minimum -Infinity
298
+ * @maximum Infinity
299
+ * @step 1
300
+ */
247
301
  min: number;
248
302
  /**
249
- * Max value of the span
250
- * @default 1
251
- * @minimum -Infinity
252
- * @maximum Infinity
253
- * @step 1
254
- */
303
+ * The last number.
304
+ * @default 1
305
+ * @minimum -Infinity
306
+ * @maximum Infinity
307
+ * @step 1
308
+ */
255
309
  max: number;
256
310
  }
311
+ /**
312
+ * A start point, a direction and a distance for `vector.onRay`, which finds the point that far
313
+ * along the direction.
314
+ */
257
315
  class RayPointDto {
258
316
  constructor(point?: Base.Point3, distance?: number, vector?: number[]);
259
317
  /**
260
- * Origin location of the ray
318
+ * Where the ray starts.
261
319
  * @default undefined
262
320
  */
263
321
  point: Base.Point3;
264
322
  /**
265
- * Distance to the point on the ray
323
+ * How far to travel from `point`, in multiples of the direction vector's length; a negative
324
+ * distance goes backwards.
266
325
  * @default 1
267
326
  * @minimum -Infinity
268
327
  * @maximum Infinity
@@ -270,23 +329,32 @@ export declare namespace Vector {
270
329
  */
271
330
  distance: number;
272
331
  /**
273
- * Vector array of numbers
332
+ * The direction to travel in, used as given; a unit vector makes `distance` a length in
333
+ * model units.
274
334
  * @default undefined
275
335
  */
276
336
  vector: number[];
277
337
  }
338
+ /**
339
+ * A list of vectors for `vector.addAll`, which adds them entry by entry into one vector.
340
+ */
278
341
  class VectorsDto {
279
342
  constructor(vectors?: number[][]);
280
343
  /**
281
- * Vectors array
344
+ * The vectors to add together; the result has as many entries as the first.
282
345
  * @default undefined
283
346
  */
284
347
  vectors: number[][];
285
348
  }
349
+ /**
350
+ * Two vectors and a fraction for `vector.lerp`, which blends them: 1 gives the first, 0 the
351
+ * second.
352
+ */
286
353
  class FractionTwoVectorsDto {
287
354
  constructor(fraction?: number, first?: Base.Vector3, second?: Base.Vector3);
288
355
  /**
289
- * Fraction number
356
+ * The share of `first` in the blend: 1 gives `first`, 0 gives `second`, 0.5 the midpoint.
357
+ * Values outside 0 to 1 extrapolate past the ends.
290
358
  * @default 0.5
291
359
  * @minimum -Infinity
292
360
  * @maximum Infinity
@@ -294,20 +362,24 @@ export declare namespace Vector {
294
362
  */
295
363
  fraction: number;
296
364
  /**
297
- * First vector
365
+ * The vector the blend reaches at fraction 1.
298
366
  * @default undefined
299
367
  */
300
368
  first: Base.Vector3;
301
369
  /**
302
- * Second vector
370
+ * The vector the blend reaches at fraction 0.
303
371
  * @default undefined
304
372
  */
305
373
  second: Base.Vector3;
306
374
  }
375
+ /**
376
+ * A vector and one number for `vector.mul` and `vector.div`, which apply the number to every
377
+ * entry.
378
+ */
307
379
  class VectorScalarDto {
308
380
  constructor(scalar?: number, vector?: number[]);
309
381
  /**
310
- * Scalar number
382
+ * The number every entry is multiplied or divided by.
311
383
  * @default 1
312
384
  * @minimum -Infinity
313
385
  * @maximum Infinity
@@ -315,25 +387,31 @@ export declare namespace Vector {
315
387
  */
316
388
  scalar: number;
317
389
  /**
318
- * Vector array of numbers
390
+ * The vector to scale.
319
391
  * @default undefined
320
392
  */
321
393
  vector: number[];
322
394
  }
395
+ /**
396
+ * Two vectors and a reference direction for `vector.signedAngleBetween` and
397
+ * `vector.positiveAngleBetween`, which measure the turn from the first to the second around the
398
+ * reference.
399
+ */
323
400
  class TwoVectorsReferenceDto {
324
401
  constructor(reference?: number[], first?: Base.Vector3, second?: Base.Vector3);
325
402
  /**
326
- * Reference vector
403
+ * The direction to turn around; the angle is counter-clockwise when this vector points
404
+ * toward you.
327
405
  * @default undefined
328
406
  */
329
407
  reference: number[];
330
408
  /**
331
- * First vector
409
+ * The vector the turn starts from.
332
410
  * @default undefined
333
411
  */
334
412
  first: Base.Vector3;
335
413
  /**
336
- * Second vector
414
+ * The vector the turn ends at.
337
415
  * @default undefined
338
416
  */
339
417
  second: Base.Vector3;