@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.
- package/lib/api/GlobalCDNProvider.js +1 -1
- package/lib/api/inputs/base-inputs.d.ts +13 -12
- package/lib/api/inputs/color-inputs.d.ts +97 -48
- package/lib/api/inputs/color-inputs.js +95 -46
- package/lib/api/inputs/dates-inputs.d.ts +67 -26
- package/lib/api/inputs/dates-inputs.js +57 -16
- package/lib/api/inputs/io-inputs.d.ts +13 -15
- package/lib/api/inputs/io-inputs.js +7 -8
- package/lib/api/inputs/line-inputs.d.ts +88 -33
- package/lib/api/inputs/line-inputs.js +61 -11
- package/lib/api/inputs/lists-inputs.d.ts +207 -96
- package/lib/api/inputs/lists-inputs.js +153 -45
- package/lib/api/inputs/logic-inputs.d.ts +52 -22
- package/lib/api/inputs/logic-inputs.js +41 -12
- package/lib/api/inputs/math-inputs.d.ts +113 -52
- package/lib/api/inputs/math-inputs.js +112 -51
- package/lib/api/inputs/mesh-inputs.d.ts +30 -11
- package/lib/api/inputs/mesh-inputs.js +21 -3
- package/lib/api/inputs/point-inputs.d.ts +240 -107
- package/lib/api/inputs/point-inputs.js +199 -73
- package/lib/api/inputs/polyline-inputs.d.ts +68 -28
- package/lib/api/inputs/polyline-inputs.js +48 -13
- package/lib/api/inputs/text-inputs.d.ts +117 -46
- package/lib/api/inputs/text-inputs.js +111 -41
- package/lib/api/inputs/transforms-inputs.d.ts +65 -23
- package/lib/api/inputs/transforms-inputs.js +64 -22
- package/lib/api/inputs/vector-inputs.d.ts +154 -76
- package/lib/api/inputs/vector-inputs.js +132 -57
- package/lib/api/models/point/hex-grid-data.d.ts +1 -1
- package/lib/api/models/point/hex-grid-data.js +1 -1
- package/lib/api/services/color.d.ts +149 -70
- package/lib/api/services/color.js +149 -70
- package/lib/api/services/dates.d.ts +313 -150
- package/lib/api/services/dates.js +313 -150
- package/lib/api/services/line.d.ts +138 -68
- package/lib/api/services/line.js +138 -68
- package/lib/api/services/lists.d.ts +357 -177
- package/lib/api/services/lists.js +357 -177
- package/lib/api/services/logic.d.ts +98 -45
- package/lib/api/services/logic.js +98 -45
- package/lib/api/services/math.d.ts +363 -211
- package/lib/api/services/math.js +363 -211
- package/lib/api/services/mesh.d.ts +73 -31
- package/lib/api/services/mesh.js +73 -31
- package/lib/api/services/point.d.ts +367 -147
- package/lib/api/services/point.js +367 -147
- package/lib/api/services/polyline.d.ts +146 -71
- package/lib/api/services/polyline.js +146 -71
- package/lib/api/services/text.d.ts +320 -165
- package/lib/api/services/text.js +320 -165
- package/lib/api/services/transforms.d.ts +145 -58
- package/lib/api/services/transforms.js +145 -58
- package/lib/api/services/vector.d.ts +381 -156
- package/lib/api/services/vector.js +381 -156
- package/package.json +1 -1
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { Math } from "./math-inputs";
|
|
2
2
|
/**
|
|
3
3
|
* Parameters for vector arithmetic: the operands for addition, subtraction, scaling, dot and cross
|
|
4
|
-
* products,
|
|
4
|
+
* products, normalization, angle and distance measurement, projection and interpolation. Vectors are
|
|
5
5
|
* number arrays, so these DTOs mostly carry one or two of them plus a scalar.
|
|
6
6
|
*/
|
|
7
7
|
export var Vector;
|
|
8
8
|
(function (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, second) {
|
|
11
16
|
if (first !== undefined) {
|
|
@@ -17,6 +22,9 @@ export var Vector;
|
|
|
17
22
|
}
|
|
18
23
|
}
|
|
19
24
|
Vector.TwoVectorsDto = TwoVectorsDto;
|
|
25
|
+
/**
|
|
26
|
+
* A list of booleans for `vector.all`, which tells whether every one of them is true.
|
|
27
|
+
*/
|
|
20
28
|
class VectorBoolDto {
|
|
21
29
|
constructor(vector) {
|
|
22
30
|
if (vector !== undefined) {
|
|
@@ -25,10 +33,14 @@ export var Vector;
|
|
|
25
33
|
}
|
|
26
34
|
}
|
|
27
35
|
Vector.VectorBoolDto = VectorBoolDto;
|
|
36
|
+
/**
|
|
37
|
+
* Vectors to filter with `vector.removeAllDuplicateVectors`, and how close two vectors must be
|
|
38
|
+
* to count as the same.
|
|
39
|
+
*/
|
|
28
40
|
class RemoveAllDuplicateVectorsDto {
|
|
29
41
|
constructor(vectors, tolerance) {
|
|
30
42
|
/**
|
|
31
|
-
*
|
|
43
|
+
* Two vectors count as the same when every entry differs by less than this.
|
|
32
44
|
* @default 1e-7
|
|
33
45
|
* @minimum 0
|
|
34
46
|
* @maximum Infinity
|
|
@@ -43,15 +55,20 @@ export var Vector;
|
|
|
43
55
|
}
|
|
44
56
|
}
|
|
45
57
|
Vector.RemoveAllDuplicateVectorsDto = RemoveAllDuplicateVectorsDto;
|
|
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
|
+
*/
|
|
46
62
|
class RemoveConsecutiveDuplicateVectorsDto {
|
|
47
63
|
constructor(vectors, checkFirstAndLast, tolerance) {
|
|
48
64
|
/**
|
|
49
|
-
*
|
|
65
|
+
* When true, a last vector that repeats the first is dropped as well, which closes a loop
|
|
66
|
+
* of points cleanly.
|
|
50
67
|
* @default false
|
|
51
68
|
*/
|
|
52
69
|
this.checkFirstAndLast = false;
|
|
53
70
|
/**
|
|
54
|
-
*
|
|
71
|
+
* Two vectors count as the same when every entry differs by less than this.
|
|
55
72
|
* @default 1e-7
|
|
56
73
|
* @minimum 0
|
|
57
74
|
* @maximum Infinity
|
|
@@ -69,10 +86,13 @@ export var Vector;
|
|
|
69
86
|
}
|
|
70
87
|
}
|
|
71
88
|
Vector.RemoveConsecutiveDuplicateVectorsDto = RemoveConsecutiveDuplicateVectorsDto;
|
|
89
|
+
/**
|
|
90
|
+
* Two vectors to compare with `vector.vectorsTheSame`, and how close their entries must be.
|
|
91
|
+
*/
|
|
72
92
|
class VectorsTheSameDto {
|
|
73
93
|
constructor(vec1, vec2, tolerance) {
|
|
74
94
|
/**
|
|
75
|
-
*
|
|
95
|
+
* Entries count as equal when they differ by less than this.
|
|
76
96
|
* @default 1e-7
|
|
77
97
|
* @minimum 0
|
|
78
98
|
* @maximum Infinity
|
|
@@ -90,6 +110,10 @@ export var Vector;
|
|
|
90
110
|
}
|
|
91
111
|
}
|
|
92
112
|
Vector.VectorsTheSameDto = VectorsTheSameDto;
|
|
113
|
+
/**
|
|
114
|
+
* One vector of any length for the single-vector methods of `vector`: `sum`, `min`, `max`,
|
|
115
|
+
* `norm`, `neg`, `finite`, `isZero` and the others.
|
|
116
|
+
*/
|
|
93
117
|
class VectorDto {
|
|
94
118
|
constructor(vector) {
|
|
95
119
|
if (vector !== undefined) {
|
|
@@ -98,6 +122,9 @@ export var Vector;
|
|
|
98
122
|
}
|
|
99
123
|
}
|
|
100
124
|
Vector.VectorDto = VectorDto;
|
|
125
|
+
/**
|
|
126
|
+
* A list of number strings for `vector.parseNumbers`, which turns each into a number.
|
|
127
|
+
*/
|
|
101
128
|
class VectorStringDto {
|
|
102
129
|
constructor(vector) {
|
|
103
130
|
if (vector !== undefined) {
|
|
@@ -106,6 +133,9 @@ export var Vector;
|
|
|
106
133
|
}
|
|
107
134
|
}
|
|
108
135
|
Vector.VectorStringDto = VectorStringDto;
|
|
136
|
+
/**
|
|
137
|
+
* One 3D vector for `vector.length`, `vector.lengthSq` and `vector.normalized`.
|
|
138
|
+
*/
|
|
109
139
|
class Vector3Dto {
|
|
110
140
|
constructor(vector) {
|
|
111
141
|
if (vector !== undefined) {
|
|
@@ -114,10 +144,13 @@ export var Vector;
|
|
|
114
144
|
}
|
|
115
145
|
}
|
|
116
146
|
Vector.Vector3Dto = Vector3Dto;
|
|
147
|
+
/**
|
|
148
|
+
* The end of the range `vector.range` lists, which runs from 0 up to but not including it.
|
|
149
|
+
*/
|
|
117
150
|
class RangeMaxDto {
|
|
118
151
|
constructor(max) {
|
|
119
152
|
/**
|
|
120
|
-
*
|
|
153
|
+
* The end of the range; it is not included, so 5 gives `[0, 1, 2, 3, 4]`.
|
|
121
154
|
* @default 10
|
|
122
155
|
* @minimum -Infinity
|
|
123
156
|
* @maximum Infinity
|
|
@@ -130,10 +163,13 @@ export var Vector;
|
|
|
130
163
|
}
|
|
131
164
|
}
|
|
132
165
|
Vector.RangeMaxDto = RangeMaxDto;
|
|
166
|
+
/**
|
|
167
|
+
* The three values `vector.vectorXYZ` puts together into `[x, y, z]`.
|
|
168
|
+
*/
|
|
133
169
|
class VectorXYZDto {
|
|
134
170
|
constructor(x, y, z) {
|
|
135
171
|
/**
|
|
136
|
-
* X value
|
|
172
|
+
* The X value, the first entry.
|
|
137
173
|
* @default 0
|
|
138
174
|
* @minimum -Infinity
|
|
139
175
|
* @maximum Infinity
|
|
@@ -141,7 +177,7 @@ export var Vector;
|
|
|
141
177
|
*/
|
|
142
178
|
this.x = 0;
|
|
143
179
|
/**
|
|
144
|
-
* Y value
|
|
180
|
+
* The Y value, the second entry; Y is up.
|
|
145
181
|
* @default 0
|
|
146
182
|
* @minimum -Infinity
|
|
147
183
|
* @maximum Infinity
|
|
@@ -149,7 +185,7 @@ export var Vector;
|
|
|
149
185
|
*/
|
|
150
186
|
this.y = 0;
|
|
151
187
|
/**
|
|
152
|
-
* Z value
|
|
188
|
+
* The Z value, the third entry.
|
|
153
189
|
* @default 0
|
|
154
190
|
* @minimum -Infinity
|
|
155
191
|
* @maximum Infinity
|
|
@@ -168,10 +204,13 @@ export var Vector;
|
|
|
168
204
|
}
|
|
169
205
|
}
|
|
170
206
|
Vector.VectorXYZDto = VectorXYZDto;
|
|
207
|
+
/**
|
|
208
|
+
* The two values `vector.vectorXY` puts together into `[x, y]`.
|
|
209
|
+
*/
|
|
171
210
|
class VectorXYDto {
|
|
172
211
|
constructor(x, y) {
|
|
173
212
|
/**
|
|
174
|
-
* X value
|
|
213
|
+
* The X value, the first entry.
|
|
175
214
|
* @default 0
|
|
176
215
|
* @minimum -Infinity
|
|
177
216
|
* @maximum Infinity
|
|
@@ -179,7 +218,7 @@ export var Vector;
|
|
|
179
218
|
*/
|
|
180
219
|
this.x = 0;
|
|
181
220
|
/**
|
|
182
|
-
* Y value
|
|
221
|
+
* The Y value, the second entry.
|
|
183
222
|
* @default 0
|
|
184
223
|
* @minimum -Infinity
|
|
185
224
|
* @maximum Infinity
|
|
@@ -195,10 +234,15 @@ export var Vector;
|
|
|
195
234
|
}
|
|
196
235
|
}
|
|
197
236
|
Vector.VectorXYDto = VectorXYDto;
|
|
237
|
+
/**
|
|
238
|
+
* A start, an end and a step for `vector.span`, which lists every number from `min` to `max` in
|
|
239
|
+
* steps of `step`.
|
|
240
|
+
*/
|
|
198
241
|
class SpanDto {
|
|
199
242
|
constructor(step, min, max) {
|
|
200
243
|
/**
|
|
201
|
-
*
|
|
244
|
+
* Distance between neighboring numbers; the last number is `max` only when a step lands on
|
|
245
|
+
* it.
|
|
202
246
|
* @default 0.1
|
|
203
247
|
* @minimum -Infinity
|
|
204
248
|
* @maximum Infinity
|
|
@@ -206,20 +250,20 @@ export var Vector;
|
|
|
206
250
|
*/
|
|
207
251
|
this.step = 0.1;
|
|
208
252
|
/**
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
253
|
+
* The first number of the span.
|
|
254
|
+
* @default 0
|
|
255
|
+
* @minimum -Infinity
|
|
256
|
+
* @maximum Infinity
|
|
257
|
+
* @step 1
|
|
258
|
+
*/
|
|
215
259
|
this.min = 0;
|
|
216
260
|
/**
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
261
|
+
* The end of the span; included when a step lands on it.
|
|
262
|
+
* @default 1
|
|
263
|
+
* @minimum -Infinity
|
|
264
|
+
* @maximum Infinity
|
|
265
|
+
* @step 1
|
|
266
|
+
*/
|
|
223
267
|
this.max = 1;
|
|
224
268
|
if (step !== undefined) {
|
|
225
269
|
this.step = step;
|
|
@@ -233,10 +277,14 @@ export var Vector;
|
|
|
233
277
|
}
|
|
234
278
|
}
|
|
235
279
|
Vector.SpanDto = SpanDto;
|
|
280
|
+
/**
|
|
281
|
+
* A start, an end, a count and an easing curve for `vector.spanEaseItems`, which spaces the
|
|
282
|
+
* numbers unevenly along the curve.
|
|
283
|
+
*/
|
|
236
284
|
class SpanEaseItemsDto {
|
|
237
285
|
constructor(nrItems, min, max, ease) {
|
|
238
286
|
/**
|
|
239
|
-
*
|
|
287
|
+
* How many numbers to produce, including `min` and `max`; at least 2.
|
|
240
288
|
* @default 100
|
|
241
289
|
* @minimum 2
|
|
242
290
|
* @maximum Infinity
|
|
@@ -244,28 +292,30 @@ export var Vector;
|
|
|
244
292
|
*/
|
|
245
293
|
this.nrItems = 100;
|
|
246
294
|
/**
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
295
|
+
* The first number.
|
|
296
|
+
* @default 0
|
|
297
|
+
* @minimum -Infinity
|
|
298
|
+
* @maximum Infinity
|
|
299
|
+
* @step 1
|
|
300
|
+
*/
|
|
253
301
|
this.min = 0;
|
|
254
302
|
/**
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
303
|
+
* The last number.
|
|
304
|
+
* @default 1
|
|
305
|
+
* @minimum -Infinity
|
|
306
|
+
* @maximum Infinity
|
|
307
|
+
* @step 1
|
|
308
|
+
*/
|
|
261
309
|
this.max = 1;
|
|
262
310
|
/**
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
311
|
+
* The easing curve that spaces the numbers: an `easeIn` curve bunches them near `min`, an
|
|
312
|
+
* `easeOut` curve near `max`, an `easeInOut` curve at both ends.
|
|
313
|
+
* @default easeInSine
|
|
314
|
+
*/
|
|
266
315
|
this.ease = Math.easeEnum.easeInSine;
|
|
267
316
|
/**
|
|
268
|
-
*
|
|
317
|
+
* When true, the result holds the gaps between neighboring numbers instead of the numbers
|
|
318
|
+
* themselves; the first entry is `min`.
|
|
269
319
|
* @default false
|
|
270
320
|
*/
|
|
271
321
|
this.intervals = false;
|
|
@@ -284,10 +334,13 @@ export var Vector;
|
|
|
284
334
|
}
|
|
285
335
|
}
|
|
286
336
|
Vector.SpanEaseItemsDto = SpanEaseItemsDto;
|
|
337
|
+
/**
|
|
338
|
+
* A start, an end and a count for `vector.spanLinearItems`, which spaces the numbers evenly.
|
|
339
|
+
*/
|
|
287
340
|
class SpanLinearItemsDto {
|
|
288
341
|
constructor(nrItems, min, max) {
|
|
289
342
|
/**
|
|
290
|
-
*
|
|
343
|
+
* How many numbers to produce, including `min` and `max`; at least 2.
|
|
291
344
|
* @default 100
|
|
292
345
|
* @minimum 2
|
|
293
346
|
* @maximum Infinity
|
|
@@ -295,20 +348,20 @@ export var Vector;
|
|
|
295
348
|
*/
|
|
296
349
|
this.nrItems = 100;
|
|
297
350
|
/**
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
351
|
+
* The first number.
|
|
352
|
+
* @default 0
|
|
353
|
+
* @minimum -Infinity
|
|
354
|
+
* @maximum Infinity
|
|
355
|
+
* @step 1
|
|
356
|
+
*/
|
|
304
357
|
this.min = 0;
|
|
305
358
|
/**
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
359
|
+
* The last number.
|
|
360
|
+
* @default 1
|
|
361
|
+
* @minimum -Infinity
|
|
362
|
+
* @maximum Infinity
|
|
363
|
+
* @step 1
|
|
364
|
+
*/
|
|
312
365
|
this.max = 1;
|
|
313
366
|
if (nrItems !== undefined) {
|
|
314
367
|
this.nrItems = nrItems;
|
|
@@ -322,10 +375,15 @@ export var Vector;
|
|
|
322
375
|
}
|
|
323
376
|
}
|
|
324
377
|
Vector.SpanLinearItemsDto = SpanLinearItemsDto;
|
|
378
|
+
/**
|
|
379
|
+
* A start point, a direction and a distance for `vector.onRay`, which finds the point that far
|
|
380
|
+
* along the direction.
|
|
381
|
+
*/
|
|
325
382
|
class RayPointDto {
|
|
326
383
|
constructor(point, distance, vector) {
|
|
327
384
|
/**
|
|
328
|
-
*
|
|
385
|
+
* How far to travel from `point`, in multiples of the direction vector's length; a negative
|
|
386
|
+
* distance goes backwards.
|
|
329
387
|
* @default 1
|
|
330
388
|
* @minimum -Infinity
|
|
331
389
|
* @maximum Infinity
|
|
@@ -344,6 +402,9 @@ export var Vector;
|
|
|
344
402
|
}
|
|
345
403
|
}
|
|
346
404
|
Vector.RayPointDto = RayPointDto;
|
|
405
|
+
/**
|
|
406
|
+
* A list of vectors for `vector.addAll`, which adds them entry by entry into one vector.
|
|
407
|
+
*/
|
|
347
408
|
class VectorsDto {
|
|
348
409
|
constructor(vectors) {
|
|
349
410
|
if (vectors !== undefined) {
|
|
@@ -352,10 +413,15 @@ export var Vector;
|
|
|
352
413
|
}
|
|
353
414
|
}
|
|
354
415
|
Vector.VectorsDto = VectorsDto;
|
|
416
|
+
/**
|
|
417
|
+
* Two vectors and a fraction for `vector.lerp`, which blends them: 1 gives the first, 0 the
|
|
418
|
+
* second.
|
|
419
|
+
*/
|
|
355
420
|
class FractionTwoVectorsDto {
|
|
356
421
|
constructor(fraction, first, second) {
|
|
357
422
|
/**
|
|
358
|
-
*
|
|
423
|
+
* The share of `first` in the blend: 1 gives `first`, 0 gives `second`, 0.5 the midpoint.
|
|
424
|
+
* Values outside 0 to 1 extrapolate past the ends.
|
|
359
425
|
* @default 0.5
|
|
360
426
|
* @minimum -Infinity
|
|
361
427
|
* @maximum Infinity
|
|
@@ -374,10 +440,14 @@ export var Vector;
|
|
|
374
440
|
}
|
|
375
441
|
}
|
|
376
442
|
Vector.FractionTwoVectorsDto = FractionTwoVectorsDto;
|
|
443
|
+
/**
|
|
444
|
+
* A vector and one number for `vector.mul` and `vector.div`, which apply the number to every
|
|
445
|
+
* entry.
|
|
446
|
+
*/
|
|
377
447
|
class VectorScalarDto {
|
|
378
448
|
constructor(scalar, vector) {
|
|
379
449
|
/**
|
|
380
|
-
*
|
|
450
|
+
* The number every entry is multiplied or divided by.
|
|
381
451
|
* @default 1
|
|
382
452
|
* @minimum -Infinity
|
|
383
453
|
* @maximum Infinity
|
|
@@ -393,6 +463,11 @@ export var Vector;
|
|
|
393
463
|
}
|
|
394
464
|
}
|
|
395
465
|
Vector.VectorScalarDto = VectorScalarDto;
|
|
466
|
+
/**
|
|
467
|
+
* Two vectors and a reference direction for `vector.signedAngleBetween` and
|
|
468
|
+
* `vector.positiveAngleBetween`, which measure the turn from the first to the second around the
|
|
469
|
+
* reference.
|
|
470
|
+
*/
|
|
396
471
|
class TwoVectorsReferenceDto {
|
|
397
472
|
constructor(reference, first, second) {
|
|
398
473
|
if (reference !== undefined) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Base } from "../../inputs/base-inputs";
|
|
2
2
|
/**
|
|
3
|
-
* A generated hexagonal grid: the
|
|
3
|
+
* A generated hexagonal grid: the center point of every hexagon, its corner points, and the
|
|
4
4
|
* row and column structure that placed them. The layout used for honeycomb patterns, perforations
|
|
5
5
|
* and panelised surfaces.
|
|
6
6
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A generated hexagonal grid: the
|
|
2
|
+
* A generated hexagonal grid: the center point of every hexagon, its corner points, and the
|
|
3
3
|
* row and column structure that placed them. The layout used for honeycomb patterns, perforations
|
|
4
4
|
* and panelised surfaces.
|
|
5
5
|
*/
|