@itwin/rpcinterface-full-stack-tests 4.0.0-dev.39 → 4.0.0-dev.40

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.
@@ -1 +1 @@
1
- {"version":3,"file":"_d48c.bundled-tests.js","mappings":";;;;;;;;AAAA","sources":["file:///ignored|D:\\vsts_a\\10\\s\\common\\temp\\node_modules\\.pnpm\\@loaders.gl+worker-utils@3.3.1\\node_modules\\@loaders.gl\\worker-utils\\dist\\esm\\lib\\library-utils|../node/require-utils.node"],"names":[],"sourceRoot":""}
1
+ {"version":3,"file":"_d48c.bundled-tests.js","mappings":";;;;;;;;AAAA","sources":["file:///ignored|D:\\vsts_b\\57\\s\\common\\temp\\node_modules\\.pnpm\\@loaders.gl+worker-utils@3.3.1\\node_modules\\@loaders.gl\\worker-utils\\dist\\esm\\lib\\library-utils|../node/require-utils.node"],"names":[],"sourceRoot":""}
@@ -175366,8 +175366,8 @@ class Geometry {
175366
175366
  return (Math.abs(a) <= Geometry.smallMetricDistanceSquared) ? undefined : 1.0 / a;
175367
175367
  }
175368
175368
  /**
175369
- * Boolean test for metric coordinate near-equality. If tolerance is not passed, `Geometry.smallMetricDistance`
175370
- * is used as tolerance.
175369
+ * Boolean test for metric coordinate near-equality (i.e., if x and y are almost equal). If tolerance is not passed,
175370
+ * `Geometry.smallMetricDistance` is used as tolerance.
175371
175371
  */
175372
175372
  static isSameCoordinate(x, y, tol) {
175373
175373
  if (tol)
@@ -175565,7 +175565,8 @@ class Geometry {
175565
175565
  q = c;
175566
175566
  return q;
175567
175567
  }
175568
- /** Examine the value (particularly sign) of x.
175568
+ /**
175569
+ * Examine the value (particularly sign) of x.
175569
175570
  * * If x is negative, return outNegative.
175570
175571
  * * If x is true zero, return outZero
175571
175572
  * * If x is positive, return outPositive
@@ -175806,7 +175807,7 @@ class Geometry {
175806
175807
  /** return 0 if the value is undefined, 1 if defined. */
175807
175808
  static defined01(value) { return value === undefined ? 0 : 1; }
175808
175809
  /**
175809
- * Return `numerator` over `denominator` or `undefined`.
175810
+ * Return `numerator` divided by `denominator`, or `undefined`.
175810
175811
  * @param numerator the numerator
175811
175812
  * @param denominator the denominator
175812
175813
  * @returns return `numerator/denominator` but if the ratio would exceed `Geometry.largeFractionResult`,
@@ -175818,7 +175819,7 @@ class Geometry {
175818
175819
  return undefined;
175819
175820
  }
175820
175821
  /**
175821
- * Return `numerator` over `denominator`.
175822
+ * Return `numerator` divided by `denominator`.
175822
175823
  * @param numerator the numerator
175823
175824
  * @param denominator the denominator
175824
175825
  * @returns return `numerator/denominator` but if the ratio would exceed `Geometry.largeFractionResult`,
@@ -175831,7 +175832,7 @@ class Geometry {
175831
175832
  return defaultResult;
175832
175833
  }
175833
175834
  /**
175834
- * Return `numerator` over `denominator` (with a given `largestResult`) or `undefined`.
175835
+ * Return `numerator` divided by `denominator` (with a given `largestResult`), or `undefined`.
175835
175836
  * @param numerator the numerator
175836
175837
  * @param denominator the denominator
175837
175838
  * @param largestResult the ratio threshold.
@@ -210899,7 +210900,7 @@ __webpack_require__.r(__webpack_exports__);
210899
210900
 
210900
210901
 
210901
210902
  /* eslint-disable @itwin/prefer-get */
210902
- // cSpell:words XXYZ YXYZ ZXYZ SaeedTorabi arctan newcommand
210903
+ // cSpell:words XXYZ YXYZ ZXYZ SaeedTorabi arctan newcommand diagonalization
210903
210904
  /**
210904
210905
  * PackedMatrix3dOps contains static methods for matrix operations where the matrix is a Float64Array.
210905
210906
  * * The Float64Array contains the matrix entries in row-major order
@@ -211552,7 +211553,14 @@ class Matrix3d {
211552
211553
  }
211553
211554
  return Matrix3d.createIdentity(result);
211554
211555
  }
211555
- /** Return the matrix for rotation of `angle` around desired `axis` */
211556
+ /**
211557
+ * Return the matrix for rotation of `angle` around desired `axis`
211558
+ * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/CubeRotationAroundAnAxis
211559
+ * @param axis the axis of rotation
211560
+ * @param angle the angle of rotation
211561
+ * @param result caller-allocated matrix (optional)
211562
+ * @returns the `rotation matrix` or `undefined` (if axis magnitude is near zero).
211563
+ */
211556
211564
  static createRotationAroundVector(axis, angle, result) {
211557
211565
  // Rodriguez formula (matrix form), https://mathworld.wolfram.com/RodriguesRotationFormula.html
211558
211566
  const c = angle.cos();
@@ -211768,63 +211776,143 @@ class Matrix3d {
211768
211776
  return result;
211769
211777
  }
211770
211778
  /**
211771
- * Apply (in place) a jacobi update that zeros out this.at(i,j).
211779
+ * Apply (in place) a jacobi eigenvalue algorithm.
211772
211780
  * @param i row index of zeroed member
211773
211781
  * @param j column index of zeroed member
211774
- * @param k other row/column index (different from i and j)
211775
- * @param leftEigenVectors a matrix that its columns will be filled by eigenvectors of this Matrix3d
211776
- * (allocated by caller, computed and filled by this function)
211782
+ * @param leftEigenvectors a matrix that its columns will be filled by the left eigenvectors of `this` Matrix3d
211783
+ * (allocated by caller, computed and filled by this function). Note that columns of leftEigenVectors will be
211784
+ * mutually perpendicular because `this` matrix is symmetric.
211785
+ * @param lambda a matrix that its diagonal entries will be filled by eigenvalues and its non-diagonal elements
211786
+ * converge to 0 (allocated by caller, computed and filled by this function).
211787
+ */
211788
+ applySymmetricJacobi(i, j, leftEigenvectors, lambda) {
211789
+ const sii = lambda.at(i, i);
211790
+ const sjj = lambda.at(j, j);
211791
+ const sij = lambda.at(i, j);
211792
+ if (Math.abs(sij) < 1.0e-15 * (sii + sjj))
211793
+ return 0.0;
211794
+ const jacobi = _Angle__WEBPACK_IMPORTED_MODULE_1__.Angle.trigValuesToHalfAngleTrigValues(sii - sjj, 2.0 * sij);
211795
+ const c = jacobi.c;
211796
+ const s = jacobi.s;
211797
+ /**
211798
+ * The following check does not exist in applyFastSymmetricJacobi because here if we don't return
211799
+ * early, the matrix remains untouched. However, applyFastSymmetricJacobi zeroes-out elements ij
211800
+ * and ji. Therefore, if we return early in applyFastSymmetricJacobi, zeroing-out wont happen.
211801
+ */
211802
+ if (Math.abs(s) < 2.0e-15)
211803
+ return 0.0;
211804
+ /**
211805
+ * If you apply the following 2 lines to a symmetric matrix, you get same lines used in
211806
+ * applyFastSymmetricJacobi. There are 2 differences which make applyFastSymmetricJacobi
211807
+ * more efficient. First, we directly set elements ij and ji equal to zero rather than
211808
+ * calculation them. Second, we copy symmetric elements from upper triangle to lower
211809
+ * instead of calculating them.
211810
+ */
211811
+ lambda.applyGivensRowOp(i, j, c, s);
211812
+ lambda.applyGivensColumnOp(i, j, c, s);
211813
+ leftEigenvectors.applyGivensColumnOp(i, j, c, s);
211814
+ return Math.abs(sij);
211815
+ }
211816
+ /**
211817
+ * Factor `this` matrix as a product `U * lambda * UT` where `U` is an orthogonal matrix and `lambda`
211818
+ * is a diagonal matrix.
211819
+ *
211820
+ * * **Note 1:** You must apply this function to a `symmetric` matrix. Otherwise, the lower triangle is ignored
211821
+ * and the upper triangle is mirrored to the lower triangle to enforce symmetry.
211822
+ * * **Note 2:** This function is replaced by a faster method called `fastSymmetricEigenvalues` so consider
211823
+ * using the fast version instead.
211824
+ * @param leftEigenvectors a matrix that its columns will be filled by the left eigenvectors of `this` Matrix3d
211825
+ * (allocated by caller, computed and filled by this function). Note that columns of leftEigenVectors will be
211826
+ * mutually perpendicular because `this` matrix is symmetric.
211827
+ * @param lambda a vector that its entries will be filled by eigenvalues of `this` Matrix3d (allocated by
211828
+ * caller, computed and filled by this function).
211829
+ */
211830
+ symmetricEigenvalues(leftEigenvectors, lambda) {
211831
+ const matrix = this.clone();
211832
+ leftEigenvectors.setIdentity();
211833
+ matrix.coffs[3] = matrix.coffs[1];
211834
+ matrix.coffs[6] = matrix.coffs[2];
211835
+ matrix.coffs[7] = matrix.coffs[5];
211836
+ const tolerance = 1.0e-12 * this.sumSquares();
211837
+ const numberOfIterations = 7;
211838
+ for (let iteration = 0; iteration < numberOfIterations; iteration++) {
211839
+ const sum = this.applySymmetricJacobi(0, 1, leftEigenvectors, matrix)
211840
+ + this.applySymmetricJacobi(0, 2, leftEigenvectors, matrix)
211841
+ + this.applySymmetricJacobi(1, 2, leftEigenvectors, matrix);
211842
+ if (sum < tolerance) {
211843
+ lambda.set(matrix.at(0, 0), matrix.at(1, 1), matrix.at(2, 2));
211844
+ return true;
211845
+ }
211846
+ }
211847
+ return false;
211848
+ }
211849
+ /**
211850
+ * Apply (in place) a jacobi eigenvalue algorithm that diagonalize `this` matrix, i.e., zeros out this.at(i,j).
211851
+ * * During diagonalization, the upper triangle is mirrored to lower triangle to enforce symmetry.
211852
+ * * Math details can be found at docs/learning/geometry/Matrix.md
211853
+ * @param i row index of zeroed member.
211854
+ * @param j column index of zeroed member.
211855
+ * @param k other row/column index (different from i and j).
211856
+ * @param leftEigenVectors a matrix that its columns will be filled by the left eigenvectors of `this` Matrix3d
211857
+ * (allocated by caller, computed and filled by this function). Note that columns of leftEigenVectors will be
211858
+ * mutually perpendicular because `this` matrix is symmetric.
211777
211859
  */
211778
- applyFastSymmetricJacobiUpdate(i, j, k, leftEigenVectors) {
211860
+ applyFastSymmetricJacobi(i, j, k, leftEigenVectors) {
211779
211861
  const indexII = 4 * i;
211780
211862
  const indexJJ = 4 * j;
211781
211863
  const indexIJ = 3 * i + j;
211864
+ const indexJI = 3 * j + i;
211782
211865
  const indexIK = 3 * i + k;
211866
+ const indexKI = 3 * k + i;
211783
211867
  const indexJK = 3 * j + k;
211784
- const dotUU = this.coffs[indexII];
211785
- const dotVV = this.coffs[indexJJ];
211786
- const dotUV = this.coffs[indexIJ];
211787
- const jacobi = _Angle__WEBPACK_IMPORTED_MODULE_1__.Angle.trigValuesToHalfAngleTrigValues(dotUU - dotVV, 2.0 * dotUV);
211788
- if (Math.abs(dotUV) < 1.0e-15 * (dotUU + dotVV))
211868
+ const indexKJ = 3 * k + j;
211869
+ const sii = this.coffs[indexII];
211870
+ const sjj = this.coffs[indexJJ];
211871
+ const sij = this.coffs[indexIJ];
211872
+ if (Math.abs(sij) < 1.0e-15 * (sii + sjj))
211789
211873
  return 0.0;
211874
+ const jacobi = _Angle__WEBPACK_IMPORTED_MODULE_1__.Angle.trigValuesToHalfAngleTrigValues(sii - sjj, 2.0 * sij);
211790
211875
  const c = jacobi.c;
211791
211876
  const s = jacobi.s;
211792
211877
  const cc = c * c;
211793
211878
  const ss = s * s;
211794
211879
  const sc2 = 2.0 * c * s;
211795
- this.coffs[indexII] = cc * dotUU + sc2 * dotUV + ss * dotVV;
211796
- this.coffs[indexJJ] = ss * dotUU - sc2 * dotUV + cc * dotVV;
211880
+ this.coffs[indexII] = cc * sii + sc2 * sij + ss * sjj;
211881
+ this.coffs[indexJJ] = ss * sii - sc2 * sij + cc * sjj;
211797
211882
  this.coffs[indexIJ] = 0.0;
211883
+ this.coffs[indexJI] = 0.0;
211798
211884
  const a = this.coffs[indexIK];
211799
211885
  const b = this.coffs[indexJK];
211800
- this.coffs[indexIK] = a * c + b * s;
211886
+ this.coffs[indexIK] = c * a + s * b;
211801
211887
  this.coffs[indexJK] = -s * a + c * b;
211802
- this.coffs[3 * j + i] = 0.0;
211803
- this.coffs[3 * k + i] = this.coffs[indexIK];
211804
- this.coffs[3 * k + j] = this.coffs[indexJK];
211888
+ this.coffs[indexKI] = this.coffs[indexIK];
211889
+ this.coffs[indexKJ] = this.coffs[indexJK];
211805
211890
  leftEigenVectors.applyGivensColumnOp(i, j, c, s);
211806
- return Math.abs(dotUV);
211891
+ return Math.abs(sij);
211807
211892
  }
211808
211893
  /**
211809
- * Factor this (symmetrized) as a product U * lambda * UT where U is orthogonal, lambda is diagonal.
211810
- * The upper triangle is mirrored to lower triangle to enforce symmetry.
211811
- * @param leftEigenvectors a matrix that its columns will be filled by eigenvectors of this Matrix3d
211812
- * (allocated by caller, computed and filled by this function)
211813
- * @param lambda a vector that its entries will be filled by eigenvalues of this Matrix3d
211814
- * (allocated by caller, computed and filled by this function)
211894
+ * Factor `this` matrix as a product `U * lambda * UT` where `U` is an orthogonal matrix and `lambda`
211895
+ * is a diagonal matrix.
211896
+ *
211897
+ * * **Note:** You must apply this function to a `symmetric` matrix. Otherwise, the lower triangle is ignored
211898
+ * and the upper triangle is mirrored to the lower triangle to enforce symmetry.
211899
+ * * Math details can be found at docs/learning/geometry/Matrix.md
211900
+ * @param leftEigenvectors a matrix that its columns will be filled by the left eigenvectors of `this` Matrix3d
211901
+ * (allocated by caller, computed and filled by this function). Note that columns of leftEigenVectors will be
211902
+ * mutually perpendicular because `this` matrix is symmetric.
211903
+ * @param lambda a vector that its entries will be filled by eigenvalues of `this` Matrix3d (allocated by
211904
+ * caller, computed and filled by this function).
211815
211905
  */
211816
211906
  fastSymmetricEigenvalues(leftEigenvectors, lambda) {
211817
211907
  const matrix = this.clone();
211818
211908
  leftEigenvectors.setIdentity();
211819
211909
  const tolerance = 1.0e-12 * this.sumSquares();
211820
- for (let iteration = 0; iteration < 7; iteration++) {
211821
- const sum = matrix.applyFastSymmetricJacobiUpdate(0, 1, 2, leftEigenvectors)
211822
- + matrix.applyFastSymmetricJacobiUpdate(0, 2, 1, leftEigenvectors)
211823
- + matrix.applyFastSymmetricJacobiUpdate(1, 2, 0, leftEigenvectors);
211824
- // console.log("symmetric sum", sum);
211825
- // console.log ("sum", sum);
211910
+ const numberOfIterations = 7;
211911
+ for (let iteration = 0; iteration < numberOfIterations; iteration++) {
211912
+ const sum = matrix.applyFastSymmetricJacobi(0, 1, 2, leftEigenvectors)
211913
+ + matrix.applyFastSymmetricJacobi(0, 2, 1, leftEigenvectors)
211914
+ + matrix.applyFastSymmetricJacobi(1, 2, 0, leftEigenvectors);
211826
211915
  if (sum < tolerance) {
211827
- // console.log("symmetric iterations", iteration);
211828
211916
  lambda.set(matrix.at(0, 0), matrix.at(1, 1), matrix.at(2, 2));
211829
211917
  return true;
211830
211918
  }
@@ -211832,8 +211920,8 @@ class Matrix3d {
211832
211920
  return false;
211833
211921
  }
211834
211922
  /**
211835
- * Compute the (unit vector) axis and angle of rotation.
211836
- * * math details can be found at docs/learning/geometry/Angle.md
211923
+ * Compute the (unit vector) axis and angle for the rotation generated by `this` Matrix3d.
211924
+ * * Math details can be found at docs/learning/geometry/Angle.md
211837
211925
  * @returns Returns axis and angle of rotation with result.ok === true when the conversion succeeded.
211838
211926
  */
211839
211927
  getAxisAndAngleOfRotation() {
@@ -211859,7 +211947,7 @@ class Matrix3d {
211859
211947
  * 2x^2-1 2xy 2xz
211860
211948
  * 2xy 2y^2-1 2yz
211861
211949
  * 2xz 2yz 2z^2-1
211862
- * Note that the matrix is symmetric.
211950
+ * Note that the matrix is "symmetric".
211863
211951
  * If rotation is around one the standard basis then non-diagonal entries become 0 and we
211864
211952
  * have one 1 and two -1s on the diagonal.
211865
211953
  * If rotation is around an axis other than standard basis, then the axis is the eigenvector
@@ -211881,7 +211969,7 @@ class Matrix3d {
211881
211969
  // Look for eigenvector with eigenvalue = 1
211882
211970
  const eigenvectors = Matrix3d.createIdentity();
211883
211971
  const eigenvalues = _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.create(0, 0, 0);
211884
- if (this.fastSymmetricEigenvalues(eigenvectors, eigenvalues)) {
211972
+ if (this.fastSymmetricEigenvalues(eigenvectors, eigenvalues)) { // note: this matrix is "symmetric"
211885
211973
  for (let axisIndex = 0; axisIndex < 2; axisIndex++) {
211886
211974
  const lambda = eigenvalues.at(axisIndex);
211887
211975
  if (_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isAlmostEqualNumber(1, lambda))
@@ -211902,53 +211990,67 @@ class Matrix3d {
211902
211990
  };
211903
211991
  return result;
211904
211992
  }
211905
- /** Rotate so columns i and j become perpendicular */
211993
+ /**
211994
+ * Rotate columns i and j of `this` matrix to make them perpendicular using the angle that zero-out
211995
+ * `thisTranspose * this`.
211996
+ * @param i row index of zeroed member.
211997
+ * @param j column index of zeroed member.
211998
+ * @param matrixU a matrix that its columns will be filled by the right eigenvectors of `thisTranspose * this`
211999
+ * (allocated by caller, computed and filled by this function). Note that columns of matrixU will be mutually
212000
+ * perpendicular because `thisTranspose * this` matrix is symmetric.
212001
+ */
211906
212002
  applyJacobiColumnRotation(i, j, matrixU) {
211907
- const uDotU = this.coffs[i] * this.coffs[i] + this.coffs[i + 3] * this.coffs[i + 3] + this.coffs[i + 6] * this.coffs[i + 6];
211908
- const vDotV = this.coffs[j] * this.coffs[j] + this.coffs[j + 3] * this.coffs[j + 3] + this.coffs[j + 6] * this.coffs[j + 6];
211909
- const uDotV = this.coffs[i] * this.coffs[j] + this.coffs[i + 3] * this.coffs[j + 3] + this.coffs[i + 6] * this.coffs[j + 6];
211910
- // const c2 = uDotU - vDotV;
211911
- // const s2 = 2.0 * uDotV;
212003
+ const uDotU = this.coffs[i] * this.coffs[i]
212004
+ + this.coffs[i + 3] * this.coffs[i + 3]
212005
+ + this.coffs[i + 6] * this.coffs[i + 6];
212006
+ const vDotV = this.coffs[j] * this.coffs[j]
212007
+ + this.coffs[j + 3] * this.coffs[j + 3]
212008
+ + this.coffs[j + 6] * this.coffs[j + 6];
212009
+ const uDotV = this.coffs[i] * this.coffs[j]
212010
+ + this.coffs[i + 3] * this.coffs[j + 3]
212011
+ + this.coffs[i + 6] * this.coffs[j + 6];
211912
212012
  const jacobi = _Angle__WEBPACK_IMPORTED_MODULE_1__.Angle.trigValuesToHalfAngleTrigValues(uDotU - vDotV, 2.0 * uDotV);
211913
- // const h = Math.hypot(c2, s2);
211914
- // console.log(" c2 s2", c2 / h, s2 / h);
211915
- // console.log(" C S ", Math.cos(2 * jacobi.radians), Math.sin(2 * jacobi.radians));
211916
- // console.log("i j uDotV", i, j, uDotV);
211917
- if (Math.abs(jacobi.s) < 2.0e-15)
212013
+ const c = jacobi.c;
212014
+ const s = jacobi.s;
212015
+ if (Math.abs(s) < 2.0e-15)
211918
212016
  return 0.0;
211919
- this.applyGivensColumnOp(i, j, jacobi.c, jacobi.s);
211920
- matrixU.applyGivensRowOp(i, j, jacobi.c, jacobi.s);
211921
- // const BTB = this.multiplyMatrixTransposeMatrix(this);
211922
- // console.log("BTB", BTB.at(0, 0), BTB.at(1, 1), BTB.at(2, 2), " off", BTB.at(0, 1), BTB.at(0, 2), BTB.at(1, 2), " at(i,j)", BTB.at(i, j));
212017
+ this.applyGivensColumnOp(i, j, c, s); // make columns i and j of `this` matrix perpendicular
212018
+ matrixU.applyGivensRowOp(i, j, c, s); // right eigenvalues of `thisTranspose * this`
211923
212019
  return Math.abs(uDotV);
211924
212020
  }
211925
212021
  /**
211926
- * Factor this as a product C * U where C has mutually perpendicular columns and
211927
- * U is orthogonal.
211928
- * @param matrixC (allocate by caller, computed here)
211929
- * @param matrixU (allocate by caller, computed here)
212022
+ * Factor `this` matrix as a product `VD * U` where `VD` has mutually perpendicular columns and `U` is orthogonal.
212023
+ * @param matrixVD a matrix that its columns will be filled by rotating columns of `this` to make them mutually
212024
+ * perpendicular (allocated by caller, computed and filled by this function).
212025
+ * @param matrixU a matrix that its columns will be filled by the right eigenvectors of `thisTranspose * this`
212026
+ * (allocated by caller, computed and filled by this function). Note that columns of matrixU will be mutually
212027
+ * perpendicular because `thisTranspose * this` matrix is symmetric.
211930
212028
  */
211931
- factorPerpendicularColumns(matrixC, matrixU) {
211932
- matrixC.setFrom(this);
212029
+ factorPerpendicularColumns(matrixVD, matrixU) {
212030
+ matrixVD.setFrom(this);
211933
212031
  matrixU.setIdentity();
211934
212032
  const tolerance = 1.0e-12 * this.sumSquares();
211935
- for (let iteration = 0; iteration < 7; iteration++) {
211936
- const sum = matrixC.applyJacobiColumnRotation(0, 1, matrixU)
211937
- + matrixC.applyJacobiColumnRotation(0, 2, matrixU)
211938
- + matrixC.applyJacobiColumnRotation(1, 2, matrixU);
211939
- // console.log (" sum", sum);
212033
+ const numberOfIterations = 7;
212034
+ for (let iteration = 0; iteration < numberOfIterations; iteration++) {
212035
+ const sum = matrixVD.applyJacobiColumnRotation(0, 1, matrixU)
212036
+ + matrixVD.applyJacobiColumnRotation(0, 2, matrixU)
212037
+ + matrixVD.applyJacobiColumnRotation(1, 2, matrixU);
211940
212038
  if (sum < tolerance) {
211941
- // console.log("jacobi iterations", iteration);
211942
212039
  return true;
211943
212040
  }
211944
212041
  }
211945
212042
  return false;
211946
212043
  }
211947
212044
  /**
211948
- * Factor this matrix M as a product M = V * D * U where V and U are orthogonal, and D is diagonal (scale matrix).
211949
- * @param matrixV left orthogonal factor (allocate by caller, computed here)
211950
- * @param scale diagonal entries of D (allocate by caller, computed here)
211951
- * @param matrixU right orthogonal factor (allocate by caller, computed here)
212045
+ * Factor `this` matrix as a product `V * D * U` where `V` and `U` are orthogonal and `D` is diagonal with
212046
+ * positive entries.
212047
+ * * This is formally known as the `Singular Value Decomposition` or `SVD`.
212048
+ * @param matrixV an orthogonal matrix that its columns will be filled by the left eigenvectors of
212049
+ * `thisTranspose * this` (allocated by caller, computed and filled by this function).
212050
+ * @param scale singular values of `this` (allocated by caller, computed and filled by this function).
212051
+ * The singular values in the `scale` are non-negative and decreasing.
212052
+ * @param matrixU an orthogonal matrix that its columns will be filled by the right eigenvectors of
212053
+ * `thisTranspose * this` (allocated by caller, computed and filled by this function).
211952
212054
  */
211953
212055
  factorOrthogonalScaleOrthogonal(matrixV, scale, matrixU) {
211954
212056
  const matrixVD = Matrix3d.createZero();
@@ -211958,7 +212060,7 @@ class Matrix3d {
211958
212060
  column.push(matrixVD.getColumn(0));
211959
212061
  column.push(matrixVD.getColumn(1));
211960
212062
  column.push(matrixVD.getColumn(2));
211961
- scale.set(column[0].magnitude(), column[1].magnitude(), column[2].magnitude());
212063
+ scale.set(column[0].magnitude(), column[1].magnitude(), column[2].magnitude()); // singular values of `this`
211962
212064
  const det = matrixVD.determinant();
211963
212065
  if (det < 0)
211964
212066
  scale.z = -scale.z;
@@ -211966,7 +212068,7 @@ class Matrix3d {
211966
212068
  const scaleXIsZero = Math.abs(scale.x) < almostZero;
211967
212069
  const scaleYIsZero = Math.abs(scale.y) < almostZero;
211968
212070
  const scaleZIsZero = Math.abs(scale.z) < almostZero;
211969
- // ASSUME: any zero-magnitude column(s) of matrixVD are last
212071
+ // NOTE: We assume any zero-magnitude column(s) of matrixVD are last
211970
212072
  if (!scaleXIsZero && !scaleYIsZero && !scaleZIsZero) { // full rank
211971
212073
  matrixV = matrixVD.scaleColumns(1 / scale.x, 1 / scale.y, 1 / scale.z, matrixV);
211972
212074
  }
@@ -211984,59 +212086,6 @@ class Matrix3d {
211984
212086
  }
211985
212087
  return true;
211986
212088
  }
211987
- /** Apply a jacobi step to lambda which evolves towards diagonal. */
211988
- applySymmetricJacobi(i, j, lambda) {
211989
- const uDotU = lambda.at(i, i);
211990
- const vDotV = lambda.at(j, j);
211991
- const uDotV = lambda.at(i, j);
211992
- if (Math.abs(uDotV) < 1.0e-15 * (uDotU + vDotV))
211993
- return 0.0;
211994
- // const c2 = uDotU - vDotV;
211995
- // const s2 = 2.0 * uDotV;
211996
- const jacobi = _Angle__WEBPACK_IMPORTED_MODULE_1__.Angle.trigValuesToHalfAngleTrigValues(uDotU - vDotV, 2.0 * uDotV);
211997
- // const h = Math.hypot(c2, s2);
211998
- // console.log(" c2 s2", c2 / h, s2 / h);
211999
- // console.log(" C S ", Math.cos(2 * jacobi.radians), Math.sin(2 * jacobi.radians));
212000
- // console.log("i j uDotV", i, j, uDotV);
212001
- if (Math.abs(jacobi.s) < 2.0e-15)
212002
- return 0.0;
212003
- // Factored form is this *lambda * thisTranspose
212004
- // Let Q be the rotation matrix. Q*QT is inserted, viz
212005
- // this*Q * QT * lambda * Q*thisTranspose
212006
- this.applyGivensColumnOp(i, j, jacobi.c, jacobi.s);
212007
- lambda.applyGivensRowOp(i, j, jacobi.c, jacobi.s);
212008
- lambda.applyGivensColumnOp(i, j, jacobi.c, jacobi.s);
212009
- // const BTB = this.multiplyMatrixTransposeMatrix(this);
212010
- // console.log("BTB", BTB.at(0, 0), BTB.at(1, 1), BTB.at(2, 2), " off", BTB.at(0, 1), BTB.at(0, 2), BTB.at(1, 2), " at(i,j)", BTB.at(i, j));
212011
- return Math.abs(uDotV);
212012
- }
212013
- /**
212014
- * Factor this (symmetrized) as a product U * lambda * UT where U is orthogonal, lambda is diagonal.
212015
- * The upper triangle is mirrored to lower triangle to enforce symmetry.
212016
- * @param matrixC (allocate by caller, computed here)
212017
- * @param factor (allocate by caller, computed here)
212018
- */
212019
- symmetricEigenvalues(leftEigenvectors, lambda) {
212020
- const matrix = this.clone();
212021
- leftEigenvectors.setIdentity();
212022
- matrix.coffs[3] = matrix.coffs[1];
212023
- matrix.coffs[6] = matrix.coffs[2];
212024
- matrix.coffs[7] = matrix.coffs[5];
212025
- const tolerance = 1.0e-12 * this.sumSquares();
212026
- for (let iteration = 0; iteration < 7; iteration++) {
212027
- const sum = leftEigenvectors.applySymmetricJacobi(0, 1, matrix)
212028
- + leftEigenvectors.applySymmetricJacobi(0, 2, matrix)
212029
- + leftEigenvectors.applySymmetricJacobi(1, 2, matrix);
212030
- // console.log("symmetric sum", sum);
212031
- // console.log (" sum", sum);
212032
- if (sum < tolerance) {
212033
- // console.log("symmetric iterations", iteration);
212034
- lambda.set(matrix.at(0, 0), matrix.at(1, 1), matrix.at(2, 2));
212035
- return true;
212036
- }
212037
- }
212038
- return false;
212039
- }
212040
212089
  /**
212041
212090
  * Return a matrix that rotates a fraction of the angular sweep from vectorA to vectorB.
212042
212091
  * @param vectorA initial vector position
@@ -213134,8 +213183,7 @@ class Matrix3d {
213134
213183
  this.inverseState = InverseMatrixState.unknown;
213135
213184
  }
213136
213185
  /**
213137
- * Create a rigid matrix (columns and rows are unit length and pairwise perpendicular) for
213138
- * the given eye coordinate.
213186
+ * Create a rigid matrix (columns and rows are unit length and pairwise perpendicular) for the given eye coordinate.
213139
213187
  * * column 2 is parallel to (x,y,z).
213140
213188
  * * column 0 is perpendicular to column 2 and is in the xy plane.
213141
213189
  * * column 1 is perpendicular to both. It is the "up" vector on the view plane.
@@ -213168,7 +213216,8 @@ class Matrix3d {
213168
213216
  *
213169
213217
  * This is an orthogonal matrix meaning it rotates the standard XYZ axis to ABC axis system
213170
213218
  * (if matrix is [A B C]). The matrix rotates (0,0,1), i.e., the default Top view or Z axis,
213171
- * to the eye point (x/r,y/r,z/r). The matrix also rotates (1,0,0) to a point on XY plane.
213219
+ * to the eye point (x/r,y/r,z/r) where r = sqrt(x*x + y*y + z*z). The matrix also rotates
213220
+ * (1,0,0) to a point on XY plane.
213172
213221
  */
213173
213222
  const c = x / rxy;
213174
213223
  const s = y / rxy;
@@ -213248,6 +213297,15 @@ class Matrix3d {
213248
213297
  const sumOff = Math.abs(sumAll - sumDiagonal);
213249
213298
  return Math.sqrt(sumOff) <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians * (1.0 + Math.sqrt(sumAll));
213250
213299
  }
213300
+ /** Sum of squared differences between symmetric pairs (symmetric pairs have indices (1,3), (2,6), and (5,7).) */
213301
+ sumSkewSquares() {
213302
+ return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.hypotenuseSquaredXYZ(this.coffs[1] - this.coffs[3], this.coffs[2] - this.coffs[6], this.coffs[5] - this.coffs[7]);
213303
+ }
213304
+ /** Test if the matrix is (very near to) symmetric */
213305
+ isSymmetric() {
213306
+ const offDiagonal = this.sumSkewSquares();
213307
+ return Math.sqrt(offDiagonal) <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians * (1.0 + Math.sqrt(this.sumSquares()));
213308
+ }
213251
213309
  /** Test if the stored inverse is present and marked valid */
213252
213310
  get hasCachedInverse() {
213253
213311
  return this.inverseState === InverseMatrixState.inverseStored && this.inverseCoffs !== undefined;
@@ -213261,7 +213319,7 @@ class Matrix3d {
213261
213319
  /** Test if the above diagonal entries (1,2,5) are all nearly zero */
213262
213320
  get isLowerTriangular() {
213263
213321
  const sumAll = this.sumSquares();
213264
- const sumLow = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.hypotenuseSquaredXYZ(this.coffs[1], this.coffs[2], this.coffs[75]);
213322
+ const sumLow = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.hypotenuseSquaredXYZ(this.coffs[1], this.coffs[2], this.coffs[5]);
213265
213323
  return Math.sqrt(sumLow) <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians * (1.0 + Math.sqrt(sumAll));
213266
213324
  }
213267
213325
  /**
@@ -213278,10 +213336,6 @@ class Matrix3d {
213278
213336
  return this.coffs[0];
213279
213337
  return undefined;
213280
213338
  }
213281
- /** Sum of squared differences between symmetric pairs (entry 1 and 3 - 2 and 6 - 5 and 7) */
213282
- sumSkewSquares() {
213283
- return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.hypotenuseSquaredXYZ(this.coffs[1] - this.coffs[3], this.coffs[2] - this.coffs[6], this.coffs[5] - this.coffs[7]);
213284
- }
213285
213339
  /**
213286
213340
  * Test if all rows and columns are unit length and are perpendicular to each other, i.e., the matrix is either
213287
213341
  * a `pure rotation` (determinant is +1) or is a `mirror` (determinant is -1).
@@ -213585,6 +213639,7 @@ class OrderedRotationAngles {
213585
213639
  * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
213586
213640
  * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
213587
213641
  * matrix multiplication would be zRot*yRot*xRot
213642
+ * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/CubeRotationAroundStandardAxes
213588
213643
  * @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.
213589
213644
  * rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.
213590
213645
  * * if xyzRotationIsClockwise is undefined it's set to [false, false, false].
@@ -280029,7 +280084,7 @@ class TestContext {
280029
280084
  this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
280030
280085
  const iModelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${process.env.IMJS_URL_PREFIX ?? ""}api.bentley.com/imodels` } });
280031
280086
  await core_frontend_1.NoRenderApp.startup({
280032
- applicationVersion: "4.0.0-dev.39",
280087
+ applicationVersion: "4.0.0-dev.40",
280033
280088
  applicationId: this.settings.gprid,
280034
280089
  authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.adminUserAccessToken),
280035
280090
  hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),
@@ -299585,7 +299640,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
299585
299640
  /***/ ((module) => {
299586
299641
 
299587
299642
  "use strict";
299588
- module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"4.0.0-dev.39","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","build:ci":"npm run -s build && 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 \\"../../tools/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/tree/master/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.39","@itwin/core-bentley":"workspace:^4.0.0-dev.39","@itwin/core-common":"workspace:^4.0.0-dev.39","@itwin/core-geometry":"workspace:^4.0.0-dev.39","@itwin/core-orbitgt":"workspace:^4.0.0-dev.39","@itwin/core-quantity":"workspace:^4.0.0-dev.39"},"//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":"workspace:*","@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":"~4.4.0","webpack":"^5.64.4"},"//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"}}]}}');
299643
+ module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"4.0.0-dev.40","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","build:ci":"npm run -s build && 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 \\"../../tools/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/tree/master/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.40","@itwin/core-bentley":"workspace:^4.0.0-dev.40","@itwin/core-common":"workspace:^4.0.0-dev.40","@itwin/core-geometry":"workspace:^4.0.0-dev.40","@itwin/core-orbitgt":"workspace:^4.0.0-dev.40","@itwin/core-quantity":"workspace:^4.0.0-dev.40"},"//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":"workspace:*","@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":"~4.4.0","webpack":"^5.64.4"},"//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"}}]}}');
299589
299644
 
299590
299645
  /***/ }),
299591
299646