@itwin/ecschema-rpcinterface-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 +251 -207
- package/lib/dist/bundled-tests.js.map +1 -1
- package/package.json +16 -16
|
@@ -219193,6 +219193,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
219193
219193
|
* `degrees` or `radians` because both are available if requested by caller.
|
|
219194
219194
|
* * The various access method are named so that callers can specify whether untyped numbers passed in or
|
|
219195
219195
|
* out are degrees or radians.
|
|
219196
|
+
* * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/AngleSweep
|
|
219196
219197
|
* @public
|
|
219197
219198
|
*/
|
|
219198
219199
|
class Angle {
|
|
@@ -219756,6 +219757,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
219756
219757
|
* * (350,370) covers the same unit angles as (-10,10).
|
|
219757
219758
|
* * (370,350) covers the same unit angles as (10,-10).
|
|
219758
219759
|
* * math details related fraction API can be found at docs/learning/geometry/Angle.md
|
|
219760
|
+
* * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/AngleSweep
|
|
219759
219761
|
* @public
|
|
219760
219762
|
*/
|
|
219761
219763
|
class AngleSweep {
|
|
@@ -225068,7 +225070,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
225068
225070
|
|
|
225069
225071
|
|
|
225070
225072
|
/* eslint-disable @itwin/prefer-get */
|
|
225071
|
-
// cSpell:words XXYZ YXYZ ZXYZ
|
|
225073
|
+
// cSpell:words XXYZ YXYZ ZXYZ SaeedTorabi
|
|
225072
225074
|
/**
|
|
225073
225075
|
* PackedMatrix3dOps contains static methods for matrix operations where the matrix is a Float64Array.
|
|
225074
225076
|
* * The Float64Array contains the matrix entries in row-major order
|
|
@@ -225478,9 +225480,20 @@ class Matrix3d {
|
|
|
225478
225480
|
return result;
|
|
225479
225481
|
}
|
|
225480
225482
|
/**
|
|
225481
|
-
|
|
225482
|
-
|
|
225483
|
-
|
|
225483
|
+
* Create the inverseCoffs member (filled with zeros)
|
|
225484
|
+
* This is for use by matrix * matrix multiplications which need to be sure the member is there to be
|
|
225485
|
+
* filled with method-specific content.
|
|
225486
|
+
*/
|
|
225487
|
+
createInverseCoffsWithZeros() {
|
|
225488
|
+
if (!this.inverseCoffs) {
|
|
225489
|
+
this.inverseState = InverseMatrixState.unknown;
|
|
225490
|
+
this.inverseCoffs = new Float64Array(9);
|
|
225491
|
+
}
|
|
225492
|
+
}
|
|
225493
|
+
/**
|
|
225494
|
+
* Copy the transpose of the coffs to the inverseCoffs.
|
|
225495
|
+
* * Mark the matrix as inverseStored.
|
|
225496
|
+
*/
|
|
225484
225497
|
setupInverseTranspose() {
|
|
225485
225498
|
const coffs = this.coffs;
|
|
225486
225499
|
this.inverseState = InverseMatrixState.inverseStored;
|
|
@@ -225699,6 +225712,7 @@ class Matrix3d {
|
|
|
225699
225712
|
* Construct a rigid matrix (orthogonal matrix with +1 determinant) using vectorA and its 2 perpendicular.
|
|
225700
225713
|
* * If axisOrder is not passed then `AxisOrder = AxisOrder.ZXY` is used as default.
|
|
225701
225714
|
* * This function internally uses createPerpendicularVectorFavorXYPlane and createRigidFromColumns.
|
|
225715
|
+
* * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/2PerpendicularVectorsTo1Vector
|
|
225702
225716
|
*/
|
|
225703
225717
|
static createRigidHeadsUp(vectorA, axisOrder = _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.ZXY, result) {
|
|
225704
225718
|
const vectorB = Matrix3d.createPerpendicularVectorFavorXYPlane(vectorA);
|
|
@@ -225748,7 +225762,7 @@ class Matrix3d {
|
|
|
225748
225762
|
/**
|
|
225749
225763
|
* Replace current rows Ui and Uj with (c*Ui + s*Uj) and (c*Uj - s*Ui).
|
|
225750
225764
|
* * There is no checking for i,j being 0,1,2.
|
|
225751
|
-
* @param i first row index.
|
|
225765
|
+
* @param i first row index. **must be 0,1,2** (unchecked)
|
|
225752
225766
|
* @param j second row index. **must be 0,1,2** (unchecked)
|
|
225753
225767
|
* @param c fist coefficient
|
|
225754
225768
|
* @param s second coefficient
|
|
@@ -226448,6 +226462,7 @@ class Matrix3d {
|
|
|
226448
226462
|
* \text{The matrix is } I + (s-1) D D^T
|
|
226449
226463
|
* \\ \text{with }D\text{ being the normalized direction vector and }s\text{ being the scale.}
|
|
226450
226464
|
* ```
|
|
226465
|
+
* * Visualization can be found at itwinjs.org/sandbox/SaeedTorabi/DirectionalScale
|
|
226451
226466
|
*/
|
|
226452
226467
|
static createDirectionalScale(direction, scale, result) {
|
|
226453
226468
|
const unit = direction.normalize();
|
|
@@ -226581,7 +226596,7 @@ class Matrix3d {
|
|
|
226581
226596
|
return result;
|
|
226582
226597
|
}
|
|
226583
226598
|
/**
|
|
226584
|
-
* Multiply transpose
|
|
226599
|
+
* Multiply the transpose matrix times a vector.
|
|
226585
226600
|
* * This produces the same x,y,z as treating the vector as a row on the left of the (un-transposed) matrix.
|
|
226586
226601
|
* ```
|
|
226587
226602
|
* equation
|
|
@@ -226590,7 +226605,7 @@ class Matrix3d {
|
|
|
226590
226605
|
* \text{Treating U as a row to the left of untransposed matrix\: return row}&\rowSubXYZ{V}&=&\rowSubXYZ{U}\matrixXY{A}
|
|
226591
226606
|
* \end{matrix}
|
|
226592
226607
|
* ```
|
|
226593
|
-
* @return the vector result
|
|
226608
|
+
* @return the vector result (optional)
|
|
226594
226609
|
*/
|
|
226595
226610
|
multiplyTransposeVector(vector, result) {
|
|
226596
226611
|
result = result ? result : new _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d();
|
|
@@ -226602,87 +226617,100 @@ class Matrix3d {
|
|
|
226602
226617
|
result.z = this.coffs[2] * x + this.coffs[5] * y + this.coffs[8] * z;
|
|
226603
226618
|
return result;
|
|
226604
226619
|
}
|
|
226605
|
-
/**
|
|
226606
|
-
*
|
|
226620
|
+
/**
|
|
226621
|
+
* Multiply the matrix * [x,y,z], i.e. the vector [x,y,z] is a column vector on the right.
|
|
226622
|
+
* @return the vector result (optional)
|
|
226607
226623
|
*/
|
|
226608
226624
|
multiplyXYZ(x, y, z, result) {
|
|
226609
226625
|
result = result ? result : new _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d();
|
|
226610
|
-
result.x =
|
|
226611
|
-
result.y =
|
|
226612
|
-
result.z =
|
|
226626
|
+
result.x = this.coffs[0] * x + this.coffs[1] * y + this.coffs[2] * z;
|
|
226627
|
+
result.y = this.coffs[3] * x + this.coffs[4] * y + this.coffs[5] * z;
|
|
226628
|
+
result.z = this.coffs[6] * x + this.coffs[7] * y + this.coffs[8] * z;
|
|
226613
226629
|
return result;
|
|
226614
226630
|
}
|
|
226615
|
-
/**
|
|
226616
|
-
*
|
|
226617
|
-
*
|
|
226631
|
+
/**
|
|
226632
|
+
* Multiply the matrix * xyz, place result in (required) return value.
|
|
226633
|
+
* @param xyz right side
|
|
226634
|
+
* @param result the result.
|
|
226618
226635
|
*/
|
|
226619
226636
|
multiplyXYZtoXYZ(xyz, result) {
|
|
226620
226637
|
const x = xyz.x;
|
|
226621
226638
|
const y = xyz.y;
|
|
226622
226639
|
const z = xyz.z;
|
|
226623
|
-
result.x =
|
|
226624
|
-
result.y =
|
|
226625
|
-
result.z =
|
|
226640
|
+
result.x = this.coffs[0] * x + this.coffs[1] * y + this.coffs[2] * z;
|
|
226641
|
+
result.y = this.coffs[3] * x + this.coffs[4] * y + this.coffs[5] * z;
|
|
226642
|
+
result.z = this.coffs[6] * x + this.coffs[7] * y + this.coffs[8] * z;
|
|
226626
226643
|
return result;
|
|
226627
226644
|
}
|
|
226628
|
-
/**
|
|
226629
|
-
*
|
|
226645
|
+
/**
|
|
226646
|
+
* Multiply the matrix * [x,y,0], i.e. the vector [x,y,0] is a column vector on the right.
|
|
226647
|
+
* @return the vector result (optional)
|
|
226630
226648
|
*/
|
|
226631
226649
|
multiplyXY(x, y, result) {
|
|
226632
226650
|
result = result ? result : new _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d();
|
|
226633
|
-
result.x =
|
|
226634
|
-
result.y =
|
|
226635
|
-
result.z =
|
|
226651
|
+
result.x = this.coffs[0] * x + this.coffs[1] * y;
|
|
226652
|
+
result.y = this.coffs[3] * x + this.coffs[4] * y;
|
|
226653
|
+
result.z = this.coffs[6] * x + this.coffs[7] * y;
|
|
226636
226654
|
return result;
|
|
226637
226655
|
}
|
|
226638
|
-
/**
|
|
226656
|
+
/**
|
|
226657
|
+
* Compute origin + the matrix * [x,y,0].
|
|
226658
|
+
* @return the vector result (optional)
|
|
226659
|
+
*/
|
|
226639
226660
|
originPlusMatrixTimesXY(origin, x, y, result) {
|
|
226640
226661
|
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);
|
|
226641
226662
|
}
|
|
226642
|
-
/**
|
|
226663
|
+
/**
|
|
226664
|
+
* Multiply the matrix * (x,y,z) in place, i.e. the vector (x,y,z) is a column vector on the right and
|
|
226665
|
+
* the multiplication updates the vector values.
|
|
226666
|
+
* @param xyzData the vector data
|
|
226667
|
+
*/
|
|
226643
226668
|
multiplyVectorInPlace(xyzData) {
|
|
226644
226669
|
const x = xyzData.x;
|
|
226645
226670
|
const y = xyzData.y;
|
|
226646
226671
|
const z = xyzData.z;
|
|
226647
|
-
|
|
226648
|
-
xyzData.
|
|
226649
|
-
xyzData.
|
|
226650
|
-
xyzData.z = (coffs[6] * x + coffs[7] * y + coffs[8] * z);
|
|
226672
|
+
xyzData.x = this.coffs[0] * x + this.coffs[1] * y + this.coffs[2] * z;
|
|
226673
|
+
xyzData.y = this.coffs[3] * x + this.coffs[4] * y + this.coffs[5] * z;
|
|
226674
|
+
xyzData.z = this.coffs[6] * x + this.coffs[7] * y + this.coffs[8] * z;
|
|
226651
226675
|
}
|
|
226652
|
-
/**
|
|
226653
|
-
*
|
|
226676
|
+
/**
|
|
226677
|
+
* Multiply the transpose matrix times [x,y,z] in place, i.e. the vector [x,y,z] is a column vector on
|
|
226678
|
+
* the right and the multiplication updates the vector values.
|
|
226679
|
+
* * This is equivalent to `multiplyTransposeVector` but always returns the result directly in the input.
|
|
226680
|
+
* @param xyzData the vector data
|
|
226654
226681
|
*/
|
|
226655
226682
|
multiplyTransposeVectorInPlace(vectorU) {
|
|
226656
226683
|
const x = vectorU.x;
|
|
226657
226684
|
const y = vectorU.y;
|
|
226658
226685
|
const z = vectorU.z;
|
|
226659
|
-
|
|
226660
|
-
vectorU.
|
|
226661
|
-
vectorU.
|
|
226662
|
-
vectorU.z = (coffs[2] * x + coffs[5] * y + coffs[8] * z);
|
|
226686
|
+
vectorU.x = this.coffs[0] * x + this.coffs[3] * y + this.coffs[6] * z;
|
|
226687
|
+
vectorU.y = this.coffs[1] * x + this.coffs[4] * y + this.coffs[7] * z;
|
|
226688
|
+
vectorU.z = this.coffs[2] * x + this.coffs[5] * y + this.coffs[8] * z;
|
|
226663
226689
|
}
|
|
226664
|
-
/**
|
|
226665
|
-
*
|
|
226690
|
+
/**
|
|
226691
|
+
* Multiply the transpose matrix times column using individual numeric inputs.
|
|
226692
|
+
* * This produces the same x,y,z as treating the vector as a row on the left of the (un-transposed) matrix.
|
|
226666
226693
|
* ```
|
|
226667
226694
|
* equation
|
|
226668
226695
|
* \begin{matrix}
|
|
226669
|
-
* \text{treating the input as a column } \columnXYZ{x}{y}{z}\text{ compute }&\columnSubXYZ{V} &= &A^T \columnXYZ{x}{y}{z} \\
|
|
226670
|
-
* \text{or row vector } \rowXYZ{x}{y}{z} \text{ compute }&\rowSubXYZ{V} &= &\rowXYZ{x}{y}{z} A \\
|
|
226696
|
+
* \text{treating the input as a column vector } \columnXYZ{x}{y}{z}\text{ compute }&\columnSubXYZ{V} &= &A^T \columnXYZ{x}{y}{z} \\
|
|
226697
|
+
* \text{or as a row vector } \rowXYZ{x}{y}{z} \text{ compute }&\rowSubXYZ{V} &= &\rowXYZ{x}{y}{z} A \\
|
|
226671
226698
|
* \phantom{8888}\text{and return V as a Vector3d} & & &
|
|
226672
226699
|
* \end{matrix}
|
|
226673
226700
|
* ````
|
|
226674
|
-
* @return the vector result
|
|
226701
|
+
* @return the vector result (optional)
|
|
226675
226702
|
*/
|
|
226676
226703
|
multiplyTransposeXYZ(x, y, z, result) {
|
|
226677
226704
|
result = result ? result : new _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d();
|
|
226678
|
-
result.x =
|
|
226679
|
-
result.y =
|
|
226680
|
-
result.z =
|
|
226705
|
+
result.x = this.coffs[0] * x + this.coffs[3] * y + this.coffs[6] * z;
|
|
226706
|
+
result.y = this.coffs[1] * x + this.coffs[4] * y + this.coffs[7] * z;
|
|
226707
|
+
result.z = this.coffs[2] * x + this.coffs[5] * y + this.coffs[8] * z;
|
|
226681
226708
|
return result;
|
|
226682
226709
|
}
|
|
226683
|
-
/**
|
|
226684
|
-
*
|
|
226685
|
-
* *
|
|
226710
|
+
/**
|
|
226711
|
+
* Solve `matrix * result = vector` for an unknown `result`.
|
|
226712
|
+
* * This is equivalent to multiplication `result = inverse matrix * vector`.
|
|
226713
|
+
* * Result is undefined if the matrix is singular (e.g. has parallel columns or a zero magnitude column)
|
|
226686
226714
|
*/
|
|
226687
226715
|
multiplyInverse(vector, result) {
|
|
226688
226716
|
this.computeCachedInverse(true);
|
|
@@ -226690,13 +226718,14 @@ class Matrix3d {
|
|
|
226690
226718
|
const x = vector.x;
|
|
226691
226719
|
const y = vector.y;
|
|
226692
226720
|
const z = vector.z;
|
|
226693
|
-
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.create(
|
|
226721
|
+
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);
|
|
226694
226722
|
}
|
|
226695
226723
|
return undefined;
|
|
226696
226724
|
}
|
|
226697
|
-
/**
|
|
226725
|
+
/**
|
|
226726
|
+
* Solve `matrixTranspose * result = vector` for an unknown `result`.
|
|
226698
226727
|
* * This is equivalent to multiplication `result = matrixInverseTranspose * vector`.
|
|
226699
|
-
* * Result is undefined if the matrix is singular (e.g. has parallel or zero
|
|
226728
|
+
* * Result is undefined if the matrix is singular (e.g. has parallel columns or a zero magnitude column)
|
|
226700
226729
|
*/
|
|
226701
226730
|
multiplyInverseTranspose(vector, result) {
|
|
226702
226731
|
this.computeCachedInverse(true);
|
|
@@ -226704,87 +226733,91 @@ class Matrix3d {
|
|
|
226704
226733
|
const x = vector.x;
|
|
226705
226734
|
const y = vector.y;
|
|
226706
226735
|
const z = vector.z;
|
|
226707
|
-
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.create(
|
|
226736
|
+
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);
|
|
226708
226737
|
}
|
|
226709
226738
|
return undefined;
|
|
226710
226739
|
}
|
|
226711
226740
|
/**
|
|
226712
|
-
*
|
|
226713
|
-
* *
|
|
226714
|
-
* *
|
|
226741
|
+
* Multiply `matrixInverse * [x,y,z]`.
|
|
226742
|
+
* * This is equivalent to solving `matrix * result = [x,y,z]` for an unknown `result`.
|
|
226743
|
+
* * Result is undefined if the matrix is singular (e.g. has parallel columns or a zero magnitude column)
|
|
226744
|
+
* @return result as a Vector3d or undefined (if the matrix is singular).
|
|
226715
226745
|
*/
|
|
226716
226746
|
multiplyInverseXYZAsVector3d(x, y, z, result) {
|
|
226717
226747
|
this.computeCachedInverse(true);
|
|
226718
226748
|
if (this.inverseCoffs) {
|
|
226719
|
-
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.create(
|
|
226749
|
+
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);
|
|
226720
226750
|
}
|
|
226721
226751
|
return undefined;
|
|
226722
226752
|
}
|
|
226723
226753
|
/**
|
|
226724
|
-
*
|
|
226725
|
-
* *
|
|
226726
|
-
* *
|
|
226727
|
-
*
|
|
226754
|
+
* Multiply `matrixInverse * [x,y,z]` and return result as `Point4d` with given weight.
|
|
226755
|
+
* * Equivalent to solving `matrix * result = [x,y,z]` for an unknown `result`.
|
|
226756
|
+
* * Result is undefined if the matrix is singular (e.g. has parallel columns or a zero magnitude column)
|
|
226757
|
+
* @return result as a Point4d with the same weight.
|
|
226728
226758
|
*/
|
|
226729
226759
|
multiplyInverseXYZW(x, y, z, w, result) {
|
|
226730
226760
|
this.computeCachedInverse(true);
|
|
226731
226761
|
if (this.inverseCoffs) {
|
|
226732
|
-
return _geometry4d_Point4d__WEBPACK_IMPORTED_MODULE_4__.Point4d.create(
|
|
226762
|
+
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);
|
|
226733
226763
|
}
|
|
226734
226764
|
return undefined;
|
|
226735
226765
|
}
|
|
226736
226766
|
/**
|
|
226737
|
-
*
|
|
226738
|
-
* *
|
|
226739
|
-
*
|
|
226740
|
-
* * return as a Point3d.
|
|
226767
|
+
* Multiply `matrixInverse * [x,y,z]` and return result as `Point3d`.
|
|
226768
|
+
* * Equivalent to solving `matrix * result = [x,y,z]` for an unknown `result`.
|
|
226769
|
+
* @return result as a Point3d or undefined (if the matrix is singular).
|
|
226741
226770
|
*/
|
|
226742
226771
|
multiplyInverseXYZAsPoint3d(x, y, z, result) {
|
|
226743
226772
|
this.computeCachedInverse(true);
|
|
226744
226773
|
if (this.inverseCoffs) {
|
|
226745
|
-
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Point3d.create(
|
|
226774
|
+
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);
|
|
226746
226775
|
}
|
|
226747
226776
|
return undefined;
|
|
226748
226777
|
}
|
|
226749
226778
|
/**
|
|
226750
|
-
*
|
|
226751
|
-
* * set
|
|
226752
|
-
*
|
|
226779
|
+
* Invoke a given matrix*matrix operation to compute the inverse matrix and set this.inverseCoffs
|
|
226780
|
+
* * If either input coffA or coffB is undefined, set state to `InverseMatrixState.unknown` but
|
|
226781
|
+
* leave the inverseCoffs untouched.
|
|
226782
|
+
* @param f the given matrix*matrix operation that is called by this function to compute the inverse.
|
|
226783
|
+
* `f` must be a matrix*matrix operation. Otherwise, the function does not generate the inverse properly.
|
|
226753
226784
|
*/
|
|
226754
226785
|
finishInverseCoffs(f, coffA, coffB) {
|
|
226755
226786
|
if (coffA && coffB) {
|
|
226756
226787
|
this.createInverseCoffsWithZeros();
|
|
226757
226788
|
this.inverseState = InverseMatrixState.inverseStored;
|
|
226758
|
-
f(coffA, coffB, this.inverseCoffs);
|
|
226789
|
+
f(coffA, coffB, this.inverseCoffs); // call function f (which is provided by user) to compute the inverse.
|
|
226759
226790
|
}
|
|
226760
226791
|
else {
|
|
226761
226792
|
this.inverseState = InverseMatrixState.unknown;
|
|
226762
226793
|
}
|
|
226763
226794
|
}
|
|
226764
|
-
|
|
226765
|
-
|
|
226766
|
-
|
|
226767
|
-
|
|
226768
|
-
|
|
226769
|
-
|
|
226770
|
-
|
|
226771
|
-
|
|
226772
|
-
|
|
226773
|
-
* @return the matrix product A * B
|
|
226795
|
+
// Notes on inverse of matrix products:
|
|
226796
|
+
// 1) M = A * B ===> MInverse = BInverse * AInverse
|
|
226797
|
+
// 2) M = A * BInverse ===> MInverse = B * AInverse
|
|
226798
|
+
// 3) M = AInverse * B ===> MInverse = BInverse * A
|
|
226799
|
+
// 4) M = A * BTranspose ===> MInverse = BInverseTranspose * AInverse
|
|
226800
|
+
// 5) M = ATranspose * B ===> MInverse = BInverse * AInverseTranspose
|
|
226801
|
+
/**
|
|
226802
|
+
* Multiply `this` matrix times `other` matrix
|
|
226803
|
+
* @return the matrix result: this*other
|
|
226774
226804
|
*/
|
|
226775
226805
|
multiplyMatrixMatrix(other, result) {
|
|
226776
226806
|
result = result ? result : new Matrix3d();
|
|
226777
226807
|
PackedMatrix3dOps.multiplyMatrixMatrix(this.coffs, other.coffs, result.coffs);
|
|
226778
|
-
if (this.inverseState === InverseMatrixState.inverseStored
|
|
226808
|
+
if (this.inverseState === InverseMatrixState.inverseStored
|
|
226809
|
+
&& other.inverseState === InverseMatrixState.inverseStored)
|
|
226779
226810
|
result.finishInverseCoffs(PackedMatrix3dOps.multiplyMatrixMatrix, other.inverseCoffs, this.inverseCoffs);
|
|
226780
|
-
else if (this.inverseState === InverseMatrixState.singular
|
|
226811
|
+
else if (this.inverseState === InverseMatrixState.singular
|
|
226812
|
+
|| other.inverseState === InverseMatrixState.singular)
|
|
226781
226813
|
result.inverseState = InverseMatrixState.singular;
|
|
226782
226814
|
else
|
|
226783
226815
|
result.inverseState = InverseMatrixState.unknown;
|
|
226784
226816
|
return result;
|
|
226785
226817
|
}
|
|
226786
|
-
/**
|
|
226787
|
-
*
|
|
226818
|
+
/**
|
|
226819
|
+
* Multiply `this` matrix times `inverse of other` matrix
|
|
226820
|
+
* @return the matrix result: this*otherInverse
|
|
226788
226821
|
*/
|
|
226789
226822
|
multiplyMatrixMatrixInverse(other, result) {
|
|
226790
226823
|
if (!other.computeCachedInverse(true))
|
|
@@ -226798,8 +226831,9 @@ class Matrix3d {
|
|
|
226798
226831
|
PackedMatrix3dOps.copy(Matrix3d._productBuffer, result.coffs);
|
|
226799
226832
|
return result;
|
|
226800
226833
|
}
|
|
226801
|
-
/**
|
|
226802
|
-
*
|
|
226834
|
+
/**
|
|
226835
|
+
* Multiply `inverse of this` matrix times `other` matrix
|
|
226836
|
+
* @return the matrix result: thisInverse*other
|
|
226803
226837
|
*/
|
|
226804
226838
|
multiplyMatrixInverseMatrix(other, result) {
|
|
226805
226839
|
if (!this.computeCachedInverse(true))
|
|
@@ -226813,30 +226847,32 @@ class Matrix3d {
|
|
|
226813
226847
|
PackedMatrix3dOps.copy(Matrix3d._productBuffer, result.coffs);
|
|
226814
226848
|
return result;
|
|
226815
226849
|
}
|
|
226816
|
-
/**
|
|
226850
|
+
/**
|
|
226851
|
+
* Multiply `this` matrix times the transpose of `other` matrix
|
|
226817
226852
|
* ```
|
|
226818
226853
|
* equation
|
|
226819
|
-
* \text{for instance matrix }A\text{ and
|
|
226854
|
+
* \text{for instance matrix }A\text{ and matrix }B\text{ return matrix }C{\text where }\\\matrixXY{C}=\matrixXY{A}\matrixTransposeSubXY{B}
|
|
226820
226855
|
* ```
|
|
226821
|
-
* @return the matrix result
|
|
226856
|
+
* @return the matrix result: this*otherTranspose
|
|
226822
226857
|
*/
|
|
226823
|
-
multiplyMatrixMatrixTranspose(
|
|
226858
|
+
multiplyMatrixMatrixTranspose(other, result) {
|
|
226824
226859
|
result = result ? result : new Matrix3d();
|
|
226825
|
-
PackedMatrix3dOps.multiplyMatrixMatrixTranspose(this.coffs,
|
|
226826
|
-
if (this.inverseState === InverseMatrixState.inverseStored &&
|
|
226827
|
-
result.finishInverseCoffs(PackedMatrix3dOps.multiplyMatrixTransposeMatrix,
|
|
226828
|
-
else if (this.inverseState === InverseMatrixState.singular ||
|
|
226860
|
+
PackedMatrix3dOps.multiplyMatrixMatrixTranspose(this.coffs, other.coffs, result.coffs);
|
|
226861
|
+
if (this.inverseState === InverseMatrixState.inverseStored && other.inverseState === InverseMatrixState.inverseStored)
|
|
226862
|
+
result.finishInverseCoffs(PackedMatrix3dOps.multiplyMatrixTransposeMatrix, other.inverseCoffs, this.inverseCoffs);
|
|
226863
|
+
else if (this.inverseState === InverseMatrixState.singular || other.inverseState === InverseMatrixState.singular)
|
|
226829
226864
|
result.inverseState = InverseMatrixState.singular;
|
|
226830
226865
|
else
|
|
226831
226866
|
result.inverseState = InverseMatrixState.unknown;
|
|
226832
226867
|
return result;
|
|
226833
226868
|
}
|
|
226834
|
-
/**
|
|
226869
|
+
/**
|
|
226870
|
+
* Multiply the transpose of `this` matrix times `other` matrix
|
|
226835
226871
|
* ```
|
|
226836
226872
|
* equation
|
|
226837
226873
|
* \matrixXY{result}=\matrixXY{\text{this}}\matrixTransposeSubXY{\text{other}}
|
|
226838
226874
|
* ```
|
|
226839
|
-
*
|
|
226875
|
+
* @return the matrix result: thisTranspose*other
|
|
226840
226876
|
*/
|
|
226841
226877
|
multiplyMatrixTransposeMatrix(other, result) {
|
|
226842
226878
|
result = result ? result : new Matrix3d();
|
|
@@ -226849,30 +226885,31 @@ class Matrix3d {
|
|
|
226849
226885
|
result.inverseState = InverseMatrixState.unknown;
|
|
226850
226886
|
return result;
|
|
226851
226887
|
}
|
|
226852
|
-
/**
|
|
226888
|
+
/**
|
|
226889
|
+
* Multiply `this` Matrix3d (considered as a Transform with 0 translation) times `other` Transform.
|
|
226853
226890
|
* ```
|
|
226854
226891
|
* equation
|
|
226855
226892
|
* \begin{matrix}
|
|
226856
|
-
*
|
|
226857
|
-
*
|
|
226893
|
+
* \text{This matrix }\bold{A}\text{ promoted to block transform} & \blockTransform{A}{0} \\
|
|
226894
|
+
* \text{other transform with matrix part }\bold{B}\text{ and translation }\bold{b} & \blockTransform{B}{b}\\
|
|
226858
226895
|
* \text{product}& \blockTransform{A}{0}\blockTransform{B}{b}=\blockTransform{AB}{Ab}
|
|
226859
226896
|
* \end{matrix}
|
|
226860
226897
|
* ```
|
|
226861
|
-
* @param other
|
|
226862
|
-
* @param result
|
|
226898
|
+
* @param other Right hand Matrix3d for multiplication.
|
|
226899
|
+
* @param result the Transform result (optional)
|
|
226863
226900
|
*/
|
|
226864
226901
|
multiplyMatrixTransform(other, result) {
|
|
226865
226902
|
if (!result)
|
|
226866
226903
|
return _Transform__WEBPACK_IMPORTED_MODULE_5__.Transform.createRefs(this.multiplyXYZ(other.origin.x, other.origin.y, other.origin.z), this.multiplyMatrixMatrix(other.matrix));
|
|
226867
|
-
// be sure to do the point multiplication first before aliasing changes the matrix
|
|
226904
|
+
// be sure to do the point multiplication first before aliasing changes the matrix
|
|
226868
226905
|
this.multiplyXYZtoXYZ(other.origin, result.origin);
|
|
226869
226906
|
this.multiplyMatrixMatrix(other.matrix, result.matrix);
|
|
226870
226907
|
return result;
|
|
226871
226908
|
}
|
|
226872
226909
|
/**
|
|
226873
226910
|
* Return the transpose of `this` matrix.
|
|
226874
|
-
* If `result` is passed as argument, then the function copies the transpose of `this` into `result
|
|
226875
|
-
* `this` is not changed unless also passed as the result, i.e., this.transpose(this) transposes `this` in place
|
|
226911
|
+
* * If `result` is passed as argument, then the function copies the transpose of `this` into `result`.
|
|
226912
|
+
* * `this` is not changed unless also passed as the result, i.e., `this.transpose(this)` transposes `this` in place.
|
|
226876
226913
|
*/
|
|
226877
226914
|
transpose(result) {
|
|
226878
226915
|
if (!result)
|
|
@@ -226894,18 +226931,22 @@ class Matrix3d {
|
|
|
226894
226931
|
transposeInPlace() {
|
|
226895
226932
|
PackedMatrix3dOps.transposeInPlace(this.coffs);
|
|
226896
226933
|
if (this.inverseCoffs)
|
|
226897
|
-
PackedMatrix3dOps.transposeInPlace(this.inverseCoffs);
|
|
226934
|
+
PackedMatrix3dOps.transposeInPlace(this.inverseCoffs); // inverse of transpose is equal to transpose of inverse
|
|
226898
226935
|
}
|
|
226899
|
-
/**
|
|
226900
|
-
*
|
|
226901
|
-
*
|
|
226902
|
-
* *
|
|
226936
|
+
/**
|
|
226937
|
+
* Return the inverse matrix.
|
|
226938
|
+
* The return is undefined if the matrix is singular (e.g. has parallel columns or a zero magnitude column)
|
|
226939
|
+
* * If `result == this`, then content of inverse of `this` matrix is copied into `this`. Otherwise, inverse
|
|
226940
|
+
* of `this` is stored in `result`.
|
|
226941
|
+
* * **Note:** Each Matrix3d object caches its own inverse (`this.inverseCoffs`) and has methods to multiply
|
|
226942
|
+
* the inverse times matrices and vectors (e.g., `multiplyMatrixInverseMatrix`, `multiplyMatrixMatrixInverse`,
|
|
226943
|
+
* `multiplyInverse`). Hence explicitly constructing this new inverse object is rarely necessary.
|
|
226903
226944
|
*/
|
|
226904
226945
|
inverse(result) {
|
|
226905
226946
|
if (!this.computeCachedInverse(true))
|
|
226906
226947
|
return undefined;
|
|
226907
226948
|
if (result === this) {
|
|
226908
|
-
// swap the contents
|
|
226949
|
+
// swap the contents of this.coffs and this.inverseCoffs
|
|
226909
226950
|
PackedMatrix3dOps.copy(this.coffs, Matrix3d._productBuffer);
|
|
226910
226951
|
PackedMatrix3dOps.copy(this.inverseCoffs, this.coffs);
|
|
226911
226952
|
PackedMatrix3dOps.copy(Matrix3d._productBuffer, this.inverseCoffs);
|
|
@@ -226920,33 +226961,48 @@ class Matrix3d {
|
|
|
226920
226961
|
result.inverseState = this.inverseState;
|
|
226921
226962
|
return result;
|
|
226922
226963
|
}
|
|
226923
|
-
|
|
226924
|
-
|
|
226925
|
-
|
|
226926
|
-
|
|
226964
|
+
/**
|
|
226965
|
+
* Take the dot product of a row (specified by `rowStartA`) of `coffA` and `columnStartB` of `coffB`.
|
|
226966
|
+
* * **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.
|
|
226967
|
+
*/
|
|
226968
|
+
static rowColumnDot(coffA, rowStartA, coffB, columnStartB) {
|
|
226969
|
+
return coffA[rowStartA] * coffB[columnStartB] +
|
|
226970
|
+
coffA[rowStartA + 1] * coffB[columnStartB + 3] +
|
|
226971
|
+
coffA[rowStartA + 2] * coffB[columnStartB + 6];
|
|
226972
|
+
}
|
|
226973
|
+
/**
|
|
226974
|
+
* Take the cross product of 2 rows (specified by `rowStart0` and `rowStart1`) of `source` and store the result
|
|
226975
|
+
* in `columnStart` of `dest`.
|
|
226976
|
+
* * **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.
|
|
226977
|
+
*/
|
|
226927
226978
|
static indexedRowCrossProduct(source, rowStart0, rowStart1, dest, columnStart) {
|
|
226928
226979
|
dest[columnStart] = source[rowStart0 + 1] * source[rowStart1 + 2] - source[rowStart0 + 2] * source[rowStart1 + 1];
|
|
226929
226980
|
dest[columnStart + 3] = source[rowStart0 + 2] * source[rowStart1] - source[rowStart0] * source[rowStart1 + 2];
|
|
226930
226981
|
dest[columnStart + 6] = source[rowStart0] * source[rowStart1 + 1] - source[rowStart0 + 1] * source[rowStart1];
|
|
226931
226982
|
}
|
|
226932
|
-
|
|
226933
|
-
|
|
226934
|
-
|
|
226983
|
+
/**
|
|
226984
|
+
* Take the cross product of 2 columns (i.e., `colStart0` and `colStart1`) of `this` matrix and store the
|
|
226985
|
+
* result in `colStart2` of the same matrix.
|
|
226986
|
+
* * **Note:** We don't validate column numbers. Pass 0/1/2 for column 0/1/2.
|
|
226987
|
+
*/
|
|
226935
226988
|
indexedColumnCrossProductInPlace(colStart0, colStart1, colStart2) {
|
|
226936
226989
|
const coffs = this.coffs;
|
|
226937
226990
|
coffs[colStart2] = coffs[colStart0 + 3] * coffs[colStart1 + 6] - coffs[colStart0 + 6] * coffs[colStart1 + 3];
|
|
226938
226991
|
coffs[colStart2 + 3] = coffs[colStart0 + 6] * coffs[colStart1] - coffs[colStart0] * coffs[colStart1 + 6];
|
|
226939
226992
|
coffs[colStart2 + 6] = coffs[colStart0] * coffs[colStart1 + 3] - coffs[colStart0 + 3] * coffs[colStart1];
|
|
226940
226993
|
}
|
|
226941
|
-
/**
|
|
226942
|
-
*
|
|
226943
|
-
*
|
|
226994
|
+
/**
|
|
226995
|
+
* Form cross products among columns in axisOrder.
|
|
226996
|
+
* For axis order ABC:
|
|
226997
|
+
* * form cross product of column A and B, store in C.
|
|
226944
226998
|
* * form cross product of column C and A, store in B.
|
|
226999
|
+
* * [A B C] ===> [A B AxB] ===> [A (AxB)xA AxB]
|
|
227000
|
+
*
|
|
226945
227001
|
* This means that in the final matrix:
|
|
226946
|
-
* * column A is
|
|
226947
|
-
* * column B is linear combination of
|
|
227002
|
+
* * column A is same as original column A.
|
|
227003
|
+
* * column B is linear combination of original A and B (i.e., is in the plane of original A and B).
|
|
226948
227004
|
* * column C is perpendicular to A and B of both the original and final.
|
|
226949
|
-
* * original column C does not participate in the result.
|
|
227005
|
+
* * original column C is overwritten and does not participate in the result.
|
|
226950
227006
|
*/
|
|
226951
227007
|
axisOrderCrossProductsInPlace(axisOrder) {
|
|
226952
227008
|
switch (axisOrder) {
|
|
@@ -226982,41 +227038,44 @@ class Matrix3d {
|
|
|
226982
227038
|
}
|
|
226983
227039
|
}
|
|
226984
227040
|
}
|
|
226985
|
-
/**
|
|
226986
|
-
*
|
|
226987
|
-
* @
|
|
226988
|
-
* @
|
|
227041
|
+
/**
|
|
227042
|
+
* Normalize each column in place.
|
|
227043
|
+
* @param originalRowMagnitudes optional vector to store original column magnitudes.
|
|
227044
|
+
* @returns Return true if all columns have non-zero lengths. Otherwise, return false.
|
|
227045
|
+
* * If false is returned, the magnitudes are stored in the `originalRowMagnitudes` vector but no columns
|
|
227046
|
+
* are altered.
|
|
226989
227047
|
*/
|
|
226990
|
-
normalizeColumnsInPlace(
|
|
227048
|
+
normalizeColumnsInPlace(originalRowMagnitudes) {
|
|
226991
227049
|
const ax = this.columnXMagnitude();
|
|
226992
227050
|
const ay = this.columnYMagnitude();
|
|
226993
227051
|
const az = this.columnZMagnitude();
|
|
226994
|
-
if (
|
|
226995
|
-
|
|
227052
|
+
if (originalRowMagnitudes)
|
|
227053
|
+
originalRowMagnitudes.set(ax, ay, az);
|
|
226996
227054
|
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))
|
|
226997
227055
|
return false;
|
|
226998
227056
|
this.scaleColumns(1.0 / ax, 1.0 / ay, 1.0 / az, this);
|
|
226999
227057
|
return true;
|
|
227000
227058
|
}
|
|
227001
|
-
/**
|
|
227002
|
-
|
|
227059
|
+
/**
|
|
227060
|
+
* Normalize each row in place.
|
|
227061
|
+
* @param originalColumnMagnitudes optional vector to store original row magnitudes.
|
|
227062
|
+
* @returns Return true if all rows have non-zero lengths. Otherwise, return false.
|
|
227063
|
+
* * If false is returned, the magnitudes are stored in the `originalColumnMagnitudes` vector but no rows
|
|
227064
|
+
* are altered.
|
|
227065
|
+
*/
|
|
227066
|
+
normalizeRowsInPlace(originalColumnMagnitudes) {
|
|
227003
227067
|
const ax = this.rowXMagnitude();
|
|
227004
227068
|
const ay = this.rowYMagnitude();
|
|
227005
227069
|
const az = this.rowZMagnitude();
|
|
227006
|
-
if (
|
|
227007
|
-
|
|
227070
|
+
if (originalColumnMagnitudes)
|
|
227071
|
+
originalColumnMagnitudes.set(ax, ay, az);
|
|
227008
227072
|
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))
|
|
227009
227073
|
return false;
|
|
227010
227074
|
this.scaleRows(1.0 / ax, 1.0 / ay, 1.0 / az, this);
|
|
227011
227075
|
return true;
|
|
227012
227076
|
}
|
|
227013
|
-
// take the cross product of two rows of source.
|
|
227014
|
-
// store as a column of dest.
|
|
227015
|
-
static rowColumnDot(coffA, rowStartA, coffB, columnStartB) {
|
|
227016
|
-
return coffA[rowStartA] * coffB[columnStartB] + coffA[rowStartA + 1] * coffB[columnStartB + 3] + coffA[rowStartA + 2] * coffB[columnStartB + 6];
|
|
227017
|
-
}
|
|
227018
227077
|
/**
|
|
227019
|
-
* Returns true if the matrix is singular
|
|
227078
|
+
* Returns true if the matrix is singular.
|
|
227020
227079
|
*/
|
|
227021
227080
|
isSingular() {
|
|
227022
227081
|
return !this.computeCachedInverse(true);
|
|
@@ -227028,18 +227087,10 @@ class Matrix3d {
|
|
|
227028
227087
|
this.inverseState = InverseMatrixState.singular;
|
|
227029
227088
|
}
|
|
227030
227089
|
/**
|
|
227031
|
-
*
|
|
227032
|
-
*
|
|
227033
|
-
*
|
|
227034
|
-
|
|
227035
|
-
createInverseCoffsWithZeros() {
|
|
227036
|
-
if (!this.inverseCoffs) {
|
|
227037
|
-
this.inverseState = InverseMatrixState.unknown;
|
|
227038
|
-
this.inverseCoffs = new Float64Array(9);
|
|
227039
|
-
}
|
|
227040
|
-
}
|
|
227041
|
-
/** compute the inverse of this Matrix3d. The inverse is stored for later use.
|
|
227042
|
-
* @returns Return true if the inverse computed. (False if the columns collapse to a point, line or plane.)
|
|
227090
|
+
* Compute the inverse of `this` Matrix3d. The inverse is stored in `this.inverseCoffs` for later use.
|
|
227091
|
+
* @param useCacheIfAvailable if `true`, use the previously computed inverse if available. If `false`,
|
|
227092
|
+
* recompute the inverse.
|
|
227093
|
+
* @returns Return `true` if the inverse is computed. Return `false` if matrix is singular.
|
|
227043
227094
|
*/
|
|
227044
227095
|
computeCachedInverse(useCacheIfAvailable) {
|
|
227045
227096
|
if (useCacheIfAvailable && Matrix3d.useCachedInverse && this.inverseState !== InverseMatrixState.unknown) {
|
|
@@ -227050,71 +227101,45 @@ class Matrix3d {
|
|
|
227050
227101
|
this.createInverseCoffsWithZeros();
|
|
227051
227102
|
const coffs = this.coffs;
|
|
227052
227103
|
const inverseCoffs = this.inverseCoffs;
|
|
227053
|
-
|
|
227054
|
-
|
|
227055
|
-
|
|
227104
|
+
/**
|
|
227105
|
+
* We calculate the inverse using cross products.
|
|
227106
|
+
* Math details can be found at
|
|
227107
|
+
* https://www.chilimath.com/lessons/advanced-algebra/determinant-3x3-matrix/
|
|
227108
|
+
* In summary, if M = [A B C] then inverse of M = (1/det)[BxC CxA AxB] where det is the
|
|
227109
|
+
* determinant of matrix M and can be calculated by "A dot BxC".
|
|
227110
|
+
*/
|
|
227111
|
+
Matrix3d.indexedRowCrossProduct(coffs, 3, 6, inverseCoffs, 0); // BxC
|
|
227112
|
+
Matrix3d.indexedRowCrossProduct(coffs, 6, 0, inverseCoffs, 1); // CxA
|
|
227113
|
+
Matrix3d.indexedRowCrossProduct(coffs, 0, 3, inverseCoffs, 2); // AxB
|
|
227056
227114
|
Matrix3d.numComputeCache++;
|
|
227057
|
-
const
|
|
227058
|
-
if (
|
|
227115
|
+
const det = Matrix3d.rowColumnDot(coffs, 0, inverseCoffs, 0); // A dot BxC
|
|
227116
|
+
if (det === 0.0) {
|
|
227059
227117
|
this.inverseState = InverseMatrixState.singular;
|
|
227060
227118
|
this.inverseCoffs = undefined;
|
|
227061
227119
|
return false;
|
|
227062
227120
|
}
|
|
227063
|
-
const f = 1.0 /
|
|
227121
|
+
const f = 1.0 / det;
|
|
227064
227122
|
for (let i = 0; i < 9; i++)
|
|
227065
227123
|
inverseCoffs[i] *= f;
|
|
227066
227124
|
this.inverseState = InverseMatrixState.inverseStored;
|
|
227067
|
-
// verify inverse
|
|
227068
|
-
// const p = new Float64Array(9);
|
|
227069
|
-
// for (let i = 0; i < 9; i += 3)
|
|
227070
|
-
// for (let j = 0; j < 3; j++)
|
|
227071
|
-
// p[i + j] = Matrix3d.rowColumnDot (coffs, i, inverseCoffs, j);
|
|
227072
227125
|
return true;
|
|
227073
227126
|
}
|
|
227074
|
-
|
|
227075
|
-
|
|
227076
|
-
|
|
227077
|
-
|
|
227078
|
-
private static crossXY: Vector3d = Vector3d.create();
|
|
227079
|
-
private static crossZX: Vector3d = Vector3d.create();
|
|
227080
|
-
private static crossYZ: Vector3d = Vector3d.create();
|
|
227081
|
-
private computeCachedInverse(useCacheIfAvailable: boolean) {
|
|
227082
|
-
if (useCacheIfAvailable && Matrix3d.useCachedInverse && this.inverseState !== InverseMatrixState.unknown) {
|
|
227083
|
-
Matrix3d.numUseCache++;
|
|
227084
|
-
return this.inverseState === InverseMatrixState.inverseStored;
|
|
227085
|
-
}
|
|
227086
|
-
this.inverseState = InverseMatrixState.unknown;
|
|
227087
|
-
Matrix3d.numComputeCache++;
|
|
227088
|
-
const rowX = this.rowX(Matrix3d.rowX);
|
|
227089
|
-
const rowY = this.rowY(Matrix3d.rowY);
|
|
227090
|
-
const rowZ = this.rowZ(Matrix3d.rowZ);
|
|
227091
|
-
const crossXY = rowX.crossProduct(rowY, Matrix3d.crossXY);
|
|
227092
|
-
const crossYZ = rowY.crossProduct(rowZ, Matrix3d.crossYZ);
|
|
227093
|
-
const crossZX = rowZ.crossProduct(rowX, Matrix3d.crossZX);
|
|
227094
|
-
const d = rowX.dotProduct(crossYZ); // that's the determinant
|
|
227095
|
-
if (d === 0.0) { // better test?
|
|
227096
|
-
this.inverseState = InverseMatrixState.singular;
|
|
227097
|
-
this.inverseCoffs = undefined;
|
|
227098
|
-
return false;
|
|
227099
|
-
}
|
|
227100
|
-
const f = 1.0 / d;
|
|
227101
|
-
this.inverseState = InverseMatrixState.inverseStored; // Currently just lists that the inverse has been stored... singular case not handled
|
|
227102
|
-
this.inverseCoffs = Float64Array.from([crossYZ.x * f, crossZX.x * f, crossXY.x * f,
|
|
227103
|
-
crossYZ.y * f, crossZX.y * f, crossXY.y * f,
|
|
227104
|
-
crossYZ.z * f, crossZX.z * f, crossXY.z * f]);
|
|
227105
|
-
return true;
|
|
227106
|
-
}
|
|
227107
|
-
*/
|
|
227108
|
-
/** convert a (row,column) index pair to the single index within flattened array of 9 numbers in row-major-order */
|
|
227127
|
+
/**
|
|
227128
|
+
* Convert a (row,column) index pair to the single index within flattened array of 9 numbers in row-major-order
|
|
227129
|
+
* * **Note:** Out of range row/column is interpreted cyclically.
|
|
227130
|
+
*/
|
|
227109
227131
|
static flatIndexOf(row, column) {
|
|
227110
227132
|
return 3 * _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.cyclic3dAxis(row) + _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.cyclic3dAxis(column);
|
|
227111
227133
|
}
|
|
227112
|
-
/**
|
|
227134
|
+
/**
|
|
227135
|
+
* Get elements of column `index` packaged as a Point4d with given `weight`.
|
|
227136
|
+
* * **Note:** Out of range index is interpreted cyclically.
|
|
227137
|
+
*/
|
|
227113
227138
|
indexedColumnWithWeight(index, weight, result) {
|
|
227114
227139
|
index = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.cyclic3dAxis(index);
|
|
227115
227140
|
return _geometry4d_Point4d__WEBPACK_IMPORTED_MODULE_4__.Point4d.create(this.coffs[index], this.coffs[index + 3], this.coffs[index + 6], weight, result);
|
|
227116
227141
|
}
|
|
227117
|
-
/**
|
|
227142
|
+
/** Return the entry at specific row and column */
|
|
227118
227143
|
at(row, column) {
|
|
227119
227144
|
return this.coffs[Matrix3d.flatIndexOf(row, column)];
|
|
227120
227145
|
}
|
|
@@ -227148,7 +227173,7 @@ class Matrix3d {
|
|
|
227148
227173
|
this.coffs[7] *= scaleY;
|
|
227149
227174
|
this.coffs[8] *= scaleZ;
|
|
227150
227175
|
if (this.inverseState === InverseMatrixState.inverseStored && this.inverseCoffs !== undefined) {
|
|
227151
|
-
// apply
|
|
227176
|
+
// apply reciprocal scales to the ROWS of the inverse
|
|
227152
227177
|
const divX = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.conditionalDivideFraction(1.0, scaleX);
|
|
227153
227178
|
const divY = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.conditionalDivideFraction(1.0, scaleY);
|
|
227154
227179
|
const divZ = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.conditionalDivideFraction(1.0, scaleZ);
|
|
@@ -227224,12 +227249,11 @@ class Matrix3d {
|
|
|
227224
227249
|
/**
|
|
227225
227250
|
* Create a rigid matrix (columns and rows are unit length and pairwise perpendicular) for
|
|
227226
227251
|
* the given eye coordinate.
|
|
227227
|
-
* * column
|
|
227228
|
-
* * column
|
|
227229
|
-
* * column
|
|
227252
|
+
* * column 2 is parallel to (x,y,z).
|
|
227253
|
+
* * column 0 is perpendicular to column 2 and is in the xy plane.
|
|
227254
|
+
* * column 1 is perpendicular to both. It is the "up" vector on the view plane.
|
|
227230
227255
|
* * Multiplying the returned matrix times a local (view) vector gives the world vector.
|
|
227231
|
-
* * Multiplying transpose of the returned matrix times a world vector gives the local
|
|
227232
|
-
* (view) vector.
|
|
227256
|
+
* * Multiplying transpose of the returned matrix times a world vector gives the local (view) vector.
|
|
227233
227257
|
* @param x eye x coordinate
|
|
227234
227258
|
* @param y eye y coordinate
|
|
227235
227259
|
* @param z eye z coordinate
|
|
@@ -227244,11 +227268,27 @@ class Matrix3d {
|
|
|
227244
227268
|
result.scaleColumnsInPlace(1.0, -1.0, -1.0);
|
|
227245
227269
|
}
|
|
227246
227270
|
else {
|
|
227271
|
+
// if coordinate is (x,y,0), i.e., Front or Back or Left or Right view
|
|
227272
|
+
/**
|
|
227273
|
+
* The matrix that the "else" statement creates is
|
|
227274
|
+
* [-s -s1*c c1*c]
|
|
227275
|
+
* [c -s1*s c1*s]
|
|
227276
|
+
* [0 c1 s1 ]
|
|
227277
|
+
* where
|
|
227278
|
+
* c = x / sqrt(x*x + y*y)
|
|
227279
|
+
* s = y / sqrt(x*x + y*y)
|
|
227280
|
+
* c1 = sqrt(x*x + y*y) / sqrt(x*x + y*y + z*z)
|
|
227281
|
+
* s1 = z / sqrt(x*x + y*y + z*z)
|
|
227282
|
+
*
|
|
227283
|
+
* This is an orthogonal matrix meaning it rotates the standard XYZ axis to ABC axis system
|
|
227284
|
+
* (if matrix is [A B C]). The matrix rotates (0,0,1), i.e., the default Top view or Z axis,
|
|
227285
|
+
* to the eye point (x/r,y/r,z/r). The matrix also rotates (1,0,0) to a point on XY plane.
|
|
227286
|
+
*/
|
|
227247
227287
|
const c = x / rxy;
|
|
227248
227288
|
const s = y / rxy;
|
|
227249
|
-
// if coordinate is (x,y,0),
|
|
227289
|
+
// 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)
|
|
227250
227290
|
result.setRowValues(-s, 0, c, c, 0, s, 0, 1, 0);
|
|
227251
|
-
// if coordinate is (x,y,z), i.e., other views such as Iso or RightIso
|
|
227291
|
+
// if coordinate is (x,y,z) and z is not 0, i.e., other views such as Iso or RightIso
|
|
227252
227292
|
if (z !== 0.0) {
|
|
227253
227293
|
const r = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.hypotenuseXYZ(x, y, z);
|
|
227254
227294
|
const s1 = z / r;
|
|
@@ -227520,6 +227560,7 @@ Matrix3d.useCachedInverse = true; // cached inverse can be suppressed for testin
|
|
|
227520
227560
|
Matrix3d.numUseCache = 0;
|
|
227521
227561
|
/** Total number of times a cached inverse was computed. */
|
|
227522
227562
|
Matrix3d.numComputeCache = 0;
|
|
227563
|
+
/** temporary buffer to store a matrix as a Float64Array (array of 9 floats) */
|
|
227523
227564
|
Matrix3d._productBuffer = new Float64Array(9);
|
|
227524
227565
|
|
|
227525
227566
|
|
|
@@ -230302,6 +230343,8 @@ class Vector3d extends XYZ {
|
|
|
230302
230343
|
* * It's returning the signed projection magnitude divided by the target magnitude.
|
|
230303
230344
|
* * To find the projection vector, scale the target vector by the value that this function is returning.
|
|
230304
230345
|
* * math details can be found at docs/learning/geometry/PointVector.md
|
|
230346
|
+
* * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnVector
|
|
230347
|
+
* and https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnPlane
|
|
230305
230348
|
* @param target the target vector
|
|
230306
230349
|
* @param defaultFraction the returned value in case magnitude square of target vector is very small
|
|
230307
230350
|
* */
|
|
@@ -230694,6 +230737,7 @@ class Vector3d extends XYZ {
|
|
|
230694
230737
|
}
|
|
230695
230738
|
/**
|
|
230696
230739
|
* Return the cross product of this vector and vectorB.
|
|
230740
|
+
* * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/CrossProduct
|
|
230697
230741
|
* @param vectorB second vector of cross product
|
|
230698
230742
|
* @param result optional preallocated result.
|
|
230699
230743
|
*/
|
|
@@ -303504,7 +303548,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
|
|
|
303504
303548
|
/***/ ((module) => {
|
|
303505
303549
|
|
|
303506
303550
|
"use strict";
|
|
303507
|
-
module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"4.0.0-dev.
|
|
303551
|
+
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"}}]}}');
|
|
303508
303552
|
|
|
303509
303553
|
/***/ })
|
|
303510
303554
|
|