@itwin/ecschema-rpcinterface-tests 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.
- package/lib/dist/_d48c.bundled-tests.js.map +1 -1
- package/lib/dist/bundled-tests.js +545 -363
- package/lib/dist/bundled-tests.js.map +1 -1
- package/lib/dist/core_frontend_lib_esm_ApproximateTerrainHeightsProps_js.bundled-tests.js.map +1 -1
- package/lib/dist/object-storage.bundled-tests.js.map +1 -1
- package/lib/dist/vendors-common_temp_node_modules_pnpm_itwin_object-storage-azure_1_5_0_node_modules_itwin_obj-e3e81d.bundled-tests.js.map +1 -1
- package/lib/dist/vendors-common_temp_node_modules_pnpm_loaders_gl_draco_3_3_1_node_modules_loaders_gl_draco_di-d3af41.bundled-tests.js.map +1 -1
- package/lib/dist/vendors-common_temp_node_modules_pnpm_reflect-metadata_0_1_13_node_modules_reflect-metadata_R-610cb3.bundled-tests.js.map +1 -1
- package/package.json +15 -15
|
@@ -173283,7 +173283,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
173283
173283
|
/**
|
|
173284
173284
|
* Enumeration of the 6 possible orderings of XYZ axis order
|
|
173285
173285
|
* * **Note:** There are 3 axis order with right hand system (XYZ = 0, YZX = 1, ZXY = 2) and 3 axis order with
|
|
173286
|
-
* left hand system (XZY = 4, YXZ = 5, ZYX = 6). Note that AxisOrder is encoding the handedness as well. Cross
|
|
173286
|
+
* left hand system (XZY = 4, YXZ = 5, ZYX = 6). Note that `AxisOrder` is encoding the handedness as well. Cross
|
|
173287
173287
|
* 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
|
|
173288
173288
|
* axis in that ordering.
|
|
173289
173289
|
* @public
|
|
@@ -173316,7 +173316,8 @@ var AxisIndex;
|
|
|
173316
173316
|
/** 2 axis is index 2 */
|
|
173317
173317
|
AxisIndex[AxisIndex["Z"] = 2] = "Z";
|
|
173318
173318
|
})(AxisIndex || (AxisIndex = {}));
|
|
173319
|
-
/**
|
|
173319
|
+
/**
|
|
173320
|
+
* Standard views. Used in `Matrix3d.createStandardViewAxes(index: StandardViewIndex, invert: boolean)`
|
|
173320
173321
|
* @public
|
|
173321
173322
|
*/
|
|
173322
173323
|
var StandardViewIndex;
|
|
@@ -173325,20 +173326,21 @@ var StandardViewIndex;
|
|
|
173325
173326
|
StandardViewIndex[StandardViewIndex["Top"] = 1] = "Top";
|
|
173326
173327
|
/** X to right, negative Y up */
|
|
173327
173328
|
StandardViewIndex[StandardViewIndex["Bottom"] = 2] = "Bottom";
|
|
173328
|
-
/**
|
|
173329
|
+
/** Negative Y to right, Z up */
|
|
173329
173330
|
StandardViewIndex[StandardViewIndex["Left"] = 3] = "Left";
|
|
173330
|
-
/**
|
|
173331
|
+
/** Y to right, Z up */
|
|
173331
173332
|
StandardViewIndex[StandardViewIndex["Right"] = 4] = "Right";
|
|
173332
173333
|
/** X to right, Z up */
|
|
173333
173334
|
StandardViewIndex[StandardViewIndex["Front"] = 5] = "Front";
|
|
173334
|
-
/**
|
|
173335
|
+
/** Negative X to right, Z up */
|
|
173335
173336
|
StandardViewIndex[StandardViewIndex["Back"] = 6] = "Back";
|
|
173336
|
-
/**
|
|
173337
|
+
/** Isometric: view towards origin from (-1,-1,1) */
|
|
173337
173338
|
StandardViewIndex[StandardViewIndex["Iso"] = 7] = "Iso";
|
|
173338
|
-
/**
|
|
173339
|
+
/** Right isometric: view towards origin from (1,-1,1) */
|
|
173339
173340
|
StandardViewIndex[StandardViewIndex["RightIso"] = 8] = "RightIso";
|
|
173340
173341
|
})(StandardViewIndex || (StandardViewIndex = {}));
|
|
173341
|
-
/**
|
|
173342
|
+
/**
|
|
173343
|
+
* Enumeration among choice for how a coordinate transformation should incorporate scaling.
|
|
173342
173344
|
* @public
|
|
173343
173345
|
*/
|
|
173344
173346
|
var AxisScaleSelect;
|
|
@@ -173350,7 +173352,8 @@ var AxisScaleSelect;
|
|
|
173350
173352
|
/** On each axis, the vector length matches he length of the corresponding edge of the range. */
|
|
173351
173353
|
AxisScaleSelect[AxisScaleSelect["NonUniformRangeContainment"] = 2] = "NonUniformRangeContainment";
|
|
173352
173354
|
})(AxisScaleSelect || (AxisScaleSelect = {}));
|
|
173353
|
-
/**
|
|
173355
|
+
/**
|
|
173356
|
+
* Enumeration of possible locations of a point in the plane of a polygon.
|
|
173354
173357
|
* @public
|
|
173355
173358
|
*/
|
|
173356
173359
|
var PolygonLocation;
|
|
@@ -173383,18 +173386,26 @@ var PolygonLocation;
|
|
|
173383
173386
|
* @public
|
|
173384
173387
|
*/
|
|
173385
173388
|
class Geometry {
|
|
173386
|
-
/** Test if absolute value of x is
|
|
173387
|
-
|
|
173389
|
+
/** Test if absolute value of x is large (larger than `Geometry.largeCoordinateResult`) */
|
|
173390
|
+
static isLargeCoordinateResult(x) {
|
|
173391
|
+
return x > this.largeCoordinateResult || x < -this.largeCoordinateResult;
|
|
173392
|
+
}
|
|
173393
|
+
/**
|
|
173394
|
+
* Test if absolute value of x is large (larger than `Geometry.largeCoordinateResult`).
|
|
173395
|
+
* @deprecated in 4.x. Use `isLargeCoordinateResult`.
|
|
173388
173396
|
*/
|
|
173389
173397
|
static isHugeCoordinate(x) {
|
|
173390
|
-
return
|
|
173398
|
+
return Geometry.isLargeCoordinateResult(x);
|
|
173391
173399
|
}
|
|
173392
|
-
/** Test if a number is odd
|
|
173393
|
-
*/
|
|
173400
|
+
/** Test if a number is odd */
|
|
173394
173401
|
static isOdd(x) {
|
|
173395
|
-
return (x & (0x01)) === 1;
|
|
173402
|
+
return (x & (0x01)) === 1; // bitwise operation
|
|
173396
173403
|
}
|
|
173397
|
-
/**
|
|
173404
|
+
/**
|
|
173405
|
+
* Correct distance to zero.
|
|
173406
|
+
* * If `distance` magnitude is `undefined` or smaller than `smallMetricDistance`, then return `replacement`
|
|
173407
|
+
* (or 0 if replacement is not passed). Otherwise return `distance`.
|
|
173408
|
+
*/
|
|
173398
173409
|
static correctSmallMetricDistance(distance, replacement = 0.0) {
|
|
173399
173410
|
if (distance === undefined || Math.abs(distance) < Geometry.smallMetricDistance) {
|
|
173400
173411
|
return replacement;
|
|
@@ -173402,64 +173413,119 @@ class Geometry {
|
|
|
173402
173413
|
return distance;
|
|
173403
173414
|
}
|
|
173404
173415
|
/**
|
|
173405
|
-
|
|
173406
|
-
|
|
173407
|
-
|
|
173408
|
-
|
|
173409
|
-
|
|
173416
|
+
* Correct `fraction` to `replacement` if `fraction` is undefined or too small.
|
|
173417
|
+
* @param fraction number to test
|
|
173418
|
+
* @param replacement value to return if `fraction` is too small
|
|
173419
|
+
* @returns `fraction` if its absolute value is at least `Geometry.smallFraction`; otherwise returns `replacement`
|
|
173420
|
+
*/
|
|
173421
|
+
static correctSmallFraction(fraction, replacement = 0.0) {
|
|
173422
|
+
if (fraction === undefined || Math.abs(fraction) < Geometry.smallFraction) {
|
|
173423
|
+
return replacement;
|
|
173424
|
+
}
|
|
173425
|
+
return fraction;
|
|
173426
|
+
}
|
|
173427
|
+
/**
|
|
173428
|
+
* Return the inverse of `distance`.
|
|
173429
|
+
* * If `distance` magnitude is smaller than `smallMetricDistance` (i.e. distance is large enough for safe division),
|
|
173430
|
+
* then return `1/distance`. Otherwise return `undefined`.
|
|
173431
|
+
*/
|
|
173432
|
+
static inverseMetricDistance(distance) {
|
|
173433
|
+
return (Math.abs(distance) <= Geometry.smallMetricDistance) ? undefined : 1.0 / distance;
|
|
173410
173434
|
}
|
|
173411
173435
|
/**
|
|
173412
|
-
*
|
|
173413
|
-
*
|
|
173436
|
+
* Return the inverse of `distanceSquared`.
|
|
173437
|
+
* * If `distanceSquared ` magnitude is smaller than `smallMetricDistanceSquared` (i.e. distanceSquared is large
|
|
173438
|
+
* enough for safe division), then return `1/distanceSquared `. Otherwise return `undefined`.
|
|
173414
173439
|
*/
|
|
173415
|
-
static inverseMetricDistanceSquared(
|
|
173416
|
-
return (Math.abs(
|
|
173440
|
+
static inverseMetricDistanceSquared(distanceSquared) {
|
|
173441
|
+
return (Math.abs(distanceSquared) <= Geometry.smallMetricDistanceSquared) ? undefined : 1.0 / distanceSquared;
|
|
173417
173442
|
}
|
|
173418
173443
|
/**
|
|
173419
|
-
* Boolean test for metric coordinate near-equality (i.e., if x and y are almost equal)
|
|
173420
|
-
* `Geometry.smallMetricDistance` is used
|
|
173444
|
+
* Boolean test for metric coordinate near-equality (i.e., if `x` and `y` are almost equal) using `tolerance`.
|
|
173445
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
173421
173446
|
*/
|
|
173422
|
-
static isSameCoordinate(x, y,
|
|
173423
|
-
|
|
173424
|
-
|
|
173425
|
-
|
|
173447
|
+
static isSameCoordinate(x, y, tolerance = Geometry.smallMetricDistance) {
|
|
173448
|
+
let d = x - y;
|
|
173449
|
+
if (d < 0)
|
|
173450
|
+
d = -d;
|
|
173451
|
+
return d <= tolerance;
|
|
173426
173452
|
}
|
|
173427
|
-
/**
|
|
173453
|
+
/**
|
|
173454
|
+
* Boolean test for metric coordinate near-equality (i.e., if `x` and `y` are almost equal) using
|
|
173455
|
+
* `tolerance = toleranceFactor * smallMetricDistance`
|
|
173456
|
+
* */
|
|
173428
173457
|
static isSameCoordinateWithToleranceFactor(x, y, toleranceFactor) {
|
|
173429
173458
|
return Geometry.isSameCoordinate(x, y, toleranceFactor * Geometry.smallMetricDistance);
|
|
173430
173459
|
}
|
|
173431
|
-
/**
|
|
173432
|
-
|
|
173460
|
+
/**
|
|
173461
|
+
* Boolean test for metric coordinate pair near-equality (i.e., if `x0` and `x1` are almost equal
|
|
173462
|
+
* and `y0` and `y1` are almost equal) using `tolerance`.
|
|
173463
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
173464
|
+
*/
|
|
173465
|
+
static isSameCoordinateXY(x0, y0, x1, y1, tolerance = Geometry.smallMetricDistance) {
|
|
173433
173466
|
let d = x1 - x0;
|
|
173434
173467
|
if (d < 0)
|
|
173435
173468
|
d = -d;
|
|
173436
|
-
if (d >
|
|
173469
|
+
if (d > tolerance)
|
|
173437
173470
|
return false;
|
|
173438
173471
|
d = y1 - y0;
|
|
173439
173472
|
if (d < 0)
|
|
173440
173473
|
d = -d;
|
|
173441
|
-
return d
|
|
173442
|
-
}
|
|
173443
|
-
/**
|
|
173444
|
-
|
|
173445
|
-
|
|
173446
|
-
|
|
173447
|
-
|
|
173448
|
-
static
|
|
173449
|
-
|
|
173450
|
-
|
|
173451
|
-
|
|
173452
|
-
|
|
173453
|
-
|
|
173454
|
-
|
|
173455
|
-
|
|
173456
|
-
|
|
173457
|
-
|
|
173458
|
-
|
|
173459
|
-
|
|
173460
|
-
|
|
173461
|
-
|
|
173462
|
-
|
|
173474
|
+
return d <= tolerance;
|
|
173475
|
+
}
|
|
173476
|
+
/**
|
|
173477
|
+
* Boolean test for squared metric coordinate near-equality (i.e., if `sqrt(x)` and `sqrt(y)` are
|
|
173478
|
+
* almost equal) using `tolerance`.
|
|
173479
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
173480
|
+
*/
|
|
173481
|
+
static isSameCoordinateSquared(x, y, tolerance = Geometry.smallMetricDistance) {
|
|
173482
|
+
return Math.abs(Math.sqrt(x) - Math.sqrt(y)) <= tolerance;
|
|
173483
|
+
}
|
|
173484
|
+
/**
|
|
173485
|
+
* Boolean test for small `dataA.distance(dataB)` within `tolerance`.
|
|
173486
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
173487
|
+
*/
|
|
173488
|
+
static isSamePoint3d(dataA, dataB, tolerance = Geometry.smallMetricDistance) {
|
|
173489
|
+
return dataA.distance(dataB) <= tolerance;
|
|
173490
|
+
}
|
|
173491
|
+
/**
|
|
173492
|
+
* Boolean test for small xyz-distance within `tolerance`.
|
|
173493
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
173494
|
+
* * Note that Point3d and Vector3d are both derived from XYZ, so this method tolerates mixed types.
|
|
173495
|
+
*/
|
|
173496
|
+
static isSameXYZ(dataA, dataB, tolerance = Geometry.smallMetricDistance) {
|
|
173497
|
+
return dataA.distance(dataB) <= tolerance;
|
|
173498
|
+
}
|
|
173499
|
+
/**
|
|
173500
|
+
* Boolean test for small xy-distance (ignoring z) within `tolerance`.
|
|
173501
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
173502
|
+
*/
|
|
173503
|
+
static isSamePoint3dXY(dataA, dataB, tolerance = Geometry.smallMetricDistance) {
|
|
173504
|
+
return dataA.distanceXY(dataB) <= tolerance;
|
|
173505
|
+
}
|
|
173506
|
+
/**
|
|
173507
|
+
* Boolean test for small xyz-distance within `tolerance`.
|
|
173508
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
173509
|
+
*/
|
|
173510
|
+
static isSameVector3d(dataA, dataB, tolerance = Geometry.smallMetricDistance) {
|
|
173511
|
+
return dataA.distance(dataB) <= tolerance;
|
|
173512
|
+
}
|
|
173513
|
+
/**
|
|
173514
|
+
* Boolean test for small xy-distance within `tolerance`.
|
|
173515
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
173516
|
+
*/
|
|
173517
|
+
static isSamePoint2d(dataA, dataB, tolerance = Geometry.smallMetricDistance) {
|
|
173518
|
+
return dataA.distance(dataB) <= tolerance;
|
|
173519
|
+
}
|
|
173520
|
+
/**
|
|
173521
|
+
* Boolean test for small xy-distance within `tolerance`.
|
|
173522
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
173523
|
+
*/
|
|
173524
|
+
static isSameVector2d(dataA, dataB, tolerance = Geometry.smallMetricDistance) {
|
|
173525
|
+
return dataA.distance(dataB) <= tolerance;
|
|
173526
|
+
}
|
|
173527
|
+
/**
|
|
173528
|
+
* Lexical comparison of (a.x, a.y) and (b.x, b.y) with x as first test and y as second (z is ignored).
|
|
173463
173529
|
* * This is appropriate for a horizontal sweep in the plane.
|
|
173464
173530
|
*/
|
|
173465
173531
|
static lexicalXYLessThan(a, b) {
|
|
@@ -173474,7 +173540,7 @@ class Geometry {
|
|
|
173474
173540
|
return 0;
|
|
173475
173541
|
}
|
|
173476
173542
|
/**
|
|
173477
|
-
* Lexical comparison of (a.x,a.y) (b.x,b.y) with y as first test
|
|
173543
|
+
* Lexical comparison of (a.x, a.y) and (b.x, b.y) with y as first test and x as second (z is ignored).
|
|
173478
173544
|
* * This is appropriate for a vertical sweep in the plane.
|
|
173479
173545
|
*/
|
|
173480
173546
|
static lexicalYXLessThan(a, b) {
|
|
@@ -173488,9 +173554,7 @@ class Geometry {
|
|
|
173488
173554
|
return 1;
|
|
173489
173555
|
return 0;
|
|
173490
173556
|
}
|
|
173491
|
-
/**
|
|
173492
|
-
* Lexical test, based on x first, y second, z third.
|
|
173493
|
-
*/
|
|
173557
|
+
/** 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. */
|
|
173494
173558
|
static lexicalXYZLessThan(a, b) {
|
|
173495
173559
|
if (a.x < b.x)
|
|
173496
173560
|
return -1;
|
|
@@ -173506,19 +173570,21 @@ class Geometry {
|
|
|
173506
173570
|
return 1;
|
|
173507
173571
|
return 0;
|
|
173508
173572
|
}
|
|
173509
|
-
/**
|
|
173573
|
+
/**
|
|
173574
|
+
* Test if `value` is small compared to `smallFraction`.
|
|
173510
173575
|
* * This is appropriate if `value` is know to be a typical 0..1 fraction.
|
|
173511
173576
|
*/
|
|
173512
173577
|
static isSmallRelative(value) {
|
|
173513
|
-
return Math.abs(value) < Geometry.
|
|
173578
|
+
return Math.abs(value) < Geometry.smallFraction;
|
|
173514
173579
|
}
|
|
173515
173580
|
/** Test if `value` is small compared to `smallAngleRadians` */
|
|
173516
173581
|
static isSmallAngleRadians(value) {
|
|
173517
173582
|
return Math.abs(value) < Geometry.smallAngleRadians;
|
|
173518
173583
|
}
|
|
173519
|
-
/**
|
|
173520
|
-
*
|
|
173521
|
-
|
|
173584
|
+
/**
|
|
173585
|
+
* Returns `true` if both values are `undefined` or if both are defined and almost equal within tolerance.
|
|
173586
|
+
* If one is `undefined` and the other is not, then `false` is returned.
|
|
173587
|
+
*/
|
|
173522
173588
|
static isAlmostEqualOptional(a, b, tolerance) {
|
|
173523
173589
|
if (a !== undefined && b !== undefined) {
|
|
173524
173590
|
if (Math.abs(a - b) > tolerance)
|
|
@@ -173530,44 +173596,43 @@ class Geometry {
|
|
|
173530
173596
|
}
|
|
173531
173597
|
return true;
|
|
173532
173598
|
}
|
|
173533
|
-
/**
|
|
173534
|
-
*
|
|
173535
|
-
|
|
173536
|
-
|
|
173599
|
+
/**
|
|
173600
|
+
* Toleranced equality test using tolerance `tolerance * ( 1 + abs(a) + abs(b) )`.
|
|
173601
|
+
* * `Geometry.smallAngleRadians` is used if tolerance is `undefined`.
|
|
173602
|
+
*/
|
|
173603
|
+
static isAlmostEqualNumber(a, b, tolerance = Geometry.smallAngleRadians) {
|
|
173537
173604
|
const sumAbs = 1.0 + Math.abs(a) + Math.abs(b);
|
|
173538
|
-
return Math.abs(a - b) <=
|
|
173605
|
+
return Math.abs(a - b) <= tolerance * sumAbs;
|
|
173539
173606
|
}
|
|
173540
|
-
/**
|
|
173541
|
-
*
|
|
173542
|
-
|
|
173543
|
-
|
|
173544
|
-
|
|
173545
|
-
const
|
|
173546
|
-
return Math.abs(a.x - b.x) <=
|
|
173607
|
+
/**
|
|
173608
|
+
* Toleranced equality test using tolerance `tolerance * ( 1 + abs(a.x) + abs(a.y) + abs(b.x) + abs(b.y) )`.
|
|
173609
|
+
* * `Geometry.smallAngleRadians` is used if tolerance is `undefined`.
|
|
173610
|
+
*/
|
|
173611
|
+
static isAlmostEqualXAndY(a, b, tolerance = Geometry.smallAngleRadians) {
|
|
173612
|
+
const tol = tolerance * (1.0 + Math.abs(a.x) + Math.abs(b.x) + Math.abs(a.y) + Math.abs(b.y));
|
|
173613
|
+
return (Math.abs(a.x - b.x) <= tol) && (Math.abs(a.y - b.y) <= tol);
|
|
173547
173614
|
}
|
|
173548
173615
|
/**
|
|
173549
|
-
* Toleranced equality test
|
|
173550
|
-
*
|
|
173616
|
+
* Toleranced equality test using caller-supplied `tolerance`.
|
|
173617
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
173551
173618
|
*/
|
|
173552
|
-
static isDistanceWithinTol(distance,
|
|
173553
|
-
|
|
173554
|
-
return Math.abs(distance) <= Math.abs(tol);
|
|
173555
|
-
return Math.abs(distance) <= Geometry.smallMetricDistance;
|
|
173619
|
+
static isDistanceWithinTol(distance, tolerance = Geometry.smallMetricDistance) {
|
|
173620
|
+
return Math.abs(distance) <= tolerance;
|
|
173556
173621
|
}
|
|
173557
|
-
/** Toleranced equality test
|
|
173622
|
+
/** Toleranced equality test using `smallMetricDistance` tolerance. */
|
|
173558
173623
|
static isSmallMetricDistance(distance) {
|
|
173559
173624
|
return Math.abs(distance) <= Geometry.smallMetricDistance;
|
|
173560
173625
|
}
|
|
173561
|
-
/** Toleranced equality
|
|
173626
|
+
/** Toleranced equality test using `smallMetricDistanceSquared` tolerance. */
|
|
173562
173627
|
static isSmallMetricDistanceSquared(distanceSquared) {
|
|
173563
173628
|
return Math.abs(distanceSquared) <= Geometry.smallMetricDistanceSquared;
|
|
173564
173629
|
}
|
|
173565
173630
|
/**
|
|
173566
173631
|
* Return `axis modulo 3` with proper handling of negative indices
|
|
173567
173632
|
* ..., -3:x, -2:y, -1:z, 0:x, 1:y, 2:z, 3:x, 4:y, 5:z, 6:x, 7:y, 8:z, ...
|
|
173568
|
-
|
|
173633
|
+
*/
|
|
173569
173634
|
static cyclic3dAxis(axis) {
|
|
173570
|
-
/* Direct test for the most common cases
|
|
173635
|
+
/* Direct test for the most common cases to avoid more expensive modulo operation */
|
|
173571
173636
|
if (axis >= 0) {
|
|
173572
173637
|
if (axis < 3)
|
|
173573
173638
|
return axis;
|
|
@@ -173580,7 +173645,8 @@ class Geometry {
|
|
|
173580
173645
|
return j;
|
|
173581
173646
|
return 2 - ((-axis - 1) % 3);
|
|
173582
173647
|
}
|
|
173583
|
-
/**
|
|
173648
|
+
/**
|
|
173649
|
+
* Return the `AxisOrder` for which `axisIndex` is the first named axis.
|
|
173584
173650
|
* * `axisIndex === 0` returns `AxisOrder.XYZ`
|
|
173585
173651
|
* * `axisIndex === 1` returns `AxisOrder.YZX`
|
|
173586
173652
|
* * `axisIndex === 2` returns `AxisOrder.ZXY`
|
|
@@ -173594,32 +173660,55 @@ class Geometry {
|
|
|
173594
173660
|
return AxisOrder.ZXY;
|
|
173595
173661
|
return Geometry.axisIndexToRightHandedAxisOrder(Geometry.cyclic3dAxis(axisIndex));
|
|
173596
173662
|
}
|
|
173597
|
-
/** Return the largest
|
|
173598
|
-
static
|
|
173599
|
-
|
|
173663
|
+
/** Return the largest signed value among `a`, `b`, and `c` */
|
|
173664
|
+
static maxXYZ(a, b, c) {
|
|
173665
|
+
let max = a;
|
|
173666
|
+
if (b > max)
|
|
173667
|
+
max = b;
|
|
173668
|
+
if (c > max)
|
|
173669
|
+
max = c;
|
|
173670
|
+
return max;
|
|
173600
173671
|
}
|
|
173601
|
-
/** Return the
|
|
173672
|
+
/** Return the smallest signed value among `a`, `b`, and `c` */
|
|
173673
|
+
static minXYZ(a, b, c) {
|
|
173674
|
+
let min = a;
|
|
173675
|
+
if (b < min)
|
|
173676
|
+
min = b;
|
|
173677
|
+
if (c < min)
|
|
173678
|
+
min = c;
|
|
173679
|
+
return min;
|
|
173680
|
+
}
|
|
173681
|
+
/** Return the largest signed value among `a` and `b` */
|
|
173682
|
+
static maxXY(a, b) {
|
|
173683
|
+
let max = a;
|
|
173684
|
+
if (b > max)
|
|
173685
|
+
max = b;
|
|
173686
|
+
return max;
|
|
173687
|
+
}
|
|
173688
|
+
/** Return the smallest signed value among `a` and `b` */
|
|
173689
|
+
static minXY(a, b) {
|
|
173690
|
+
let min = a;
|
|
173691
|
+
if (b < min)
|
|
173692
|
+
min = b;
|
|
173693
|
+
return min;
|
|
173694
|
+
}
|
|
173695
|
+
/** Return the largest absolute value among `x`, `y`, and `z` */
|
|
173602
173696
|
static maxAbsXYZ(x, y, z) {
|
|
173603
173697
|
return Geometry.maxXYZ(Math.abs(x), Math.abs(y), Math.abs(z));
|
|
173604
173698
|
}
|
|
173605
|
-
/** Return the largest absolute
|
|
173699
|
+
/** Return the largest absolute value among `x` and `y` */
|
|
173606
173700
|
static maxAbsXY(x, y) {
|
|
173607
173701
|
return Geometry.maxXY(Math.abs(x), Math.abs(y));
|
|
173608
173702
|
}
|
|
173609
|
-
/** Return the largest
|
|
173610
|
-
static
|
|
173611
|
-
|
|
173612
|
-
if (b > q)
|
|
173613
|
-
q = b;
|
|
173614
|
-
if (c > q)
|
|
173615
|
-
q = c;
|
|
173616
|
-
return q;
|
|
173703
|
+
/** Return the largest absolute distance from `a` to either of `b0` or `b1` */
|
|
173704
|
+
static maxAbsDiff(a, b0, b1) {
|
|
173705
|
+
return Math.max(Math.abs(a - b0), Math.abs(a - b1));
|
|
173617
173706
|
}
|
|
173618
173707
|
/**
|
|
173619
|
-
* Examine the
|
|
173620
|
-
* * If x is negative, return outNegative
|
|
173621
|
-
* * If x is true zero, return outZero
|
|
173622
|
-
* * If x is positive, return outPositive
|
|
173708
|
+
* Examine the sign of `x`.
|
|
173709
|
+
* * If `x` is negative, return `outNegative`
|
|
173710
|
+
* * If `x` is true zero, return `outZero`
|
|
173711
|
+
* * If `x` is positive, return `outPositive`
|
|
173623
173712
|
*/
|
|
173624
173713
|
static split3WaySign(x, outNegative, outZero, outPositive) {
|
|
173625
173714
|
if (x < 0)
|
|
@@ -173641,45 +173730,40 @@ class Geometry {
|
|
|
173641
173730
|
return -1;
|
|
173642
173731
|
return 0;
|
|
173643
173732
|
}
|
|
173644
|
-
/** Return the
|
|
173645
|
-
static
|
|
173646
|
-
|
|
173647
|
-
if (b > q)
|
|
173648
|
-
q = b;
|
|
173649
|
-
return q;
|
|
173650
|
-
}
|
|
173651
|
-
/** Return the smallest signed value among a, b */
|
|
173652
|
-
static minXY(a, b) {
|
|
173653
|
-
let q = a;
|
|
173654
|
-
if (b < q)
|
|
173655
|
-
q = b;
|
|
173656
|
-
return q;
|
|
173733
|
+
/** Return the square of x */
|
|
173734
|
+
static square(x) {
|
|
173735
|
+
return x * x;
|
|
173657
173736
|
}
|
|
173658
|
-
/**
|
|
173737
|
+
/**
|
|
173738
|
+
* Return the hypotenuse (i.e., `sqrt(x*x + y*y)`).
|
|
173739
|
+
* * This is much faster than `Math.hypot(x,y)`.
|
|
173740
|
+
*/
|
|
173659
173741
|
static hypotenuseXY(x, y) {
|
|
173660
173742
|
return Math.sqrt(x * x + y * y);
|
|
173661
173743
|
}
|
|
173662
|
-
/** Return the squared
|
|
173744
|
+
/** Return the squared hypotenuse (i.e., `x*x + y*y`). */
|
|
173663
173745
|
static hypotenuseSquaredXY(x, y) {
|
|
173664
173746
|
return x * x + y * y;
|
|
173665
173747
|
}
|
|
173666
|
-
/**
|
|
173667
|
-
|
|
173668
|
-
|
|
173669
|
-
|
|
173670
|
-
/** Return the hypotenuse `sqrt(x*x + y*y + z*z)`. This is much faster than `Math.hypot(x,y,z)`. */
|
|
173748
|
+
/**
|
|
173749
|
+
* Return the hypotenuse (i.e., `sqrt(x*x + y*y + z*z)`).
|
|
173750
|
+
* * This is much faster than `Math.hypot(x,y,z)`.
|
|
173751
|
+
*/
|
|
173671
173752
|
static hypotenuseXYZ(x, y, z) {
|
|
173672
173753
|
return Math.sqrt(x * x + y * y + z * z);
|
|
173673
173754
|
}
|
|
173674
|
-
/** Return the squared hypotenuse `
|
|
173755
|
+
/** Return the squared hypotenuse (i.e., `x*x + y*y + z*z`). */
|
|
173675
173756
|
static hypotenuseSquaredXYZ(x, y, z) {
|
|
173676
173757
|
return x * x + y * y + z * z;
|
|
173677
173758
|
}
|
|
173678
|
-
/**
|
|
173759
|
+
/**
|
|
173760
|
+
* Return the full 4d hypotenuse (i.e., `sqrt(x*x + y*y + z*z + w*w)`).
|
|
173761
|
+
* * This is much faster than `Math.hypot(x,y,z,w)`.
|
|
173762
|
+
*/
|
|
173679
173763
|
static hypotenuseXYZW(x, y, z, w) {
|
|
173680
173764
|
return Math.sqrt(x * x + y * y + z * z + w * w);
|
|
173681
173765
|
}
|
|
173682
|
-
/** Return the squared hypotenuse `
|
|
173766
|
+
/** Return the squared hypotenuse (i.e., `x*x + y*y + z*z + w*w`). */
|
|
173683
173767
|
static hypotenuseSquaredXYZW(x, y, z, w) {
|
|
173684
173768
|
return x * x + y * y + z * z + w * w;
|
|
173685
173769
|
}
|
|
@@ -173705,8 +173789,8 @@ class Geometry {
|
|
|
173705
173789
|
static distanceXYZXYZ(x0, y0, z0, x1, y1, z1) {
|
|
173706
173790
|
return Geometry.hypotenuseXYZ(x1 - x0, y1 - y0, z1 - z0);
|
|
173707
173791
|
}
|
|
173708
|
-
/**
|
|
173709
|
-
*
|
|
173792
|
+
/**
|
|
173793
|
+
* Returns the triple product of 3 vectors provided as x,y,z number sequences.
|
|
173710
173794
|
* * The triple product is the determinant of the 3x3 matrix with the 9 numbers (3 vectors placed in 3 rows).
|
|
173711
173795
|
* * The triple product is positive if the 3 vectors form a right handed coordinate system.
|
|
173712
173796
|
* * The triple product is negative if the 3 vectors form a left handed coordinate system.
|
|
@@ -173714,170 +173798,196 @@ class Geometry {
|
|
|
173714
173798
|
* * U dot (V cross W)
|
|
173715
173799
|
* * V dot (W cross U)
|
|
173716
173800
|
* * W dot (U cross V)
|
|
173717
|
-
* *
|
|
173718
|
-
* *
|
|
173719
|
-
* *
|
|
173720
|
-
* *
|
|
173801
|
+
* * -U dot (W cross V)
|
|
173802
|
+
* * -V dot (U cross W)
|
|
173803
|
+
* * -W dot (V cross U)
|
|
173804
|
+
* * Note the negative in the last 3 formulas. Reversing cross product order changes the sign.
|
|
173805
|
+
* * The triple product is 6 times the (signed) volume of the tetrahedron with the three vectors as edges from a
|
|
173806
|
+
* common vertex.
|
|
173721
173807
|
*/
|
|
173722
173808
|
static tripleProduct(ux, uy, uz, vx, vy, vz, wx, wy, wz) {
|
|
173723
173809
|
return ux * (vy * wz - vz * wy)
|
|
173724
173810
|
+ uy * (vz * wx - vx * wz)
|
|
173725
173811
|
+ uz * (vx * wy - vy * wx);
|
|
173726
173812
|
}
|
|
173727
|
-
/** Returns the determinant of the 4x4 matrix unrolled as the 16 parameters
|
|
173728
|
-
*/
|
|
173813
|
+
/** Returns the determinant of the 4x4 matrix unrolled as the 16 parameters */
|
|
173729
173814
|
static determinant4x4(xx, xy, xz, xw, yx, yy, yz, yw, zx, zy, zz, zw, wx, wy, wz, ww) {
|
|
173730
173815
|
return xx * this.tripleProduct(yy, yz, yw, zy, zz, zw, wy, wz, ww)
|
|
173731
173816
|
- yx * this.tripleProduct(xy, xz, xw, zy, zz, zw, wy, wz, ww)
|
|
173732
173817
|
+ zx * this.tripleProduct(xy, xz, xw, yy, yz, yw, wy, wz, ww)
|
|
173733
173818
|
- wx * this.tripleProduct(xy, xz, xw, yy, yz, yw, zy, zz, zw);
|
|
173734
173819
|
}
|
|
173735
|
-
/** Return the mean curvature for two radii, with 0 radius implying 0 curvature */
|
|
173736
|
-
static meanCurvatureOfRadii(r0, r1) {
|
|
173737
|
-
return 0.5 * (this.safeDivideFraction(1, r0, 0) + this.safeDivideFraction(1, r1, 0));
|
|
173738
|
-
}
|
|
173739
173820
|
/**
|
|
173740
|
-
|
|
173741
|
-
|
|
173742
|
-
|
|
173743
|
-
|
|
173744
|
-
|
|
173745
|
-
* @param vy second derivative y component
|
|
173746
|
-
* @param vz second derivative z component
|
|
173747
|
-
*/
|
|
173748
|
-
static curvatureMagnitude(ux, uy, uz, vx, vy, vz) {
|
|
173749
|
-
let q = uy * vz - uz * vy;
|
|
173750
|
-
let sum = q * q;
|
|
173751
|
-
q = uz * vx - ux * vz;
|
|
173752
|
-
sum += q * q;
|
|
173753
|
-
q = ux * vy - uy * vx;
|
|
173754
|
-
sum += q * q;
|
|
173755
|
-
const a = Math.sqrt(ux * ux + uy * uy + uz * uz);
|
|
173756
|
-
const b = Math.sqrt(sum);
|
|
173757
|
-
// (sum and a are both nonnegative)
|
|
173758
|
-
const aaa = a * a * a;
|
|
173759
|
-
// radius of curvature = aaa / b;
|
|
173760
|
-
// curvature = b/aaa
|
|
173761
|
-
const tol = Geometry.smallAngleRadians;
|
|
173762
|
-
if (aaa > tol * b)
|
|
173763
|
-
return b / aaa;
|
|
173764
|
-
return 0; // hm.. maybe should be infinite?
|
|
173765
|
-
}
|
|
173766
|
-
/** Returns the determinant of 3x3 matrix with x and y rows taken from 3 points, third row from corresponding numbers.
|
|
173767
|
-
*
|
|
173821
|
+
* Returns the determinant of 3x3 matrix with first and second rows created from the 3 xy points and the third
|
|
173822
|
+
* row created from the 3 numbers:
|
|
173823
|
+
* [columnA.x columnB.x columnC.x]
|
|
173824
|
+
* [columnA.y columnB.y columnC.y]
|
|
173825
|
+
* [ weightA weightB weightC ]
|
|
173768
173826
|
*/
|
|
173769
173827
|
static tripleProductXYW(columnA, weightA, columnB, weightB, columnC, weightC) {
|
|
173770
173828
|
return Geometry.tripleProduct(columnA.x, columnB.x, columnC.x, columnA.y, columnB.y, columnC.y, weightA, weightB, weightC);
|
|
173771
173829
|
}
|
|
173772
|
-
/**
|
|
173773
|
-
*
|
|
173830
|
+
/**
|
|
173831
|
+
* Returns the determinant of 3x3 matrix columns created by the given `Point4d` ignoring the z part:
|
|
173832
|
+
* [columnA.x columnB.x columnC.x]
|
|
173833
|
+
* [columnA.y columnB.y columnC.y]
|
|
173834
|
+
* [columnA.w columnB.w columnC.w]
|
|
173774
173835
|
*/
|
|
173775
173836
|
static tripleProductPoint4dXYW(columnA, columnB, columnC) {
|
|
173776
173837
|
return Geometry.tripleProduct(columnA.x, columnB.x, columnC.x, columnA.y, columnB.y, columnC.y, columnA.w, columnB.w, columnC.w);
|
|
173777
173838
|
}
|
|
173778
|
-
/** 2D cross product of vectors
|
|
173839
|
+
/** 2D cross product of vectors with the vectors presented as numbers. */
|
|
173779
173840
|
static crossProductXYXY(ux, uy, vx, vy) {
|
|
173780
173841
|
return ux * vy - uy * vx;
|
|
173781
173842
|
}
|
|
173782
|
-
/** 3D cross product of vectors
|
|
173843
|
+
/** 3D cross product of vectors with the vectors presented as numbers. */
|
|
173783
173844
|
static crossProductXYZXYZ(ux, uy, uz, vx, vy, vz, result) {
|
|
173784
173845
|
return _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Vector3d.create(uy * vz - uz * vy, uz * vx - ux * vz, ux * vy - uy * vx, result);
|
|
173785
173846
|
}
|
|
173786
|
-
/**
|
|
173847
|
+
/** Magnitude of 3D cross product of vectors with the vectors presented as numbers. */
|
|
173787
173848
|
static crossProductMagnitude(ux, uy, uz, vx, vy, vz) {
|
|
173788
173849
|
return Geometry.hypotenuseXYZ(uy * vz - uz * vy, uz * vx - ux * vz, ux * vy - uy * vx);
|
|
173789
173850
|
}
|
|
173790
|
-
/**
|
|
173851
|
+
/** 2D dot product of vectors with the vectors presented as numbers. */
|
|
173852
|
+
static dotProductXYXY(ux, uy, vx, vy) {
|
|
173853
|
+
return ux * vx + uy * vy;
|
|
173854
|
+
}
|
|
173855
|
+
/** 3D dot product of vectors with the vectors presented as numbers. */
|
|
173791
173856
|
static dotProductXYZXYZ(ux, uy, uz, vx, vy, vz) {
|
|
173792
173857
|
return ux * vx + uy * vy + uz * vz;
|
|
173793
173858
|
}
|
|
173794
|
-
/**
|
|
173795
|
-
|
|
173796
|
-
|
|
173859
|
+
/**
|
|
173860
|
+
* Return the mean curvature for two radii.
|
|
173861
|
+
* * Curvature is the reciprocal of radius.
|
|
173862
|
+
* * 0 radius implies 0 curvature.
|
|
173863
|
+
* @param r0 first radius
|
|
173864
|
+
* @param r1 second radius
|
|
173865
|
+
*/
|
|
173866
|
+
static meanCurvatureOfRadii(r0, r1) {
|
|
173867
|
+
return 0.5 * (this.safeDivideFraction(1, r0, 0) + this.safeDivideFraction(1, r1, 0));
|
|
173797
173868
|
}
|
|
173798
173869
|
/**
|
|
173799
|
-
*
|
|
173800
|
-
* *
|
|
173801
|
-
*
|
|
173802
|
-
*
|
|
173803
|
-
* @param
|
|
173870
|
+
* Returns curvature from the first and second derivative vectors.
|
|
173871
|
+
* * If U is the first derivative and V is the second derivative, the curvature is defined as:
|
|
173872
|
+
* * `|| U x V || / || U ||^3`.
|
|
173873
|
+
* * Math details can be found at https://en.wikipedia.org/wiki/Curvature#General_expressions
|
|
173874
|
+
* @param ux first derivative x component
|
|
173875
|
+
* @param uy first derivative y component
|
|
173876
|
+
* @param uz first derivative z component
|
|
173877
|
+
* @param vx second derivative x component
|
|
173878
|
+
* @param vy second derivative y component
|
|
173879
|
+
* @param vz second derivative z component
|
|
173880
|
+
*/
|
|
173881
|
+
static curvatureMagnitude(ux, uy, uz, vx, vy, vz) {
|
|
173882
|
+
let q = uy * vz - uz * vy;
|
|
173883
|
+
let sum = q * q;
|
|
173884
|
+
q = uz * vx - ux * vz;
|
|
173885
|
+
sum += q * q;
|
|
173886
|
+
q = ux * vy - uy * vx;
|
|
173887
|
+
sum += q * q;
|
|
173888
|
+
const magUxV = Math.sqrt(sum);
|
|
173889
|
+
const magU = Math.sqrt(ux * ux + uy * uy + uz * uz);
|
|
173890
|
+
const magUCubed = magU * magU * magU;
|
|
173891
|
+
if (magUCubed > Geometry.smallAngleRadians * magUxV)
|
|
173892
|
+
return magUxV / magUCubed;
|
|
173893
|
+
return 0;
|
|
173894
|
+
}
|
|
173895
|
+
/**
|
|
173896
|
+
* Clamp to (min(a,b), max(a,b)).
|
|
173897
|
+
* * Always returns a number between `a` and `b`.
|
|
173898
|
+
* @param value value to clamp
|
|
173899
|
+
* @param a smallest allowed output if `a < b` or largest allowed output if `a > b`
|
|
173900
|
+
* @param b largest allowed output if `a < b` or smallest allowed output if `a > b`
|
|
173804
173901
|
*/
|
|
173805
|
-
static clampToStartEnd(
|
|
173902
|
+
static clampToStartEnd(value, a, b) {
|
|
173806
173903
|
if (a > b)
|
|
173807
|
-
return Geometry.clampToStartEnd(
|
|
173808
|
-
if (
|
|
173904
|
+
return Geometry.clampToStartEnd(value, b, a);
|
|
173905
|
+
if (value < a)
|
|
173809
173906
|
return a;
|
|
173810
|
-
if (b <
|
|
173907
|
+
if (b < value)
|
|
173811
173908
|
return b;
|
|
173812
|
-
return
|
|
173909
|
+
return value;
|
|
173813
173910
|
}
|
|
173814
173911
|
/**
|
|
173815
|
-
* Clamp value to (min,max) with no test for order of (min,max)
|
|
173912
|
+
* Clamp value to (min, max) with no test for order of (min, max).
|
|
173913
|
+
* * Always returns a number between `min` and `max`.
|
|
173816
173914
|
* @param value value to clamp
|
|
173817
173915
|
* @param min smallest allowed output
|
|
173818
|
-
* @param max largest allowed
|
|
173916
|
+
* @param max largest allowed output
|
|
173819
173917
|
*/
|
|
173820
|
-
static clamp(value, min, max) {
|
|
173821
|
-
|
|
173918
|
+
static clamp(value, min, max) {
|
|
173919
|
+
return Math.max(min, Math.min(max, value));
|
|
173920
|
+
}
|
|
173921
|
+
/** If given a `value`, return it. If given `undefined`, return `defaultValue`. */
|
|
173822
173922
|
static resolveNumber(value, defaultValue = 0) {
|
|
173823
173923
|
return value !== undefined ? value : defaultValue;
|
|
173824
173924
|
}
|
|
173825
|
-
/** If given a value
|
|
173925
|
+
/** If given a `value`, return it. If given `undefined`, return `defaultValue`. */
|
|
173826
173926
|
static resolveValue(value, defaultValue) {
|
|
173827
173927
|
return value !== undefined ? value : defaultValue;
|
|
173828
173928
|
}
|
|
173829
|
-
/** If given value matches
|
|
173929
|
+
/** If given `value` matches the `targetValue`, return `undefined`. Otherwise return the `value`. */
|
|
173830
173930
|
static resolveToUndefined(value, targetValue) {
|
|
173831
173931
|
return value === targetValue ? undefined : value;
|
|
173832
173932
|
}
|
|
173833
173933
|
/**
|
|
173834
|
-
* Simple interpolation between values
|
|
173835
|
-
* point for maximum accuracy.
|
|
173934
|
+
* Simple interpolation between values `a` and `b` with fraction `f`.
|
|
173836
173935
|
* * If `f = 0`, then `a` is returned and if `f = 1`, then `b` is returned.
|
|
173936
|
+
* * For maximum accuracy, we choose `a` or `b` as starting point based on fraction `f`.
|
|
173837
173937
|
*/
|
|
173838
173938
|
static interpolate(a, f, b) {
|
|
173839
173939
|
return f <= 0.5 ? a + f * (b - a) : b - (1.0 - f) * (b - a);
|
|
173840
173940
|
}
|
|
173841
173941
|
/**
|
|
173842
|
-
* Given an axisOrder (e.g. XYZ, YZX, etc) and an index
|
|
173843
|
-
* * For example, if axisOrder = XYZ
|
|
173844
|
-
* Y (or axis
|
|
173845
|
-
*
|
|
173846
|
-
*
|
|
173847
|
-
*
|
|
173848
|
-
*
|
|
173942
|
+
* Given an `axisOrder` (e.g. XYZ, YZX, etc) and an `index`, return the `axis` at the given index.
|
|
173943
|
+
* * For example, if `axisOrder = XYZ`, then for index 0 return `X` (or axis 0), for index 1 return
|
|
173944
|
+
* `Y` (or axis 1), and for index 2 return `Z` (or axis 2).
|
|
173945
|
+
* * Another example: if `axisOrder = ZXY`, then for index 0 return `Z` (or axis 2), for index 1 return
|
|
173946
|
+
* `X` (or axis 0), and for index 2 return `Y` (or axis 1).
|
|
173947
|
+
* * For indexes greater than 2 or smaller than 0, it return cyclic axis. See [[Geometry.cyclic3dAxis]]
|
|
173948
|
+
* for more info.
|
|
173949
|
+
*/
|
|
173849
173950
|
static axisOrderToAxis(order, index) {
|
|
173850
173951
|
const axis = order <= AxisOrder.ZXY ? order + index : (order - AxisOrder.XZY) - index;
|
|
173851
173952
|
return Geometry.cyclic3dAxis(axis);
|
|
173852
173953
|
}
|
|
173853
|
-
/**
|
|
173954
|
+
/**
|
|
173955
|
+
* Return `a` modulo `period`.
|
|
173956
|
+
* * Both `a` and `period` can be negative.
|
|
173957
|
+
* * This function can be faster than the `%` operator for the common case when `p > 0` and `-p < a < 2p`.
|
|
173958
|
+
*/
|
|
173854
173959
|
static modulo(a, period) {
|
|
173960
|
+
// period is negative
|
|
173855
173961
|
if (period <= 0) {
|
|
173856
173962
|
if (period === 0)
|
|
173857
173963
|
return a;
|
|
173858
173964
|
return -Geometry.modulo(-a, -period);
|
|
173859
173965
|
}
|
|
173966
|
+
// period is positive
|
|
173860
173967
|
if (a >= 0) {
|
|
173861
|
-
if (a < period)
|
|
173968
|
+
if (a < period) // "0 < a < period"
|
|
173862
173969
|
return a;
|
|
173863
|
-
if (a < 2 * period)
|
|
173970
|
+
if (a < 2 * period) // "0 < period < a < 2*period"
|
|
173864
173971
|
return a - period;
|
|
173865
173972
|
}
|
|
173866
|
-
else {
|
|
173867
|
-
a += period;
|
|
173973
|
+
else { // "-period < a < 0"
|
|
173974
|
+
a += period;
|
|
173868
173975
|
if (a > 0)
|
|
173869
173976
|
return a;
|
|
173870
173977
|
}
|
|
173978
|
+
// "0 < 2*period < a" or "a < -period < 0"
|
|
173871
173979
|
const m = Math.floor(a / period);
|
|
173872
173980
|
return a - m * period;
|
|
173873
173981
|
}
|
|
173874
|
-
/**
|
|
173875
|
-
static defined01(value) {
|
|
173982
|
+
/** Return 0 if the value is `undefined` and 1 if the value is defined. */
|
|
173983
|
+
static defined01(value) {
|
|
173984
|
+
return value === undefined ? 0 : 1;
|
|
173985
|
+
}
|
|
173876
173986
|
/**
|
|
173877
|
-
* Return `numerator` divided by `denominator
|
|
173987
|
+
* Return `numerator` divided by `denominator`.
|
|
173878
173988
|
* @param numerator the numerator
|
|
173879
173989
|
* @param denominator the denominator
|
|
173880
|
-
* @returns return `numerator/denominator` but if the ratio
|
|
173990
|
+
* @returns return `numerator/denominator` but if the ratio exceeds `Geometry.largeFractionResult`,
|
|
173881
173991
|
* return `undefined`.
|
|
173882
173992
|
*/
|
|
173883
173993
|
static conditionalDivideFraction(numerator, denominator) {
|
|
@@ -173889,76 +173999,105 @@ class Geometry {
|
|
|
173889
173999
|
* Return `numerator` divided by `denominator`.
|
|
173890
174000
|
* @param numerator the numerator
|
|
173891
174001
|
* @param denominator the denominator
|
|
173892
|
-
* @returns return `numerator/denominator` but if the ratio
|
|
174002
|
+
* @returns return `numerator/denominator` but if the ratio exceeds `Geometry.largeFractionResult`,
|
|
173893
174003
|
* return `defaultResult`.
|
|
173894
174004
|
*/
|
|
173895
174005
|
static safeDivideFraction(numerator, denominator, defaultResult) {
|
|
173896
|
-
const
|
|
173897
|
-
if (
|
|
173898
|
-
return
|
|
174006
|
+
const ratio = Geometry.conditionalDivideFraction(numerator, denominator);
|
|
174007
|
+
if (ratio !== undefined)
|
|
174008
|
+
return ratio;
|
|
173899
174009
|
return defaultResult;
|
|
173900
174010
|
}
|
|
173901
174011
|
/**
|
|
173902
|
-
* Return `numerator` divided by `denominator` (with a given `largestResult`)
|
|
174012
|
+
* Return `numerator` divided by `denominator` (with a given `largestResult`).
|
|
173903
174013
|
* @param numerator the numerator
|
|
173904
174014
|
* @param denominator the denominator
|
|
173905
|
-
* @param largestResult the ratio threshold
|
|
173906
|
-
* @returns return `numerator/denominator` but if the ratio
|
|
174015
|
+
* @param largestResult the ratio threshold
|
|
174016
|
+
* @returns return `numerator/denominator` but if the ratio exceeds `largestResult`, return `undefined`.
|
|
173907
174017
|
*/
|
|
173908
174018
|
static conditionalDivideCoordinate(numerator, denominator, largestResult = Geometry.largeCoordinateResult) {
|
|
173909
174019
|
if (Math.abs(denominator * largestResult) > Math.abs(numerator))
|
|
173910
174020
|
return numerator / denominator;
|
|
173911
174021
|
return undefined;
|
|
173912
174022
|
}
|
|
173913
|
-
/**
|
|
173914
|
-
*
|
|
173915
|
-
*
|
|
174023
|
+
/**
|
|
174024
|
+
* Return solution(s) of equation `constCoff + cosCoff*c + sinCoff*s = 0` for `c` and `s` with the
|
|
174025
|
+
* constraint `c*c + s*s = 1`.
|
|
174026
|
+
* * There could be 0, 1, or 2 solutions. Return `undefined` if there is no solution.
|
|
173916
174027
|
*/
|
|
173917
174028
|
static solveTrigForm(constCoff, cosCoff, sinCoff) {
|
|
173918
|
-
|
|
173919
|
-
|
|
173920
|
-
|
|
173921
|
-
|
|
173922
|
-
|
|
173923
|
-
|
|
173924
|
-
|
|
173925
|
-
|
|
173926
|
-
|
|
173927
|
-
|
|
173928
|
-
|
|
173929
|
-
|
|
173930
|
-
|
|
173931
|
-
|
|
173932
|
-
|
|
173933
|
-
|
|
173934
|
-
|
|
173935
|
-
|
|
173936
|
-
|
|
173937
|
-
|
|
173938
|
-
|
|
173939
|
-
|
|
173940
|
-
|
|
174029
|
+
/**
|
|
174030
|
+
* Solutions can be found by finding the intersection of line "ax + by + d = 0" and unit circle "x^2 + y^2 = 1".
|
|
174031
|
+
* From the line equation we have "y = (-ax - d) / b". By replacing this into the circle equation we get
|
|
174032
|
+
* "x^2 + (ax+d)^2/b^2 = 1". If we solve this by quadratic formula we get
|
|
174033
|
+
* x = (-ad +- b*sqrt(a^2+b^2-d^2)) / (a^2+b^2)
|
|
174034
|
+
* y = (-ad -+ a*sqrt(a^2+b^2-d^2)) / (a^2+b^2)
|
|
174035
|
+
*
|
|
174036
|
+
* If "a^2+b^2-d^2 > 0" then there are two solutions (above).
|
|
174037
|
+
* If "a^2+b^2-d^2 = 0" then there is one solution which is (-ad/(a^2+b^2), -bd/(a^2+b^2)).
|
|
174038
|
+
* If "a^2+b^2-d^2 < 0" then there is no solution.
|
|
174039
|
+
*
|
|
174040
|
+
* Below in the code we have "a = cosCoff", "b = sinCoff", and "d = constCoff". Also equivalent criterion
|
|
174041
|
+
* is used in the code. For example, "a^2+b^2-d^2 > 0" is equivalent of "1 - d^2/(a^2+b^2) > 0".
|
|
174042
|
+
*/
|
|
174043
|
+
const a2b2 = cosCoff * cosCoff + sinCoff * sinCoff; // a^2+b^2
|
|
174044
|
+
const d2 = constCoff * constCoff; // d^2
|
|
174045
|
+
let result;
|
|
174046
|
+
if (a2b2 > 0.0) {
|
|
174047
|
+
const a2b2r = 1.0 / a2b2; // 1/(a^2+b^2)
|
|
174048
|
+
const d2a2b2 = d2 * a2b2r; // d^2/(a^2+b^2)
|
|
174049
|
+
const criteria = 1.0 - d2a2b2; // 1 - d^2/(a^2+b^2); the criteria to specify how many solutions we got
|
|
174050
|
+
if (criteria < -Geometry.smallMetricDistanceSquared) // nSolution = 0
|
|
174051
|
+
return result;
|
|
174052
|
+
const da2b2 = -constCoff * a2b2r; // -d/(a^2+b^2)
|
|
174053
|
+
const c0 = da2b2 * cosCoff; // -ad/(a^2+b^2)
|
|
174054
|
+
const s0 = da2b2 * sinCoff; // -bd/(a^2+b^2)
|
|
174055
|
+
if (criteria <= 0.0) { // nSolution = 1 (observed criteria = -2.22e-16 in rotated system)
|
|
174056
|
+
result = [_geometry3d_Point2dVector2d__WEBPACK_IMPORTED_MODULE_1__.Vector2d.create(c0, s0)];
|
|
174057
|
+
}
|
|
174058
|
+
else if (criteria > 0.0) { // nSolution = 2
|
|
174059
|
+
const s = Math.sqrt(criteria * a2b2r); // sqrt(a^2+b^2-d^2)) / (a^2+b^2)
|
|
174060
|
+
result = [
|
|
174061
|
+
_geometry3d_Point2dVector2d__WEBPACK_IMPORTED_MODULE_1__.Vector2d.create(c0 - s * sinCoff, s0 + s * cosCoff),
|
|
174062
|
+
_geometry3d_Point2dVector2d__WEBPACK_IMPORTED_MODULE_1__.Vector2d.create(c0 + s * sinCoff, s0 - s * cosCoff),
|
|
174063
|
+
];
|
|
173941
174064
|
}
|
|
173942
|
-
return result;
|
|
173943
174065
|
}
|
|
174066
|
+
return result;
|
|
173944
174067
|
}
|
|
173945
|
-
/**
|
|
173946
|
-
|
|
173947
|
-
|
|
173948
|
-
|
|
173949
|
-
|
|
174068
|
+
/**
|
|
174069
|
+
* For a line `f(x)` where `f(x0) = f0` and `f(x1) = f1`, return the `x` value at which `f(x) = fTarget`
|
|
174070
|
+
* Return `defaultResult` if `(fTarget - f0) / (f1 - f0)` exceeds `Geometry.largeFractionResult`
|
|
174071
|
+
*/
|
|
174072
|
+
static inverseInterpolate(x0, f0, x1, f1, fTarget = 0, defaultResult) {
|
|
174073
|
+
/**
|
|
174074
|
+
* Line equation is "fTarget-f0 = (f1-f0)/(x1-x0) * (x-x0)" or "(fTarget-f0)/(f1-f0) = (x-x0)/(x1-x0)".
|
|
174075
|
+
* The left hand side is known so if we call it "fr" (short for "fraction") we get "fr = (x-x0)/(x1-x0)".
|
|
174076
|
+
* Therefore, "x = x0*(1-fr) + x1*fr". This is same as interpolation between "x0" and "x1" with fraction "fr".
|
|
174077
|
+
*/
|
|
174078
|
+
const fr = Geometry.conditionalDivideFraction(fTarget - f0, f1 - f0); // (fTarget-f0)/(f1-f0)
|
|
174079
|
+
if (fr !== undefined)
|
|
174080
|
+
return Geometry.interpolate(x0, fr, x1); // x = x0*(1-fr) + x1*fr
|
|
173950
174081
|
return defaultResult;
|
|
173951
174082
|
}
|
|
173952
|
-
/**
|
|
173953
|
-
|
|
173954
|
-
|
|
174083
|
+
/**
|
|
174084
|
+
* For a line `f(x)` where `f(0) = f0` and `f(1) = f1`, return the `x` value at which `f(x) = fTarget`
|
|
174085
|
+
* Return `undefined` if `(fTarget - f0) / (f1 - f0)` exceeds `Geometry.largeFractionResult`
|
|
174086
|
+
*/
|
|
174087
|
+
static inverseInterpolate01(f0, f1, fTarget = 0) {
|
|
174088
|
+
/**
|
|
174089
|
+
* Line equation is "fTarget-f0 = (f1-f0)*x" so "x = (fTarget-f0)/(f1-f0)"
|
|
174090
|
+
*/
|
|
174091
|
+
return Geometry.conditionalDivideFraction(fTarget - f0, f1 - f0); // x = (fTarget-f0)/(f1-f0)
|
|
173955
174092
|
}
|
|
173956
|
-
/**
|
|
174093
|
+
/**
|
|
174094
|
+
* Return `true` if `json` is an array with at least `minEntries` entries and all entries are numbers (including
|
|
174095
|
+
* those beyond minEntries).
|
|
174096
|
+
*/
|
|
173957
174097
|
static isNumberArray(json, minEntries = 0) {
|
|
173958
174098
|
if (Array.isArray(json) && json.length >= minEntries) {
|
|
173959
174099
|
let entry;
|
|
173960
174100
|
for (entry of json) {
|
|
173961
|
-
// if (!(entry as number) && entry !== 0.0)
|
|
173962
174101
|
if (!Number.isFinite(entry))
|
|
173963
174102
|
return false;
|
|
173964
174103
|
}
|
|
@@ -173966,10 +174105,12 @@ class Geometry {
|
|
|
173966
174105
|
}
|
|
173967
174106
|
return false;
|
|
173968
174107
|
}
|
|
173969
|
-
/**
|
|
174108
|
+
/**
|
|
174109
|
+
* Return `true` if `json` is an array of at least `minArrays` arrays with at least `minEntries` entries in
|
|
174110
|
+
* each array and all entries are numbers (including those beyond minEntries).
|
|
173970
174111
|
*/
|
|
173971
|
-
static isArrayOfNumberArray(json,
|
|
173972
|
-
if (Array.isArray(json) && json.length >=
|
|
174112
|
+
static isArrayOfNumberArray(json, minArrays, minEntries = 0) {
|
|
174113
|
+
if (Array.isArray(json) && json.length >= minArrays) {
|
|
173973
174114
|
let entry;
|
|
173974
174115
|
for (entry of json)
|
|
173975
174116
|
if (!Geometry.isNumberArray(entry, minEntries))
|
|
@@ -173978,36 +174119,53 @@ class Geometry {
|
|
|
173978
174119
|
}
|
|
173979
174120
|
return false;
|
|
173980
174121
|
}
|
|
173981
|
-
/**
|
|
173982
|
-
*
|
|
173983
|
-
*
|
|
173984
|
-
|
|
174122
|
+
/**
|
|
174123
|
+
* Return the number of steps to take so that `numSteps * stepSize >= total`.
|
|
174124
|
+
* * `minCount` is returned in the following 3 cases:
|
|
174125
|
+
* * (a) `stepSize <= 0`
|
|
174126
|
+
* * (b) `stepSize >= total`
|
|
174127
|
+
* * (b) `numSteps < minCount`
|
|
174128
|
+
* * `maxCount` is returned if `numSteps > maxCount`.
|
|
174129
|
+
*/
|
|
173985
174130
|
static stepCount(stepSize, total, minCount = 1, maxCount = 101) {
|
|
173986
174131
|
if (stepSize <= 0)
|
|
173987
174132
|
return minCount;
|
|
173988
174133
|
total = Math.abs(total);
|
|
173989
174134
|
if (stepSize >= total)
|
|
173990
174135
|
return minCount;
|
|
173991
|
-
|
|
173992
|
-
|
|
174136
|
+
/**
|
|
174137
|
+
* 0.999999 is multiplied so we return the same "numSteps" if
|
|
174138
|
+
* stepSize*(numSteps-1) < total <= stepSize*numSteps.
|
|
174139
|
+
* For example, if "stepSize = 2" then we return "numSteps = 5" if 8 < total <= 10.
|
|
174140
|
+
*/
|
|
174141
|
+
const numSteps = Math.floor((total + 0.999999 * stepSize) / stepSize);
|
|
174142
|
+
if (numSteps < minCount)
|
|
173993
174143
|
return minCount;
|
|
173994
|
-
if (
|
|
174144
|
+
if (numSteps > maxCount)
|
|
173995
174145
|
return maxCount;
|
|
173996
|
-
return
|
|
174146
|
+
return numSteps;
|
|
173997
174147
|
}
|
|
173998
|
-
/**
|
|
174148
|
+
/**
|
|
174149
|
+
* Test if `x` is in the interval [0,1] (but skip the test if `apply01 = false`).
|
|
174150
|
+
* * This odd behavior is very convenient for code that sometimes does not do the filtering.
|
|
173999
174151
|
* @param x value to test.
|
|
174000
|
-
* @param apply01 if false,
|
|
174152
|
+
* @param apply01 if false, return `true` for all values of `x`.
|
|
174001
174153
|
*/
|
|
174002
|
-
static isIn01(x, apply01 = true) {
|
|
174003
|
-
|
|
174154
|
+
static isIn01(x, apply01 = true) {
|
|
174155
|
+
return apply01 ? x >= 0.0 && x <= 1.0 : true;
|
|
174156
|
+
}
|
|
174157
|
+
/**
|
|
174158
|
+
* Test if `x` is in the interval [0,1] for a given positive `tolerance`.
|
|
174159
|
+
* * Make sure to pass a positive `tolerance` because there is no check for that in the code.
|
|
174004
174160
|
* @param x value to test.
|
|
174005
|
-
* @param
|
|
174161
|
+
* @param tolerance the tolerance.
|
|
174006
174162
|
*/
|
|
174007
|
-
static isIn01WithTolerance(x, tolerance) {
|
|
174163
|
+
static isIn01WithTolerance(x, tolerance) {
|
|
174164
|
+
return x + tolerance >= 0.0 && x - tolerance <= 1.0;
|
|
174165
|
+
}
|
|
174008
174166
|
/**
|
|
174009
|
-
*
|
|
174010
|
-
* @param x
|
|
174167
|
+
* Restrict x so it is in the interval `[a,b]` (allowing `a` and `b` to be in either order).
|
|
174168
|
+
* @param x value to restrict
|
|
174011
174169
|
* @param a (usually the lower) interval limit
|
|
174012
174170
|
* @param b (usually the upper) interval limit
|
|
174013
174171
|
*/
|
|
@@ -174019,7 +174177,7 @@ class Geometry {
|
|
|
174019
174177
|
return b;
|
|
174020
174178
|
return x;
|
|
174021
174179
|
}
|
|
174022
|
-
// reversed interval
|
|
174180
|
+
// reversed interval
|
|
174023
174181
|
if (x < b)
|
|
174024
174182
|
return b;
|
|
174025
174183
|
if (x > a)
|
|
@@ -174028,12 +174186,15 @@ class Geometry {
|
|
|
174028
174186
|
}
|
|
174029
174187
|
/**
|
|
174030
174188
|
* Case-insensitive string comparison.
|
|
174031
|
-
* * Return true if the toUpperCase values match.
|
|
174189
|
+
* * Return `true` if the `toUpperCase` values of `string1` and `string2` match.
|
|
174032
174190
|
*/
|
|
174033
174191
|
static equalStringNoCase(string1, string2) {
|
|
174034
174192
|
return string1.toUpperCase() === string2.toUpperCase();
|
|
174035
174193
|
}
|
|
174036
|
-
/**
|
|
174194
|
+
/**
|
|
174195
|
+
* Test for exact match of two number arrays.
|
|
174196
|
+
* Returns `true` if both arrays have the same length and entries, or if both arrays are empty or `undefined`.
|
|
174197
|
+
*/
|
|
174037
174198
|
static exactEqualNumberArrays(a, b) {
|
|
174038
174199
|
if (Array.isArray(a) && a.length === 0)
|
|
174039
174200
|
a = undefined;
|
|
@@ -174051,7 +174212,10 @@ class Geometry {
|
|
|
174051
174212
|
}
|
|
174052
174213
|
return false;
|
|
174053
174214
|
}
|
|
174054
|
-
/**
|
|
174215
|
+
/**
|
|
174216
|
+
* Test for match of two arrays of type `T`.
|
|
174217
|
+
* Returns `true` if both arrays have the same length and have the same entries (or both are empty arrays).
|
|
174218
|
+
*/
|
|
174055
174219
|
static almostEqualArrays(a, b, testFunction) {
|
|
174056
174220
|
if (Array.isArray(a) && a.length === 0)
|
|
174057
174221
|
a = undefined;
|
|
@@ -174070,7 +174234,10 @@ class Geometry {
|
|
|
174070
174234
|
}
|
|
174071
174235
|
return false;
|
|
174072
174236
|
}
|
|
174073
|
-
/**
|
|
174237
|
+
/**
|
|
174238
|
+
* Test for match of two arrays of type number or Float64Array.
|
|
174239
|
+
* Returns `true` if both arrays have the same length and have the same entries (or both are empty arrays).
|
|
174240
|
+
*/
|
|
174074
174241
|
static almostEqualNumberArrays(a, b, testFunction) {
|
|
174075
174242
|
if (Array.isArray(a) && a.length === 0)
|
|
174076
174243
|
a = undefined;
|
|
@@ -174090,15 +174257,12 @@ class Geometry {
|
|
|
174090
174257
|
return false;
|
|
174091
174258
|
}
|
|
174092
174259
|
/**
|
|
174093
|
-
*
|
|
174094
|
-
* * true if both values are defined and equal (with ===).
|
|
174095
|
-
* * false if both defined by not equal
|
|
174096
|
-
* * return (option arg) resultIfBothUndefined when both are undefined.
|
|
174097
|
-
* * return false if one is defined and the other undefined
|
|
174260
|
+
* Test for match of two values of type `T`.
|
|
174098
174261
|
* @param a first value
|
|
174099
174262
|
* @param b second value
|
|
174100
|
-
* @param resultIfBothUndefined
|
|
174101
|
-
* @returns
|
|
174263
|
+
* @param resultIfBothUndefined returned value when both are `undefined`
|
|
174264
|
+
* @returns `true` if both values are defined and equal (with ===) and `false` if both values are defined
|
|
174265
|
+
* but not equal or if one is defined and the other undefined.
|
|
174102
174266
|
*/
|
|
174103
174267
|
static areEqualAllowUndefined(a, b, resultIfBothUndefined = true) {
|
|
174104
174268
|
if (a === undefined && b === undefined)
|
|
@@ -174107,47 +174271,53 @@ class Geometry {
|
|
|
174107
174271
|
return a === b;
|
|
174108
174272
|
return false;
|
|
174109
174273
|
}
|
|
174110
|
-
/**
|
|
174111
|
-
*
|
|
174112
|
-
|
|
174113
|
-
|
|
174114
|
-
|
|
174274
|
+
/**
|
|
174275
|
+
* Clone an array whose members have type `T`, which implements the clone method.
|
|
174276
|
+
* * If the clone method returns `undefined`, then `undefined` is forced into the cloned array.
|
|
174277
|
+
*/
|
|
174278
|
+
static cloneMembers(array) {
|
|
174279
|
+
if (array === undefined)
|
|
174115
174280
|
return undefined;
|
|
174116
|
-
const
|
|
174117
|
-
for (const
|
|
174118
|
-
|
|
174281
|
+
const clonedArray = [];
|
|
174282
|
+
for (const element of array) {
|
|
174283
|
+
clonedArray.push(element.clone());
|
|
174119
174284
|
}
|
|
174120
|
-
return
|
|
174285
|
+
return clonedArray;
|
|
174121
174286
|
}
|
|
174122
174287
|
}
|
|
174123
|
-
/** Tolerance for small distances in metric coordinates */
|
|
174288
|
+
/** Tolerance for small distances in metric coordinates. */
|
|
174124
174289
|
Geometry.smallMetricDistance = 1.0e-6;
|
|
174125
|
-
/** Square of `
|
|
174290
|
+
/** Square of `smallMetricDistance`. */
|
|
174126
174291
|
Geometry.smallMetricDistanceSquared = 1.0e-12;
|
|
174127
|
-
/**
|
|
174292
|
+
/** Tolerance for small angle measured in radians. */
|
|
174128
174293
|
Geometry.smallAngleRadians = 1.0e-12;
|
|
174129
|
-
/**
|
|
174294
|
+
/** Square of `smallAngleRadians`. */
|
|
174130
174295
|
Geometry.smallAngleRadiansSquared = 1.0e-24;
|
|
174131
|
-
/**
|
|
174296
|
+
/** Tolerance for small angle measured in degrees. */
|
|
174132
174297
|
Geometry.smallAngleDegrees = 5.7e-11;
|
|
174133
|
-
/**
|
|
174298
|
+
/** Tolerance for small angle measured in arc-seconds. */
|
|
174134
174299
|
Geometry.smallAngleSeconds = 2e-7;
|
|
174135
|
-
/**
|
|
174136
|
-
|
|
174300
|
+
/** Numeric value that may be considered zero for fractions between 0 and 1. */
|
|
174301
|
+
Geometry.smallFraction = 1.0e-10;
|
|
174302
|
+
/** Radians value for full circle 2PI radians minus `smallAngleRadians`. */
|
|
174303
|
+
Geometry.fullCircleRadiansMinusSmallAngle = 2.0 * Math.PI - Geometry.smallAngleRadians;
|
|
174304
|
+
/**
|
|
174305
|
+
* Numeric value that may be considered large for a ratio of numbers.
|
|
174306
|
+
* * Note that the allowed result value is vastly larger than 1.
|
|
174137
174307
|
*/
|
|
174138
174308
|
Geometry.largeFractionResult = 1.0e10;
|
|
174139
|
-
/**
|
|
174140
|
-
|
|
174141
|
-
/** numeric value that may considered huge for numbers expected to be coordinates.
|
|
174309
|
+
/**
|
|
174310
|
+
* Numeric value that may considered large for numbers expected to be coordinates.
|
|
174142
174311
|
* * This allows larger results than `largeFractionResult`.
|
|
174143
174312
|
*/
|
|
174144
174313
|
Geometry.largeCoordinateResult = 1.0e13;
|
|
174145
|
-
/**
|
|
174146
|
-
*
|
|
174314
|
+
/**
|
|
174315
|
+
* Numeric value that may considered infinite for metric coordinates.
|
|
174316
|
+
* @deprecated in 4.x. Use `largeCoordinateResult`.
|
|
174317
|
+
* * This coordinate should be used only as a placeholder indicating "at infinity" -- computing actual
|
|
174318
|
+
* points at this coordinate invites numerical problems.
|
|
174147
174319
|
*/
|
|
174148
174320
|
Geometry.hugeCoordinate = 1.0e12;
|
|
174149
|
-
/** Radians value for full circle 2PI radians minus `smallAngleRadians` */
|
|
174150
|
-
Geometry.fullCircleRadiansMinusSmallAngle = 2.0 * Math.PI - 1.0e-12; // smallAngleRadians less than 360degrees
|
|
174151
174321
|
|
|
174152
174322
|
|
|
174153
174323
|
|
|
@@ -183175,17 +183345,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
183175
183345
|
/* harmony export */ "ConvexClipPlaneSet": () => (/* binding */ ConvexClipPlaneSet)
|
|
183176
183346
|
/* harmony export */ });
|
|
183177
183347
|
/* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
|
|
183178
|
-
/* harmony import */ var _geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../geometry3d/Plane3dByOriginAndUnitNormal */ "../../core/geometry/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js");
|
|
183179
183348
|
/* harmony import */ var _geometry3d_GrowableFloat64Array__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../geometry3d/GrowableFloat64Array */ "../../core/geometry/lib/esm/geometry3d/GrowableFloat64Array.js");
|
|
183180
183349
|
/* harmony import */ var _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geometry3d/GrowableXYZArray */ "../../core/geometry/lib/esm/geometry3d/GrowableXYZArray.js");
|
|
183181
183350
|
/* harmony import */ var _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geometry3d/Matrix3d */ "../../core/geometry/lib/esm/geometry3d/Matrix3d.js");
|
|
183351
|
+
/* harmony import */ var _geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../geometry3d/Plane3dByOriginAndUnitNormal */ "../../core/geometry/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js");
|
|
183182
183352
|
/* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
|
|
183183
183353
|
/* harmony import */ var _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geometry3d/PolygonOps */ "../../core/geometry/lib/esm/geometry3d/PolygonOps.js");
|
|
183184
183354
|
/* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
|
|
183185
|
-
/* harmony import */ var _ClipPlane__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ClipPlane */ "../../core/geometry/lib/esm/clipping/ClipPlane.js");
|
|
183186
|
-
/* harmony import */ var _ClipUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ClipUtils */ "../../core/geometry/lib/esm/clipping/ClipUtils.js");
|
|
183187
183355
|
/* harmony import */ var _polyface_Polyface__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../polyface/Polyface */ "../../core/geometry/lib/esm/polyface/Polyface.js");
|
|
183188
183356
|
/* harmony import */ var _polyface_PolyfaceQuery__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../polyface/PolyfaceQuery */ "../../core/geometry/lib/esm/polyface/PolyfaceQuery.js");
|
|
183357
|
+
/* harmony import */ var _ClipPlane__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ClipPlane */ "../../core/geometry/lib/esm/clipping/ClipPlane.js");
|
|
183358
|
+
/* harmony import */ var _ClipUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ClipUtils */ "../../core/geometry/lib/esm/clipping/ClipUtils.js");
|
|
183189
183359
|
/*---------------------------------------------------------------------------------------------
|
|
183190
183360
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
183191
183361
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -183410,17 +183580,19 @@ class ConvexClipPlaneSet {
|
|
|
183410
183580
|
get planes() {
|
|
183411
183581
|
return this._planes;
|
|
183412
183582
|
}
|
|
183413
|
-
/**
|
|
183583
|
+
/**
|
|
183584
|
+
* Test if there is any intersection with a ray defined by origin and direction.
|
|
183414
183585
|
* * Optionally record the range (null or otherwise) in caller-allocated result.
|
|
183415
|
-
* * If the ray is unbounded inside the clip, result can contain positive or negative
|
|
183586
|
+
* * If the ray is unbounded inside the clip, result can contain positive or negative
|
|
183587
|
+
* "Geometry.largeCoordinateResult" values
|
|
183416
183588
|
* * If no result is provide, there are no object allocations.
|
|
183417
183589
|
* @param result optional Range1d to receive parameters along the ray.
|
|
183418
183590
|
*/
|
|
183419
183591
|
hasIntersectionWithRay(ray, result, tolerance = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.smallMetricDistance) {
|
|
183420
183592
|
// form low and high values in locals that do not require allocation.
|
|
183421
183593
|
// transfer to caller-supplied result at end
|
|
183422
|
-
let t0 = -_Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.
|
|
183423
|
-
let t1 = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.
|
|
183594
|
+
let t0 = -_Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.largeCoordinateResult;
|
|
183595
|
+
let t1 = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.largeCoordinateResult;
|
|
183424
183596
|
if (result)
|
|
183425
183597
|
result.setNull();
|
|
183426
183598
|
const velocityTolerance = 1.0e-13;
|
|
@@ -184031,9 +184203,11 @@ class UnionOfConvexClipPlaneSets {
|
|
|
184031
184203
|
if (toAdd)
|
|
184032
184204
|
this._convexSets.push(toAdd);
|
|
184033
184205
|
}
|
|
184034
|
-
/**
|
|
184206
|
+
/**
|
|
184207
|
+
* Test if there is any intersection with a ray defined by origin and direction.
|
|
184035
184208
|
* * Optionally record the range (null or otherwise) in caller-allocated result.
|
|
184036
|
-
* * If the ray is unbounded inside the clip, result can contain positive or negative
|
|
184209
|
+
* * If the ray is unbounded inside the clip, result can contain positive or negative
|
|
184210
|
+
* "Geometry.largeCoordinateResult" values
|
|
184037
184211
|
* * If no result is provide, there are no object allocations.
|
|
184038
184212
|
* @param maximalRange optional Range1d to receive parameters along the ray.
|
|
184039
184213
|
*/
|
|
@@ -212197,32 +212371,40 @@ class Plane3dByOriginAndUnitNormal extends _Plane3d__WEBPACK_IMPORTED_MODULE_0__
|
|
|
212197
212371
|
return Plane3dByOriginAndUnitNormal._create(origin.x, origin.y, origin.z, 0, 1, 0);
|
|
212198
212372
|
return Plane3dByOriginAndUnitNormal._create(0, 0, 0, 0, 1, 0);
|
|
212199
212373
|
}
|
|
212200
|
-
/**
|
|
212374
|
+
/** Create a new Plane3dByOriginAndUnitNormal with given origin and normal.
|
|
212201
212375
|
* * The inputs are NOT captured.
|
|
212202
|
-
* * Returns undefined if
|
|
212376
|
+
* * Returns undefined if `normal.normalize()` returns undefined.
|
|
212203
212377
|
*/
|
|
212204
212378
|
static create(origin, normal, result) {
|
|
212205
|
-
const normalized = normal.normalize();
|
|
212206
|
-
if (!normalized)
|
|
212207
|
-
return undefined;
|
|
212208
212379
|
if (result) {
|
|
212209
|
-
result.
|
|
212380
|
+
if (normal.normalize(result._normal) === undefined)
|
|
212381
|
+
return undefined;
|
|
212382
|
+
origin.clone(result._origin);
|
|
212210
212383
|
return result;
|
|
212211
212384
|
}
|
|
212385
|
+
const normalized = normal.normalize();
|
|
212386
|
+
if (normalized === undefined)
|
|
212387
|
+
return undefined;
|
|
212212
212388
|
return new Plane3dByOriginAndUnitNormal(origin.clone(), normalized);
|
|
212213
212389
|
}
|
|
212214
|
-
/**
|
|
212390
|
+
/** Create a new Plane3dByOriginAndUnitNormal from a variety of plane types.
|
|
212215
212391
|
* * The inputs are NOT captured.
|
|
212216
|
-
* * Returns undefined if
|
|
212392
|
+
* * Returns undefined if `source.getUnitNormal()` returns undefined.
|
|
212217
212393
|
*/
|
|
212218
212394
|
static createFrom(source, result) {
|
|
212219
212395
|
if (source instanceof Plane3dByOriginAndUnitNormal)
|
|
212220
212396
|
return source.clone(result);
|
|
212397
|
+
if (result) {
|
|
212398
|
+
if (source.getUnitNormal(result._normal) === undefined)
|
|
212399
|
+
return undefined;
|
|
212400
|
+
source.getAnyPointOnPlane(result._origin);
|
|
212401
|
+
return result;
|
|
212402
|
+
}
|
|
212221
212403
|
const normal = source.getUnitNormal();
|
|
212222
212404
|
if (normal === undefined)
|
|
212223
212405
|
return undefined;
|
|
212224
212406
|
const origin = source.getAnyPointOnPlane();
|
|
212225
|
-
return
|
|
212407
|
+
return new Plane3dByOriginAndUnitNormal(origin, normal);
|
|
212226
212408
|
}
|
|
212227
212409
|
/** create a new Plane3dByOriginAndUnitNormal with direct coordinates of origin and normal.
|
|
212228
212410
|
* * Returns undefined if the normal vector is all zeros.
|
|
@@ -213381,7 +213563,7 @@ class Vector2d extends XY {
|
|
|
213381
213563
|
}
|
|
213382
213564
|
/** Return a unit vector in direction of this instance (undefined if this instance has near zero length) */
|
|
213383
213565
|
normalize(result) {
|
|
213384
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.
|
|
213566
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.correctSmallFraction(this.magnitude());
|
|
213385
213567
|
result = result ? result : new Vector2d();
|
|
213386
213568
|
return this.safeDivideOrNull(mag, result);
|
|
213387
213569
|
}
|
|
@@ -213526,7 +213708,7 @@ class Vector2d extends XY {
|
|
|
213526
213708
|
}
|
|
213527
213709
|
/** Return a vector parallel to this but with specified length */
|
|
213528
213710
|
scaleToLength(length, result) {
|
|
213529
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.
|
|
213711
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.correctSmallFraction(this.magnitude());
|
|
213530
213712
|
if (mag === 0)
|
|
213531
213713
|
return undefined;
|
|
213532
213714
|
return this.scale(length / mag, result);
|
|
@@ -214721,7 +214903,12 @@ class Vector3d extends XYZ {
|
|
|
214721
214903
|
static unitZ(scale = 1) {
|
|
214722
214904
|
return new Vector3d(0, 0, scale);
|
|
214723
214905
|
}
|
|
214724
|
-
/**
|
|
214906
|
+
/**
|
|
214907
|
+
* Scale the instance by 1.0/`denominator`.
|
|
214908
|
+
* @param denominator number by which to divide the coordinates of this instance
|
|
214909
|
+
* @param result optional pre-allocated object to return
|
|
214910
|
+
* @return scaled vector, or undefined if `denominator` is exactly zero (in which case instance is untouched).
|
|
214911
|
+
*/
|
|
214725
214912
|
safeDivideOrNull(denominator, result) {
|
|
214726
214913
|
if (denominator !== 0.0) {
|
|
214727
214914
|
return this.scale(1.0 / denominator, result);
|
|
@@ -214729,15 +214916,17 @@ class Vector3d extends XYZ {
|
|
|
214729
214916
|
return undefined;
|
|
214730
214917
|
}
|
|
214731
214918
|
/**
|
|
214732
|
-
* Return a
|
|
214733
|
-
*
|
|
214734
|
-
*
|
|
214735
|
-
*
|
|
214919
|
+
* Return a normalized instance and instance length.
|
|
214920
|
+
* @param result optional pre-allocated object to return as `v` property
|
|
214921
|
+
* @returns object containing the properties:
|
|
214922
|
+
* * `v`: unit vector in the direction of the instance, or undefined if `mag` is near zero
|
|
214923
|
+
* * `mag`: length of the instance prior to normalization
|
|
214736
214924
|
*/
|
|
214737
214925
|
normalizeWithLength(result) {
|
|
214738
|
-
const
|
|
214926
|
+
const originalMagnitude = this.magnitude();
|
|
214927
|
+
const correctedMagnitude = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.correctSmallFraction(originalMagnitude);
|
|
214739
214928
|
result = result ? result : new Vector3d();
|
|
214740
|
-
return { v: this.safeDivideOrNull(
|
|
214929
|
+
return { v: this.safeDivideOrNull(correctedMagnitude, result), mag: originalMagnitude };
|
|
214741
214930
|
}
|
|
214742
214931
|
/**
|
|
214743
214932
|
* Return a unit vector parallel with this. Return undefined if this.magnitude is near zero.
|
|
@@ -214748,16 +214937,10 @@ class Vector3d extends XYZ {
|
|
|
214748
214937
|
}
|
|
214749
214938
|
/**
|
|
214750
214939
|
* If this vector has nonzero length, divide by the length to change to a unit vector.
|
|
214751
|
-
* @returns true if normalization
|
|
214940
|
+
* @returns true if normalization was successful
|
|
214752
214941
|
*/
|
|
214753
214942
|
normalizeInPlace() {
|
|
214754
|
-
|
|
214755
|
-
if (a === undefined)
|
|
214756
|
-
return false;
|
|
214757
|
-
this.x *= a;
|
|
214758
|
-
this.y *= a;
|
|
214759
|
-
this.z *= a;
|
|
214760
|
-
return true;
|
|
214943
|
+
return this.normalizeWithLength(this).v !== undefined;
|
|
214761
214944
|
}
|
|
214762
214945
|
/**
|
|
214763
214946
|
* Create a normalized vector from the inputs.
|
|
@@ -214777,7 +214960,7 @@ class Vector3d extends XYZ {
|
|
|
214777
214960
|
* Return fractional projection of this vector on the target vector.
|
|
214778
214961
|
* * It's returning the signed projection magnitude divided by the target magnitude.
|
|
214779
214962
|
* * To find the projection vector, scale the target vector by the value that this function is returning.
|
|
214780
|
-
* *
|
|
214963
|
+
* * Math details can be found at docs/learning/geometry/PointVector.md
|
|
214781
214964
|
* * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnVector
|
|
214782
214965
|
* and https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnPlane
|
|
214783
214966
|
* @param target the target vector
|
|
@@ -214992,7 +215175,7 @@ class Vector3d extends XYZ {
|
|
|
214992
215175
|
* @param result optional preallocated result
|
|
214993
215176
|
*/
|
|
214994
215177
|
scaleToLength(length, result) {
|
|
214995
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.
|
|
215178
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.correctSmallFraction(this.magnitude());
|
|
214996
215179
|
if (mag === 0)
|
|
214997
215180
|
return undefined;
|
|
214998
215181
|
return this.scale(length / mag, result);
|
|
@@ -215043,7 +215226,7 @@ class Vector3d extends XYZ {
|
|
|
215043
215226
|
* @param smallestMagnitude smallest magnitude allowed as divisor.
|
|
215044
215227
|
* @returns false if magnitude is too small. In this case the vector is unchanged.
|
|
215045
215228
|
*/
|
|
215046
|
-
tryNormalizeInPlace(smallestMagnitude = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.
|
|
215229
|
+
tryNormalizeInPlace(smallestMagnitude = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallFraction) {
|
|
215047
215230
|
const a = this.magnitude();
|
|
215048
215231
|
if (a < smallestMagnitude || a === 0.0)
|
|
215049
215232
|
return false;
|
|
@@ -223824,7 +224007,6 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
223824
224007
|
*/
|
|
223825
224008
|
static createPlaneFrom(source) {
|
|
223826
224009
|
return new Point4d(source.normalX(), source.normalY(), source.normalZ(), source.altitudeXYZ(0, 0, 0));
|
|
223827
|
-
return undefined;
|
|
223828
224010
|
}
|
|
223829
224011
|
/** Copy coordinates from `other`. */
|
|
223830
224012
|
setFrom(other) {
|
|
@@ -223967,7 +224149,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
223967
224149
|
* * other structure with members x,y and optional z,w
|
|
223968
224150
|
* * array of numbers
|
|
223969
224151
|
* * default z is 0.0
|
|
223970
|
-
* * default
|
|
224152
|
+
* * default w is 1.0 (array[3] can replace)
|
|
223971
224153
|
*/
|
|
223972
224154
|
static createFromPoint(point) {
|
|
223973
224155
|
if (point instanceof _geometry3d_Point2dVector2d__WEBPACK_IMPORTED_MODULE_3__.Point2d)
|
|
@@ -223984,10 +224166,10 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
223984
224166
|
const w1 = point.length > 3 ? point[3] : 1.0;
|
|
223985
224167
|
return new Point4d(x1, y1, z1, w1);
|
|
223986
224168
|
}
|
|
223987
|
-
const x = point.
|
|
223988
|
-
const y = point.
|
|
224169
|
+
const x = point.x;
|
|
224170
|
+
const y = point.y;
|
|
223989
224171
|
const z = point.hasOwnProperty("z") ? point.z : 0.0;
|
|
223990
|
-
const w = point.hasOwnProperty("w") ? point.w :
|
|
224172
|
+
const w = point.hasOwnProperty("w") ? point.w : 1.0;
|
|
223991
224173
|
return new Point4d(x, y, z, w);
|
|
223992
224174
|
}
|
|
223993
224175
|
/** Return `point + vector * scalar` */
|
|
@@ -224114,7 +224296,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
224114
224296
|
* @param result optional result
|
|
224115
224297
|
*/
|
|
224116
224298
|
normalizeWeight(result) {
|
|
224117
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.
|
|
224299
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.correctSmallFraction(this.xyzw[3]);
|
|
224118
224300
|
result = result ? result : new Point4d();
|
|
224119
224301
|
return this.safeDivideOrNull(mag, result);
|
|
224120
224302
|
}
|
|
@@ -224124,7 +224306,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
224124
224306
|
* @param result optional result
|
|
224125
224307
|
*/
|
|
224126
224308
|
realPoint(result) {
|
|
224127
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.
|
|
224309
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.correctSmallFraction(this.xyzw[3]);
|
|
224128
224310
|
if (mag === 0.0)
|
|
224129
224311
|
return undefined;
|
|
224130
224312
|
const a = 1.0 / mag; // in zero case everything multiplies right back to true zero.
|
|
@@ -224135,7 +224317,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
224135
224317
|
* * If `this.w` is zero, return a Vector3d `(x,y,z)`
|
|
224136
224318
|
*/
|
|
224137
224319
|
realPointOrVector() {
|
|
224138
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.
|
|
224320
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.correctSmallFraction(this.xyzw[3]);
|
|
224139
224321
|
if (mag === 0.0)
|
|
224140
224322
|
return _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.create(this.x, this.y, this.z);
|
|
224141
224323
|
const a = 1.0 / mag; // in zero case everything multiplies right back to true zero.
|
|
@@ -224151,7 +224333,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
224151
224333
|
* @param result optional result
|
|
224152
224334
|
*/
|
|
224153
224335
|
static createRealPoint3dDefault000(x, y, z, w, result) {
|
|
224154
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.
|
|
224336
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.correctSmallFraction(w);
|
|
224155
224337
|
const a = mag === 0 ? 0.0 : (1.0 / mag); // in zero case everything multiplies right back to true zero.
|
|
224156
224338
|
return _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Point3d.create(x * a, y * a, z * a, result);
|
|
224157
224339
|
}
|
|
@@ -224169,7 +224351,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
224169
224351
|
* @param result optional result
|
|
224170
224352
|
*/
|
|
224171
224353
|
static createRealDerivativeRay3dDefault000(x, y, z, w, dx, dy, dz, dw, result) {
|
|
224172
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.
|
|
224354
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.correctSmallFraction(w);
|
|
224173
224355
|
// real point is X/w.
|
|
224174
224356
|
// real derivative is (X' * w - X *w) / ww, and weight is always 0 by cross products.
|
|
224175
224357
|
const a = mag === 0 ? 0.0 : (1.0 / mag); // in zero case everything multiplies right back to true zero.
|
|
@@ -224190,7 +224372,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
224190
224372
|
* @param result optional result
|
|
224191
224373
|
*/
|
|
224192
224374
|
static createRealDerivativePlane3dByOriginAndVectorsDefault000(x, y, z, w, dx, dy, dz, dw, ddx, ddy, ddz, ddw, result) {
|
|
224193
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.
|
|
224375
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.correctSmallFraction(w);
|
|
224194
224376
|
// real point is X/w.
|
|
224195
224377
|
// real derivative is (X' * w - X *w) / ww, and weight is always 0 by cross products.
|
|
224196
224378
|
const a = mag === 0 ? 0.0 : (1.0 / mag); // in zero case everything multiplies right back to true zero.
|
|
@@ -224208,7 +224390,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
224208
224390
|
* * If this.w is zero, return 000
|
|
224209
224391
|
*/
|
|
224210
224392
|
realPointDefault000(result) {
|
|
224211
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.
|
|
224393
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.correctSmallFraction(this.xyzw[3]);
|
|
224212
224394
|
if (mag === 0.0)
|
|
224213
224395
|
return _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Point3d.create(0, 0, 0, result);
|
|
224214
224396
|
result = result ? result : new _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Point3d();
|
|
@@ -224221,7 +224403,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
224221
224403
|
* * Use normalizeWeight to divide by the w component.
|
|
224222
224404
|
*/
|
|
224223
224405
|
normalizeXYZW(result) {
|
|
224224
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.
|
|
224406
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.correctSmallFraction(this.magnitudeXYZW());
|
|
224225
224407
|
result = result ? result : new Point4d();
|
|
224226
224408
|
return this.safeDivideOrNull(mag, result);
|
|
224227
224409
|
}
|
|
@@ -289175,7 +289357,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
|
|
|
289175
289357
|
/***/ ((module) => {
|
|
289176
289358
|
|
|
289177
289359
|
"use strict";
|
|
289178
|
-
module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"4.0.0-dev.
|
|
289360
|
+
module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"4.0.0-dev.68","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs && npm run -s build:esm","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2020 --outDir lib/esm","clean":"rimraf lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","docs":"betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/primitives,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-eslintrc -c \\"./node_modules/@itwin/eslint-plugin/dist/configs/extension-exports-config.js\\" \\"./src/**/*.ts\\" 1>&2","lint":"eslint -f visualstudio \\"./src/**/*.ts\\" 1>&2","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run -s webpackTests && certa -r chrome","cover":"npm -s test","test:debug":"certa -r chrome --debug","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:^4.0.0-dev.68","@itwin/core-bentley":"workspace:^4.0.0-dev.68","@itwin/core-common":"workspace:^4.0.0-dev.68","@itwin/core-geometry":"workspace:^4.0.0-dev.68","@itwin/core-orbitgt":"workspace:^4.0.0-dev.68","@itwin/core-quantity":"workspace:^4.0.0-dev.68"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/certa":"workspace:*","@itwin/eslint-plugin":"^4.0.0-dev.32","@itwin/webgl-compatibility":"workspace:*","@types/chai":"4.3.1","@types/chai-as-promised":"^7","@types/deep-assign":"^0.1.0","@types/mocha":"^8.2.2","@types/node":"^18.11.5","@types/qs":"^6.5.0","@types/semver":"7.3.10","@types/superagent":"^4.1.14","@types/sinon":"^9.0.0","babel-loader":"~8.2.5","babel-plugin-istanbul":"~6.1.1","chai":"^4.1.2","chai-as-promised":"^7","cpx2":"^3.0.0","eslint":"^7.11.0","glob":"^7.1.2","mocha":"^10.0.0","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^9.0.2","source-map-loader":"^4.0.0","typescript":"~5.0.2","webpack":"^5.76.0"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/object-storage-azure":"^1.5.0","@itwin/cloud-agnostic-core":"^1.5.0","@itwin/object-storage-core":"^1.5.0","@itwin/core-i18n":"workspace:*","@itwin/core-telemetry":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","deep-assign":"^2.0.0","fuse.js":"^3.3.0","qs":"^6.5.3","semver":"^7.3.5","superagent":"^7.1.5","wms-capabilities":"0.4.0","reflect-metadata":"0.1.13"},"nyc":{"extends":"./node_modules/@itwin/build-tools/.nycrc"},"eslintConfig":{"plugins":["@itwin"],"extends":"plugin:@itwin/itwinjs-recommended","rules":{"@itwin/no-internal-barrel-imports":["error",{"required-barrel-modules":["./src/tile/internal.ts"]}],"@itwin/public-extension-exports":["error",{"releaseTags":["public","preview"],"outputApiFile":false}]},"overrides":[{"files":["*.test.ts","*.test.tsx","**/test/**/*.ts"],"rules":{"@itwin/no-internal-barrel-imports":"off"}}]}}');
|
|
289179
289361
|
|
|
289180
289362
|
/***/ })
|
|
289181
289363
|
|