@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
@@ -5,9 +5,10 @@ import { Vector } from "./vector";
5
5
  import * as Models from "../models";
6
6
  import { Lists } from "./lists";
7
7
  /**
8
- * Contains various methods for points. Point in bitbybit is simply an array containing 3 numbers for [x, y,
9
- * z]. Because of this form Point can be interchanged with Vector, which also is an array in [x, y, z] form.
10
- * When creating 2D points, z coordinate is simply set to 0 - [x, y, 0].
8
+ * Points as plain number arrays. A point is `[x, y, z]` with Y pointing up, the same shape as a
9
+ * vector, so the two can be passed to each other's methods; a 2D point is `[x, y]`. Every method
10
+ * returns new points or numbers and never changes its inputs. Angles are in degrees and lengths in
11
+ * model units.
11
12
  */
12
13
  export declare class Point {
13
14
  private readonly geometryHelper;
@@ -16,346 +17,565 @@ export declare class Point {
16
17
  private readonly lists;
17
18
  constructor(geometryHelper: GeometryHelper, transforms: Transforms, vector: Vector, lists: Lists);
18
19
  /**
19
- * Applies transformation matrix to a single point (rotates, scales, or translates).
20
- * Example: point=[0,0,0] with translation [5,5,0] → [5,5,0]
21
- * @param inputs Contains a point and the transformations to apply
22
- * @returns Transformed point
20
+ * Applies a transformation matrix, or a list of them in order, to one point.
21
+ *
22
+ * Example: point [0,0,0] with a translation by [5,5,0] -> [5,5,0]
23
+ * @param inputs - The point and the transformation to apply
24
+ * @returns The transformed point
23
25
  * @group transforms
24
26
  * @shortname transform point
25
27
  * @drawable true
28
+ * @example
29
+ * ```typescript
30
+ * const moved = bitbybit.point.transformPoint({
31
+ * point: [0, 0, 0],
32
+ * transformation: bitbybit.transforms.translationXYZ({ translation: [5, 5, 0] }),
33
+ * });
34
+ * ```
26
35
  */
27
36
  transformPoint(inputs: Inputs.Point.TransformPointDto): Inputs.Base.Point3;
28
37
  /**
29
- * Applies same transformation matrix to multiple points (batch transform).
30
- * Example: 5 points with rotation 90° → all 5 points rotated together
31
- * @param inputs Contains points and the transformations to apply
32
- * @returns Transformed points
38
+ * Applies the same transformation matrix, or list of them in order, to every point.
39
+ *
40
+ * Example: five points with a 90 degree rotation -> all five rotated together
41
+ * @param inputs - The points and the transformation to apply to each
42
+ * @returns The transformed points, in the same order
33
43
  * @group transforms
34
44
  * @shortname transform points
35
45
  * @drawable true
46
+ * @example
47
+ * ```typescript
48
+ * const rotated = bitbybit.point.transformPoints({
49
+ * points: [[1, 0, 0], [2, 0, 0]],
50
+ * transformation: bitbybit.transforms.rotationCenterAxis({ center: [0, 0, 0], axis: [0, 1, 0], angle: 90 }),
51
+ * });
52
+ * ```
36
53
  */
37
54
  transformPoints(inputs: Inputs.Point.TransformPointsDto): Inputs.Base.Point3[];
38
55
  /**
39
- * Applies different transformation matrices to corresponding points (one transform per point).
40
- * Arrays must have equal length.
41
- * Example: 3 points with 3 different translations → each point moved independently
42
- * @param inputs Contains points and the transformations to apply
43
- * @returns Transformed points
56
+ * Applies a different transformation to each point: the first transformation to the first
57
+ * point, and so on.
58
+ *
59
+ * The two lists must have the same length, or an error is thrown.
60
+ * Example: three points with three translations -> each point moved by its own translation
61
+ * @param inputs - The points and one transformation per point
62
+ * @returns The transformed points, in the same order
44
63
  * @group transforms
45
64
  * @shortname transforms for points
46
65
  * @drawable true
66
+ * @example
67
+ * ```typescript
68
+ * const placed = bitbybit.point.transformsForPoints({
69
+ * points: [[0, 0, 0], [1, 0, 0]],
70
+ * transformation: bitbybit.transforms.translationsXYZ({ translations: [[0, 1, 0], [0, 2, 0]] }),
71
+ * });
72
+ * ```
47
73
  */
48
74
  transformsForPoints(inputs: Inputs.Point.TransformsForPointsDto): Inputs.Base.Point3[];
49
75
  /**
50
- * Moves multiple points by a translation vector (same offset for all points).
51
- * Example: points=[[0,0,0], [1,0,0]], translation=[5,5,0] → [[5,5,0], [6,5,0]]
52
- * @param inputs Contains points and the translation vector
53
- * @returns Translated points
76
+ * Moves every point by the same vector.
77
+ *
78
+ * Example: points [[0,0,0], [1,0,0]] by [5,5,0] -> [[5,5,0], [6,5,0]]
79
+ * @param inputs - The points and the vector to move them by
80
+ * @returns The moved points, in the same order
54
81
  * @group transforms
55
82
  * @shortname translate points
56
83
  * @drawable true
84
+ * @example
85
+ * ```typescript
86
+ * const moved = bitbybit.point.translatePoints({ points: [[0, 0, 0], [1, 0, 0]], translation: [5, 5, 0] });
87
+ * ```
57
88
  */
58
89
  translatePoints(inputs: Inputs.Point.TranslatePointsDto): Inputs.Base.Point3[];
59
90
  /**
60
- * Moves multiple points by corresponding translation vectors (one vector per point).
61
- * Arrays must have equal length.
62
- * Example: 3 points with 3 different vectors → each point moved by its corresponding vector
63
- * @param inputs Contains points and the translation vector
64
- * @returns Translated points
91
+ * Moves each point by its own vector: the first point by the first vector, and so on.
92
+ *
93
+ * The two lists must have the same length, or an error is thrown.
94
+ * Example: three points with three vectors -> each point moved by its own vector
95
+ * @param inputs - The points and one vector per point
96
+ * @returns The moved points, in the same order
65
97
  * @group transforms
66
98
  * @shortname translate points with vectors
67
99
  * @drawable true
100
+ * @example
101
+ * ```typescript
102
+ * const moved = bitbybit.point.translatePointsWithVectors({
103
+ * points: [[0, 0, 0], [1, 0, 0]],
104
+ * translations: [[0, 1, 0], [0, 2, 0]],
105
+ * });
106
+ * ```
68
107
  */
69
108
  translatePointsWithVectors(inputs: Inputs.Point.TranslatePointsWithVectorsDto): Inputs.Base.Point3[];
70
109
  /**
71
- * Moves multiple points by separate X, Y, Z values (convenience method for translation).
72
- * Example: points=[[0,0,0]], x=10, y=5, z=0 → [[10,5,0]]
73
- * @param inputs Contains points and the translation in x y and z
74
- * @returns Translated points
110
+ * Moves every point by the given x, y and z amounts.
111
+ *
112
+ * Example: point [0,0,0] with x=10, y=5, z=0 -> [10,5,0]
113
+ * @param inputs - The points and the distance to move along each axis
114
+ * @returns The moved points, in the same order
75
115
  * @group transforms
76
116
  * @shortname translate xyz points
77
117
  * @drawable true
118
+ * @example
119
+ * ```typescript
120
+ * const lifted = bitbybit.point.translateXYZPoints({ points: [[0, 0, 0], [1, 0, 0]], x: 0, y: 5, z: 0 });
121
+ * ```
78
122
  */
79
123
  translateXYZPoints(inputs: Inputs.Point.TranslateXYZPointsDto): Inputs.Base.Point3[];
80
124
  /**
81
- * Scales multiple points around a center point with different factors per axis.
82
- * Example: points=[[10,0,0]], center=[5,0,0], scaleXyz=[2,1,1] → [[15,0,0]] (doubles X distance from center)
83
- * @param inputs Contains points, center point and scale factors
84
- * @returns Scaled points
125
+ * Scales points away from or toward a center, with its own factor per axis.
126
+ *
127
+ * Example: point [10,0,0] about center [5,0,0] with factors [2,1,1] -> [15,0,0]
128
+ * @param inputs - The points, the center to scale about and the factor per axis
129
+ * @returns The scaled points, in the same order
85
130
  * @group transforms
86
131
  * @shortname scale points on center
87
132
  * @drawable true
133
+ * @example
134
+ * ```typescript
135
+ * const stretched = bitbybit.point.scalePointsCenterXYZ({
136
+ * points: [[10, 0, 0], [0, 10, 0]],
137
+ * center: [0, 0, 0],
138
+ * scaleXyz: [2, 1, 1],
139
+ * });
140
+ * ```
88
141
  */
89
142
  scalePointsCenterXYZ(inputs: Inputs.Point.ScalePointsCenterXYZDto): Inputs.Base.Point3[];
90
143
  /**
91
- * Stretches multiple points along a direction from a center point (directional scaling).
92
- * Example: points=[[10,0,0]], center=[0,0,0], direction=[1,0,0], scale=2 → [[20,0,0]]
93
- * @param inputs Contains points, center point, direction and scale factor
94
- * @returns Stretched points
144
+ * Stretches points along one direction, measured from a center; distances across that direction
145
+ * stay as they are.
146
+ *
147
+ * Example: point [10,0,0] from center [0,0,0] along [1,0,0] with scale 2 -> [20,0,0]
148
+ * @param inputs - The points, the center, the direction to stretch along and the factor
149
+ * @returns The stretched points, in the same order
95
150
  * @group transforms
96
151
  * @shortname stretch points dir from center
97
152
  * @drawable true
153
+ * @example
154
+ * ```typescript
155
+ * const taller = bitbybit.point.stretchPointsDirFromCenter({
156
+ * points: [[0, 1, 0], [0, 2, 0]],
157
+ * center: [0, 0, 0],
158
+ * direction: [0, 1, 0],
159
+ * scale: 2,
160
+ * });
161
+ * ```
98
162
  */
99
163
  stretchPointsDirFromCenter(inputs: Inputs.Point.StretchPointsDirFromCenterDto): Inputs.Base.Point3[];
100
164
  /**
101
- * Rotates multiple points around a center point along a custom axis.
102
- * Example: points=[[10,0,0]], center=[0,0,0], axis=[0,1,0], angle=90° → [[0,0,-10]]
103
- * @param inputs Contains points, axis, center point and angle of rotation
104
- * @returns Rotated points
165
+ * Rotates points around an axis that passes through a center.
166
+ *
167
+ * The angle is in degrees and turns counter-clockwise when the axis points toward you.
168
+ * Example: point [10,0,0] around the Y axis through [0,0,0] by 90 -> [0,0,-10]
169
+ * @param inputs - The points, the axis direction, the center it passes through and the angle in degrees
170
+ * @returns The rotated points, in the same order
105
171
  * @group transforms
106
172
  * @shortname rotate points center axis
107
173
  * @drawable true
174
+ * @example
175
+ * ```typescript
176
+ * const turned = bitbybit.point.rotatePointsCenterAxis({
177
+ * points: [[10, 0, 0]],
178
+ * center: [0, 0, 0],
179
+ * axis: [0, 1, 0],
180
+ * angle: 90,
181
+ * });
182
+ * ```
108
183
  */
109
184
  rotatePointsCenterAxis(inputs: Inputs.Point.RotatePointsCenterAxisDto): Inputs.Base.Point3[];
110
185
  /**
111
- * Calculates axis-aligned bounding box containing all points (min, max, center, width, height, length).
112
- * Example: points=[[0,0,0], [10,5,3]] → {min:[0,0,0], max:[10,5,3], center:[5,2.5,1.5], width:10, height:5, length:3}
113
- * @param inputs Points
114
- * @returns Bounding box of points
186
+ * Finds the smallest axis-aligned box that holds all the points.
187
+ *
188
+ * The result carries the min and max corners, the center, and the width (X), height (Y) and
189
+ * length (Z).
190
+ * Example: points [[0,0,0], [10,5,3]] -> min [0,0,0], max [10,5,3], center [5,2.5,1.5]
191
+ * @param inputs - The points to enclose
192
+ * @returns The bounding box with its corners, center and sizes
115
193
  * @group extract
116
194
  * @shortname bounding box pts
117
195
  * @drawable true
196
+ * @example
197
+ * ```typescript
198
+ * const box = bitbybit.point.boundingBoxOfPoints({ points: [[0, 0, 0], [10, 5, 3], [-2, 1, 1]] });
199
+ * ```
118
200
  */
119
201
  boundingBoxOfPoints(inputs: Inputs.Point.PointsDto): Inputs.Base.BoundingBox;
120
202
  /**
121
- * Calculates distance to the nearest point in a collection.
122
- * Example: point=[0,0,0], points=[[5,0,0], [10,0,0], [3,0,0]] → 3 (distance to [3,0,0])
123
- * @param inputs Point from which to measure and points to measure the distance against
124
- * @returns Distance to closest point
203
+ * Measures the distance from a point to the nearest point in a list.
204
+ *
205
+ * Example: point [0,0,0] and points [[5,0,0], [10,0,0], [3,0,0]] -> 3
206
+ * @param inputs - The point to measure from and the points to search
207
+ * @returns The distance to the nearest point, in model units
125
208
  * @group extract
126
209
  * @shortname distance to closest pt
127
210
  * @drawable false
211
+ * @example
212
+ * ```typescript
213
+ * const nearest = bitbybit.point.closestPointFromPointsDistance({ point: [0, 0, 0], points: [[5, 0, 0], [3, 0, 0]] });
214
+ * ```
128
215
  */
129
216
  closestPointFromPointsDistance(inputs: Inputs.Point.ClosestPointFromPointsDto): number;
130
217
  /**
131
- * Finds array index of the nearest point in a collection (1-based index, not 0-based).
132
- * Example: point=[0,0,0], points=[[5,0,0], [10,0,0], [3,0,0]] → 3 (index of [3,0,0])
133
- * @param inputs Point from which to find the index in a collection of points
134
- * @returns Closest point index
218
+ * Finds the position of the nearest point in a list, counted from 1.
219
+ *
220
+ * Example: point [0,0,0] and points [[5,0,0], [10,0,0], [3,0,0]] -> 3
221
+ * @param inputs - The point to measure from and the points to search
222
+ * @returns The 1-based index of the nearest point
135
223
  * @group extract
136
224
  * @shortname index of closest pt
137
225
  * @drawable false
226
+ * @example
227
+ * ```typescript
228
+ * const index = bitbybit.point.closestPointFromPointsIndex({ point: [0, 0, 0], points: [[5, 0, 0], [3, 0, 0]] });
229
+ * ```
138
230
  */
139
231
  closestPointFromPointsIndex(inputs: Inputs.Point.ClosestPointFromPointsDto): number;
140
232
  /**
141
- * Finds the nearest point in a collection to a reference point.
142
- * Example: point=[0,0,0], points=[[5,0,0], [10,0,0], [3,0,0]] → [3,0,0]
143
- * @param inputs Point and points collection to find the closest point in
144
- * @returns Closest point
233
+ * Finds the nearest point in a list to a given point.
234
+ *
235
+ * Example: point [0,0,0] and points [[5,0,0], [10,0,0], [3,0,0]] -> [3,0,0]
236
+ * @param inputs - The point to measure from and the points to search
237
+ * @returns The nearest point
145
238
  * @group extract
146
239
  * @shortname closest pt
147
240
  * @drawable true
241
+ * @example
242
+ * ```typescript
243
+ * const nearest = bitbybit.point.closestPointFromPoints({ point: [0, 0, 0], points: [[5, 0, 0], [3, 0, 0]] });
244
+ * ```
148
245
  */
149
246
  closestPointFromPoints(inputs: Inputs.Point.ClosestPointFromPointsDto): Inputs.Base.Point3;
150
247
  /**
151
- * Calculates Euclidean distance between two points.
152
- * Example: start=[0,0,0], end=[3,4,0] → 5 (using Pythagorean theorem: √(3²+4²))
153
- * @param inputs Coordinates of start and end points
154
- * @returns Distance
248
+ * Measures the straight-line distance between two points.
249
+ *
250
+ * Example: [0,0,0] to [3,4,0] -> 5
251
+ * @param inputs - The two points
252
+ * @returns The distance in model units
155
253
  * @group measure
156
254
  * @shortname distance
157
255
  * @drawable false
256
+ * @example
257
+ * ```typescript
258
+ * const d = bitbybit.point.distance({ startPoint: [0, 0, 0], endPoint: [3, 4, 0] });
259
+ * ```
158
260
  */
159
261
  distance(inputs: Inputs.Point.StartEndPointsDto): number;
160
262
  /**
161
- * Calculates distances from a start point to multiple end points.
162
- * Example: start=[0,0,0], endPoints=[[3,0,0], [0,4,0], [5,0,0]] → [3, 4, 5]
163
- * @param inputs Coordinates of start and end points
164
- * @returns Distances
263
+ * Measures the distance from one point to each point in a list.
264
+ *
265
+ * Example: start [0,0,0] and end points [[3,0,0], [0,4,0], [5,0,0]] -> [3, 4, 5]
266
+ * @param inputs - The start point and the points to measure to
267
+ * @returns One distance per end point, in the same order
165
268
  * @group measure
166
269
  * @shortname distances to points
167
270
  * @drawable false
271
+ * @example
272
+ * ```typescript
273
+ * const distances = bitbybit.point.distancesToPoints({ startPoint: [0, 0, 0], endPoints: [[3, 0, 0], [0, 4, 0]] });
274
+ * ```
168
275
  */
169
276
  distancesToPoints(inputs: Inputs.Point.StartEndPointsListDto): number[];
170
277
  /**
171
- * Duplicates a point N times (creates array with N copies of the same point).
172
- * Example: point=[5,5,0], amountOfPoints=3 → [[5,5,0], [5,5,0], [5,5,0]]
173
- * @param inputs The point to be multiplied and the amount of points to create
174
- * @returns Distance
278
+ * Repeats one point a given number of times in a list.
279
+ *
280
+ * Example: point [5,5,0] three times -> [[5,5,0], [5,5,0], [5,5,0]]
281
+ * @param inputs - The point and how many copies to make
282
+ * @returns The list of copies
175
283
  * @group transforms
176
284
  * @shortname multiply point
177
285
  * @drawable true
286
+ * @example
287
+ * ```typescript
288
+ * const copies = bitbybit.point.multiplyPoint({ point: [5, 5, 0], amountOfPoints: 3 });
289
+ * ```
178
290
  */
179
291
  multiplyPoint(inputs: Inputs.Point.MultiplyPointDto): Inputs.Base.Point3[];
180
292
  /**
181
- * Extracts X coordinate from a point.
182
- * Example: point=[5,10,3] → 5
183
- * @param inputs The point
184
- * @returns X coordinate
293
+ * Reads the X value of a point.
294
+ *
295
+ * Example: [5,10,3] -> 5
296
+ * @param inputs - The point
297
+ * @returns The X value
185
298
  * @group get
186
299
  * @shortname x coord
187
300
  * @drawable false
188
301
  */
189
302
  getX(inputs: Inputs.Point.PointDto): number;
190
303
  /**
191
- * Extracts Y coordinate from a point.
192
- * Example: point=[5,10,3] → 10
193
- * @param inputs The point
194
- * @returns Y coordinate
304
+ * Reads the Y value of a point, the one that points up.
305
+ *
306
+ * Example: [5,10,3] -> 10
307
+ * @param inputs - The point
308
+ * @returns The Y value
195
309
  * @group get
196
310
  * @shortname y coord
197
311
  * @drawable false
198
312
  */
199
313
  getY(inputs: Inputs.Point.PointDto): number;
200
314
  /**
201
- * Extracts Z coordinate from a point.
202
- * Example: point=[5,10,3] → 3
203
- * @param inputs The point
204
- * @returns Z coordinate
315
+ * Reads the Z value of a point.
316
+ *
317
+ * Example: [5,10,3] -> 3
318
+ * @param inputs - The point
319
+ * @returns The Z value
205
320
  * @group get
206
321
  * @shortname z coord
207
322
  * @drawable false
208
323
  */
209
324
  getZ(inputs: Inputs.Point.PointDto): number;
210
325
  /**
211
- * Calculates centroid (average position) of multiple points.
212
- * Example: points=[[0,0,0], [10,0,0], [10,10,0]] → [6.67,3.33,0]
213
- * @param inputs The points
214
- * @returns point
326
+ * Finds the average of the points, which is their center of mass when they weigh the same.
327
+ *
328
+ * Example: [[0,0,0], [10,0,0], [10,10,0]] -> [6.67,3.33,0]
329
+ * @param inputs - The points to average
330
+ * @returns The average point
215
331
  * @group extract
216
332
  * @shortname average point
217
333
  * @drawable true
334
+ * @example
335
+ * ```typescript
336
+ * const center = bitbybit.point.averagePoint({ points: [[0, 0, 0], [10, 0, 0], [10, 10, 0]] });
337
+ * ```
218
338
  */
219
339
  averagePoint(inputs: Inputs.Point.PointsDto): Inputs.Base.Point3;
220
340
  /**
221
- * Creates a 3D point from X, Y, Z coordinates.
222
- * Example: x=10, y=5, z=3 → [10,5,3]
223
- * @param inputs xyz information
224
- * @returns point 3d
341
+ * Builds a 3D point from its x, y and z values.
342
+ *
343
+ * Example: x=10, y=5, z=3 -> [10,5,3]
344
+ * @param inputs - The three values
345
+ * @returns The point `[x, y, z]`
225
346
  * @group create
226
347
  * @shortname point xyz
227
348
  * @drawable true
349
+ * @example
350
+ * ```typescript
351
+ * const point = bitbybit.point.pointXYZ({ x: 10, y: 5, z: 3 });
352
+ * ```
228
353
  */
229
354
  pointXYZ(inputs: Inputs.Point.PointXYZDto): Inputs.Base.Point3;
230
355
  /**
231
- * Creates a 2D point from X, Y coordinates.
232
- * Example: x=10, y=5 → [10,5]
233
- * @param inputs xy information
234
- * @returns point 3d
356
+ * Builds a 2D point from its x and y values.
357
+ *
358
+ * Example: x=10, y=5 -> [10,5]
359
+ * @param inputs - The two values
360
+ * @returns The point `[x, y]`
235
361
  * @group create
236
362
  * @shortname point xy
237
363
  * @drawable false
364
+ * @example
365
+ * ```typescript
366
+ * const point = bitbybit.point.pointXY({ x: 10, y: 5 });
367
+ * ```
238
368
  */
239
369
  pointXY(inputs: Inputs.Point.PointXYDto): Inputs.Base.Point2;
240
370
  /**
241
- * Creates logarithmic spiral points using golden angle or custom widening factor.
242
- * Generates natural spiral patterns common in nature (sunflower, nautilus shell).
243
- * Example: numberPoints=100, radius=10, phi=1.618 → 100 points forming outward spiral
244
- * @param inputs Spiral information
245
- * @returns Specified number of points in the array along the spiral
371
+ * Lays out points along a logarithmic spiral in the XY plane, from the origin outward to
372
+ * `radius`.
373
+ *
374
+ * `numberPoints` sets how many points are placed, `phi` and `widening` how quickly the spiral
375
+ * opens, and `factor` where along the curve it starts. Every point has z = 0.
376
+ * @param inputs - The point count, the radius and the shape of the spiral
377
+ * @returns The points along the spiral, from the center outward
246
378
  * @group create
247
379
  * @shortname spiral
248
380
  * @drawable true
381
+ * @example
382
+ * ```typescript
383
+ * const points = bitbybit.point.spiral({ phi: 0.9, numberPoints: 100, widening: 3, radius: 10, factor: 1 });
384
+ * ```
249
385
  */
250
386
  spiral(inputs: Inputs.Point.SpiralDto): Inputs.Base.Point3[];
251
387
  /**
252
- * Creates hexagonal grid center points on XY plane (honeycomb pattern).
253
- * Grid size controlled by number of hexagons, not width/height.
254
- * Example: radiusHexagon=1, nrHexagonsX=3, nrHexagonsY=3 → 9 hex centers in grid pattern
255
- * @param inputs Information about hexagon and the grid
256
- * @returns Points in the array on the grid
388
+ * Lays out the centers of a honeycomb of hexagons in the XY plane.
389
+ *
390
+ * `radiusHexagon` is the distance from a hexagon's center to a corner; columns run along X and
391
+ * rows along Y, every second row shifted by half a column. `orientOnCenter` centers the grid on
392
+ * the origin, `pointsOnGround` lays it on the XZ plane.
393
+ * @param inputs - The hexagon size, how many columns and rows, and where to place the grid
394
+ * @returns The center points, row by row
257
395
  * @group create
258
396
  * @shortname hex grid
259
397
  * @drawable true
398
+ * @example
399
+ * ```typescript
400
+ * const centers = bitbybit.point.hexGrid({ radiusHexagon: 1, nrHexagonsX: 5, nrHexagonsY: 4, orientOnCenter: true, pointsOnGround: false });
401
+ * ```
260
402
  */
261
403
  hexGrid(inputs: Inputs.Point.HexGridCentersDto): Inputs.Base.Point3[];
262
404
  /**
263
- * Creates hexagonal grid scaled to fit within specified width/height bounds (auto-calculates hex size).
264
- * Returns center points and hex vertices. Supports pointy-top or flat-top orientation.
265
- * Example: width=10, height=10, nrHexagonsInHeight=3 → hex grid filling 10×10 area with 3 rows
266
- * @param inputs Information about the desired grid dimensions and hexagon counts.
267
- * @returns An object containing the array of center points and an array of hexagon vertex arrays.
405
+ * Lays out a honeycomb of hexagons that fills a given width and height, sizing the hexagons
406
+ * from the counts.
407
+ *
408
+ * The result carries the center points and the six corners of every hexagon. A corner points up
409
+ * unless `flatTop` is set; the extend flags stretch the outer rows past the edges to cover the
410
+ * rectangle without a jagged border.
411
+ * @param inputs - The area to fill, the hexagon counts, the orientation and the placement options
412
+ * @returns The centers and the corner points of every hexagon
268
413
  * @group create
269
414
  * @shortname scaled hex grid to fit
270
415
  * @drawable false
416
+ * @example
417
+ * ```typescript
418
+ * const grid = bitbybit.point.hexGridScaledToFit({
419
+ * width: 10,
420
+ * height: 10,
421
+ * nrHexagonsInWidth: 5,
422
+ * nrHexagonsInHeight: 5,
423
+ * flatTop: false,
424
+ * centerGrid: true,
425
+ * });
426
+ * ```
271
427
  */
272
428
  hexGridScaledToFit(inputs: Inputs.Point.HexGridScaledToFitDto): Models.Point.HexGridData;
273
429
  /**
274
- * Calculates the maximum possible fillet radius at a corner formed by two line segments
275
- * sharing an endpoint (C), such that the fillet arc is tangent to both segments
276
- * and lies entirely within them.
277
- * @param inputs three points and the tolerance
278
- * @returns the maximum fillet radius
430
+ * Finds the largest fillet that fits a corner: the arc touches both segments and stays inside
431
+ * them.
432
+ *
433
+ * The corner is `end`; `start` and `center` are the far ends of the two segments that meet
434
+ * there. The radius is limited by the shorter segment. A straight or folded-back corner, or a
435
+ * segment shorter than `tolerance`, gives 0.
436
+ * @param inputs - The far end of each segment, the corner they share, and the tolerance
437
+ * @returns The largest fillet radius, in model units
279
438
  * @group fillet
280
439
  * @shortname max fillet radius
281
440
  * @drawable false
441
+ * @example
442
+ * ```typescript
443
+ * const radius = bitbybit.point.maxFilletRadius({ start: [10, 0, 0], center: [0, 10, 0], end: [0, 0, 0], tolerance: 1e-7 });
444
+ * ```
282
445
  */
283
446
  maxFilletRadius(inputs: Inputs.Point.ThreePointsToleranceDto): number;
284
447
  /**
285
- * Calculates the maximum possible fillet radius at a corner C, such that the fillet arc
286
- * is tangent to both segments (P1-C, P2-C) and the tangent points lie within
287
- * the first half of each segment (measured from C).
288
- * @param inputs three points and the tolerance
289
- * @returns the maximum fillet radius
448
+ * Finds the largest fillet at a corner whose arc touches each segment within its nearer half,
449
+ * so neighboring corners of a polyline can each be filleted without the arcs overlapping.
450
+ *
451
+ * The corner is `end`; `start` and `center` are the far ends of the two segments. A straight or
452
+ * folded-back corner, or a segment shorter than `tolerance`, gives 0.
453
+ * @param inputs - The far end of each segment, the corner they share, and the tolerance
454
+ * @returns The largest fillet radius under the half-segment rule, in model units
290
455
  * @group fillet
291
456
  * @shortname max fillet radius half line
292
457
  * @drawable false
458
+ * @example
459
+ * ```typescript
460
+ * const radius = bitbybit.point.maxFilletRadiusHalfLine({ start: [10, 0, 0], center: [0, 10, 0], end: [0, 0, 0], tolerance: 1e-7 });
461
+ * ```
293
462
  */
294
463
  maxFilletRadiusHalfLine(inputs: Inputs.Point.ThreePointsToleranceDto): number;
295
464
  /**
296
- * Calculates the maximum possible fillet radius at each corner of a polyline formed by
297
- * formed by a series of points. The fillet radius is calculated for each internal
298
- * corner and optionally for the closing corners if the polyline is closed.
299
- * @param inputs Points, checkLastWithFirst flag, and tolerance
300
- * @returns Array of maximum fillet radii for each corner
465
+ * Finds the largest fillet for every corner of a polyline, each limited to the nearer half of
466
+ * its segments so the fillets never overlap.
467
+ *
468
+ * With `checkLastWithFirst` on, the polyline is treated as closed and the two corners at the
469
+ * ends are included. Fewer than three points give an empty list.
470
+ * @param inputs - The polyline points, whether it is closed, and the tolerance
471
+ * @returns One radius per corner, in the order of the corners
301
472
  * @group fillet
302
473
  * @shortname max fillets half line
303
474
  * @drawable false
475
+ * @example
476
+ * ```typescript
477
+ * const radii = bitbybit.point.maxFilletsHalfLine({
478
+ * points: [[0, 0, 0], [10, 0, 0], [10, 10, 0], [0, 10, 0]],
479
+ * checkLastWithFirst: true,
480
+ * tolerance: 1e-7,
481
+ * });
482
+ * ```
304
483
  */
305
484
  maxFilletsHalfLine(inputs: Inputs.Point.PointsMaxFilletsHalfLineDto): number[];
306
485
  /**
307
- * Calculates the single safest maximum fillet radius that can be applied
308
- * uniformly to all corners of collection of points, based on the 'half-line' constraint.
309
- * This is determined by finding the minimum of the maximum possible fillet
310
- * radii calculated for each individual corner.
311
- * @param inputs Defines the points, whether it's closed, and an optional tolerance.
312
- * @returns The smallest value from the results of pointsMaxFilletsHalfLine.
313
- * Returns 0 if the polyline has fewer than 3 points or if any
314
- * calculated maximum radius is 0.
486
+ * Finds one fillet radius that fits every corner of a polyline: the smallest of the per-corner
487
+ * maximums under the half-segment rule.
488
+ *
489
+ * With `checkLastWithFirst` on, the polyline is treated as closed. Fewer than three points, or
490
+ * any corner that allows no fillet, give 0.
491
+ * @param inputs - The polyline points, whether it is closed, and the tolerance
492
+ * @returns The radius that fits every corner, in model units
315
493
  * @group fillet
316
494
  * @shortname safest fillet radii points
317
495
  * @drawable false
496
+ * @example
497
+ * ```typescript
498
+ * const radius = bitbybit.point.safestPointsMaxFilletHalfLine({
499
+ * points: [[0, 0, 0], [10, 0, 0], [10, 10, 0], [0, 10, 0]],
500
+ * checkLastWithFirst: true,
501
+ * tolerance: 1e-7,
502
+ * });
503
+ * ```
318
504
  */
319
505
  safestPointsMaxFilletHalfLine(inputs: Inputs.Point.PointsMaxFilletsHalfLineDto): number;
320
506
  /**
321
- * Removes consecutive duplicate points from array within tolerance.
322
- * Example: [[0,0,0], [0,0,0], [1,0,0], [1,0,0], [2,0,0]] → [[0,0,0], [1,0,0], [2,0,0]]
323
- * @param inputs points, tolerance and check first and last
324
- * @returns Points in the array without consecutive duplicates
507
+ * Removes a point when it repeats the one right before it; the same point further away is kept.
508
+ *
509
+ * With `checkFirstAndLast` on, a last point that repeats the first is dropped too. Points
510
+ * within `tolerance` of each other count as the same.
511
+ * Example: [[0,0,0], [0,0,0], [1,0,0], [1,0,0], [2,0,0]] -> [[0,0,0], [1,0,0], [2,0,0]]
512
+ * @param inputs - The points, the tolerance and whether to compare the first and last
513
+ * @returns The points without consecutive repeats
325
514
  * @group clean
326
515
  * @shortname remove duplicates
327
516
  * @drawable true
517
+ * @example
518
+ * ```typescript
519
+ * const cleaned = bitbybit.point.removeConsecutiveDuplicates({
520
+ * points: [[0, 0, 0], [0, 0, 0], [1, 0, 0]],
521
+ * tolerance: 1e-7,
522
+ * checkFirstAndLast: false,
523
+ * });
524
+ * ```
328
525
  */
329
526
  removeConsecutiveDuplicates(inputs: Inputs.Point.RemoveConsecutiveDuplicatesDto): Inputs.Base.Point3[];
330
527
  /**
331
- * Calculates normal vector from three points using cross product (perpendicular to plane).
332
- * Example: p1=[0,0,0], p2=[1,0,0], p3=[0,1,0] → [0,0,1] (pointing up from XY plane)
333
- * @param inputs Three points and the reverse normal flag
334
- * @returns Normal vector
528
+ * Finds the direction at right angles to the plane through three points, with length 1.
529
+ *
530
+ * The direction follows the right-hand rule going from the first point to the second to the
531
+ * third; `reverseNormal` flips it. Points on one line have no plane, so the result is
532
+ * undefined.
533
+ * Example: [0,0,0], [1,0,0], [0,1,0] -> [0,0,1]
534
+ * @param inputs - The three points and whether to flip the result
535
+ * @returns The unit normal, or undefined when the points are on one line
335
536
  * @group create
336
537
  * @shortname normal from 3 points
337
538
  * @drawable true
539
+ * @example
540
+ * ```typescript
541
+ * const normal = bitbybit.point.normalFromThreePoints({
542
+ * point1: [0, 0, 0],
543
+ * point2: [1, 0, 0],
544
+ * point3: [0, 1, 0],
545
+ * reverseNormal: false,
546
+ * });
547
+ * ```
338
548
  */
339
549
  normalFromThreePoints(inputs: Inputs.Point.ThreePointsNormalDto): Inputs.Base.Vector3 | undefined;
340
550
  private closestPointFromPointData;
341
551
  /**
342
- * Checks if two points are approximately equal within tolerance (distance-based comparison).
343
- * Example: point1=[1.0000001, 2.0, 3.0], point2=[1.0, 2.0, 3.0], tolerance=1e-6 → true
344
- * @param inputs Two points and the tolerance
345
- * @returns true if the points are almost equal
552
+ * Tells whether two points are closer together than a tolerance.
553
+ *
554
+ * Example: [1.0000001, 2, 3] and [1, 2, 3] with tolerance 1e-6 -> true
555
+ * @param inputs - The two points and the tolerance
556
+ * @returns True when the distance between them is below the tolerance
346
557
  * @group measure
347
558
  * @shortname two points almost equal
348
559
  * @drawable false
560
+ * @example
561
+ * ```typescript
562
+ * const same = bitbybit.point.twoPointsAlmostEqual({ point1: [1, 2, 3], point2: [1, 2, 3.0000001], tolerance: 1e-6 });
563
+ * ```
349
564
  */
350
565
  twoPointsAlmostEqual(inputs: Inputs.Point.TwoPointsToleranceDto): boolean;
351
566
  /**
352
- * Sorts points lexicographically (by X, then Y, then Z coordinates).
353
- * Example: [[5,0,0], [1,0,0], [3,0,0]] → [[1,0,0], [3,0,0], [5,0,0]]
354
- * @param inputs points
355
- * @returns sorted points
567
+ * Sorts points by X, then by Y for equal X, then by Z.
568
+ *
569
+ * Example: [[5,0,0], [1,0,0], [3,0,0]] -> [[1,0,0], [3,0,0], [5,0,0]]
570
+ * @param inputs - The points to sort
571
+ * @returns A sorted copy of the points
356
572
  * @group sort
357
573
  * @shortname sort points
358
574
  * @drawable true
575
+ * @example
576
+ * ```typescript
577
+ * const sorted = bitbybit.point.sortPoints({ points: [[5, 0, 0], [1, 0, 0], [3, 0, 0]] });
578
+ * ```
359
579
  */
360
580
  sortPoints(inputs: Inputs.Point.PointsDto): Inputs.Base.Point3[];
361
581
  /**