@bitbybit-dev/base 0.20.2 → 0.20.3

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 +149 -0
  32. package/lib/api/services/line.js +320 -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 +444 -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
@@ -2,6 +2,8 @@ import { GeometryHelper } from "./geometry-helper";
2
2
  import * as Inputs from "../inputs";
3
3
  import { Transforms } from "./transforms";
4
4
  import { Vector } from "./vector";
5
+ import * as Models from "../models";
6
+ import { Lists } from "./lists";
5
7
  /**
6
8
  * Contains various methods for points. Point in bitbybit is simply an array containing 3 numbers for [x, y, z].
7
9
  * Because of this form Point can be interchanged with Vector, which also is an array in [x, y, z] form.
@@ -11,7 +13,8 @@ export declare class Point {
11
13
  private readonly geometryHelper;
12
14
  private readonly transforms;
13
15
  private readonly vector;
14
- constructor(geometryHelper: GeometryHelper, transforms: Transforms, vector: Vector);
16
+ private readonly lists;
17
+ constructor(geometryHelper: GeometryHelper, transforms: Transforms, vector: Vector, lists: Lists);
15
18
  /**
16
19
  * Transforms the single point
17
20
  * @param inputs Contains a point and the transformations to apply
@@ -75,6 +78,15 @@ export declare class Point {
75
78
  * @drawable true
76
79
  */
77
80
  scalePointsCenterXYZ(inputs: Inputs.Point.ScalePointsCenterXYZDto): Inputs.Base.Point3[];
81
+ /**
82
+ * Stretch multiple points by providing center point, direction and uniform scale factor
83
+ * @param inputs Contains points, center point, direction and scale factor
84
+ * @returns Stretched points
85
+ * @group transforms
86
+ * @shortname stretch points dir from center
87
+ * @drawable true
88
+ */
89
+ stretchPointsDirFromCenter(inputs: Inputs.Point.StretchPointsDirFromCenterDto): Inputs.Base.Point3[];
78
90
  /**
79
91
  * Rotate multiple points by providing center point, axis and degrees of rotation
80
92
  * @param inputs Contains points, axis, center point and angle of rotation
@@ -220,6 +232,64 @@ export declare class Point {
220
232
  * @drawable true
221
233
  */
222
234
  hexGrid(inputs: Inputs.Point.HexGridCentersDto): Inputs.Base.Point3[];
235
+ /**
236
+ * Creates a pointy-top or flat-top hexagon grid, scaling hexagons to fit specified dimensions exactly.
237
+ * Returns both center points and the vertices of each (potentially scaled) hexagon.
238
+ * Hexagons are ordered column-first, then row-first.
239
+ * @param inputs Information about the desired grid dimensions and hexagon counts.
240
+ * @returns An object containing the array of center points and an array of hexagon vertex arrays.
241
+ * @group create
242
+ * @shortname scaled hex grid to fit
243
+ * @drawable false
244
+ */
245
+ hexGridScaledToFit(inputs: Inputs.Point.HexGridScaledToFitDto): Models.Point.HexGridData;
246
+ /**
247
+ * Calculates the maximum possible fillet radius at a corner formed by two line segments
248
+ * sharing an endpoint (C), such that the fillet arc is tangent to both segments
249
+ * and lies entirely within them.
250
+ * @param inputs three points and the tolerance
251
+ * @returns the maximum fillet radius
252
+ * @group fillet
253
+ * @shortname max fillet radius
254
+ * @drawable false
255
+ */
256
+ maxFilletRadius(inputs: Inputs.Point.ThreePointsToleranceDto): number;
257
+ /**
258
+ * Calculates the maximum possible fillet radius at a corner C, such that the fillet arc
259
+ * is tangent to both segments (P1-C, P2-C) and the tangent points lie within
260
+ * the first half of each segment (measured from C).
261
+ * @param inputs three points and the tolerance
262
+ * @returns the maximum fillet radius
263
+ * @group fillet
264
+ * @shortname max fillet radius half line
265
+ * @drawable false
266
+ */
267
+ maxFilletRadiusHalfLine(inputs: Inputs.Point.ThreePointsToleranceDto): number;
268
+ /**
269
+ * Calculates the maximum possible fillet radius at each corner of a polyline formed by
270
+ * formed by a series of points. The fillet radius is calculated for each internal
271
+ * corner and optionally for the closing corners if the polyline is closed.
272
+ * @param inputs Points, checkLastWithFirst flag, and tolerance
273
+ * @returns Array of maximum fillet radii for each corner
274
+ * @group fillet
275
+ * @shortname max fillets half line
276
+ * @drawable false
277
+ */
278
+ maxFilletsHalfLine(inputs: Inputs.Point.PointsMaxFilletsHalfLineDto): number[];
279
+ /**
280
+ * Calculates the single safest maximum fillet radius that can be applied
281
+ * uniformly to all corners of collection of points, based on the 'half-line' constraint.
282
+ * This is determined by finding the minimum of the maximum possible fillet
283
+ * radii calculated for each individual corner.
284
+ * @param inputs Defines the points, whether it's closed, and an optional tolerance.
285
+ * @returns The smallest value from the results of pointsMaxFilletsHalfLine.
286
+ * Returns 0 if the polyline has fewer than 3 points or if any
287
+ * calculated maximum radius is 0.
288
+ * @group fillet
289
+ * @shortname safest fillet radii points
290
+ * @drawable false
291
+ */
292
+ safestPointsMaxFilletHalfLine(inputs: Inputs.Point.PointsMaxFilletsHalfLineDto): number;
223
293
  /**
224
294
  * Removes consecutive duplicates from the point array with tolerance
225
295
  * @param inputs points, tolerance and check first and last
@@ -239,4 +309,29 @@ export declare class Point {
239
309
  */
240
310
  normalFromThreePoints(inputs: Inputs.Point.ThreePointsNormalDto): Inputs.Base.Vector3;
241
311
  private closestPointFromPointData;
312
+ /**
313
+ * Checks if two points are almost equal
314
+ * @param inputs Two points and the tolerance
315
+ * @returns true if the points are almost equal
316
+ * @group measure
317
+ * @shortname two points almost equal
318
+ * @drawable false
319
+ */
320
+ twoPointsAlmostEqual(inputs: Inputs.Point.TwoPointsToleranceDto): boolean;
321
+ /**
322
+ * Sorts points lexicographically (X, then Y, then Z)
323
+ * @param inputs points
324
+ * @returns sorted points
325
+ * @group sort
326
+ * @shortname sort points
327
+ * @drawable true
328
+ */
329
+ sortPoints(inputs: Inputs.Point.PointsDto): Inputs.Base.Point3[];
330
+ /**
331
+ * Calculates the 6 vertices of a regular flat-top hexagon.
332
+ * @param center The center point [x, y, z].
333
+ * @param radius The radius (distance from center to vertex).
334
+ * @returns An array of 6 Point3 vertices in counter-clockwise order.
335
+ */
336
+ private getRegularHexagonVertices;
242
337
  }