@itwin/rpcinterface-full-stack-tests 4.0.0-dev.10 → 4.0.0-dev.11
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/bundled-tests.js +252 -208
- package/lib/dist/bundled-tests.js.map +1 -1
- package/package.json +14 -14
|
@@ -212221,6 +212221,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
212221
212221
|
* `degrees` or `radians` because both are available if requested by caller.
|
|
212222
212222
|
* * The various access method are named so that callers can specify whether untyped numbers passed in or
|
|
212223
212223
|
* out are degrees or radians.
|
|
212224
|
+
* * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/AngleSweep
|
|
212224
212225
|
* @public
|
|
212225
212226
|
*/
|
|
212226
212227
|
class Angle {
|
|
@@ -212784,6 +212785,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
212784
212785
|
* * (350,370) covers the same unit angles as (-10,10).
|
|
212785
212786
|
* * (370,350) covers the same unit angles as (10,-10).
|
|
212786
212787
|
* * math details related fraction API can be found at docs/learning/geometry/Angle.md
|
|
212788
|
+
* * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/AngleSweep
|
|
212787
212789
|
* @public
|
|
212788
212790
|
*/
|
|
212789
212791
|
class AngleSweep {
|
|
@@ -218096,7 +218098,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
218096
218098
|
|
|
218097
218099
|
|
|
218098
218100
|
/* eslint-disable @itwin/prefer-get */
|
|
218099
|
-
// cSpell:words XXYZ YXYZ ZXYZ
|
|
218101
|
+
// cSpell:words XXYZ YXYZ ZXYZ SaeedTorabi
|
|
218100
218102
|
/**
|
|
218101
218103
|
* PackedMatrix3dOps contains static methods for matrix operations where the matrix is a Float64Array.
|
|
218102
218104
|
* * The Float64Array contains the matrix entries in row-major order
|
|
@@ -218506,9 +218508,20 @@ class Matrix3d {
|
|
|
218506
218508
|
return result;
|
|
218507
218509
|
}
|
|
218508
218510
|
/**
|
|
218509
|
-
|
|
218510
|
-
|
|
218511
|
-
|
|
218511
|
+
* Create the inverseCoffs member (filled with zeros)
|
|
218512
|
+
* This is for use by matrix * matrix multiplications which need to be sure the member is there to be
|
|
218513
|
+
* filled with method-specific content.
|
|
218514
|
+
*/
|
|
218515
|
+
createInverseCoffsWithZeros() {
|
|
218516
|
+
if (!this.inverseCoffs) {
|
|
218517
|
+
this.inverseState = InverseMatrixState.unknown;
|
|
218518
|
+
this.inverseCoffs = new Float64Array(9);
|
|
218519
|
+
}
|
|
218520
|
+
}
|
|
218521
|
+
/**
|
|
218522
|
+
* Copy the transpose of the coffs to the inverseCoffs.
|
|
218523
|
+
* * Mark the matrix as inverseStored.
|
|
218524
|
+
*/
|
|
218512
218525
|
setupInverseTranspose() {
|
|
218513
218526
|
const coffs = this.coffs;
|
|
218514
218527
|
this.inverseState = InverseMatrixState.inverseStored;
|
|
@@ -218727,6 +218740,7 @@ class Matrix3d {
|
|
|
218727
218740
|
* Construct a rigid matrix (orthogonal matrix with +1 determinant) using vectorA and its 2 perpendicular.
|
|
218728
218741
|
* * If axisOrder is not passed then `AxisOrder = AxisOrder.ZXY` is used as default.
|
|
218729
218742
|
* * This function internally uses createPerpendicularVectorFavorXYPlane and createRigidFromColumns.
|
|
218743
|
+
* * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/2PerpendicularVectorsTo1Vector
|
|
218730
218744
|
*/
|
|
218731
218745
|
static createRigidHeadsUp(vectorA, axisOrder = _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.ZXY, result) {
|
|
218732
218746
|
const vectorB = Matrix3d.createPerpendicularVectorFavorXYPlane(vectorA);
|
|
@@ -218776,7 +218790,7 @@ class Matrix3d {
|
|
|
218776
218790
|
/**
|
|
218777
218791
|
* Replace current rows Ui and Uj with (c*Ui + s*Uj) and (c*Uj - s*Ui).
|
|
218778
218792
|
* * There is no checking for i,j being 0,1,2.
|
|
218779
|
-
* @param i first row index.
|
|
218793
|
+
* @param i first row index. **must be 0,1,2** (unchecked)
|
|
218780
218794
|
* @param j second row index. **must be 0,1,2** (unchecked)
|
|
218781
218795
|
* @param c fist coefficient
|
|
218782
218796
|
* @param s second coefficient
|
|
@@ -219476,6 +219490,7 @@ class Matrix3d {
|
|
|
219476
219490
|
* \text{The matrix is } I + (s-1) D D^T
|
|
219477
219491
|
* \\ \text{with }D\text{ being the normalized direction vector and }s\text{ being the scale.}
|
|
219478
219492
|
* ```
|
|
219493
|
+
* * Visualization can be found at itwinjs.org/sandbox/SaeedTorabi/DirectionalScale
|
|
219479
219494
|
*/
|
|
219480
219495
|
static createDirectionalScale(direction, scale, result) {
|
|
219481
219496
|
const unit = direction.normalize();
|
|
@@ -219609,7 +219624,7 @@ class Matrix3d {
|
|
|
219609
219624
|
return result;
|
|
219610
219625
|
}
|
|
219611
219626
|
/**
|
|
219612
|
-
* Multiply transpose
|
|
219627
|
+
* Multiply the transpose matrix times a vector.
|
|
219613
219628
|
* * This produces the same x,y,z as treating the vector as a row on the left of the (un-transposed) matrix.
|
|
219614
219629
|
* ```
|
|
219615
219630
|
* equation
|
|
@@ -219618,7 +219633,7 @@ class Matrix3d {
|
|
|
219618
219633
|
* \text{Treating U as a row to the left of untransposed matrix\: return row}&\rowSubXYZ{V}&=&\rowSubXYZ{U}\matrixXY{A}
|
|
219619
219634
|
* \end{matrix}
|
|
219620
219635
|
* ```
|
|
219621
|
-
* @return the vector result
|
|
219636
|
+
* @return the vector result (optional)
|
|
219622
219637
|
*/
|
|
219623
219638
|
multiplyTransposeVector(vector, result) {
|
|
219624
219639
|
result = result ? result : new _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d();
|
|
@@ -219630,87 +219645,100 @@ class Matrix3d {
|
|
|
219630
219645
|
result.z = this.coffs[2] * x + this.coffs[5] * y + this.coffs[8] * z;
|
|
219631
219646
|
return result;
|
|
219632
219647
|
}
|
|
219633
|
-
/**
|
|
219634
|
-
*
|
|
219648
|
+
/**
|
|
219649
|
+
* Multiply the matrix * [x,y,z], i.e. the vector [x,y,z] is a column vector on the right.
|
|
219650
|
+
* @return the vector result (optional)
|
|
219635
219651
|
*/
|
|
219636
219652
|
multiplyXYZ(x, y, z, result) {
|
|
219637
219653
|
result = result ? result : new _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d();
|
|
219638
|
-
result.x =
|
|
219639
|
-
result.y =
|
|
219640
|
-
result.z =
|
|
219654
|
+
result.x = this.coffs[0] * x + this.coffs[1] * y + this.coffs[2] * z;
|
|
219655
|
+
result.y = this.coffs[3] * x + this.coffs[4] * y + this.coffs[5] * z;
|
|
219656
|
+
result.z = this.coffs[6] * x + this.coffs[7] * y + this.coffs[8] * z;
|
|
219641
219657
|
return result;
|
|
219642
219658
|
}
|
|
219643
|
-
/**
|
|
219644
|
-
*
|
|
219645
|
-
*
|
|
219659
|
+
/**
|
|
219660
|
+
* Multiply the matrix * xyz, place result in (required) return value.
|
|
219661
|
+
* @param xyz right side
|
|
219662
|
+
* @param result the result.
|
|
219646
219663
|
*/
|
|
219647
219664
|
multiplyXYZtoXYZ(xyz, result) {
|
|
219648
219665
|
const x = xyz.x;
|
|
219649
219666
|
const y = xyz.y;
|
|
219650
219667
|
const z = xyz.z;
|
|
219651
|
-
result.x =
|
|
219652
|
-
result.y =
|
|
219653
|
-
result.z =
|
|
219668
|
+
result.x = this.coffs[0] * x + this.coffs[1] * y + this.coffs[2] * z;
|
|
219669
|
+
result.y = this.coffs[3] * x + this.coffs[4] * y + this.coffs[5] * z;
|
|
219670
|
+
result.z = this.coffs[6] * x + this.coffs[7] * y + this.coffs[8] * z;
|
|
219654
219671
|
return result;
|
|
219655
219672
|
}
|
|
219656
|
-
/**
|
|
219657
|
-
*
|
|
219673
|
+
/**
|
|
219674
|
+
* Multiply the matrix * [x,y,0], i.e. the vector [x,y,0] is a column vector on the right.
|
|
219675
|
+
* @return the vector result (optional)
|
|
219658
219676
|
*/
|
|
219659
219677
|
multiplyXY(x, y, result) {
|
|
219660
219678
|
result = result ? result : new _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d();
|
|
219661
|
-
result.x =
|
|
219662
|
-
result.y =
|
|
219663
|
-
result.z =
|
|
219679
|
+
result.x = this.coffs[0] * x + this.coffs[1] * y;
|
|
219680
|
+
result.y = this.coffs[3] * x + this.coffs[4] * y;
|
|
219681
|
+
result.z = this.coffs[6] * x + this.coffs[7] * y;
|
|
219664
219682
|
return result;
|
|
219665
219683
|
}
|
|
219666
|
-
/**
|
|
219684
|
+
/**
|
|
219685
|
+
* Compute origin + the matrix * [x,y,0].
|
|
219686
|
+
* @return the vector result (optional)
|
|
219687
|
+
*/
|
|
219667
219688
|
originPlusMatrixTimesXY(origin, x, y, result) {
|
|
219668
219689
|
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Point3d.create(origin.x + this.coffs[0] * x + this.coffs[1] * y, origin.y + this.coffs[3] * x + this.coffs[4] * y, origin.z + this.coffs[6] * x + this.coffs[7] * y, result);
|
|
219669
219690
|
}
|
|
219670
|
-
/**
|
|
219691
|
+
/**
|
|
219692
|
+
* Multiply the matrix * (x,y,z) in place, i.e. the vector (x,y,z) is a column vector on the right and
|
|
219693
|
+
* the multiplication updates the vector values.
|
|
219694
|
+
* @param xyzData the vector data
|
|
219695
|
+
*/
|
|
219671
219696
|
multiplyVectorInPlace(xyzData) {
|
|
219672
219697
|
const x = xyzData.x;
|
|
219673
219698
|
const y = xyzData.y;
|
|
219674
219699
|
const z = xyzData.z;
|
|
219675
|
-
|
|
219676
|
-
xyzData.
|
|
219677
|
-
xyzData.
|
|
219678
|
-
xyzData.z = (coffs[6] * x + coffs[7] * y + coffs[8] * z);
|
|
219700
|
+
xyzData.x = this.coffs[0] * x + this.coffs[1] * y + this.coffs[2] * z;
|
|
219701
|
+
xyzData.y = this.coffs[3] * x + this.coffs[4] * y + this.coffs[5] * z;
|
|
219702
|
+
xyzData.z = this.coffs[6] * x + this.coffs[7] * y + this.coffs[8] * z;
|
|
219679
219703
|
}
|
|
219680
|
-
/**
|
|
219681
|
-
*
|
|
219704
|
+
/**
|
|
219705
|
+
* Multiply the transpose matrix times [x,y,z] in place, i.e. the vector [x,y,z] is a column vector on
|
|
219706
|
+
* the right and the multiplication updates the vector values.
|
|
219707
|
+
* * This is equivalent to `multiplyTransposeVector` but always returns the result directly in the input.
|
|
219708
|
+
* @param xyzData the vector data
|
|
219682
219709
|
*/
|
|
219683
219710
|
multiplyTransposeVectorInPlace(vectorU) {
|
|
219684
219711
|
const x = vectorU.x;
|
|
219685
219712
|
const y = vectorU.y;
|
|
219686
219713
|
const z = vectorU.z;
|
|
219687
|
-
|
|
219688
|
-
vectorU.
|
|
219689
|
-
vectorU.
|
|
219690
|
-
vectorU.z = (coffs[2] * x + coffs[5] * y + coffs[8] * z);
|
|
219714
|
+
vectorU.x = this.coffs[0] * x + this.coffs[3] * y + this.coffs[6] * z;
|
|
219715
|
+
vectorU.y = this.coffs[1] * x + this.coffs[4] * y + this.coffs[7] * z;
|
|
219716
|
+
vectorU.z = this.coffs[2] * x + this.coffs[5] * y + this.coffs[8] * z;
|
|
219691
219717
|
}
|
|
219692
|
-
/**
|
|
219693
|
-
*
|
|
219718
|
+
/**
|
|
219719
|
+
* Multiply the transpose matrix times column using individual numeric inputs.
|
|
219720
|
+
* * This produces the same x,y,z as treating the vector as a row on the left of the (un-transposed) matrix.
|
|
219694
219721
|
* ```
|
|
219695
219722
|
* equation
|
|
219696
219723
|
* \begin{matrix}
|
|
219697
|
-
* \text{treating the input as a column } \columnXYZ{x}{y}{z}\text{ compute }&\columnSubXYZ{V} &= &A^T \columnXYZ{x}{y}{z} \\
|
|
219698
|
-
* \text{or row vector } \rowXYZ{x}{y}{z} \text{ compute }&\rowSubXYZ{V} &= &\rowXYZ{x}{y}{z} A \\
|
|
219724
|
+
* \text{treating the input as a column vector } \columnXYZ{x}{y}{z}\text{ compute }&\columnSubXYZ{V} &= &A^T \columnXYZ{x}{y}{z} \\
|
|
219725
|
+
* \text{or as a row vector } \rowXYZ{x}{y}{z} \text{ compute }&\rowSubXYZ{V} &= &\rowXYZ{x}{y}{z} A \\
|
|
219699
219726
|
* \phantom{8888}\text{and return V as a Vector3d} & & &
|
|
219700
219727
|
* \end{matrix}
|
|
219701
219728
|
* ````
|
|
219702
|
-
* @return the vector result
|
|
219729
|
+
* @return the vector result (optional)
|
|
219703
219730
|
*/
|
|
219704
219731
|
multiplyTransposeXYZ(x, y, z, result) {
|
|
219705
219732
|
result = result ? result : new _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d();
|
|
219706
|
-
result.x =
|
|
219707
|
-
result.y =
|
|
219708
|
-
result.z =
|
|
219733
|
+
result.x = this.coffs[0] * x + this.coffs[3] * y + this.coffs[6] * z;
|
|
219734
|
+
result.y = this.coffs[1] * x + this.coffs[4] * y + this.coffs[7] * z;
|
|
219735
|
+
result.z = this.coffs[2] * x + this.coffs[5] * y + this.coffs[8] * z;
|
|
219709
219736
|
return result;
|
|
219710
219737
|
}
|
|
219711
|
-
/**
|
|
219712
|
-
*
|
|
219713
|
-
* *
|
|
219738
|
+
/**
|
|
219739
|
+
* Solve `matrix * result = vector` for an unknown `result`.
|
|
219740
|
+
* * This is equivalent to multiplication `result = inverse matrix * vector`.
|
|
219741
|
+
* * Result is undefined if the matrix is singular (e.g. has parallel columns or a zero magnitude column)
|
|
219714
219742
|
*/
|
|
219715
219743
|
multiplyInverse(vector, result) {
|
|
219716
219744
|
this.computeCachedInverse(true);
|
|
@@ -219718,13 +219746,14 @@ class Matrix3d {
|
|
|
219718
219746
|
const x = vector.x;
|
|
219719
219747
|
const y = vector.y;
|
|
219720
219748
|
const z = vector.z;
|
|
219721
|
-
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.create(
|
|
219749
|
+
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.create(this.inverseCoffs[0] * x + this.inverseCoffs[1] * y + this.inverseCoffs[2] * z, this.inverseCoffs[3] * x + this.inverseCoffs[4] * y + this.inverseCoffs[5] * z, this.inverseCoffs[6] * x + this.inverseCoffs[7] * y + this.inverseCoffs[8] * z, result);
|
|
219722
219750
|
}
|
|
219723
219751
|
return undefined;
|
|
219724
219752
|
}
|
|
219725
|
-
/**
|
|
219753
|
+
/**
|
|
219754
|
+
* Solve `matrixTranspose * result = vector` for an unknown `result`.
|
|
219726
219755
|
* * This is equivalent to multiplication `result = matrixInverseTranspose * vector`.
|
|
219727
|
-
* * Result is undefined if the matrix is singular (e.g. has parallel or zero
|
|
219756
|
+
* * Result is undefined if the matrix is singular (e.g. has parallel columns or a zero magnitude column)
|
|
219728
219757
|
*/
|
|
219729
219758
|
multiplyInverseTranspose(vector, result) {
|
|
219730
219759
|
this.computeCachedInverse(true);
|
|
@@ -219732,87 +219761,91 @@ class Matrix3d {
|
|
|
219732
219761
|
const x = vector.x;
|
|
219733
219762
|
const y = vector.y;
|
|
219734
219763
|
const z = vector.z;
|
|
219735
|
-
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.create(
|
|
219764
|
+
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.create(this.inverseCoffs[0] * x + this.inverseCoffs[3] * y + this.inverseCoffs[6] * z, this.inverseCoffs[1] * x + this.inverseCoffs[4] * y + this.inverseCoffs[7] * z, this.inverseCoffs[2] * x + this.inverseCoffs[5] * y + this.inverseCoffs[8] * z, result);
|
|
219736
219765
|
}
|
|
219737
219766
|
return undefined;
|
|
219738
219767
|
}
|
|
219739
219768
|
/**
|
|
219740
|
-
*
|
|
219741
|
-
* *
|
|
219742
|
-
* *
|
|
219769
|
+
* Multiply `matrixInverse * [x,y,z]`.
|
|
219770
|
+
* * This is equivalent to solving `matrix * result = [x,y,z]` for an unknown `result`.
|
|
219771
|
+
* * Result is undefined if the matrix is singular (e.g. has parallel columns or a zero magnitude column)
|
|
219772
|
+
* @return result as a Vector3d or undefined (if the matrix is singular).
|
|
219743
219773
|
*/
|
|
219744
219774
|
multiplyInverseXYZAsVector3d(x, y, z, result) {
|
|
219745
219775
|
this.computeCachedInverse(true);
|
|
219746
219776
|
if (this.inverseCoffs) {
|
|
219747
|
-
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.create(
|
|
219777
|
+
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.create(this.inverseCoffs[0] * x + this.inverseCoffs[1] * y + this.inverseCoffs[2] * z, this.inverseCoffs[3] * x + this.inverseCoffs[4] * y + this.inverseCoffs[5] * z, this.inverseCoffs[6] * x + this.inverseCoffs[7] * y + this.inverseCoffs[8] * z, result);
|
|
219748
219778
|
}
|
|
219749
219779
|
return undefined;
|
|
219750
219780
|
}
|
|
219751
219781
|
/**
|
|
219752
|
-
*
|
|
219753
|
-
* *
|
|
219754
|
-
* *
|
|
219755
|
-
*
|
|
219782
|
+
* Multiply `matrixInverse * [x,y,z]` and return result as `Point4d` with given weight.
|
|
219783
|
+
* * Equivalent to solving `matrix * result = [x,y,z]` for an unknown `result`.
|
|
219784
|
+
* * Result is undefined if the matrix is singular (e.g. has parallel columns or a zero magnitude column)
|
|
219785
|
+
* @return result as a Point4d with the same weight.
|
|
219756
219786
|
*/
|
|
219757
219787
|
multiplyInverseXYZW(x, y, z, w, result) {
|
|
219758
219788
|
this.computeCachedInverse(true);
|
|
219759
219789
|
if (this.inverseCoffs) {
|
|
219760
|
-
return _geometry4d_Point4d__WEBPACK_IMPORTED_MODULE_4__.Point4d.create(
|
|
219790
|
+
return _geometry4d_Point4d__WEBPACK_IMPORTED_MODULE_4__.Point4d.create(this.inverseCoffs[0] * x + this.inverseCoffs[1] * y + this.inverseCoffs[2] * z, this.inverseCoffs[3] * x + this.inverseCoffs[4] * y + this.inverseCoffs[5] * z, this.inverseCoffs[6] * x + this.inverseCoffs[7] * y + this.inverseCoffs[8] * z, w, result);
|
|
219761
219791
|
}
|
|
219762
219792
|
return undefined;
|
|
219763
219793
|
}
|
|
219764
219794
|
/**
|
|
219765
|
-
*
|
|
219766
|
-
* *
|
|
219767
|
-
*
|
|
219768
|
-
* * return as a Point3d.
|
|
219795
|
+
* Multiply `matrixInverse * [x,y,z]` and return result as `Point3d`.
|
|
219796
|
+
* * Equivalent to solving `matrix * result = [x,y,z]` for an unknown `result`.
|
|
219797
|
+
* @return result as a Point3d or undefined (if the matrix is singular).
|
|
219769
219798
|
*/
|
|
219770
219799
|
multiplyInverseXYZAsPoint3d(x, y, z, result) {
|
|
219771
219800
|
this.computeCachedInverse(true);
|
|
219772
219801
|
if (this.inverseCoffs) {
|
|
219773
|
-
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Point3d.create(
|
|
219802
|
+
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Point3d.create(this.inverseCoffs[0] * x + this.inverseCoffs[1] * y + this.inverseCoffs[2] * z, this.inverseCoffs[3] * x + this.inverseCoffs[4] * y + this.inverseCoffs[5] * z, this.inverseCoffs[6] * x + this.inverseCoffs[7] * y + this.inverseCoffs[8] * z, result);
|
|
219774
219803
|
}
|
|
219775
219804
|
return undefined;
|
|
219776
219805
|
}
|
|
219777
219806
|
/**
|
|
219778
|
-
*
|
|
219779
|
-
* * set
|
|
219780
|
-
*
|
|
219807
|
+
* Invoke a given matrix*matrix operation to compute the inverse matrix and set this.inverseCoffs
|
|
219808
|
+
* * If either input coffA or coffB is undefined, set state to `InverseMatrixState.unknown` but
|
|
219809
|
+
* leave the inverseCoffs untouched.
|
|
219810
|
+
* @param f the given matrix*matrix operation that is called by this function to compute the inverse.
|
|
219811
|
+
* `f` must be a matrix*matrix operation. Otherwise, the function does not generate the inverse properly.
|
|
219781
219812
|
*/
|
|
219782
219813
|
finishInverseCoffs(f, coffA, coffB) {
|
|
219783
219814
|
if (coffA && coffB) {
|
|
219784
219815
|
this.createInverseCoffsWithZeros();
|
|
219785
219816
|
this.inverseState = InverseMatrixState.inverseStored;
|
|
219786
|
-
f(coffA, coffB, this.inverseCoffs);
|
|
219817
|
+
f(coffA, coffB, this.inverseCoffs); // call function f (which is provided by user) to compute the inverse.
|
|
219787
219818
|
}
|
|
219788
219819
|
else {
|
|
219789
219820
|
this.inverseState = InverseMatrixState.unknown;
|
|
219790
219821
|
}
|
|
219791
219822
|
}
|
|
219792
|
-
|
|
219793
|
-
|
|
219794
|
-
|
|
219795
|
-
|
|
219796
|
-
|
|
219797
|
-
|
|
219798
|
-
|
|
219799
|
-
|
|
219800
|
-
|
|
219801
|
-
* @return the matrix product A * B
|
|
219823
|
+
// Notes on inverse of matrix products:
|
|
219824
|
+
// 1) M = A * B ===> MInverse = BInverse * AInverse
|
|
219825
|
+
// 2) M = A * BInverse ===> MInverse = B * AInverse
|
|
219826
|
+
// 3) M = AInverse * B ===> MInverse = BInverse * A
|
|
219827
|
+
// 4) M = A * BTranspose ===> MInverse = BInverseTranspose * AInverse
|
|
219828
|
+
// 5) M = ATranspose * B ===> MInverse = BInverse * AInverseTranspose
|
|
219829
|
+
/**
|
|
219830
|
+
* Multiply `this` matrix times `other` matrix
|
|
219831
|
+
* @return the matrix result: this*other
|
|
219802
219832
|
*/
|
|
219803
219833
|
multiplyMatrixMatrix(other, result) {
|
|
219804
219834
|
result = result ? result : new Matrix3d();
|
|
219805
219835
|
PackedMatrix3dOps.multiplyMatrixMatrix(this.coffs, other.coffs, result.coffs);
|
|
219806
|
-
if (this.inverseState === InverseMatrixState.inverseStored
|
|
219836
|
+
if (this.inverseState === InverseMatrixState.inverseStored
|
|
219837
|
+
&& other.inverseState === InverseMatrixState.inverseStored)
|
|
219807
219838
|
result.finishInverseCoffs(PackedMatrix3dOps.multiplyMatrixMatrix, other.inverseCoffs, this.inverseCoffs);
|
|
219808
|
-
else if (this.inverseState === InverseMatrixState.singular
|
|
219839
|
+
else if (this.inverseState === InverseMatrixState.singular
|
|
219840
|
+
|| other.inverseState === InverseMatrixState.singular)
|
|
219809
219841
|
result.inverseState = InverseMatrixState.singular;
|
|
219810
219842
|
else
|
|
219811
219843
|
result.inverseState = InverseMatrixState.unknown;
|
|
219812
219844
|
return result;
|
|
219813
219845
|
}
|
|
219814
|
-
/**
|
|
219815
|
-
*
|
|
219846
|
+
/**
|
|
219847
|
+
* Multiply `this` matrix times `inverse of other` matrix
|
|
219848
|
+
* @return the matrix result: this*otherInverse
|
|
219816
219849
|
*/
|
|
219817
219850
|
multiplyMatrixMatrixInverse(other, result) {
|
|
219818
219851
|
if (!other.computeCachedInverse(true))
|
|
@@ -219826,8 +219859,9 @@ class Matrix3d {
|
|
|
219826
219859
|
PackedMatrix3dOps.copy(Matrix3d._productBuffer, result.coffs);
|
|
219827
219860
|
return result;
|
|
219828
219861
|
}
|
|
219829
|
-
/**
|
|
219830
|
-
*
|
|
219862
|
+
/**
|
|
219863
|
+
* Multiply `inverse of this` matrix times `other` matrix
|
|
219864
|
+
* @return the matrix result: thisInverse*other
|
|
219831
219865
|
*/
|
|
219832
219866
|
multiplyMatrixInverseMatrix(other, result) {
|
|
219833
219867
|
if (!this.computeCachedInverse(true))
|
|
@@ -219841,30 +219875,32 @@ class Matrix3d {
|
|
|
219841
219875
|
PackedMatrix3dOps.copy(Matrix3d._productBuffer, result.coffs);
|
|
219842
219876
|
return result;
|
|
219843
219877
|
}
|
|
219844
|
-
/**
|
|
219878
|
+
/**
|
|
219879
|
+
* Multiply `this` matrix times the transpose of `other` matrix
|
|
219845
219880
|
* ```
|
|
219846
219881
|
* equation
|
|
219847
|
-
* \text{for instance matrix }A\text{ and
|
|
219882
|
+
* \text{for instance matrix }A\text{ and matrix }B\text{ return matrix }C{\text where }\\\matrixXY{C}=\matrixXY{A}\matrixTransposeSubXY{B}
|
|
219848
219883
|
* ```
|
|
219849
|
-
* @return the matrix result
|
|
219884
|
+
* @return the matrix result: this*otherTranspose
|
|
219850
219885
|
*/
|
|
219851
|
-
multiplyMatrixMatrixTranspose(
|
|
219886
|
+
multiplyMatrixMatrixTranspose(other, result) {
|
|
219852
219887
|
result = result ? result : new Matrix3d();
|
|
219853
|
-
PackedMatrix3dOps.multiplyMatrixMatrixTranspose(this.coffs,
|
|
219854
|
-
if (this.inverseState === InverseMatrixState.inverseStored &&
|
|
219855
|
-
result.finishInverseCoffs(PackedMatrix3dOps.multiplyMatrixTransposeMatrix,
|
|
219856
|
-
else if (this.inverseState === InverseMatrixState.singular ||
|
|
219888
|
+
PackedMatrix3dOps.multiplyMatrixMatrixTranspose(this.coffs, other.coffs, result.coffs);
|
|
219889
|
+
if (this.inverseState === InverseMatrixState.inverseStored && other.inverseState === InverseMatrixState.inverseStored)
|
|
219890
|
+
result.finishInverseCoffs(PackedMatrix3dOps.multiplyMatrixTransposeMatrix, other.inverseCoffs, this.inverseCoffs);
|
|
219891
|
+
else if (this.inverseState === InverseMatrixState.singular || other.inverseState === InverseMatrixState.singular)
|
|
219857
219892
|
result.inverseState = InverseMatrixState.singular;
|
|
219858
219893
|
else
|
|
219859
219894
|
result.inverseState = InverseMatrixState.unknown;
|
|
219860
219895
|
return result;
|
|
219861
219896
|
}
|
|
219862
|
-
/**
|
|
219897
|
+
/**
|
|
219898
|
+
* Multiply the transpose of `this` matrix times `other` matrix
|
|
219863
219899
|
* ```
|
|
219864
219900
|
* equation
|
|
219865
219901
|
* \matrixXY{result}=\matrixXY{\text{this}}\matrixTransposeSubXY{\text{other}}
|
|
219866
219902
|
* ```
|
|
219867
|
-
*
|
|
219903
|
+
* @return the matrix result: thisTranspose*other
|
|
219868
219904
|
*/
|
|
219869
219905
|
multiplyMatrixTransposeMatrix(other, result) {
|
|
219870
219906
|
result = result ? result : new Matrix3d();
|
|
@@ -219877,30 +219913,31 @@ class Matrix3d {
|
|
|
219877
219913
|
result.inverseState = InverseMatrixState.unknown;
|
|
219878
219914
|
return result;
|
|
219879
219915
|
}
|
|
219880
|
-
/**
|
|
219916
|
+
/**
|
|
219917
|
+
* Multiply `this` Matrix3d (considered as a Transform with 0 translation) times `other` Transform.
|
|
219881
219918
|
* ```
|
|
219882
219919
|
* equation
|
|
219883
219920
|
* \begin{matrix}
|
|
219884
|
-
*
|
|
219885
|
-
*
|
|
219921
|
+
* \text{This matrix }\bold{A}\text{ promoted to block transform} & \blockTransform{A}{0} \\
|
|
219922
|
+
* \text{other transform with matrix part }\bold{B}\text{ and translation }\bold{b} & \blockTransform{B}{b}\\
|
|
219886
219923
|
* \text{product}& \blockTransform{A}{0}\blockTransform{B}{b}=\blockTransform{AB}{Ab}
|
|
219887
219924
|
* \end{matrix}
|
|
219888
219925
|
* ```
|
|
219889
|
-
* @param other
|
|
219890
|
-
* @param result
|
|
219926
|
+
* @param other Right hand Matrix3d for multiplication.
|
|
219927
|
+
* @param result the Transform result (optional)
|
|
219891
219928
|
*/
|
|
219892
219929
|
multiplyMatrixTransform(other, result) {
|
|
219893
219930
|
if (!result)
|
|
219894
219931
|
return _Transform__WEBPACK_IMPORTED_MODULE_5__.Transform.createRefs(this.multiplyXYZ(other.origin.x, other.origin.y, other.origin.z), this.multiplyMatrixMatrix(other.matrix));
|
|
219895
|
-
// be sure to do the point multiplication first before aliasing changes the matrix
|
|
219932
|
+
// be sure to do the point multiplication first before aliasing changes the matrix
|
|
219896
219933
|
this.multiplyXYZtoXYZ(other.origin, result.origin);
|
|
219897
219934
|
this.multiplyMatrixMatrix(other.matrix, result.matrix);
|
|
219898
219935
|
return result;
|
|
219899
219936
|
}
|
|
219900
219937
|
/**
|
|
219901
219938
|
* Return the transpose of `this` matrix.
|
|
219902
|
-
* If `result` is passed as argument, then the function copies the transpose of `this` into `result
|
|
219903
|
-
* `this` is not changed unless also passed as the result, i.e., this.transpose(this) transposes `this` in place
|
|
219939
|
+
* * If `result` is passed as argument, then the function copies the transpose of `this` into `result`.
|
|
219940
|
+
* * `this` is not changed unless also passed as the result, i.e., `this.transpose(this)` transposes `this` in place.
|
|
219904
219941
|
*/
|
|
219905
219942
|
transpose(result) {
|
|
219906
219943
|
if (!result)
|
|
@@ -219922,18 +219959,22 @@ class Matrix3d {
|
|
|
219922
219959
|
transposeInPlace() {
|
|
219923
219960
|
PackedMatrix3dOps.transposeInPlace(this.coffs);
|
|
219924
219961
|
if (this.inverseCoffs)
|
|
219925
|
-
PackedMatrix3dOps.transposeInPlace(this.inverseCoffs);
|
|
219962
|
+
PackedMatrix3dOps.transposeInPlace(this.inverseCoffs); // inverse of transpose is equal to transpose of inverse
|
|
219926
219963
|
}
|
|
219927
|
-
/**
|
|
219928
|
-
*
|
|
219929
|
-
*
|
|
219930
|
-
* *
|
|
219964
|
+
/**
|
|
219965
|
+
* Return the inverse matrix.
|
|
219966
|
+
* The return is undefined if the matrix is singular (e.g. has parallel columns or a zero magnitude column)
|
|
219967
|
+
* * If `result == this`, then content of inverse of `this` matrix is copied into `this`. Otherwise, inverse
|
|
219968
|
+
* of `this` is stored in `result`.
|
|
219969
|
+
* * **Note:** Each Matrix3d object caches its own inverse (`this.inverseCoffs`) and has methods to multiply
|
|
219970
|
+
* the inverse times matrices and vectors (e.g., `multiplyMatrixInverseMatrix`, `multiplyMatrixMatrixInverse`,
|
|
219971
|
+
* `multiplyInverse`). Hence explicitly constructing this new inverse object is rarely necessary.
|
|
219931
219972
|
*/
|
|
219932
219973
|
inverse(result) {
|
|
219933
219974
|
if (!this.computeCachedInverse(true))
|
|
219934
219975
|
return undefined;
|
|
219935
219976
|
if (result === this) {
|
|
219936
|
-
// swap the contents
|
|
219977
|
+
// swap the contents of this.coffs and this.inverseCoffs
|
|
219937
219978
|
PackedMatrix3dOps.copy(this.coffs, Matrix3d._productBuffer);
|
|
219938
219979
|
PackedMatrix3dOps.copy(this.inverseCoffs, this.coffs);
|
|
219939
219980
|
PackedMatrix3dOps.copy(Matrix3d._productBuffer, this.inverseCoffs);
|
|
@@ -219948,33 +219989,48 @@ class Matrix3d {
|
|
|
219948
219989
|
result.inverseState = this.inverseState;
|
|
219949
219990
|
return result;
|
|
219950
219991
|
}
|
|
219951
|
-
|
|
219952
|
-
|
|
219953
|
-
|
|
219954
|
-
|
|
219992
|
+
/**
|
|
219993
|
+
* Take the dot product of a row (specified by `rowStartA`) of `coffA` and `columnStartB` of `coffB`.
|
|
219994
|
+
* * **Note:** We don't validate row/column numbers. Pass 0/3/6 for row 0/1/2 and pass 0/1/2 for column 0/1/2.
|
|
219995
|
+
*/
|
|
219996
|
+
static rowColumnDot(coffA, rowStartA, coffB, columnStartB) {
|
|
219997
|
+
return coffA[rowStartA] * coffB[columnStartB] +
|
|
219998
|
+
coffA[rowStartA + 1] * coffB[columnStartB + 3] +
|
|
219999
|
+
coffA[rowStartA + 2] * coffB[columnStartB + 6];
|
|
220000
|
+
}
|
|
220001
|
+
/**
|
|
220002
|
+
* Take the cross product of 2 rows (specified by `rowStart0` and `rowStart1`) of `source` and store the result
|
|
220003
|
+
* in `columnStart` of `dest`.
|
|
220004
|
+
* * **Note:** We don't validate row/column numbers. Pass 0/3/6 for row 0/1/2 and pass 0/1/2 for column 0/1/2.
|
|
220005
|
+
*/
|
|
219955
220006
|
static indexedRowCrossProduct(source, rowStart0, rowStart1, dest, columnStart) {
|
|
219956
220007
|
dest[columnStart] = source[rowStart0 + 1] * source[rowStart1 + 2] - source[rowStart0 + 2] * source[rowStart1 + 1];
|
|
219957
220008
|
dest[columnStart + 3] = source[rowStart0 + 2] * source[rowStart1] - source[rowStart0] * source[rowStart1 + 2];
|
|
219958
220009
|
dest[columnStart + 6] = source[rowStart0] * source[rowStart1 + 1] - source[rowStart0 + 1] * source[rowStart1];
|
|
219959
220010
|
}
|
|
219960
|
-
|
|
219961
|
-
|
|
219962
|
-
|
|
220011
|
+
/**
|
|
220012
|
+
* Take the cross product of 2 columns (i.e., `colStart0` and `colStart1`) of `this` matrix and store the
|
|
220013
|
+
* result in `colStart2` of the same matrix.
|
|
220014
|
+
* * **Note:** We don't validate column numbers. Pass 0/1/2 for column 0/1/2.
|
|
220015
|
+
*/
|
|
219963
220016
|
indexedColumnCrossProductInPlace(colStart0, colStart1, colStart2) {
|
|
219964
220017
|
const coffs = this.coffs;
|
|
219965
220018
|
coffs[colStart2] = coffs[colStart0 + 3] * coffs[colStart1 + 6] - coffs[colStart0 + 6] * coffs[colStart1 + 3];
|
|
219966
220019
|
coffs[colStart2 + 3] = coffs[colStart0 + 6] * coffs[colStart1] - coffs[colStart0] * coffs[colStart1 + 6];
|
|
219967
220020
|
coffs[colStart2 + 6] = coffs[colStart0] * coffs[colStart1 + 3] - coffs[colStart0 + 3] * coffs[colStart1];
|
|
219968
220021
|
}
|
|
219969
|
-
/**
|
|
219970
|
-
*
|
|
219971
|
-
*
|
|
220022
|
+
/**
|
|
220023
|
+
* Form cross products among columns in axisOrder.
|
|
220024
|
+
* For axis order ABC:
|
|
220025
|
+
* * form cross product of column A and B, store in C.
|
|
219972
220026
|
* * form cross product of column C and A, store in B.
|
|
220027
|
+
* * [A B C] ===> [A B AxB] ===> [A (AxB)xA AxB]
|
|
220028
|
+
*
|
|
219973
220029
|
* This means that in the final matrix:
|
|
219974
|
-
* * column A is
|
|
219975
|
-
* * column B is linear combination of
|
|
220030
|
+
* * column A is same as original column A.
|
|
220031
|
+
* * column B is linear combination of original A and B (i.e., is in the plane of original A and B).
|
|
219976
220032
|
* * column C is perpendicular to A and B of both the original and final.
|
|
219977
|
-
* * original column C does not participate in the result.
|
|
220033
|
+
* * original column C is overwritten and does not participate in the result.
|
|
219978
220034
|
*/
|
|
219979
220035
|
axisOrderCrossProductsInPlace(axisOrder) {
|
|
219980
220036
|
switch (axisOrder) {
|
|
@@ -220010,41 +220066,44 @@ class Matrix3d {
|
|
|
220010
220066
|
}
|
|
220011
220067
|
}
|
|
220012
220068
|
}
|
|
220013
|
-
/**
|
|
220014
|
-
*
|
|
220015
|
-
* @
|
|
220016
|
-
* @
|
|
220069
|
+
/**
|
|
220070
|
+
* Normalize each column in place.
|
|
220071
|
+
* @param originalRowMagnitudes optional vector to store original column magnitudes.
|
|
220072
|
+
* @returns Return true if all columns have non-zero lengths. Otherwise, return false.
|
|
220073
|
+
* * If false is returned, the magnitudes are stored in the `originalRowMagnitudes` vector but no columns
|
|
220074
|
+
* are altered.
|
|
220017
220075
|
*/
|
|
220018
|
-
normalizeColumnsInPlace(
|
|
220076
|
+
normalizeColumnsInPlace(originalRowMagnitudes) {
|
|
220019
220077
|
const ax = this.columnXMagnitude();
|
|
220020
220078
|
const ay = this.columnYMagnitude();
|
|
220021
220079
|
const az = this.columnZMagnitude();
|
|
220022
|
-
if (
|
|
220023
|
-
|
|
220080
|
+
if (originalRowMagnitudes)
|
|
220081
|
+
originalRowMagnitudes.set(ax, ay, az);
|
|
220024
220082
|
if (_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(ax) || _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(ay) || _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(az))
|
|
220025
220083
|
return false;
|
|
220026
220084
|
this.scaleColumns(1.0 / ax, 1.0 / ay, 1.0 / az, this);
|
|
220027
220085
|
return true;
|
|
220028
220086
|
}
|
|
220029
|
-
/**
|
|
220030
|
-
|
|
220087
|
+
/**
|
|
220088
|
+
* Normalize each row in place.
|
|
220089
|
+
* @param originalColumnMagnitudes optional vector to store original row magnitudes.
|
|
220090
|
+
* @returns Return true if all rows have non-zero lengths. Otherwise, return false.
|
|
220091
|
+
* * If false is returned, the magnitudes are stored in the `originalColumnMagnitudes` vector but no rows
|
|
220092
|
+
* are altered.
|
|
220093
|
+
*/
|
|
220094
|
+
normalizeRowsInPlace(originalColumnMagnitudes) {
|
|
220031
220095
|
const ax = this.rowXMagnitude();
|
|
220032
220096
|
const ay = this.rowYMagnitude();
|
|
220033
220097
|
const az = this.rowZMagnitude();
|
|
220034
|
-
if (
|
|
220035
|
-
|
|
220098
|
+
if (originalColumnMagnitudes)
|
|
220099
|
+
originalColumnMagnitudes.set(ax, ay, az);
|
|
220036
220100
|
if (_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(ax) || _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(ay) || _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(az))
|
|
220037
220101
|
return false;
|
|
220038
220102
|
this.scaleRows(1.0 / ax, 1.0 / ay, 1.0 / az, this);
|
|
220039
220103
|
return true;
|
|
220040
220104
|
}
|
|
220041
|
-
// take the cross product of two rows of source.
|
|
220042
|
-
// store as a column of dest.
|
|
220043
|
-
static rowColumnDot(coffA, rowStartA, coffB, columnStartB) {
|
|
220044
|
-
return coffA[rowStartA] * coffB[columnStartB] + coffA[rowStartA + 1] * coffB[columnStartB + 3] + coffA[rowStartA + 2] * coffB[columnStartB + 6];
|
|
220045
|
-
}
|
|
220046
220105
|
/**
|
|
220047
|
-
* Returns true if the matrix is singular
|
|
220106
|
+
* Returns true if the matrix is singular.
|
|
220048
220107
|
*/
|
|
220049
220108
|
isSingular() {
|
|
220050
220109
|
return !this.computeCachedInverse(true);
|
|
@@ -220056,18 +220115,10 @@ class Matrix3d {
|
|
|
220056
220115
|
this.inverseState = InverseMatrixState.singular;
|
|
220057
220116
|
}
|
|
220058
220117
|
/**
|
|
220059
|
-
*
|
|
220060
|
-
*
|
|
220061
|
-
*
|
|
220062
|
-
|
|
220063
|
-
createInverseCoffsWithZeros() {
|
|
220064
|
-
if (!this.inverseCoffs) {
|
|
220065
|
-
this.inverseState = InverseMatrixState.unknown;
|
|
220066
|
-
this.inverseCoffs = new Float64Array(9);
|
|
220067
|
-
}
|
|
220068
|
-
}
|
|
220069
|
-
/** compute the inverse of this Matrix3d. The inverse is stored for later use.
|
|
220070
|
-
* @returns Return true if the inverse computed. (False if the columns collapse to a point, line or plane.)
|
|
220118
|
+
* Compute the inverse of `this` Matrix3d. The inverse is stored in `this.inverseCoffs` for later use.
|
|
220119
|
+
* @param useCacheIfAvailable if `true`, use the previously computed inverse if available. If `false`,
|
|
220120
|
+
* recompute the inverse.
|
|
220121
|
+
* @returns Return `true` if the inverse is computed. Return `false` if matrix is singular.
|
|
220071
220122
|
*/
|
|
220072
220123
|
computeCachedInverse(useCacheIfAvailable) {
|
|
220073
220124
|
if (useCacheIfAvailable && Matrix3d.useCachedInverse && this.inverseState !== InverseMatrixState.unknown) {
|
|
@@ -220078,71 +220129,45 @@ class Matrix3d {
|
|
|
220078
220129
|
this.createInverseCoffsWithZeros();
|
|
220079
220130
|
const coffs = this.coffs;
|
|
220080
220131
|
const inverseCoffs = this.inverseCoffs;
|
|
220081
|
-
|
|
220082
|
-
|
|
220083
|
-
|
|
220132
|
+
/**
|
|
220133
|
+
* We calculate the inverse using cross products.
|
|
220134
|
+
* Math details can be found at
|
|
220135
|
+
* https://www.chilimath.com/lessons/advanced-algebra/determinant-3x3-matrix/
|
|
220136
|
+
* In summary, if M = [A B C] then inverse of M = (1/det)[BxC CxA AxB] where det is the
|
|
220137
|
+
* determinant of matrix M and can be calculated by "A dot BxC".
|
|
220138
|
+
*/
|
|
220139
|
+
Matrix3d.indexedRowCrossProduct(coffs, 3, 6, inverseCoffs, 0); // BxC
|
|
220140
|
+
Matrix3d.indexedRowCrossProduct(coffs, 6, 0, inverseCoffs, 1); // CxA
|
|
220141
|
+
Matrix3d.indexedRowCrossProduct(coffs, 0, 3, inverseCoffs, 2); // AxB
|
|
220084
220142
|
Matrix3d.numComputeCache++;
|
|
220085
|
-
const
|
|
220086
|
-
if (
|
|
220143
|
+
const det = Matrix3d.rowColumnDot(coffs, 0, inverseCoffs, 0); // A dot BxC
|
|
220144
|
+
if (det === 0.0) {
|
|
220087
220145
|
this.inverseState = InverseMatrixState.singular;
|
|
220088
220146
|
this.inverseCoffs = undefined;
|
|
220089
220147
|
return false;
|
|
220090
220148
|
}
|
|
220091
|
-
const f = 1.0 /
|
|
220149
|
+
const f = 1.0 / det;
|
|
220092
220150
|
for (let i = 0; i < 9; i++)
|
|
220093
220151
|
inverseCoffs[i] *= f;
|
|
220094
220152
|
this.inverseState = InverseMatrixState.inverseStored;
|
|
220095
|
-
// verify inverse
|
|
220096
|
-
// const p = new Float64Array(9);
|
|
220097
|
-
// for (let i = 0; i < 9; i += 3)
|
|
220098
|
-
// for (let j = 0; j < 3; j++)
|
|
220099
|
-
// p[i + j] = Matrix3d.rowColumnDot (coffs, i, inverseCoffs, j);
|
|
220100
220153
|
return true;
|
|
220101
220154
|
}
|
|
220102
|
-
|
|
220103
|
-
|
|
220104
|
-
|
|
220105
|
-
|
|
220106
|
-
private static crossXY: Vector3d = Vector3d.create();
|
|
220107
|
-
private static crossZX: Vector3d = Vector3d.create();
|
|
220108
|
-
private static crossYZ: Vector3d = Vector3d.create();
|
|
220109
|
-
private computeCachedInverse(useCacheIfAvailable: boolean) {
|
|
220110
|
-
if (useCacheIfAvailable && Matrix3d.useCachedInverse && this.inverseState !== InverseMatrixState.unknown) {
|
|
220111
|
-
Matrix3d.numUseCache++;
|
|
220112
|
-
return this.inverseState === InverseMatrixState.inverseStored;
|
|
220113
|
-
}
|
|
220114
|
-
this.inverseState = InverseMatrixState.unknown;
|
|
220115
|
-
Matrix3d.numComputeCache++;
|
|
220116
|
-
const rowX = this.rowX(Matrix3d.rowX);
|
|
220117
|
-
const rowY = this.rowY(Matrix3d.rowY);
|
|
220118
|
-
const rowZ = this.rowZ(Matrix3d.rowZ);
|
|
220119
|
-
const crossXY = rowX.crossProduct(rowY, Matrix3d.crossXY);
|
|
220120
|
-
const crossYZ = rowY.crossProduct(rowZ, Matrix3d.crossYZ);
|
|
220121
|
-
const crossZX = rowZ.crossProduct(rowX, Matrix3d.crossZX);
|
|
220122
|
-
const d = rowX.dotProduct(crossYZ); // that's the determinant
|
|
220123
|
-
if (d === 0.0) { // better test?
|
|
220124
|
-
this.inverseState = InverseMatrixState.singular;
|
|
220125
|
-
this.inverseCoffs = undefined;
|
|
220126
|
-
return false;
|
|
220127
|
-
}
|
|
220128
|
-
const f = 1.0 / d;
|
|
220129
|
-
this.inverseState = InverseMatrixState.inverseStored; // Currently just lists that the inverse has been stored... singular case not handled
|
|
220130
|
-
this.inverseCoffs = Float64Array.from([crossYZ.x * f, crossZX.x * f, crossXY.x * f,
|
|
220131
|
-
crossYZ.y * f, crossZX.y * f, crossXY.y * f,
|
|
220132
|
-
crossYZ.z * f, crossZX.z * f, crossXY.z * f]);
|
|
220133
|
-
return true;
|
|
220134
|
-
}
|
|
220135
|
-
*/
|
|
220136
|
-
/** convert a (row,column) index pair to the single index within flattened array of 9 numbers in row-major-order */
|
|
220155
|
+
/**
|
|
220156
|
+
* Convert a (row,column) index pair to the single index within flattened array of 9 numbers in row-major-order
|
|
220157
|
+
* * **Note:** Out of range row/column is interpreted cyclically.
|
|
220158
|
+
*/
|
|
220137
220159
|
static flatIndexOf(row, column) {
|
|
220138
220160
|
return 3 * _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.cyclic3dAxis(row) + _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.cyclic3dAxis(column);
|
|
220139
220161
|
}
|
|
220140
|
-
/**
|
|
220162
|
+
/**
|
|
220163
|
+
* Get elements of column `index` packaged as a Point4d with given `weight`.
|
|
220164
|
+
* * **Note:** Out of range index is interpreted cyclically.
|
|
220165
|
+
*/
|
|
220141
220166
|
indexedColumnWithWeight(index, weight, result) {
|
|
220142
220167
|
index = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.cyclic3dAxis(index);
|
|
220143
220168
|
return _geometry4d_Point4d__WEBPACK_IMPORTED_MODULE_4__.Point4d.create(this.coffs[index], this.coffs[index + 3], this.coffs[index + 6], weight, result);
|
|
220144
220169
|
}
|
|
220145
|
-
/**
|
|
220170
|
+
/** Return the entry at specific row and column */
|
|
220146
220171
|
at(row, column) {
|
|
220147
220172
|
return this.coffs[Matrix3d.flatIndexOf(row, column)];
|
|
220148
220173
|
}
|
|
@@ -220176,7 +220201,7 @@ class Matrix3d {
|
|
|
220176
220201
|
this.coffs[7] *= scaleY;
|
|
220177
220202
|
this.coffs[8] *= scaleZ;
|
|
220178
220203
|
if (this.inverseState === InverseMatrixState.inverseStored && this.inverseCoffs !== undefined) {
|
|
220179
|
-
// apply
|
|
220204
|
+
// apply reciprocal scales to the ROWS of the inverse
|
|
220180
220205
|
const divX = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.conditionalDivideFraction(1.0, scaleX);
|
|
220181
220206
|
const divY = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.conditionalDivideFraction(1.0, scaleY);
|
|
220182
220207
|
const divZ = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.conditionalDivideFraction(1.0, scaleZ);
|
|
@@ -220252,12 +220277,11 @@ class Matrix3d {
|
|
|
220252
220277
|
/**
|
|
220253
220278
|
* Create a rigid matrix (columns and rows are unit length and pairwise perpendicular) for
|
|
220254
220279
|
* the given eye coordinate.
|
|
220255
|
-
* * column
|
|
220256
|
-
* * column
|
|
220257
|
-
* * column
|
|
220280
|
+
* * column 2 is parallel to (x,y,z).
|
|
220281
|
+
* * column 0 is perpendicular to column 2 and is in the xy plane.
|
|
220282
|
+
* * column 1 is perpendicular to both. It is the "up" vector on the view plane.
|
|
220258
220283
|
* * Multiplying the returned matrix times a local (view) vector gives the world vector.
|
|
220259
|
-
* * Multiplying transpose of the returned matrix times a world vector gives the local
|
|
220260
|
-
* (view) vector.
|
|
220284
|
+
* * Multiplying transpose of the returned matrix times a world vector gives the local (view) vector.
|
|
220261
220285
|
* @param x eye x coordinate
|
|
220262
220286
|
* @param y eye y coordinate
|
|
220263
220287
|
* @param z eye z coordinate
|
|
@@ -220272,11 +220296,27 @@ class Matrix3d {
|
|
|
220272
220296
|
result.scaleColumnsInPlace(1.0, -1.0, -1.0);
|
|
220273
220297
|
}
|
|
220274
220298
|
else {
|
|
220299
|
+
// if coordinate is (x,y,0), i.e., Front or Back or Left or Right view
|
|
220300
|
+
/**
|
|
220301
|
+
* The matrix that the "else" statement creates is
|
|
220302
|
+
* [-s -s1*c c1*c]
|
|
220303
|
+
* [c -s1*s c1*s]
|
|
220304
|
+
* [0 c1 s1 ]
|
|
220305
|
+
* where
|
|
220306
|
+
* c = x / sqrt(x*x + y*y)
|
|
220307
|
+
* s = y / sqrt(x*x + y*y)
|
|
220308
|
+
* c1 = sqrt(x*x + y*y) / sqrt(x*x + y*y + z*z)
|
|
220309
|
+
* s1 = z / sqrt(x*x + y*y + z*z)
|
|
220310
|
+
*
|
|
220311
|
+
* This is an orthogonal matrix meaning it rotates the standard XYZ axis to ABC axis system
|
|
220312
|
+
* (if matrix is [A B C]). The matrix rotates (0,0,1), i.e., the default Top view or Z axis,
|
|
220313
|
+
* to the eye point (x/r,y/r,z/r). The matrix also rotates (1,0,0) to a point on XY plane.
|
|
220314
|
+
*/
|
|
220275
220315
|
const c = x / rxy;
|
|
220276
220316
|
const s = y / rxy;
|
|
220277
|
-
// if coordinate is (x,y,0),
|
|
220317
|
+
// if coordinate is (x,y,0), e.g., Front or Back or Left or Right view (for those 4 views x or y is 0 not both)
|
|
220278
220318
|
result.setRowValues(-s, 0, c, c, 0, s, 0, 1, 0);
|
|
220279
|
-
// if coordinate is (x,y,z), i.e., other views such as Iso or RightIso
|
|
220319
|
+
// if coordinate is (x,y,z) and z is not 0, i.e., other views such as Iso or RightIso
|
|
220280
220320
|
if (z !== 0.0) {
|
|
220281
220321
|
const r = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.hypotenuseXYZ(x, y, z);
|
|
220282
220322
|
const s1 = z / r;
|
|
@@ -220548,6 +220588,7 @@ Matrix3d.useCachedInverse = true; // cached inverse can be suppressed for testin
|
|
|
220548
220588
|
Matrix3d.numUseCache = 0;
|
|
220549
220589
|
/** Total number of times a cached inverse was computed. */
|
|
220550
220590
|
Matrix3d.numComputeCache = 0;
|
|
220591
|
+
/** temporary buffer to store a matrix as a Float64Array (array of 9 floats) */
|
|
220551
220592
|
Matrix3d._productBuffer = new Float64Array(9);
|
|
220552
220593
|
|
|
220553
220594
|
|
|
@@ -223330,6 +223371,8 @@ class Vector3d extends XYZ {
|
|
|
223330
223371
|
* * It's returning the signed projection magnitude divided by the target magnitude.
|
|
223331
223372
|
* * To find the projection vector, scale the target vector by the value that this function is returning.
|
|
223332
223373
|
* * math details can be found at docs/learning/geometry/PointVector.md
|
|
223374
|
+
* * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnVector
|
|
223375
|
+
* and https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnPlane
|
|
223333
223376
|
* @param target the target vector
|
|
223334
223377
|
* @param defaultFraction the returned value in case magnitude square of target vector is very small
|
|
223335
223378
|
* */
|
|
@@ -223722,6 +223765,7 @@ class Vector3d extends XYZ {
|
|
|
223722
223765
|
}
|
|
223723
223766
|
/**
|
|
223724
223767
|
* Return the cross product of this vector and vectorB.
|
|
223768
|
+
* * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/CrossProduct
|
|
223725
223769
|
* @param vectorB second vector of cross product
|
|
223726
223770
|
* @param result optional preallocated result.
|
|
223727
223771
|
*/
|
|
@@ -287084,7 +287128,7 @@ class TestContext {
|
|
|
287084
287128
|
this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
|
|
287085
287129
|
const iModelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${(_a = process.env.IMJS_URL_PREFIX) !== null && _a !== void 0 ? _a : ""}api.bentley.com/imodels` } });
|
|
287086
287130
|
await core_frontend_1.NoRenderApp.startup({
|
|
287087
|
-
applicationVersion: "4.0.0-dev.
|
|
287131
|
+
applicationVersion: "4.0.0-dev.11",
|
|
287088
287132
|
applicationId: this.settings.gprid,
|
|
287089
287133
|
authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.adminUserAccessToken),
|
|
287090
287134
|
hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),
|
|
@@ -306513,7 +306557,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
|
|
|
306513
306557
|
/***/ ((module) => {
|
|
306514
306558
|
|
|
306515
306559
|
"use strict";
|
|
306516
|
-
module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"4.0.0-dev.
|
|
306560
|
+
module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"4.0.0-dev.11","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.8","@itwin/core-bentley":"workspace:^4.0.0-dev.11","@itwin/core-common":"workspace:^4.0.0-dev.11","@itwin/core-geometry":"workspace:^4.0.0-dev.11","@itwin/core-orbitgt":"workspace:^4.0.0-dev.11","@itwin/core-quantity":"workspace:^4.0.0-dev.11"},"//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/lodash":"^4.14.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.4.0","@itwin/cloud-agnostic-core":"~1.4.0","@itwin/object-storage-core":"~1.4.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","lodash":"^4.17.10","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"}}]}}');
|
|
306517
306561
|
|
|
306518
306562
|
/***/ }),
|
|
306519
306563
|
|