@itwin/core-geometry 4.0.0-dev.66 → 4.0.0-dev.68

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 (53) hide show
  1. package/lib/cjs/Geometry.d.ts +367 -243
  2. package/lib/cjs/Geometry.d.ts.map +1 -1
  3. package/lib/cjs/Geometry.js +481 -311
  4. package/lib/cjs/Geometry.js.map +1 -1
  5. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +6 -4
  6. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  7. package/lib/cjs/clipping/ConvexClipPlaneSet.js +9 -7
  8. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  9. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +5 -3
  10. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  11. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +4 -2
  12. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  13. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +4 -4
  14. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  15. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +17 -9
  16. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  17. package/lib/cjs/geometry3d/Point2dVector2d.js +2 -2
  18. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  19. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +13 -7
  20. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  21. package/lib/cjs/geometry3d/Point3dVector3d.js +19 -18
  22. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  23. package/lib/cjs/geometry4d/Point4d.d.ts +1 -1
  24. package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
  25. package/lib/cjs/geometry4d/Point4d.js +12 -13
  26. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  27. package/lib/esm/Geometry.d.ts +367 -243
  28. package/lib/esm/Geometry.d.ts.map +1 -1
  29. package/lib/esm/Geometry.js +481 -311
  30. package/lib/esm/Geometry.js.map +1 -1
  31. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +6 -4
  32. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  33. package/lib/esm/clipping/ConvexClipPlaneSet.js +9 -7
  34. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  35. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +5 -3
  36. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  37. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +4 -2
  38. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  39. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +4 -4
  40. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  41. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +17 -9
  42. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  43. package/lib/esm/geometry3d/Point2dVector2d.js +2 -2
  44. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  45. package/lib/esm/geometry3d/Point3dVector3d.d.ts +13 -7
  46. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  47. package/lib/esm/geometry3d/Point3dVector3d.js +19 -18
  48. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  49. package/lib/esm/geometry4d/Point4d.d.ts +1 -1
  50. package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
  51. package/lib/esm/geometry4d/Point4d.js +12 -13
  52. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  53. package/package.json +3 -3
@@ -9,7 +9,7 @@ import { Point4d } from "./geometry4d/Point4d";
9
9
  /**
10
10
  * Enumeration of the 6 possible orderings of XYZ axis order
11
11
  * * **Note:** There are 3 axis order with right hand system (XYZ = 0, YZX = 1, ZXY = 2) and 3 axis order with
12
- * left hand system (XZY = 4, YXZ = 5, ZYX = 6). Note that AxisOrder is encoding the handedness as well. Cross
12
+ * left hand system (XZY = 4, YXZ = 5, ZYX = 6). Note that `AxisOrder` is encoding the handedness as well. Cross
13
13
  * product of the i_th axis in an ordering (i=0,1,2), with the i+1_th in that ordering, will produce the i+2_th
14
14
  * axis in that ordering.
15
15
  * @public
@@ -40,7 +40,8 @@ export declare enum AxisIndex {
40
40
  /** 2 axis is index 2 */
41
41
  Z = 2
42
42
  }
43
- /** Standard views. Used in `Matrix3d.createStandardViewAxes(index: StandardViewIndex, invert: boolean)`
43
+ /**
44
+ * Standard views. Used in `Matrix3d.createStandardViewAxes(index: StandardViewIndex, invert: boolean)`
44
45
  * @public
45
46
  */
46
47
  export declare enum StandardViewIndex {
@@ -48,20 +49,21 @@ export declare enum StandardViewIndex {
48
49
  Top = 1,
49
50
  /** X to right, negative Y up */
50
51
  Bottom = 2,
51
- /** negative Y to right, Z up */
52
+ /** Negative Y to right, Z up */
52
53
  Left = 3,
53
- /** Y to right, Z up */
54
+ /** Y to right, Z up */
54
55
  Right = 4,
55
56
  /** X to right, Z up */
56
57
  Front = 5,
57
- /** negative X to right, Z up */
58
+ /** Negative X to right, Z up */
58
59
  Back = 6,
59
- /** isometric: view towards origin from (-1,-1,1) */
60
+ /** Isometric: view towards origin from (-1,-1,1) */
60
61
  Iso = 7,
61
- /** right isometric: view towards origin from (1,-1,1) */
62
+ /** Right isometric: view towards origin from (1,-1,1) */
62
63
  RightIso = 8
63
64
  }
64
- /** Enumeration among choice for how a coordinate transformation should incorporate scaling.
65
+ /**
66
+ * Enumeration among choice for how a coordinate transformation should incorporate scaling.
65
67
  * @public
66
68
  */
67
69
  export declare enum AxisScaleSelect {
@@ -72,15 +74,16 @@ export declare enum AxisScaleSelect {
72
74
  /** On each axis, the vector length matches he length of the corresponding edge of the range. */
73
75
  NonUniformRangeContainment = 2
74
76
  }
75
- /** object with a radians value and its associated cosine and sine values.
77
+ /**
78
+ * Object with a radians value and its associated cosine and sine values.
76
79
  * @public
77
80
  */
78
81
  export interface TrigValues {
79
- /** the cosine value */
82
+ /** The cosine value */
80
83
  c: number;
81
- /** the sine value */
84
+ /** The sine value */
82
85
  s: number;
83
- /** the radians value */
86
+ /** The radians value */
84
87
  radians: number;
85
88
  }
86
89
  /**
@@ -94,25 +97,27 @@ export interface TrigValues {
94
97
  */
95
98
  export interface PlaneAltitudeEvaluator {
96
99
  /**
97
- * Return the altitude of the point from the plane.
98
- * @param point point for evaluation
99
- */
100
+ * Return the altitude of the `point` from the plane.
101
+ * @param point the point for evaluation
102
+ */
100
103
  altitude(point: Point3d): number;
101
104
  /**
102
- * Return the altitude of the point from the plane, with the point supplied as simple x,y,z
103
- * @param x x coordinate
104
- * @param y y coordinate
105
- * @param z z coordinate
106
- */
105
+ * Return the altitude of the `point` from the plane, with the point supplied as simple x,y,z
106
+ * @param x x coordinate of the point
107
+ * @param y y coordinate of the point
108
+ * @param z z coordinate of the point
109
+ */
107
110
  altitudeXYZ(x: number, y: number, z: number): number;
108
111
  /**
109
- * Return the derivative of altitude wrt motion along a vector.
110
- * @param point point for evaluation
112
+ * Return the derivative of altitude with respect to motion along a `vector`.
113
+ * @param vector the vector
111
114
  */
112
115
  velocity(vector: Vector3d): number;
113
116
  /**
114
- * Return the derivative of altitude wrt motion along a vector given by components
115
- * @param point point for evaluation
117
+ * Return the derivative of altitude with respect to motion along a `vector` given by components.
118
+ * @param x x coordinate of the vector
119
+ * @param y y coordinate of the vector
120
+ * @param z z coordinate of the vector
116
121
  */
117
122
  velocityXYZ(x: number, y: number, z: number): number;
118
123
  /**
@@ -127,7 +132,8 @@ export interface PlaneAltitudeEvaluator {
127
132
  /** x part of normal vector */
128
133
  normalZ(): number;
129
134
  }
130
- /** Enumeration of possible locations of a point in the plane of a polygon.
135
+ /**
136
+ * Enumeration of possible locations of a point in the plane of a polygon.
131
137
  * @public
132
138
  */
133
139
  export declare enum PolygonLocation {
@@ -163,9 +169,10 @@ export interface BeJSONFunctions {
163
169
  /** Return a json object with this object's contents. */
164
170
  toJSON(): any;
165
171
  }
166
- /** The Properties for a JSON representation of an Angle.
167
- * If value is a number, it is in *degrees*.
168
- * If value is an object, it can have either degrees or radians.
172
+ /**
173
+ * The properties for a JSON representation of an `Angle`.
174
+ * * If AngleProps data is a number, it is in **degrees**.
175
+ * * If AngleProps data is an object, it can have either degrees or radians.
169
176
  * @public
170
177
  */
171
178
  export type AngleProps = {
@@ -177,11 +184,14 @@ export type AngleProps = {
177
184
  } | {
178
185
  _degrees: number;
179
186
  } | number;
180
- /** The Properties for a JSON representation of an AngleSweep.
181
- * * The json data is always start and end angles as a pair in an array.
182
- * If AngleProps data is an array of two numbers, it is an angle in degrees.
183
- * If the AngleProps is an object with key degrees, the degrees value must be an array with the two degrees angles as numbers
184
- * If the AngleProps is an object with key radians, the radians value must be an array with the two radians angles as numbers
187
+ /**
188
+ * The properties for a JSON representation of an `AngleSweep`.
189
+ * * The json data is always *start* and *end* angles as a pair in an array.
190
+ * * If AngleSweepProps data is an array of two numbers, those are both angles in `degrees`.
191
+ * * If AngleSweepProps data is an object with key `degrees`, then the corresponding value must be an array of
192
+ * two numbers, the start and end angles in degrees.
193
+ * * If the AngleSweepProps is an object with key `radians`, then the corresponding value must be an array of
194
+ * two numbers, the start and end angles in radians.
185
195
  * @public
186
196
  */
187
197
  export type AngleSweepProps = AngleSweep | {
@@ -192,6 +202,29 @@ export type AngleSweepProps = AngleSweep | {
192
202
  number,
193
203
  number
194
204
  ];
205
+ /**
206
+ * Interface for method with a clone operation.
207
+ * @public
208
+ */
209
+ export interface Cloneable<T> {
210
+ /** Required method to return a deep clone. */
211
+ clone(): T | undefined;
212
+ }
213
+ /** Options used for methods like [[Vector2d.isPerpendicularTo]] and [[Vector3d.isParallelTo]].
214
+ * @public
215
+ */
216
+ export interface PerpParallelOptions {
217
+ /**
218
+ * Squared radian tolerance for comparing the angle between two vectors.
219
+ * Default: [[Geometry.smallAngleRadiansSquared]].
220
+ */
221
+ radianSquaredTol?: number;
222
+ /**
223
+ * Squared distance tolerance for detecting a zero-length vector.
224
+ * Default: [[Geometry.smallMetricDistanceSquared]].
225
+ */
226
+ distanceSquaredTol?: number;
227
+ }
195
228
  /**
196
229
  * Class containing static methods for typical numeric operations.
197
230
  * * Experimentally, methods like Geometry.hypotenuse are observed to be faster than the system intrinsics.
@@ -201,143 +234,200 @@ export type AngleSweepProps = AngleSweep | {
201
234
  * @public
202
235
  */
203
236
  export declare class Geometry {
204
- /** Tolerance for small distances in metric coordinates */
237
+ /** Tolerance for small distances in metric coordinates. */
205
238
  static readonly smallMetricDistance = 0.000001;
206
- /** Square of `smallMetricTolerance` */
239
+ /** Square of `smallMetricDistance`. */
207
240
  static readonly smallMetricDistanceSquared = 1e-12;
208
- /** tolerance for small angle measured in radians. */
241
+ /** Tolerance for small angle measured in radians. */
209
242
  static readonly smallAngleRadians = 1e-12;
210
- /** square of `smallAngleRadians` */
243
+ /** Square of `smallAngleRadians`. */
211
244
  static readonly smallAngleRadiansSquared = 1e-24;
212
- /** tolerance for small angle measured in degrees. */
245
+ /** Tolerance for small angle measured in degrees. */
213
246
  static readonly smallAngleDegrees = 5.7e-11;
214
- /** tolerance for small angle measured in arc-seconds. */
247
+ /** Tolerance for small angle measured in arc-seconds. */
215
248
  static readonly smallAngleSeconds = 2e-7;
216
- /** numeric value that may be considered huge for a ratio of numbers.
217
- * * Note that the "allowed" result value is vastly larger than 1.
249
+ /** Numeric value that may be considered zero for fractions between 0 and 1. */
250
+ static readonly smallFraction = 1e-10;
251
+ /** Radians value for full circle 2PI radians minus `smallAngleRadians`. */
252
+ static readonly fullCircleRadiansMinusSmallAngle: number;
253
+ /**
254
+ * Numeric value that may be considered large for a ratio of numbers.
255
+ * * Note that the allowed result value is vastly larger than 1.
218
256
  */
219
257
  static readonly largeFractionResult = 10000000000;
220
- /** numeric value that may be considered zero for fractions between 0 and 1. */
221
- static readonly smallFraction = 1e-10;
222
- /** numeric value that may considered huge for numbers expected to be coordinates.
258
+ /**
259
+ * Numeric value that may considered large for numbers expected to be coordinates.
223
260
  * * This allows larger results than `largeFractionResult`.
224
261
  */
225
262
  static readonly largeCoordinateResult = 10000000000000;
226
- /** numeric value that may considered infinite for metric coordinates.
227
- * * This coordinate should be used only as a placeholder indicating "at infinity" -- computing actual points at this coordinate invites numerical problems.
263
+ /**
264
+ * Numeric value that may considered infinite for metric coordinates.
265
+ * @deprecated in 4.x. Use `largeCoordinateResult`.
266
+ * * This coordinate should be used only as a placeholder indicating "at infinity" -- computing actual
267
+ * points at this coordinate invites numerical problems.
228
268
  */
229
269
  static readonly hugeCoordinate = 1000000000000;
230
- /** Test if absolute value of x is huge.
231
- * * See `Geometry.hugeCoordinate`
270
+ /** Test if absolute value of x is large (larger than `Geometry.largeCoordinateResult`) */
271
+ static isLargeCoordinateResult(x: number): boolean;
272
+ /**
273
+ * Test if absolute value of x is large (larger than `Geometry.largeCoordinateResult`).
274
+ * @deprecated in 4.x. Use `isLargeCoordinateResult`.
232
275
  */
233
276
  static isHugeCoordinate(x: number): boolean;
234
- /** Test if a number is odd.
235
- */
277
+ /** Test if a number is odd */
236
278
  static isOdd(x: number): boolean;
237
- /** Radians value for full circle 2PI radians minus `smallAngleRadians` */
238
- static readonly fullCircleRadiansMinusSmallAngle: number;
239
- /** Correct `distance` to zero if undefined or smaller than metric tolerance. Otherwise return it unchanged. */
279
+ /**
280
+ * Correct distance to zero.
281
+ * * If `distance` magnitude is `undefined` or smaller than `smallMetricDistance`, then return `replacement`
282
+ * (or 0 if replacement is not passed). Otherwise return `distance`.
283
+ */
240
284
  static correctSmallMetricDistance(distance: number | undefined, replacement?: number): number;
241
285
  /**
242
- * If `a` is large enough for safe division, return `1/a`, using Geometry.smallMetricDistance as the tolerance for declaring it as divide by zero. Otherwise return `undefined`.
243
- * @param a denominator of division
244
- */
245
- static inverseMetricDistance(a: number): number | undefined;
286
+ * Correct `fraction` to `replacement` if `fraction` is undefined or too small.
287
+ * @param fraction number to test
288
+ * @param replacement value to return if `fraction` is too small
289
+ * @returns `fraction` if its absolute value is at least `Geometry.smallFraction`; otherwise returns `replacement`
290
+ */
291
+ static correctSmallFraction(fraction: number | undefined, replacement?: number): number;
292
+ /**
293
+ * Return the inverse of `distance`.
294
+ * * If `distance` magnitude is smaller than `smallMetricDistance` (i.e. distance is large enough for safe division),
295
+ * then return `1/distance`. Otherwise return `undefined`.
296
+ */
297
+ static inverseMetricDistance(distance: number): number | undefined;
246
298
  /**
247
- * If `a` is large enough, return `1/a`, using the square of Geometry.smallMetricDistance as the tolerance for declaring it as divide by zero. Otherwise return `undefined`.
248
- * @param a denominator of division
299
+ * Return the inverse of `distanceSquared`.
300
+ * * If `distanceSquared ` magnitude is smaller than `smallMetricDistanceSquared` (i.e. distanceSquared is large
301
+ * enough for safe division), then return `1/distanceSquared `. Otherwise return `undefined`.
249
302
  */
250
- static inverseMetricDistanceSquared(a: number): number | undefined;
303
+ static inverseMetricDistanceSquared(distanceSquared: number): number | undefined;
251
304
  /**
252
- * Boolean test for metric coordinate near-equality (i.e., if x and y are almost equal). If tolerance is not passed,
253
- * `Geometry.smallMetricDistance` is used as tolerance.
305
+ * Boolean test for metric coordinate near-equality (i.e., if `x` and `y` are almost equal) using `tolerance`.
306
+ * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
254
307
  */
255
- static isSameCoordinate(x: number, y: number, tol?: number): boolean;
256
- /** Boolean test for metric coordinate near-equality, with toleranceFactor applied to the usual smallMetricDistance */
308
+ static isSameCoordinate(x: number, y: number, tolerance?: number): boolean;
309
+ /**
310
+ * Boolean test for metric coordinate near-equality (i.e., if `x` and `y` are almost equal) using
311
+ * `tolerance = toleranceFactor * smallMetricDistance`
312
+ * */
257
313
  static isSameCoordinateWithToleranceFactor(x: number, y: number, toleranceFactor: number): boolean;
258
- /** Boolean test for metric coordinate near-equality of x, y pair */
259
- static isSameCoordinateXY(x0: number, y0: number, x1: number, y1: number, tol?: number): boolean;
260
- /** Boolean test for squared metric coordinate near-equality */
261
- static isSameCoordinateSquared(x: number, y: number): boolean;
262
- /** boolean test for small `dataA.distance (dataB)` within `smallMetricDistance` */
263
- static isSamePoint3d(dataA: Point3d, dataB: Point3d): boolean;
264
- /** boolean test for distance between `XYZ` objects within `smallMetricDistance`
265
- * * Note that Point3d and Vector3d are both derived from XYZ, so this method tolerates mixed types.
266
- */
267
- static isSameXYZ(dataA: XYZ, dataB: XYZ): boolean;
268
- /** boolean test for small `dataA.distanceXY (dataB)` within `smallMetricDistance` */
269
- static isSamePoint3dXY(dataA: Point3d, dataB: Point3d): boolean;
270
- /** boolean test for small `dataA.distanceXY (dataB)` within `smallMetricDistance` */
271
- static isSameVector3d(dataA: Vector3d, dataB: Vector3d): boolean;
272
- /** boolean test for small `dataA.distanceXY (dataB)` within `smallMetricDistance` */
273
- static isSamePoint2d(dataA: Point2d, dataB: Point2d): boolean;
274
- /** boolean test for small `dataA.distanceXY (dataB)` within `smallMetricDistance` */
275
- static isSameVector2d(dataA: Vector2d, dataB: Vector2d): boolean;
276
- /**
277
- * Lexical comparison of (a.x,a.y) (b.x,b.y) with x as first test, y second.
314
+ /**
315
+ * Boolean test for metric coordinate pair near-equality (i.e., if `x0` and `x1` are almost equal
316
+ * and `y0` and `y1` are almost equal) using `tolerance`.
317
+ * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
318
+ */
319
+ static isSameCoordinateXY(x0: number, y0: number, x1: number, y1: number, tolerance?: number): boolean;
320
+ /**
321
+ * Boolean test for squared metric coordinate near-equality (i.e., if `sqrt(x)` and `sqrt(y)` are
322
+ * almost equal) using `tolerance`.
323
+ * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
324
+ */
325
+ static isSameCoordinateSquared(x: number, y: number, tolerance?: number): boolean;
326
+ /**
327
+ * Boolean test for small `dataA.distance(dataB)` within `tolerance`.
328
+ * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
329
+ */
330
+ static isSamePoint3d(dataA: Point3d, dataB: Point3d, tolerance?: number): boolean;
331
+ /**
332
+ * Boolean test for small xyz-distance within `tolerance`.
333
+ * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
334
+ * * Note that Point3d and Vector3d are both derived from XYZ, so this method tolerates mixed types.
335
+ */
336
+ static isSameXYZ(dataA: XYZ, dataB: XYZ, tolerance?: number): boolean;
337
+ /**
338
+ * Boolean test for small xy-distance (ignoring z) within `tolerance`.
339
+ * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
340
+ */
341
+ static isSamePoint3dXY(dataA: Point3d, dataB: Point3d, tolerance?: number): boolean;
342
+ /**
343
+ * Boolean test for small xyz-distance within `tolerance`.
344
+ * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
345
+ */
346
+ static isSameVector3d(dataA: Vector3d, dataB: Vector3d, tolerance?: number): boolean;
347
+ /**
348
+ * Boolean test for small xy-distance within `tolerance`.
349
+ * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
350
+ */
351
+ static isSamePoint2d(dataA: Point2d, dataB: Point2d, tolerance?: number): boolean;
352
+ /**
353
+ * Boolean test for small xy-distance within `tolerance`.
354
+ * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
355
+ */
356
+ static isSameVector2d(dataA: Vector2d, dataB: Vector2d, tolerance?: number): boolean;
357
+ /**
358
+ * Lexical comparison of (a.x, a.y) and (b.x, b.y) with x as first test and y as second (z is ignored).
278
359
  * * This is appropriate for a horizontal sweep in the plane.
279
360
  */
280
361
  static lexicalXYLessThan(a: XY | XYZ, b: XY | XYZ): -1 | 0 | 1;
281
362
  /**
282
- * Lexical comparison of (a.x,a.y) (b.x,b.y) with y as first test, x second.
363
+ * Lexical comparison of (a.x, a.y) and (b.x, b.y) with y as first test and x as second (z is ignored).
283
364
  * * This is appropriate for a vertical sweep in the plane.
284
365
  */
285
366
  static lexicalYXLessThan(a: XY | XYZ, b: XY | XYZ): -1 | 0 | 1;
286
- /**
287
- * Lexical test, based on x first, y second, z third.
288
- */
367
+ /** Lexical comparison of (a.x, a.y, a.z) and (b.x, b.y, b.z) with x as first test, y as second, and z as third. */
289
368
  static lexicalXYZLessThan(a: XYZ, b: XYZ): -1 | 0 | 1;
290
- /** Test if `value` is small compared to `smallAngleRadians`.
369
+ /**
370
+ * Test if `value` is small compared to `smallFraction`.
291
371
  * * This is appropriate if `value` is know to be a typical 0..1 fraction.
292
372
  */
293
373
  static isSmallRelative(value: number): boolean;
294
374
  /** Test if `value` is small compared to `smallAngleRadians` */
295
375
  static isSmallAngleRadians(value: number): boolean;
296
- /** Returns true if both values are undefined or if both are defined and almost equal within tolerance.
297
- * If one is undefined and the other is not then false is returned.
298
- */
376
+ /**
377
+ * Returns `true` if both values are `undefined` or if both are defined and almost equal within tolerance.
378
+ * If one is `undefined` and the other is not, then `false` is returned.
379
+ */
299
380
  static isAlmostEqualOptional(a: number | undefined, b: number | undefined, tolerance: number): boolean;
300
- /** Toleranced equality test, using tolerance `smallAngleRadians * ( 1 + abs(a) + (abs(b)))`
301
- * * Effectively an absolute tolerance of `smallAngleRadians`, with tolerance increasing for larger values of a and b.
302
- */
303
- static isAlmostEqualNumber(a: number, b: number): boolean;
304
- /** Toleranced equality test, using tolerance `smallAngleRadians * ( 1 + abs(a) + (abs(b)))`
305
- * * Effectively an absolute tolerance of `smallAngleRadians`, with tolerance increasing for larger values of a and b.
306
- */
307
- static isAlmostEqualXAndY(a: XAndY, b: XAndY): boolean;
308
- /**
309
- * Toleranced equality test, using caller-supplied tolerance.
310
- * If no tolerance is given, use smallMetricDistance.
311
- */
312
- static isDistanceWithinTol(distance: number, tol?: number): boolean;
313
- /** Toleranced equality test, using `smallMetricDistance` tolerance. */
381
+ /**
382
+ * Toleranced equality test using tolerance `tolerance * ( 1 + abs(a) + abs(b) )`.
383
+ * * `Geometry.smallAngleRadians` is used if tolerance is `undefined`.
384
+ */
385
+ static isAlmostEqualNumber(a: number, b: number, tolerance?: number): boolean;
386
+ /**
387
+ * Toleranced equality test using tolerance `tolerance * ( 1 + abs(a.x) + abs(a.y) + abs(b.x) + abs(b.y) )`.
388
+ * * `Geometry.smallAngleRadians` is used if tolerance is `undefined`.
389
+ */
390
+ static isAlmostEqualXAndY(a: XAndY, b: XAndY, tolerance?: number): boolean;
391
+ /**
392
+ * Toleranced equality test using caller-supplied `tolerance`.
393
+ * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
394
+ */
395
+ static isDistanceWithinTol(distance: number, tolerance?: number): boolean;
396
+ /** Toleranced equality test using `smallMetricDistance` tolerance. */
314
397
  static isSmallMetricDistance(distance: number): boolean;
315
- /** Toleranced equality, using `smallMetricDistanceSquared` tolerance. */
398
+ /** Toleranced equality test using `smallMetricDistanceSquared` tolerance. */
316
399
  static isSmallMetricDistanceSquared(distanceSquared: number): boolean;
317
400
  /**
318
401
  * Return `axis modulo 3` with proper handling of negative indices
319
402
  * ..., -3:x, -2:y, -1:z, 0:x, 1:y, 2:z, 3:x, 4:y, 5:z, 6:x, 7:y, 8:z, ...
320
- * */
403
+ */
321
404
  static cyclic3dAxis(axis: number): number;
322
- /** Return the AxisOrder for which axisIndex is the first named axis.
405
+ /**
406
+ * Return the `AxisOrder` for which `axisIndex` is the first named axis.
323
407
  * * `axisIndex === 0` returns `AxisOrder.XYZ`
324
408
  * * `axisIndex === 1` returns `AxisOrder.YZX`
325
409
  * * `axisIndex === 2` returns `AxisOrder.ZXY`
326
410
  */
327
411
  static axisIndexToRightHandedAxisOrder(axisIndex: AxisIndex): AxisOrder;
328
- /** Return the largest absolute distance from a to either of b0 or b1 */
329
- static maxAbsDiff(a: number, b0: number, b1: number): number;
330
- /** Return the largest absolute absolute value among x,y,z */
412
+ /** Return the largest signed value among `a`, `b`, and `c` */
413
+ static maxXYZ(a: number, b: number, c: number): number;
414
+ /** Return the smallest signed value among `a`, `b`, and `c` */
415
+ static minXYZ(a: number, b: number, c: number): number;
416
+ /** Return the largest signed value among `a` and `b` */
417
+ static maxXY(a: number, b: number): number;
418
+ /** Return the smallest signed value among `a` and `b` */
419
+ static minXY(a: number, b: number): number;
420
+ /** Return the largest absolute value among `x`, `y`, and `z` */
331
421
  static maxAbsXYZ(x: number, y: number, z: number): number;
332
- /** Return the largest absolute absolute value among x,y */
422
+ /** Return the largest absolute value among `x` and `y` */
333
423
  static maxAbsXY(x: number, y: number): number;
334
- /** Return the largest signed value among a, b, c */
335
- static maxXYZ(a: number, b: number, c: number): number;
424
+ /** Return the largest absolute distance from `a` to either of `b0` or `b1` */
425
+ static maxAbsDiff(a: number, b0: number, b1: number): number;
336
426
  /**
337
- * Examine the value (particularly sign) of x.
338
- * * If x is negative, return outNegative.
339
- * * If x is true zero, return outZero
340
- * * If x is positive, return outPositive
427
+ * Examine the sign of `x`.
428
+ * * If `x` is negative, return `outNegative`
429
+ * * If `x` is true zero, return `outZero`
430
+ * * If `x` is positive, return `outPositive`
341
431
  */
342
432
  static split3WaySign(x: number, outNegative: number, outZero: number, outPositive: number): number;
343
433
  /**
@@ -347,23 +437,28 @@ export declare class Geometry {
347
437
  * * If x is positive, return 1
348
438
  */
349
439
  static split3Way01(x: number, tolerance?: number): -1 | 0 | 1;
350
- /** Return the largest signed value among a, b */
351
- static maxXY(a: number, b: number): number;
352
- /** Return the smallest signed value among a, b */
353
- static minXY(a: number, b: number): number;
354
- /** Return the hypotenuse `sqrt(x*x + y*y)`. This is much faster than `Math.hypot(x,y)`. */
355
- static hypotenuseXY(x: number, y: number): number;
356
- /** Return the squared `hypotenuse (x*x + y*y)`. */
357
- static hypotenuseSquaredXY(x: number, y: number): number;
358
440
  /** Return the square of x */
359
441
  static square(x: number): number;
360
- /** Return the hypotenuse `sqrt(x*x + y*y + z*z)`. This is much faster than `Math.hypot(x,y,z)`. */
442
+ /**
443
+ * Return the hypotenuse (i.e., `sqrt(x*x + y*y)`).
444
+ * * This is much faster than `Math.hypot(x,y)`.
445
+ */
446
+ static hypotenuseXY(x: number, y: number): number;
447
+ /** Return the squared hypotenuse (i.e., `x*x + y*y`). */
448
+ static hypotenuseSquaredXY(x: number, y: number): number;
449
+ /**
450
+ * Return the hypotenuse (i.e., `sqrt(x*x + y*y + z*z)`).
451
+ * * This is much faster than `Math.hypot(x,y,z)`.
452
+ */
361
453
  static hypotenuseXYZ(x: number, y: number, z: number): number;
362
- /** Return the squared hypotenuse `(x*x + y*y + z*z)`. This is much faster than `Math.hypot(x,y,z)`. */
454
+ /** Return the squared hypotenuse (i.e., `x*x + y*y + z*z`). */
363
455
  static hypotenuseSquaredXYZ(x: number, y: number, z: number): number;
364
- /** Return the (full 4d) hypotenuse `sqrt(x*x + y*y + z*z + w*w)`. This is much faster than `Math.hypot(x,y,z,w)`. */
456
+ /**
457
+ * Return the full 4d hypotenuse (i.e., `sqrt(x*x + y*y + z*z + w*w)`).
458
+ * * This is much faster than `Math.hypot(x,y,z,w)`.
459
+ */
365
460
  static hypotenuseXYZW(x: number, y: number, z: number, w: number): number;
366
- /** Return the squared hypotenuse `(x*x + y*y + z*z+w*w)`. This is much faster than `Math.hypot(x,y,z)`. */
461
+ /** Return the squared hypotenuse (i.e., `x*x + y*y + z*z + w*w`). */
367
462
  static hypotenuseSquaredXYZW(x: number, y: number, z: number, w: number): number;
368
463
  /**
369
464
  * Return the distance between xy points given as numbers.
@@ -383,8 +478,8 @@ export declare class Geometry {
383
478
  * @param z1 z coordinate of point 1
384
479
  */
385
480
  static distanceXYZXYZ(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number): number;
386
- /** Returns Returns the triple product of 3 vectors provided as x,y,z number sequences.
387
- *
481
+ /**
482
+ * Returns the triple product of 3 vectors provided as x,y,z number sequences.
388
483
  * * The triple product is the determinant of the 3x3 matrix with the 9 numbers (3 vectors placed in 3 rows).
389
484
  * * The triple product is positive if the 3 vectors form a right handed coordinate system.
390
485
  * * The triple product is negative if the 3 vectors form a left handed coordinate system.
@@ -392,90 +487,113 @@ export declare class Geometry {
392
487
  * * U dot (V cross W)
393
488
  * * V dot (W cross U)
394
489
  * * W dot (U cross V)
395
- * * (-U dot (W cross V)) -- (note the negative -- reversing cross product order changes the sign)
396
- * * (-V dot (U cross W)) -- (note the negative -- reversing cross product order changes the sign)
397
- * * (-W dot (V cross U)) -- (note the negative -- reversing cross product order changes the sign)
398
- * * the triple product is 6 times the (signed) volume of the tetrahedron with the three vectors as edges from a common vertex.
490
+ * * -U dot (W cross V)
491
+ * * -V dot (U cross W)
492
+ * * -W dot (V cross U)
493
+ * * Note the negative in the last 3 formulas. Reversing cross product order changes the sign.
494
+ * * The triple product is 6 times the (signed) volume of the tetrahedron with the three vectors as edges from a
495
+ * common vertex.
399
496
  */
400
497
  static tripleProduct(ux: number, uy: number, uz: number, vx: number, vy: number, vz: number, wx: number, wy: number, wz: number): number;
401
- /** Returns the determinant of the 4x4 matrix unrolled as the 16 parameters.
402
- */
498
+ /** Returns the determinant of the 4x4 matrix unrolled as the 16 parameters */
403
499
  static determinant4x4(xx: number, xy: number, xz: number, xw: number, yx: number, yy: number, yz: number, yw: number, zx: number, zy: number, zz: number, zw: number, wx: number, wy: number, wz: number, ww: number): number;
404
- /** Return the mean curvature for two radii, with 0 radius implying 0 curvature */
405
- static meanCurvatureOfRadii(r0: number, r1: number): number;
406
500
  /**
407
- * Returns curvature magnitude from a first and second derivative vector.
408
- * @param ux first derivative x component
409
- * @param uy first derivative y component
410
- * @param uz first derivative z component
411
- * @param vx second derivative x component
412
- * @param vy second derivative y component
413
- * @param vz second derivative z component
414
- */
415
- static curvatureMagnitude(ux: number, uy: number, uz: number, vx: number, vy: number, vz: number): number;
416
- /** Returns the determinant of 3x3 matrix with x and y rows taken from 3 points, third row from corresponding numbers.
417
- *
501
+ * Returns the determinant of 3x3 matrix with first and second rows created from the 3 xy points and the third
502
+ * row created from the 3 numbers:
503
+ * [columnA.x columnB.x columnC.x]
504
+ * [columnA.y columnB.y columnC.y]
505
+ * [ weightA weightB weightC ]
418
506
  */
419
507
  static tripleProductXYW(columnA: XAndY, weightA: number, columnB: XAndY, weightB: number, columnC: XAndY, weightC: number): number;
420
- /** Returns the determinant of 3x3 matrix with x and y rows taken from 3 points, third row from corresponding numbers.
421
- *
508
+ /**
509
+ * Returns the determinant of 3x3 matrix columns created by the given `Point4d` ignoring the z part:
510
+ * [columnA.x columnB.x columnC.x]
511
+ * [columnA.y columnB.y columnC.y]
512
+ * [columnA.w columnB.w columnC.w]
422
513
  */
423
514
  static tripleProductPoint4dXYW(columnA: Point4d, columnB: Point4d, columnC: Point4d): number;
424
- /** 2D cross product of vectors layed out as scalars. */
515
+ /** 2D cross product of vectors with the vectors presented as numbers. */
425
516
  static crossProductXYXY(ux: number, uy: number, vx: number, vy: number): number;
426
- /** 3D cross product of vectors layed out as scalars. */
517
+ /** 3D cross product of vectors with the vectors presented as numbers. */
427
518
  static crossProductXYZXYZ(ux: number, uy: number, uz: number, vx: number, vy: number, vz: number, result?: Vector3d): Vector3d;
428
- /** magnitude of 3D cross product of vectors, with the vectors presented as */
519
+ /** Magnitude of 3D cross product of vectors with the vectors presented as numbers. */
429
520
  static crossProductMagnitude(ux: number, uy: number, uz: number, vx: number, vy: number, vz: number): number;
430
- /** 3D dot product of vectors layed out as scalars. */
431
- static dotProductXYZXYZ(ux: number, uy: number, uz: number, vx: number, vy: number, vz: number): number;
432
- /** 2D dot product of vectors layed out as scalars. */
521
+ /** 2D dot product of vectors with the vectors presented as numbers. */
433
522
  static dotProductXYXY(ux: number, uy: number, vx: number, vy: number): number;
523
+ /** 3D dot product of vectors with the vectors presented as numbers. */
524
+ static dotProductXYZXYZ(ux: number, uy: number, uz: number, vx: number, vy: number, vz: number): number;
525
+ /**
526
+ * Return the mean curvature for two radii.
527
+ * * Curvature is the reciprocal of radius.
528
+ * * 0 radius implies 0 curvature.
529
+ * @param r0 first radius
530
+ * @param r1 second radius
531
+ */
532
+ static meanCurvatureOfRadii(r0: number, r1: number): number;
434
533
  /**
435
- * Clamp to (min(a,b), max(a,b))
436
- * * always returns a number between a and b
437
- * @param x
438
- * @param a
439
- * @param b
534
+ * Returns curvature from the first and second derivative vectors.
535
+ * * If U is the first derivative and V is the second derivative, the curvature is defined as:
536
+ * * `|| U x V || / || U ||^3`.
537
+ * * Math details can be found at https://en.wikipedia.org/wiki/Curvature#General_expressions
538
+ * @param ux first derivative x component
539
+ * @param uy first derivative y component
540
+ * @param uz first derivative z component
541
+ * @param vx second derivative x component
542
+ * @param vy second derivative y component
543
+ * @param vz second derivative z component
544
+ */
545
+ static curvatureMagnitude(ux: number, uy: number, uz: number, vx: number, vy: number, vz: number): number;
546
+ /**
547
+ * Clamp to (min(a,b), max(a,b)).
548
+ * * Always returns a number between `a` and `b`.
549
+ * @param value value to clamp
550
+ * @param a smallest allowed output if `a < b` or largest allowed output if `a > b`
551
+ * @param b largest allowed output if `a < b` or smallest allowed output if `a > b`
440
552
  */
441
- static clampToStartEnd(x: number, a: number, b: number): number;
553
+ static clampToStartEnd(value: number, a: number, b: number): number;
442
554
  /**
443
- * Clamp value to (min,max) with no test for order of (min,max)
555
+ * Clamp value to (min, max) with no test for order of (min, max).
556
+ * * Always returns a number between `min` and `max`.
444
557
  * @param value value to clamp
445
558
  * @param min smallest allowed output
446
- * @param max largest allowed result.
559
+ * @param max largest allowed output
447
560
  */
448
561
  static clamp(value: number, min: number, max: number): number;
449
- /** If given a number, return it. If given undefined, return `defaultValue`. */
562
+ /** If given a `value`, return it. If given `undefined`, return `defaultValue`. */
450
563
  static resolveNumber(value: number | undefined, defaultValue?: number): number;
451
- /** If given a value, return it. If given undefined, return `defaultValue`. */
564
+ /** If given a `value`, return it. If given `undefined`, return `defaultValue`. */
452
565
  static resolveValue<T>(value: T | undefined, defaultValue: T): T;
453
- /** If given value matches a target, return undefined. Otherwise return the value. */
566
+ /** If given `value` matches the `targetValue`, return `undefined`. Otherwise return the `value`. */
454
567
  static resolveToUndefined<T>(value: T | undefined, targetValue: T): T | undefined;
455
568
  /**
456
- * Simple interpolation between values, but choosing (based on fraction) a or b as starting
457
- * point for maximum accuracy.
569
+ * Simple interpolation between values `a` and `b` with fraction `f`.
458
570
  * * If `f = 0`, then `a` is returned and if `f = 1`, then `b` is returned.
571
+ * * For maximum accuracy, we choose `a` or `b` as starting point based on fraction `f`.
459
572
  */
460
573
  static interpolate(a: number, f: number, b: number): number;
461
574
  /**
462
- * Given an axisOrder (e.g. XYZ, YZX, etc) and an index, returns the axis index at the given index.
463
- * * For example, if axisOrder = XYZ, then for index 0 returns X (or axis index 0), for index 1 returns
464
- * Y (or axis index 1), and for index 2 returns Z (or axis index 2). For indexes greater than 2 or smaller
465
- * than 0, it returns cyclic axis index. See Geometry.cyclic3dAxis for more info.
466
- * * Another example: if axisOrder = ZYX, then for index 0 returns Z (or axis index 2), for index 1 returns
467
- * Y (or axis index 1), and for index 2 returns X (or axis index 0).
468
- * */
575
+ * Given an `axisOrder` (e.g. XYZ, YZX, etc) and an `index`, return the `axis` at the given index.
576
+ * * For example, if `axisOrder = XYZ`, then for index 0 return `X` (or axis 0), for index 1 return
577
+ * `Y` (or axis 1), and for index 2 return `Z` (or axis 2).
578
+ * * Another example: if `axisOrder = ZXY`, then for index 0 return `Z` (or axis 2), for index 1 return
579
+ * `X` (or axis 0), and for index 2 return `Y` (or axis 1).
580
+ * * For indexes greater than 2 or smaller than 0, it return cyclic axis. See [[Geometry.cyclic3dAxis]]
581
+ * for more info.
582
+ */
469
583
  static axisOrderToAxis(order: AxisOrder, index: number): number;
470
- /** Return (a modulo period), e.g. for use as a cyclic index. Both a and period may be negative. */
584
+ /**
585
+ * Return `a` modulo `period`.
586
+ * * Both `a` and `period` can be negative.
587
+ * * This function can be faster than the `%` operator for the common case when `p > 0` and `-p < a < 2p`.
588
+ */
471
589
  static modulo(a: number, period: number): number;
472
- /** return 0 if the value is undefined, 1 if defined. */
590
+ /** Return 0 if the value is `undefined` and 1 if the value is defined. */
473
591
  static defined01(value: any): number;
474
592
  /**
475
- * Return `numerator` divided by `denominator`, or `undefined`.
593
+ * Return `numerator` divided by `denominator`.
476
594
  * @param numerator the numerator
477
595
  * @param denominator the denominator
478
- * @returns return `numerator/denominator` but if the ratio would exceed `Geometry.largeFractionResult`,
596
+ * @returns return `numerator/denominator` but if the ratio exceeds `Geometry.largeFractionResult`,
479
597
  * return `undefined`.
480
598
  */
481
599
  static conditionalDivideFraction(numerator: number, denominator: number): number | undefined;
@@ -483,101 +601,107 @@ export declare class Geometry {
483
601
  * Return `numerator` divided by `denominator`.
484
602
  * @param numerator the numerator
485
603
  * @param denominator the denominator
486
- * @returns return `numerator/denominator` but if the ratio would exceed `Geometry.largeFractionResult`,
604
+ * @returns return `numerator/denominator` but if the ratio exceeds `Geometry.largeFractionResult`,
487
605
  * return `defaultResult`.
488
606
  */
489
607
  static safeDivideFraction(numerator: number, denominator: number, defaultResult: number): number;
490
608
  /**
491
- * Return `numerator` divided by `denominator` (with a given `largestResult`), or `undefined`.
609
+ * Return `numerator` divided by `denominator` (with a given `largestResult`).
492
610
  * @param numerator the numerator
493
611
  * @param denominator the denominator
494
- * @param largestResult the ratio threshold.
495
- * @returns return `numerator/denominator` but if the ratio would exceed `largestResult`, return `undefined`.
612
+ * @param largestResult the ratio threshold
613
+ * @returns return `numerator/denominator` but if the ratio exceeds `largestResult`, return `undefined`.
496
614
  */
497
615
  static conditionalDivideCoordinate(numerator: number, denominator: number, largestResult?: number): number | undefined;
498
- /** return the 0, 1, or 2 pairs of (c,s) values that solve
499
- * {constCoff + cosCoff * c + sinCoff * s = 0}
500
- * with the constraint {c*c+s*s = 1}
616
+ /**
617
+ * Return solution(s) of equation `constCoff + cosCoff*c + sinCoff*s = 0` for `c` and `s` with the
618
+ * constraint `c*c + s*s = 1`.
619
+ * * There could be 0, 1, or 2 solutions. Return `undefined` if there is no solution.
501
620
  */
502
621
  static solveTrigForm(constCoff: number, cosCoff: number, sinCoff: number): Vector2d[] | undefined;
503
- /** For a line f(x) whose function values at x0 and x1 are f0 and f1, return the x value at which f(x)=fTarget; */
504
- static inverseInterpolate(x0: number, f0: number, x1: number, f1: number, targetF?: number, defaultResult?: number): number | undefined;
505
- /** For a line f(x) whose function values at x=0 and x=1 are f0 and f1, return the x value at which f(x)=fTarget; */
506
- static inverseInterpolate01(f0: number, f1: number, targetF?: number): number | undefined;
507
- /** Return true if json is an array with at least minEntries, and all entries are numbers (including those beyond minEntries) */
622
+ /**
623
+ * For a line `f(x)` where `f(x0) = f0` and `f(x1) = f1`, return the `x` value at which `f(x) = fTarget`
624
+ * Return `defaultResult` if `(fTarget - f0) / (f1 - f0)` exceeds `Geometry.largeFractionResult`
625
+ */
626
+ static inverseInterpolate(x0: number, f0: number, x1: number, f1: number, fTarget?: number, defaultResult?: number): number | undefined;
627
+ /**
628
+ * For a line `f(x)` where `f(0) = f0` and `f(1) = f1`, return the `x` value at which `f(x) = fTarget`
629
+ * Return `undefined` if `(fTarget - f0) / (f1 - f0)` exceeds `Geometry.largeFractionResult`
630
+ */
631
+ static inverseInterpolate01(f0: number, f1: number, fTarget?: number): number | undefined;
632
+ /**
633
+ * Return `true` if `json` is an array with at least `minEntries` entries and all entries are numbers (including
634
+ * those beyond minEntries).
635
+ */
508
636
  static isNumberArray(json: any, minEntries?: number): boolean;
509
- /** Return true if json is an array of at least numNumberArrays, with at least minEntries in each number array.
637
+ /**
638
+ * Return `true` if `json` is an array of at least `minArrays` arrays with at least `minEntries` entries in
639
+ * each array and all entries are numbers (including those beyond minEntries).
640
+ */
641
+ static isArrayOfNumberArray(json: any, minArrays: number, minEntries?: number): boolean;
642
+ /**
643
+ * Return the number of steps to take so that `numSteps * stepSize >= total`.
644
+ * * `minCount` is returned in the following 3 cases:
645
+ * * (a) `stepSize <= 0`
646
+ * * (b) `stepSize >= total`
647
+ * * (b) `numSteps < minCount`
648
+ * * `maxCount` is returned if `numSteps > maxCount`.
510
649
  */
511
- static isArrayOfNumberArray(json: any, numNumberArray: number, minEntries?: number): boolean;
512
- /** return the number of steps to take so that numSteps * stepSize >= total.
513
- * minCount is returned for both (a) setSize 0 or less and (b) stepSize > total.
514
- * A small tolerance is applied for almost
515
- */
516
650
  static stepCount(stepSize: number, total: number, minCount?: number, maxCount?: number): number;
517
- /** Test if x is in simple 0..1 interval. But optionally skip the test. (this odd behavior is very convenient for code that sometimes does not do the filtering.)
651
+ /**
652
+ * Test if `x` is in the interval [0,1] (but skip the test if `apply01 = false`).
653
+ * * This odd behavior is very convenient for code that sometimes does not do the filtering.
518
654
  * @param x value to test.
519
- * @param apply01 if false, accept all x.
655
+ * @param apply01 if false, return `true` for all values of `x`.
520
656
  */
521
657
  static isIn01(x: number, apply01?: boolean): boolean;
522
- /** Test if x is in simple 0..1 interval. But optionally skip the test. (this odd behavior is very convenient for code that sometimes does not do the filtering.)
658
+ /**
659
+ * Test if `x` is in the interval [0,1] for a given positive `tolerance`.
660
+ * * Make sure to pass a positive `tolerance` because there is no check for that in the code.
523
661
  * @param x value to test.
524
- * @param apply01 if false, accept all x.
662
+ * @param tolerance the tolerance.
525
663
  */
526
664
  static isIn01WithTolerance(x: number, tolerance: number): boolean;
527
665
  /**
528
- * restrict x so it is in the interval `[a,b]`, allowing a,b to be in either order.
529
- * @param x
666
+ * Restrict x so it is in the interval `[a,b]` (allowing `a` and `b` to be in either order).
667
+ * @param x value to restrict
530
668
  * @param a (usually the lower) interval limit
531
669
  * @param b (usually the upper) interval limit
532
670
  */
533
671
  static restrictToInterval(x: number, a: number, b: number): number;
534
672
  /**
535
673
  * Case-insensitive string comparison.
536
- * * Return true if the toUpperCase values match.
674
+ * * Return `true` if the `toUpperCase` values of `string1` and `string2` match.
537
675
  */
538
676
  static equalStringNoCase(string1: string, string2: string): boolean;
539
- /** test for EXACT match of number arrays. */
677
+ /**
678
+ * Test for exact match of two number arrays.
679
+ * Returns `true` if both arrays have the same length and entries, or if both arrays are empty or `undefined`.
680
+ */
540
681
  static exactEqualNumberArrays(a: number[] | undefined, b: number[] | undefined): boolean;
541
- /** test for match of XYZ arrays. */
682
+ /**
683
+ * Test for match of two arrays of type `T`.
684
+ * Returns `true` if both arrays have the same length and have the same entries (or both are empty arrays).
685
+ */
542
686
  static almostEqualArrays<T>(a: T[] | undefined, b: T[] | undefined, testFunction: (p: T, q: T) => boolean): boolean;
543
- /** test for match of typed arrays (e.g. Float64Array). */
687
+ /**
688
+ * Test for match of two arrays of type number or Float64Array.
689
+ * Returns `true` if both arrays have the same length and have the same entries (or both are empty arrays).
690
+ */
544
691
  static almostEqualNumberArrays(a: number[] | Float64Array | undefined, b: number[] | Float64Array | undefined, testFunction: (p: number, q: number) => boolean): boolean;
545
692
  /**
546
- * Return
547
- * * true if both values are defined and equal (with ===).
548
- * * false if both defined by not equal
549
- * * return (option arg) resultIfBothUndefined when both are undefined.
550
- * * return false if one is defined and the other undefined
693
+ * Test for match of two values of type `T`.
551
694
  * @param a first value
552
695
  * @param b second value
553
- * @param resultIfBothUndefined return value when both are undefined.
554
- * @returns
696
+ * @param resultIfBothUndefined returned value when both are `undefined`
697
+ * @returns `true` if both values are defined and equal (with ===) and `false` if both values are defined
698
+ * but not equal or if one is defined and the other undefined.
555
699
  */
556
700
  static areEqualAllowUndefined<T>(a: T | undefined, b: T | undefined, resultIfBothUndefined?: boolean): boolean;
557
- /** clone an array whose members have a clone method.
558
- * * undefined return from clone is forced into the output array.
559
- */
560
- static cloneMembers<T extends Cloneable<T>>(a: T[] | undefined): T[] | undefined;
561
- }
562
- /**
563
- * interface for method with a clone operation
564
- * @public
565
- */
566
- export interface Cloneable<T> {
567
- /** required method to return a deep clone. */
568
- clone(): T | undefined;
569
- }
570
- /** Options used for methods like [[Vector2d.isPerpendicularTo]] and [[Vector3d.isParallelTo]].
571
- * @public
572
- */
573
- export interface PerpParallelOptions {
574
- /** Squared radian tolerance for comparing the angle between two vectors.
575
- * Default: [[Geometry.smallAngleRadiansSquared]].
576
- */
577
- radianSquaredTol?: number;
578
- /** Squared distance tolerance for detecting a zero-length vector.
579
- * Default: [[Geometry.smallMetricDistanceSquared]].
701
+ /**
702
+ * Clone an array whose members have type `T`, which implements the clone method.
703
+ * * If the clone method returns `undefined`, then `undefined` is forced into the cloned array.
580
704
  */
581
- distanceSquaredTol?: number;
705
+ static cloneMembers<T extends Cloneable<T>>(array: T[] | undefined): T[] | undefined;
582
706
  }
583
707
  //# sourceMappingURL=Geometry.d.ts.map