@bitbybit-dev/base 0.20.2 → 0.20.4

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 (47) hide show
  1. package/LICENSE +1 -1
  2. package/lib/api/inputs/base-inputs.d.ts +8 -0
  3. package/lib/api/inputs/index.d.ts +3 -0
  4. package/lib/api/inputs/index.js +3 -0
  5. package/lib/api/inputs/inputs.d.ts +3 -0
  6. package/lib/api/inputs/inputs.js +3 -0
  7. package/lib/api/inputs/line-inputs.d.ts +240 -0
  8. package/lib/api/inputs/line-inputs.js +247 -0
  9. package/lib/api/inputs/mesh-inputs.d.ts +82 -0
  10. package/lib/api/inputs/mesh-inputs.js +83 -0
  11. package/lib/api/inputs/point-inputs.d.ts +153 -0
  12. package/lib/api/inputs/point-inputs.js +188 -0
  13. package/lib/api/inputs/polyline-inputs.d.ts +206 -0
  14. package/lib/api/inputs/polyline-inputs.js +229 -0
  15. package/lib/api/inputs/text-inputs.d.ts +1 -1
  16. package/lib/api/inputs/transforms-inputs.d.ts +18 -0
  17. package/lib/api/inputs/transforms-inputs.js +29 -0
  18. package/lib/api/inputs/vector-inputs.d.ts +8 -0
  19. package/lib/api/inputs/vector-inputs.js +8 -0
  20. package/lib/api/models/index.d.ts +1 -0
  21. package/lib/api/models/index.js +1 -0
  22. package/lib/api/models/point/bucket.d.ts +1 -0
  23. package/lib/api/models/point/bucket.js +1 -0
  24. package/lib/api/models/point/hex-grid-data.d.ts +8 -0
  25. package/lib/api/models/point/hex-grid-data.js +2 -0
  26. package/lib/api/models/point/index.d.ts +1 -0
  27. package/lib/api/models/point/index.js +1 -0
  28. package/lib/api/services/dates.js +45 -15
  29. package/lib/api/services/index.d.ts +3 -0
  30. package/lib/api/services/index.js +3 -0
  31. package/lib/api/services/line.d.ts +158 -0
  32. package/lib/api/services/line.js +334 -0
  33. package/lib/api/services/lists.d.ts +1 -1
  34. package/lib/api/services/lists.js +1 -2
  35. package/lib/api/services/mesh.d.ts +66 -0
  36. package/lib/api/services/mesh.js +235 -0
  37. package/lib/api/services/point.d.ts +96 -1
  38. package/lib/api/services/point.js +540 -1
  39. package/lib/api/services/polyline.d.ts +149 -0
  40. package/lib/api/services/polyline.js +446 -0
  41. package/lib/api/services/transforms.d.ts +26 -1
  42. package/lib/api/services/transforms.js +66 -3
  43. package/lib/api/services/vector.d.ts +18 -0
  44. package/lib/api/services/vector.js +27 -0
  45. package/lib/api/unit-test-helper.d.ts +20 -0
  46. package/lib/api/unit-test-helper.js +130 -0
  47. package/package.json +2 -2
@@ -0,0 +1,229 @@
1
+ export var Polyline;
2
+ (function (Polyline) {
3
+ class PolylineCreateDto {
4
+ /**
5
+ * Provide options without default values
6
+ */
7
+ constructor(points, isClosed) {
8
+ /**
9
+ * Can contain is closed information
10
+ * @default false
11
+ */
12
+ this.isClosed = false;
13
+ if (points !== undefined) {
14
+ this.points = points;
15
+ }
16
+ if (isClosed !== undefined) {
17
+ this.isClosed = isClosed;
18
+ }
19
+ }
20
+ }
21
+ Polyline.PolylineCreateDto = PolylineCreateDto;
22
+ class PolylinePropertiesDto {
23
+ /**
24
+ * Provide options without default values
25
+ */
26
+ constructor(points, isClosed) {
27
+ /**
28
+ * Can contain is closed information
29
+ * @default false
30
+ */
31
+ this.isClosed = false;
32
+ if (points !== undefined) {
33
+ this.points = points;
34
+ }
35
+ if (isClosed !== undefined) {
36
+ this.isClosed = isClosed;
37
+ }
38
+ }
39
+ }
40
+ Polyline.PolylinePropertiesDto = PolylinePropertiesDto;
41
+ class PolylineDto {
42
+ constructor(polyline) {
43
+ if (polyline !== undefined) {
44
+ this.polyline = polyline;
45
+ }
46
+ }
47
+ }
48
+ Polyline.PolylineDto = PolylineDto;
49
+ class PolylinesDto {
50
+ constructor(polylines) {
51
+ if (polylines !== undefined) {
52
+ this.polylines = polylines;
53
+ }
54
+ }
55
+ }
56
+ Polyline.PolylinesDto = PolylinesDto;
57
+ class TransformPolylineDto {
58
+ constructor(polyline, transformation) {
59
+ if (polyline !== undefined) {
60
+ this.polyline = polyline;
61
+ }
62
+ if (transformation !== undefined) {
63
+ this.transformation = transformation;
64
+ }
65
+ }
66
+ }
67
+ Polyline.TransformPolylineDto = TransformPolylineDto;
68
+ class DrawPolylineDto {
69
+ /**
70
+ * Provide options without default values
71
+ */
72
+ constructor(polyline, opacity, colours, size, updatable, polylineMesh) {
73
+ /**
74
+ * Value between 0 and 1
75
+ * @default 1
76
+ * @minimum 0
77
+ * @maximum 1
78
+ * @step 0.1
79
+ */
80
+ this.opacity = 1;
81
+ /**
82
+ * Hex colour string
83
+ * @default #444444
84
+ */
85
+ this.colours = "#444444";
86
+ /**
87
+ * Width of the polyline
88
+ * @default 3
89
+ * @minimum 0
90
+ * @maximum Infinity
91
+ * @step 0.1
92
+ */
93
+ this.size = 3;
94
+ /**
95
+ * Indicates wether the position of this polyline will change in time
96
+ * @default false
97
+ */
98
+ this.updatable = false;
99
+ if (polyline !== undefined) {
100
+ this.polyline = polyline;
101
+ }
102
+ if (opacity !== undefined) {
103
+ this.opacity = opacity;
104
+ }
105
+ if (colours !== undefined) {
106
+ this.colours = colours;
107
+ }
108
+ if (size !== undefined) {
109
+ this.size = size;
110
+ }
111
+ if (updatable !== undefined) {
112
+ this.updatable = updatable;
113
+ }
114
+ if (polylineMesh !== undefined) {
115
+ this.polylineMesh = polylineMesh;
116
+ }
117
+ }
118
+ }
119
+ Polyline.DrawPolylineDto = DrawPolylineDto;
120
+ class DrawPolylinesDto {
121
+ /**
122
+ * Provide options without default values
123
+ */
124
+ constructor(polylines, opacity, colours, size, updatable, polylinesMesh) {
125
+ /**
126
+ * Value between 0 and 1
127
+ * @default 1
128
+ * @minimum 0
129
+ * @maximum 1
130
+ * @step 0.1
131
+ */
132
+ this.opacity = 1;
133
+ /**
134
+ * Hex colour string
135
+ * @default #444444
136
+ */
137
+ this.colours = "#444444";
138
+ /**
139
+ * Width of the polyline
140
+ * @default 3
141
+ * @minimum 0
142
+ * @maximum Infinity
143
+ * @step 0.1
144
+ */
145
+ this.size = 3;
146
+ /**
147
+ * Indicates wether the position of this polyline will change in time
148
+ * @default false
149
+ */
150
+ this.updatable = false;
151
+ if (polylines !== undefined) {
152
+ this.polylines = polylines;
153
+ }
154
+ if (opacity !== undefined) {
155
+ this.opacity = opacity;
156
+ }
157
+ if (colours !== undefined) {
158
+ this.colours = colours;
159
+ }
160
+ if (size !== undefined) {
161
+ this.size = size;
162
+ }
163
+ if (updatable !== undefined) {
164
+ this.updatable = updatable;
165
+ }
166
+ if (polylinesMesh !== undefined) {
167
+ this.polylinesMesh = polylinesMesh;
168
+ }
169
+ }
170
+ }
171
+ Polyline.DrawPolylinesDto = DrawPolylinesDto;
172
+ class SegmentsToleranceDto {
173
+ constructor(segments) {
174
+ /**
175
+ * Tolerance for the calculation
176
+ * @default 1e-5
177
+ * @minimum -Infinity
178
+ * @maximum Infinity
179
+ * @step 1e-5
180
+ */
181
+ this.tolerance = 1e-5;
182
+ if (segments !== undefined) {
183
+ this.segments = segments;
184
+ }
185
+ }
186
+ }
187
+ Polyline.SegmentsToleranceDto = SegmentsToleranceDto;
188
+ class PolylineToleranceDto {
189
+ constructor(polyline, tolerance) {
190
+ /**
191
+ * Tolerance for the calculation
192
+ * @default 1e-5
193
+ * @minimum -Infinity
194
+ * @maximum Infinity
195
+ * @step 1e-5
196
+ */
197
+ this.tolerance = 1e-5;
198
+ if (polyline !== undefined) {
199
+ this.polyline = polyline;
200
+ }
201
+ if (tolerance !== undefined) {
202
+ this.tolerance = tolerance;
203
+ }
204
+ }
205
+ }
206
+ Polyline.PolylineToleranceDto = PolylineToleranceDto;
207
+ class TwoPolylinesToleranceDto {
208
+ constructor(polyline1, polyline2, tolerance) {
209
+ /**
210
+ * Tolerance for the calculation
211
+ * @default 1e-5
212
+ * @minimum -Infinity
213
+ * @maximum Infinity
214
+ * @step 1e-5
215
+ */
216
+ this.tolerance = 1e-5;
217
+ if (polyline1 !== undefined) {
218
+ this.polyline1 = polyline1;
219
+ }
220
+ if (polyline2 !== undefined) {
221
+ this.polyline2 = polyline2;
222
+ }
223
+ if (tolerance !== undefined) {
224
+ this.tolerance = tolerance;
225
+ }
226
+ }
227
+ }
228
+ Polyline.TwoPolylinesToleranceDto = TwoPolylinesToleranceDto;
229
+ })(Polyline || (Polyline = {}));
@@ -184,6 +184,6 @@ export declare namespace Text {
184
184
  * Will center text on 0, 0, 0
185
185
  * @default false
186
186
  */
187
- centerOnOrigin: boolean;
187
+ centerOnOrigin?: boolean;
188
188
  }
189
189
  }
@@ -77,6 +77,24 @@ export declare namespace Transforms {
77
77
  */
78
78
  scaleXyz: Base.Vector3;
79
79
  }
80
+ class StretchDirCenterDto {
81
+ constructor(scale?: number, center?: Base.Point3, direction?: Base.Vector3);
82
+ /** The center point around which to stretch.
83
+ * @default [0, 0, 0]
84
+ */
85
+ center?: Base.Point3;
86
+ /** The direction vector along which to stretch. Does not need to be normalized initially.
87
+ * @default [0, 0, 1]
88
+ */
89
+ direction?: Base.Vector3;
90
+ /** The scale factor to apply along the direction vector. 1.0 means no change.
91
+ * @default 2
92
+ * @minimum -Infinity
93
+ * @maximum Infinity
94
+ * @step 0.1
95
+ */
96
+ scale?: number;
97
+ }
80
98
  class ScaleCenterXYZDto {
81
99
  constructor(center?: Base.Point3, scaleXyz?: Base.Vector3);
82
100
  /**
@@ -115,6 +115,35 @@ export var Transforms;
115
115
  }
116
116
  }
117
117
  Transforms.ScaleXYZDto = ScaleXYZDto;
118
+ class StretchDirCenterDto {
119
+ constructor(scale, center, direction) {
120
+ /** The center point around which to stretch.
121
+ * @default [0, 0, 0]
122
+ */
123
+ this.center = [0, 0, 0];
124
+ /** The direction vector along which to stretch. Does not need to be normalized initially.
125
+ * @default [0, 0, 1]
126
+ */
127
+ this.direction = [0, 0, 1];
128
+ /** The scale factor to apply along the direction vector. 1.0 means no change.
129
+ * @default 2
130
+ * @minimum -Infinity
131
+ * @maximum Infinity
132
+ * @step 0.1
133
+ */
134
+ this.scale = 2;
135
+ if (scale !== undefined) {
136
+ this.scale = scale;
137
+ }
138
+ if (center !== undefined) {
139
+ this.center = center;
140
+ }
141
+ if (direction !== undefined) {
142
+ this.direction = direction;
143
+ }
144
+ }
145
+ }
146
+ Transforms.StretchDirCenterDto = StretchDirCenterDto;
118
147
  class ScaleCenterXYZDto {
119
148
  constructor(center, scaleXyz) {
120
149
  /**
@@ -85,6 +85,14 @@ export declare namespace Vector {
85
85
  */
86
86
  vector: number[];
87
87
  }
88
+ class Vector3Dto {
89
+ constructor(vector?: Base.Vector3);
90
+ /**
91
+ * Vector array of 3 numbers
92
+ * @default undefined
93
+ */
94
+ vector: Base.Vector3;
95
+ }
88
96
  class RangeMaxDto {
89
97
  constructor(max?: number);
90
98
  /**
@@ -93,6 +93,14 @@ export var Vector;
93
93
  }
94
94
  }
95
95
  Vector.VectorDto = VectorDto;
96
+ class Vector3Dto {
97
+ constructor(vector) {
98
+ if (vector !== undefined) {
99
+ this.vector = vector;
100
+ }
101
+ }
102
+ }
103
+ Vector.Vector3Dto = Vector3Dto;
96
104
  class RangeMaxDto {
97
105
  constructor(max) {
98
106
  if (max !== undefined) {
@@ -1 +1,2 @@
1
1
  export * from "./text";
2
+ export * from "./point";
@@ -1 +1,2 @@
1
1
  export * from "./text";
2
+ export * from "./point";
@@ -0,0 +1 @@
1
+ export * from "./hex-grid-data";
@@ -0,0 +1 @@
1
+ export * from "./hex-grid-data";
@@ -0,0 +1,8 @@
1
+ import { Base } from "../../inputs/base-inputs";
2
+ export declare class HexGridData {
3
+ centers: Base.Point3[];
4
+ hexagons: Base.Point3[][];
5
+ shortestDistEdge: number;
6
+ longestDistEdge: number;
7
+ maxFilletRadius: number;
8
+ }
@@ -0,0 +1,2 @@
1
+ export class HexGridData {
2
+ }
@@ -0,0 +1 @@
1
+ export * as Point from "./bucket";
@@ -0,0 +1 @@
1
+ export * as Point from "./bucket";
@@ -291,7 +291,9 @@ export class Dates {
291
291
  * @drawable false
292
292
  * */
293
293
  setYear(inputs) {
294
- return new Date(inputs.date.setFullYear(inputs.year));
294
+ const dateCopy = new Date(inputs.date.getTime());
295
+ dateCopy.setFullYear(inputs.year);
296
+ return dateCopy;
295
297
  }
296
298
  /**
297
299
  * Sets the month value in the Date object using local time.
@@ -302,7 +304,9 @@ export class Dates {
302
304
  * @drawable false
303
305
  * */
304
306
  setMonth(inputs) {
305
- return new Date(inputs.date.setMonth(inputs.month));
307
+ const dateCopy = new Date(inputs.date.getTime());
308
+ dateCopy.setMonth(inputs.month);
309
+ return dateCopy;
306
310
  }
307
311
  /**
308
312
  * Sets the numeric day-of-the-month value of the Date object using local time.
@@ -313,7 +317,9 @@ export class Dates {
313
317
  * @drawable false
314
318
  */
315
319
  setDayOfMonth(inputs) {
316
- return new Date(inputs.date.setDate(inputs.day));
320
+ const dateCopy = new Date(inputs.date.getTime());
321
+ dateCopy.setDate(inputs.day);
322
+ return dateCopy;
317
323
  }
318
324
  /**
319
325
  * Sets the hour value in the Date object using local time.
@@ -324,7 +330,9 @@ export class Dates {
324
330
  * @drawable false
325
331
  * */
326
332
  setHours(inputs) {
327
- return new Date(inputs.date.setHours(inputs.hours));
333
+ const dateCopy = new Date(inputs.date.getTime());
334
+ dateCopy.setHours(inputs.hours);
335
+ return dateCopy;
328
336
  }
329
337
  /**
330
338
  * Sets the minutes value in the Date object using local time.
@@ -335,7 +343,9 @@ export class Dates {
335
343
  * @drawable false
336
344
  * */
337
345
  setMinutes(inputs) {
338
- return new Date(inputs.date.setMinutes(inputs.minutes));
346
+ const dateCopy = new Date(inputs.date.getTime());
347
+ dateCopy.setMinutes(inputs.minutes);
348
+ return dateCopy;
339
349
  }
340
350
  /**
341
351
  * Sets the seconds value in the Date object using local time.
@@ -346,7 +356,9 @@ export class Dates {
346
356
  * @drawable false
347
357
  */
348
358
  setSeconds(inputs) {
349
- return new Date(inputs.date.setSeconds(inputs.seconds));
359
+ const dateCopy = new Date(inputs.date.getTime());
360
+ dateCopy.setSeconds(inputs.seconds);
361
+ return dateCopy;
350
362
  }
351
363
  /**
352
364
  * Sets the milliseconds value in the Date object using local time.
@@ -357,7 +369,9 @@ export class Dates {
357
369
  * @drawable false
358
370
  */
359
371
  setMilliseconds(inputs) {
360
- return new Date(inputs.date.setMilliseconds(inputs.milliseconds));
372
+ const dateCopy = new Date(inputs.date.getTime());
373
+ dateCopy.setMilliseconds(inputs.milliseconds);
374
+ return dateCopy;
361
375
  }
362
376
  /**
363
377
  * Sets the date and time value in the Date object.
@@ -368,7 +382,9 @@ export class Dates {
368
382
  * @drawable false
369
383
  */
370
384
  setTime(inputs) {
371
- return new Date(inputs.date.setTime(inputs.time));
385
+ const dateCopy = new Date(inputs.date.getTime());
386
+ dateCopy.setTime(inputs.time);
387
+ return dateCopy;
372
388
  }
373
389
  /**
374
390
  * Sets the year value in the Date object using Universal Coordinated Time (UTC).
@@ -379,7 +395,9 @@ export class Dates {
379
395
  * @drawable false
380
396
  * */
381
397
  setUTCYear(inputs) {
382
- return new Date(inputs.date.setUTCFullYear(inputs.year));
398
+ const dateCopy = new Date(inputs.date.getTime());
399
+ dateCopy.setUTCFullYear(inputs.year);
400
+ return dateCopy;
383
401
  }
384
402
  /**
385
403
  * Sets the month value in the Date object using Universal Coordinated Time (UTC).
@@ -390,7 +408,9 @@ export class Dates {
390
408
  * @drawable false
391
409
  * */
392
410
  setUTCMonth(inputs) {
393
- return new Date(inputs.date.setUTCMonth(inputs.month));
411
+ const dateCopy = new Date(inputs.date.getTime());
412
+ dateCopy.setUTCMonth(inputs.month);
413
+ return dateCopy;
394
414
  }
395
415
  /**
396
416
  * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).
@@ -401,7 +421,9 @@ export class Dates {
401
421
  * @drawable false
402
422
  */
403
423
  setUTCDay(inputs) {
404
- return new Date(inputs.date.setUTCDate(inputs.day));
424
+ const dateCopy = new Date(inputs.date.getTime());
425
+ dateCopy.setUTCDate(inputs.day);
426
+ return dateCopy;
405
427
  }
406
428
  /**
407
429
  * Sets the hours value in the Date object using Universal Coordinated Time (UTC).
@@ -412,7 +434,9 @@ export class Dates {
412
434
  * @drawable false
413
435
  * */
414
436
  setUTCHours(inputs) {
415
- return new Date(inputs.date.setUTCHours(inputs.hours));
437
+ const dateCopy = new Date(inputs.date.getTime());
438
+ dateCopy.setUTCHours(inputs.hours);
439
+ return dateCopy;
416
440
  }
417
441
  /**
418
442
  * Sets the minutes value in the Date object using Universal Coordinated Time (UTC).
@@ -423,7 +447,9 @@ export class Dates {
423
447
  * @drawable false
424
448
  * */
425
449
  setUTCMinutes(inputs) {
426
- return new Date(inputs.date.setUTCMinutes(inputs.minutes));
450
+ const dateCopy = new Date(inputs.date.getTime());
451
+ dateCopy.setUTCMinutes(inputs.minutes);
452
+ return dateCopy;
427
453
  }
428
454
  /**
429
455
  * Sets the seconds value in the Date object using Universal Coordinated Time (UTC).
@@ -434,7 +460,9 @@ export class Dates {
434
460
  * @drawable false
435
461
  */
436
462
  setUTCSeconds(inputs) {
437
- return new Date(inputs.date.setUTCSeconds(inputs.seconds));
463
+ const dateCopy = new Date(inputs.date.getTime());
464
+ dateCopy.setUTCSeconds(inputs.seconds);
465
+ return dateCopy;
438
466
  }
439
467
  /**
440
468
  * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).
@@ -445,6 +473,8 @@ export class Dates {
445
473
  * @drawable false
446
474
  */
447
475
  setUTCMilliseconds(inputs) {
448
- return new Date(inputs.date.setUTCMilliseconds(inputs.milliseconds));
476
+ const dateCopy = new Date(inputs.date.getTime());
477
+ dateCopy.setUTCMilliseconds(inputs.milliseconds);
478
+ return dateCopy;
449
479
  }
450
480
  }
@@ -8,3 +8,6 @@ export * from "./dates";
8
8
  export * from "./vector";
9
9
  export * from "./transforms";
10
10
  export * from "./geometry-helper";
11
+ export * from "./line";
12
+ export * from "./polyline";
13
+ export * from "./mesh";
@@ -8,3 +8,6 @@ export * from "./dates";
8
8
  export * from "./vector";
9
9
  export * from "./transforms";
10
10
  export * from "./geometry-helper";
11
+ export * from "./line";
12
+ export * from "./polyline";
13
+ export * from "./mesh";