@itwin/rpcinterface-full-stack-tests 3.6.0-dev.47 → 3.6.0-dev.50
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 +384 -257
- package/lib/dist/bundled-tests.js.map +1 -1
- package/package.json +14 -14
|
@@ -184044,6 +184044,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
184044
184044
|
|
|
184045
184045
|
/* eslint-disable @typescript-eslint/naming-convention, no-empty */
|
|
184046
184046
|
/** Enumeration of the 6 possible orderings of XYZ axis order
|
|
184047
|
+
*
|
|
184048
|
+
* * **Note:** There are 3 axis order with right hand system (XYZ = 0, YZX = 1, ZXY = 2) and 3 axis order with
|
|
184049
|
+
* left hand system (XZY = 4, YXZ = 5, ZYX = 6). Note that AxisOrder is encoding the handedness as well. Cross
|
|
184050
|
+
* product of the i_th axis in an ordering (i=0,1,2), with the i+1_th in that ordering, will produce the i+2_th
|
|
184051
|
+
* axis in that ordering.
|
|
184047
184052
|
* @public
|
|
184048
184053
|
*/
|
|
184049
184054
|
var AxisOrder;
|
|
@@ -184073,7 +184078,7 @@ var AxisIndex;
|
|
|
184073
184078
|
/** 2 axis is index 2 */
|
|
184074
184079
|
AxisIndex[AxisIndex["Z"] = 2] = "Z";
|
|
184075
184080
|
})(AxisIndex || (AxisIndex = {}));
|
|
184076
|
-
/** Standard views.
|
|
184081
|
+
/** Standard views. Used in `Matrix3d.createStandardViewAxes(index: StandardViewIndex, invert: boolean)`
|
|
184077
184082
|
* @public
|
|
184078
184083
|
*/
|
|
184079
184084
|
var StandardViewIndex;
|
|
@@ -184090,9 +184095,9 @@ var StandardViewIndex;
|
|
|
184090
184095
|
StandardViewIndex[StandardViewIndex["Front"] = 5] = "Front";
|
|
184091
184096
|
/** negative X to right, Z up */
|
|
184092
184097
|
StandardViewIndex[StandardViewIndex["Back"] = 6] = "Back";
|
|
184093
|
-
/**
|
|
184098
|
+
/** isometric: view towards origin from (-1,-1,1) */
|
|
184094
184099
|
StandardViewIndex[StandardViewIndex["Iso"] = 7] = "Iso";
|
|
184095
|
-
/**
|
|
184100
|
+
/** right isometric: view towards origin from (1,-1,1) */
|
|
184096
184101
|
StandardViewIndex[StandardViewIndex["RightIso"] = 8] = "RightIso";
|
|
184097
184102
|
})(StandardViewIndex || (StandardViewIndex = {}));
|
|
184098
184103
|
/** Enumeration among choice for how a coordinate transformation should incorporate scaling.
|
|
@@ -184277,7 +184282,7 @@ class Geometry {
|
|
|
184277
184282
|
}
|
|
184278
184283
|
/**
|
|
184279
184284
|
* Toleranced equality test, using caller-supplied tolerance.
|
|
184280
|
-
* If no tolerance is given, use smallMetricDistance
|
|
184285
|
+
* If no tolerance is given, use smallMetricDistance.
|
|
184281
184286
|
*/
|
|
184282
184287
|
static isDistanceWithinTol(distance, tol) {
|
|
184283
184288
|
if (tol !== undefined)
|
|
@@ -184530,11 +184535,18 @@ class Geometry {
|
|
|
184530
184535
|
static resolveToUndefined(value, targetValue) {
|
|
184531
184536
|
return value === targetValue ? undefined : value;
|
|
184532
184537
|
}
|
|
184533
|
-
/**
|
|
184538
|
+
/** Simple interpolation between values, but choosing (based on fraction) a or b as starting point for maximum accuracy. */
|
|
184534
184539
|
static interpolate(a, f, b) {
|
|
184535
184540
|
return f <= 0.5 ? a + f * (b - a) : b - (1.0 - f) * (b - a);
|
|
184536
184541
|
}
|
|
184537
|
-
/**
|
|
184542
|
+
/**
|
|
184543
|
+
* Given an axisOrder (e.g. XYZ, YZX, etc) and an index, returns the axis index at the given index.
|
|
184544
|
+
* * For example, if axisOrder = XYZ, then for index 0 returns X (or axis index 0), for index 1 returns
|
|
184545
|
+
* Y (or axis index 1), and for index 2 returns Z (or axis index 2). For indexes greater than 2 or smaller
|
|
184546
|
+
* than 0, it returns cyclic axis index. See Geometry.cyclic3dAxis for more info.
|
|
184547
|
+
* * Another example: if axisOrder = ZYX, then for index 0 returns Z (or axis index 2), for index 1 returns
|
|
184548
|
+
* Y (or axis index 1), and for index 2 returns X (or axis index 0).
|
|
184549
|
+
* */
|
|
184538
184550
|
static axisOrderToAxis(order, index) {
|
|
184539
184551
|
const axis = order <= AxisOrder.ZXY ? order + index : (order - AxisOrder.XZY) - index;
|
|
184540
184552
|
return Geometry.cyclic3dAxis(axis);
|
|
@@ -219031,7 +219043,7 @@ class PackedMatrix3dOps {
|
|
|
219031
219043
|
dest[8] = a22;
|
|
219032
219044
|
}
|
|
219033
219045
|
/**
|
|
219034
|
-
*
|
|
219046
|
+
* Multiply 3x3 matrix `a*b`, store in `result`.
|
|
219035
219047
|
* * All params assumed length 9, allocated by caller.
|
|
219036
219048
|
* * c may alias either input.
|
|
219037
219049
|
*/
|
|
@@ -219042,7 +219054,7 @@ class PackedMatrix3dOps {
|
|
|
219042
219054
|
return result;
|
|
219043
219055
|
}
|
|
219044
219056
|
/**
|
|
219045
|
-
*
|
|
219057
|
+
* Multiply 3x3 matrix `a*bTranspose`, store in `result`.
|
|
219046
219058
|
* * All params assumed length 9, allocated by caller.
|
|
219047
219059
|
* * c may alias either input.
|
|
219048
219060
|
*/
|
|
@@ -219053,7 +219065,7 @@ class PackedMatrix3dOps {
|
|
|
219053
219065
|
return result;
|
|
219054
219066
|
}
|
|
219055
219067
|
/**
|
|
219056
|
-
*
|
|
219068
|
+
* Multiply 3x3 matrix `aTranspose*b`, store in `result`.
|
|
219057
219069
|
* * All params assumed length 9, allocated by caller.
|
|
219058
219070
|
* * c may alias either input.
|
|
219059
219071
|
*/
|
|
@@ -219063,7 +219075,7 @@ class PackedMatrix3dOps {
|
|
|
219063
219075
|
PackedMatrix3dOps.loadMatrix(result, (a[0] * b[0] + a[3] * b[3] + a[6] * b[6]), (a[0] * b[1] + a[3] * b[4] + a[6] * b[7]), (a[0] * b[2] + a[3] * b[5] + a[6] * b[8]), (a[1] * b[0] + a[4] * b[3] + a[7] * b[6]), (a[1] * b[1] + a[4] * b[4] + a[7] * b[7]), (a[1] * b[2] + a[4] * b[5] + a[7] * b[8]), (a[2] * b[0] + a[5] * b[3] + a[8] * b[6]), (a[2] * b[1] + a[5] * b[4] + a[8] * b[7]), (a[2] * b[2] + a[5] * b[5] + a[8] * b[8]));
|
|
219064
219076
|
return result;
|
|
219065
219077
|
}
|
|
219066
|
-
/**
|
|
219078
|
+
/** Transpose 3x3 matrix `a` in place */
|
|
219067
219079
|
static transposeInPlace(a) {
|
|
219068
219080
|
let q = a[1];
|
|
219069
219081
|
a[1] = a[3];
|
|
@@ -219075,10 +219087,14 @@ class PackedMatrix3dOps {
|
|
|
219075
219087
|
a[5] = a[7];
|
|
219076
219088
|
a[7] = q;
|
|
219077
219089
|
}
|
|
219078
|
-
/**
|
|
219090
|
+
/**
|
|
219091
|
+
* Returns the transpose of 3x3 matrix `a`
|
|
219092
|
+
* * If `dest` is passed as argument, then the function copies the transpose of 3x3 matrix `a` into `dest`
|
|
219093
|
+
* * `a` is not changed unless also passed as the dest, i.e., copyTransposed(a,a) transposes `a` in place
|
|
219094
|
+
*/
|
|
219079
219095
|
static copyTransposed(a, dest) {
|
|
219080
219096
|
if (dest === a) {
|
|
219081
|
-
PackedMatrix3dOps.transposeInPlace(
|
|
219097
|
+
PackedMatrix3dOps.transposeInPlace(dest);
|
|
219082
219098
|
}
|
|
219083
219099
|
else {
|
|
219084
219100
|
if (!dest)
|
|
@@ -219095,7 +219111,7 @@ class PackedMatrix3dOps {
|
|
|
219095
219111
|
}
|
|
219096
219112
|
return dest;
|
|
219097
219113
|
}
|
|
219098
|
-
/**
|
|
219114
|
+
/** Copy matrix `a` entries into `dest` */
|
|
219099
219115
|
static copy(a, dest) {
|
|
219100
219116
|
if (dest !== a) {
|
|
219101
219117
|
dest[0] = a[0];
|
|
@@ -219113,29 +219129,31 @@ class PackedMatrix3dOps {
|
|
|
219113
219129
|
}
|
|
219114
219130
|
/** A Matrix3d is tagged indicating one of the following states:
|
|
219115
219131
|
* * unknown: it is not know if the matrix is invertible.
|
|
219116
|
-
* * inverseStored: the matrix has its inverse stored
|
|
219132
|
+
* * inverseStored: the matrix has its inverse stored.
|
|
219117
219133
|
* * singular: the matrix is known to be singular.
|
|
219118
219134
|
* @public
|
|
219119
219135
|
*/
|
|
219120
219136
|
var InverseMatrixState;
|
|
219121
219137
|
(function (InverseMatrixState) {
|
|
219122
219138
|
/**
|
|
219123
|
-
*
|
|
219124
|
-
*
|
|
219139
|
+
* The invertibility of the `coffs` array has not been determined.
|
|
219140
|
+
* Any `inverseCoffs` contents are random.
|
|
219125
219141
|
*/
|
|
219126
219142
|
InverseMatrixState[InverseMatrixState["unknown"] = 0] = "unknown";
|
|
219127
|
-
/**
|
|
219143
|
+
/**
|
|
219144
|
+
* An inverse was computed and stored as the `inverseCoffs`
|
|
219145
|
+
*/
|
|
219128
219146
|
InverseMatrixState[InverseMatrixState["inverseStored"] = 1] = "inverseStored";
|
|
219129
219147
|
/**
|
|
219130
|
-
*
|
|
219131
|
-
*
|
|
219148
|
+
* The `coffs` array is known to be singular.
|
|
219149
|
+
* Any `inverseCoffs` contents are random.
|
|
219132
219150
|
*/
|
|
219133
219151
|
InverseMatrixState[InverseMatrixState["singular"] = 2] = "singular";
|
|
219134
219152
|
})(InverseMatrixState || (InverseMatrixState = {}));
|
|
219135
219153
|
/** A Matrix3d is a 3x3 matrix.
|
|
219136
219154
|
* * A very common use is to hold a rigid body rotation (which has no scaling or skew), but the 3x3 contents can
|
|
219137
219155
|
* also hold scaling and skewing.
|
|
219138
|
-
* * The matrix with 2-dimensional layout
|
|
219156
|
+
* * The matrix with 2-dimensional layout (note: a 2d array can be shown by a matrix)
|
|
219139
219157
|
* ```
|
|
219140
219158
|
* equation
|
|
219141
219159
|
* \matrixXY{A}
|
|
@@ -219147,19 +219165,21 @@ var InverseMatrixState;
|
|
|
219147
219165
|
* ```
|
|
219148
219166
|
* * If the matrix inverse is known it is stored in the inverseCoffs array.
|
|
219149
219167
|
* * The inverse status (`unknown`, `inverseStored`, `singular`) status is indicated by the `inverseState` property.
|
|
219150
|
-
* *
|
|
219151
|
-
*
|
|
219152
|
-
*
|
|
219153
|
-
*
|
|
219168
|
+
* * Construction methods that are able to trivially construct the inverse, store it immediately and note that in
|
|
219169
|
+
* the inverseState.
|
|
219170
|
+
* * Constructions (e.g. createRowValues) for which the inverse is not immediately known mark the inverseState as
|
|
219171
|
+
* unknown.
|
|
219172
|
+
* * Later queries for the inverse, trigger full computation if needed at that time.
|
|
219154
219173
|
* * Most matrix queries are present with both "column" and "row" variants.
|
|
219155
|
-
* * Usage elsewhere in the library is typically "column" based. For example, in a Transform
|
|
219156
|
-
*
|
|
219174
|
+
* * Usage elsewhere in the library is typically "column" based. For example, in a Transform that carries a
|
|
219175
|
+
* coordinate frame, the matrix columns are the unit vectors for the axes.
|
|
219157
219176
|
* @public
|
|
219158
219177
|
*/
|
|
219159
219178
|
class Matrix3d {
|
|
219160
219179
|
/**
|
|
219161
|
-
*
|
|
219162
|
-
* @param coffs optional coefficient array.
|
|
219180
|
+
* Constructor
|
|
219181
|
+
* @param coffs optional coefficient array.
|
|
219182
|
+
* * **WARNING:** coffs is captured (i.e., is now owned by the Matrix3d object and can be modified by it).
|
|
219163
219183
|
*/
|
|
219164
219184
|
constructor(coffs) {
|
|
219165
219185
|
this.coffs = coffs ? coffs : new Float64Array(9);
|
|
@@ -219177,14 +219197,16 @@ class Matrix3d {
|
|
|
219177
219197
|
/** Freeze this Matrix3d. */
|
|
219178
219198
|
freeze() {
|
|
219179
219199
|
this.computeCachedInverse(true);
|
|
219180
|
-
/*
|
|
219200
|
+
/*
|
|
219201
|
+
hm.. can't freeze the Float64Arrays..
|
|
219181
219202
|
Object.freeze(this.coffs);
|
|
219182
219203
|
if (this.inverseCoffs)
|
|
219183
219204
|
Object.freeze(this.inverseCoffs);
|
|
219184
219205
|
*/
|
|
219185
219206
|
return Object.freeze(this);
|
|
219186
219207
|
}
|
|
219187
|
-
/**
|
|
219208
|
+
/**
|
|
219209
|
+
* Return a json object containing the 9 numeric entries as a single array in row major order,
|
|
219188
219210
|
* `[ [1, 2, 3],[ 4, 5, 6], [7, 8, 9] ]`
|
|
219189
219211
|
*/
|
|
219190
219212
|
toJSON() {
|
|
@@ -219192,46 +219214,81 @@ class Matrix3d {
|
|
|
219192
219214
|
[this.coffs[3], this.coffs[4], this.coffs[5]],
|
|
219193
219215
|
[this.coffs[6], this.coffs[7], this.coffs[8]]];
|
|
219194
219216
|
}
|
|
219195
|
-
/**
|
|
219217
|
+
/**
|
|
219218
|
+
* Copy data from various input forms to this matrix.
|
|
219196
219219
|
* The source can be:
|
|
219197
219220
|
* * Another `Matrix3d`
|
|
219198
219221
|
* * An array of 3 arrays, each of which has the 3 numbers for a row of the matrix.
|
|
219199
|
-
* * An array of 9 numbers in row major order.
|
|
219222
|
+
* * An array of 4 or 9 numbers in row major order.
|
|
219223
|
+
* * **WARNING:** if json is an array of numbers but size is not 4 or 9, the matrix is set to zeros.
|
|
219200
219224
|
*/
|
|
219201
219225
|
setFromJSON(json) {
|
|
219202
219226
|
this.inverseCoffs = undefined;
|
|
219227
|
+
// if no json is passed
|
|
219203
219228
|
if (!json) {
|
|
219204
219229
|
this.setRowValues(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
219205
219230
|
return;
|
|
219206
219231
|
}
|
|
219232
|
+
// if json is Matrix3d
|
|
219207
219233
|
if (!Array.isArray(json)) {
|
|
219208
219234
|
if (json instanceof Matrix3d)
|
|
219209
219235
|
this.setFrom(json);
|
|
219210
219236
|
return;
|
|
219211
219237
|
}
|
|
219238
|
+
// if json is Matrix3dProps and is an array of arrays
|
|
219212
219239
|
if (_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isArrayOfNumberArray(json, 3, 3)) {
|
|
219213
219240
|
const data = json;
|
|
219214
219241
|
this.setRowValues(data[0][0], data[0][1], data[0][2], data[1][0], data[1][1], data[1][2], data[2][0], data[2][1], data[2][2]);
|
|
219215
219242
|
return;
|
|
219216
219243
|
}
|
|
219244
|
+
// if json is Matrix3dProps and is an array of numbers
|
|
219217
219245
|
if (json.length === 9) {
|
|
219218
219246
|
const data = json;
|
|
219219
219247
|
this.setRowValues(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]);
|
|
219248
|
+
return;
|
|
219220
219249
|
}
|
|
219221
219250
|
else if (json.length === 4) {
|
|
219222
219251
|
const data = json;
|
|
219223
219252
|
this.setRowValues(data[0], data[1], 0, data[2], data[3], 0, 0, 0, 1);
|
|
219253
|
+
return;
|
|
219224
219254
|
}
|
|
219255
|
+
// if json is Matrix3dProps but is not the right size
|
|
219256
|
+
this.setRowValues(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
219257
|
+
return;
|
|
219225
219258
|
}
|
|
219226
|
-
/** Return a new Matrix3d constructed from contents of the json value.
|
|
219227
|
-
static fromJSON(json) {
|
|
219228
|
-
|
|
219259
|
+
/** Return a new Matrix3d constructed from contents of the json value. See `setFromJSON` for layout rules */
|
|
219260
|
+
static fromJSON(json) {
|
|
219261
|
+
const result = Matrix3d.createIdentity();
|
|
219262
|
+
result.setFromJSON(json);
|
|
219263
|
+
return result;
|
|
219264
|
+
}
|
|
219265
|
+
/**
|
|
219266
|
+
* Test if `this` and `other` are within tolerance in all numeric entries.
|
|
219229
219267
|
* @param tol optional tolerance for comparisons by Geometry.isDistanceWithinTol
|
|
219230
219268
|
*/
|
|
219231
219269
|
isAlmostEqual(other, tol) {
|
|
219232
219270
|
return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isDistanceWithinTol(this.maxDiff(other), tol);
|
|
219233
219271
|
}
|
|
219234
|
-
/**
|
|
219272
|
+
/**
|
|
219273
|
+
* Test if `this` and `other` are within tolerance in the column entries specified by `columnIndex`.
|
|
219274
|
+
* @param tol optional tolerance for comparisons by Geometry.isDistanceWithinTol
|
|
219275
|
+
*/
|
|
219276
|
+
isAlmostEqualColumn(columnIndex, other, tol) {
|
|
219277
|
+
const max = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.maxAbsXYZ(this.coffs[columnIndex] - other.coffs[columnIndex], this.coffs[columnIndex + 3] - other.coffs[columnIndex + 3], this.coffs[columnIndex + 6] - other.coffs[columnIndex + 6]);
|
|
219278
|
+
return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isDistanceWithinTol(max, tol);
|
|
219279
|
+
}
|
|
219280
|
+
/**
|
|
219281
|
+
* Test if column (specified by `columnIndex`) entries of `this` and [ax,ay,az] are within tolerance.
|
|
219282
|
+
* @param tol optional tolerance for comparisons by Geometry.isDistanceWithinTol
|
|
219283
|
+
*/
|
|
219284
|
+
isAlmostEqualColumnXYZ(columnIndex, ax, ay, az, tol) {
|
|
219285
|
+
const max = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.maxAbsXYZ(this.coffs[columnIndex] - ax, this.coffs[columnIndex + 3] - ay, this.coffs[columnIndex + 6] - az);
|
|
219286
|
+
return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isDistanceWithinTol(max, tol);
|
|
219287
|
+
}
|
|
219288
|
+
/**
|
|
219289
|
+
* Test if `this` and `other` have almost equal Z column and have X and Y columns differing only by a
|
|
219290
|
+
* rotation of the same angle around that Z.
|
|
219291
|
+
* * **WARNING:** X and Y columns have to be perpendicular to Z column in both `this` and `other`.
|
|
219235
219292
|
* @param tol optional tolerance for comparisons by Geometry.isDistanceWithinTol
|
|
219236
219293
|
*/
|
|
219237
219294
|
isAlmostEqualAllowZRotation(other, tol) {
|
|
@@ -219239,10 +219296,15 @@ class Matrix3d {
|
|
|
219239
219296
|
return true;
|
|
219240
219297
|
if (this.isAlmostEqualColumn(_Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisIndex.Z, other, tol)) {
|
|
219241
219298
|
const radians = _Angle__WEBPACK_IMPORTED_MODULE_1__.Angle.radiansBetweenVectorsXYZ(this.coffs[0], this.coffs[3], this.coffs[6], other.coffs[0], other.coffs[3], other.coffs[6]);
|
|
219242
|
-
const angle = _Angle__WEBPACK_IMPORTED_MODULE_1__.Angle.createRadians(radians);
|
|
219299
|
+
const angle = _Angle__WEBPACK_IMPORTED_MODULE_1__.Angle.createRadians(radians); // angle between X columns in `this` and `other`
|
|
219243
219300
|
const columnX = this.columnX();
|
|
219244
219301
|
const columnY = this.columnY();
|
|
219245
219302
|
const columnZ = this.columnZ();
|
|
219303
|
+
/**
|
|
219304
|
+
* Here we rotate this.columnX() around this.columnZ() by "angle" and expect to get other.columnX().
|
|
219305
|
+
* Then we rotate this.columnY() around this.columnZ() by the same "angle" and if we get other.columnY(),
|
|
219306
|
+
* that means this` and `other` have X and Y columns differing only by a rotation around that Z.
|
|
219307
|
+
*/
|
|
219246
219308
|
let column = _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.createRotateVectorAroundVector(columnX, columnZ, angle);
|
|
219247
219309
|
if (other.isAlmostEqualColumnXYZ(0, column.x, column.y, column.z, tol)) {
|
|
219248
219310
|
column = _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.createRotateVectorAroundVector(columnY, columnZ, angle);
|
|
@@ -219251,16 +219313,10 @@ class Matrix3d {
|
|
|
219251
219313
|
}
|
|
219252
219314
|
return false;
|
|
219253
219315
|
}
|
|
219254
|
-
isAlmostEqualColumn(columnIndex, other, tol) {
|
|
219255
|
-
const a = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.maxAbsXYZ(this.coffs[columnIndex] - other.coffs[columnIndex], this.coffs[columnIndex + 3] - other.coffs[columnIndex + 3], this.coffs[columnIndex + 6] - other.coffs[columnIndex + 6]);
|
|
219256
|
-
return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isDistanceWithinTol(a, tol);
|
|
219257
|
-
}
|
|
219258
|
-
isAlmostEqualColumnXYZ(columnIndex, ax, ay, az, tol) {
|
|
219259
|
-
const a = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.maxAbsXYZ(this.coffs[columnIndex] - ax, this.coffs[columnIndex + 3] - ay, this.coffs[columnIndex + 6] - az);
|
|
219260
|
-
return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isDistanceWithinTol(a, tol);
|
|
219261
|
-
}
|
|
219262
219316
|
/** Test for exact (bitwise) equality with other. */
|
|
219263
|
-
isExactEqual(other) {
|
|
219317
|
+
isExactEqual(other) {
|
|
219318
|
+
return this.maxDiff(other) === 0.0;
|
|
219319
|
+
}
|
|
219264
219320
|
/** test if all entries in the z row and column are exact 001, i.e. the matrix only acts in 2d */
|
|
219265
219321
|
get isXY() {
|
|
219266
219322
|
return this.coffs[2] === 0.0
|
|
@@ -219269,10 +219325,16 @@ class Matrix3d {
|
|
|
219269
219325
|
&& this.coffs[7] === 0.0
|
|
219270
219326
|
&& this.coffs[8] === 1.0;
|
|
219271
219327
|
}
|
|
219272
|
-
|
|
219273
|
-
|
|
219274
|
-
|
|
219275
|
-
|
|
219328
|
+
/**
|
|
219329
|
+
* If result is not provided, then the method returns a new (zeroed) matrix; otherwise the result is
|
|
219330
|
+
* not zeroed first and is just returned as-is.
|
|
219331
|
+
*/
|
|
219332
|
+
static _create(result) {
|
|
219333
|
+
return result ? result : new Matrix3d();
|
|
219334
|
+
}
|
|
219335
|
+
/**
|
|
219336
|
+
* Returns a Matrix3d populated by numeric values given in row-major order.
|
|
219337
|
+
* Sets all entries in the matrix from call parameters appearing in row-major order, i.e.
|
|
219276
219338
|
* ```
|
|
219277
219339
|
* equation
|
|
219278
219340
|
* \begin{bmatrix}a_{xx}\ a_{xy}\ a_{xz}\\ a_{yx}\ a_{yy}\ a_{yz}\\ a_{zx}\ a_{zy}\ a_{zz}\end{bmatrix}
|
|
@@ -219303,7 +219365,7 @@ class Matrix3d {
|
|
|
219303
219365
|
}
|
|
219304
219366
|
/**
|
|
219305
219367
|
* Create a Matrix3d with caller-supplied coefficients and optional inverse coefficients.
|
|
219306
|
-
* * The inputs are captured into the new Matrix3d.
|
|
219368
|
+
* * The inputs are captured into (i.e., owned by) the new Matrix3d.
|
|
219307
219369
|
* * The caller is responsible for validity of the inverse coefficients.
|
|
219308
219370
|
* @param coffs (required) array of 9 coefficients.
|
|
219309
219371
|
* @param inverseCoffs (optional) array of 9 coefficients.
|
|
@@ -219321,12 +219383,15 @@ class Matrix3d {
|
|
|
219321
219383
|
return result;
|
|
219322
219384
|
}
|
|
219323
219385
|
/**
|
|
219324
|
-
*
|
|
219386
|
+
* Create a matrix by distributing vectors to columns in one of 6 orders.
|
|
219325
219387
|
* @param axisOrder identifies where the columns are placed.
|
|
219326
|
-
* @param columnA vector to place in the
|
|
219327
|
-
* @param columnB vector to place in the
|
|
219328
|
-
* @param columnC vector to place in the
|
|
219329
|
-
* @param result
|
|
219388
|
+
* @param columnA vector to place in the column specified by first letter in the AxisOrder name.
|
|
219389
|
+
* @param columnB vector to place in the column specified by second letter in the AxisOrder name.
|
|
219390
|
+
* @param columnC vector to place in the column specified by third letter in the AxisOrder name.
|
|
219391
|
+
* @param result optional result matrix3d
|
|
219392
|
+
* * Example: If you pass AxisOrder.YZX, then result will be [columnC, columnA, columnB] because
|
|
219393
|
+
* first letter Y means columnA should go to the second column, second letter Z means columnB should
|
|
219394
|
+
* go to the third column, and third letter X means columnC should go to the first column.
|
|
219330
219395
|
*/
|
|
219331
219396
|
static createColumnsInAxisOrder(axisOrder, columnA, columnB, columnC, result) {
|
|
219332
219397
|
if (!result)
|
|
@@ -219346,13 +219411,26 @@ class Matrix3d {
|
|
|
219346
219411
|
else if (axisOrder === _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.ZYX) {
|
|
219347
219412
|
result.setColumns(columnC, columnB, columnA);
|
|
219348
219413
|
}
|
|
219349
|
-
else { //
|
|
219414
|
+
else { // AxisOrder.XYZ
|
|
219350
219415
|
result.setColumns(columnA, columnB, columnC);
|
|
219351
219416
|
}
|
|
219352
219417
|
return result;
|
|
219353
219418
|
}
|
|
219354
219419
|
/**
|
|
219355
|
-
|
|
219420
|
+
* Copy the transpose of the coffs to the inverseCoffs.
|
|
219421
|
+
* * Mark the matrix as inverseStored.
|
|
219422
|
+
*/
|
|
219423
|
+
setupInverseTranspose() {
|
|
219424
|
+
const coffs = this.coffs;
|
|
219425
|
+
this.inverseState = InverseMatrixState.inverseStored;
|
|
219426
|
+
this.inverseCoffs = Float64Array.from([
|
|
219427
|
+
coffs[0], coffs[3], coffs[6],
|
|
219428
|
+
coffs[1], coffs[4], coffs[7],
|
|
219429
|
+
coffs[2], coffs[5], coffs[8],
|
|
219430
|
+
]);
|
|
219431
|
+
}
|
|
219432
|
+
/**
|
|
219433
|
+
* Set all entries in the matrix from call parameters appearing in row-major order.
|
|
219356
219434
|
* @param axx Row x, column x (0,0) entry
|
|
219357
219435
|
* @param axy Row x, column y (0,1) entry
|
|
219358
219436
|
* @param axz Row x, column z (0,2) entry
|
|
@@ -219376,15 +219454,22 @@ class Matrix3d {
|
|
|
219376
219454
|
this.inverseState = InverseMatrixState.unknown;
|
|
219377
219455
|
}
|
|
219378
219456
|
/** Set the matrix to an identity. */
|
|
219379
|
-
setIdentity() {
|
|
219457
|
+
setIdentity() {
|
|
219458
|
+
this.setRowValues(1, 0, 0, 0, 1, 0, 0, 0, 1);
|
|
219459
|
+
this.setupInverseTranspose();
|
|
219460
|
+
}
|
|
219380
219461
|
/** Set the matrix to all zeros. */
|
|
219381
|
-
setZero() {
|
|
219382
|
-
|
|
219462
|
+
setZero() {
|
|
219463
|
+
this.setRowValues(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
219464
|
+
this.inverseState = InverseMatrixState.singular;
|
|
219465
|
+
}
|
|
219466
|
+
/** Copy contents from another matrix. */
|
|
219383
219467
|
setFrom(other) {
|
|
219384
219468
|
if (other === undefined) {
|
|
219385
219469
|
this.setIdentity();
|
|
219470
|
+
return;
|
|
219386
219471
|
}
|
|
219387
|
-
|
|
219472
|
+
if (other !== this) {
|
|
219388
219473
|
for (let i = 0; i < 9; i++)
|
|
219389
219474
|
this.coffs[i] = other.coffs[i];
|
|
219390
219475
|
if (other.inverseState === InverseMatrixState.inverseStored && other.inverseCoffs !== undefined) {
|
|
@@ -219396,28 +219481,29 @@ class Matrix3d {
|
|
|
219396
219481
|
else if (other.inverseState !== InverseMatrixState.inverseStored) {
|
|
219397
219482
|
this.inverseState = other.inverseState;
|
|
219398
219483
|
}
|
|
219399
|
-
else { // This is reached
|
|
219484
|
+
else { // This is reached when other says stored but does not have coffs. This should not happen.
|
|
219400
219485
|
this.inverseState = InverseMatrixState.unknown;
|
|
219401
219486
|
}
|
|
219402
219487
|
}
|
|
219403
219488
|
}
|
|
219404
|
-
/**
|
|
219405
|
-
*
|
|
219406
|
-
* *
|
|
219407
|
-
* * inverse status
|
|
219489
|
+
/**
|
|
219490
|
+
* Return a clone of this matrix.
|
|
219491
|
+
* * Coefficients are copied.
|
|
219492
|
+
* * Inverse coefficients and inverse status are copied if stored by `this`.
|
|
219408
219493
|
*/
|
|
219409
219494
|
clone(result) {
|
|
219410
219495
|
result = result ? result : new Matrix3d();
|
|
219411
219496
|
result.setFrom(this);
|
|
219412
219497
|
return result;
|
|
219413
219498
|
}
|
|
219414
|
-
/**
|
|
219499
|
+
/**
|
|
219500
|
+
* Create a matrix with all zeros.
|
|
219415
219501
|
* * Note that for geometry transformations "all zeros" is not a useful default state.
|
|
219416
|
-
* * Hence almost always use `createIdentity` for graphics transformations.
|
|
219417
|
-
* * "
|
|
219502
|
+
* * Hence, almost always use `createIdentity` for graphics transformations.
|
|
219503
|
+
* * "All zeros" is appropriate for summing moment data.
|
|
219418
219504
|
* ```
|
|
219419
219505
|
* equation
|
|
219420
|
-
* \begin{bmatrix}0 0 0 \\ 0 0 0 \\ 0 0 0\end{bmatrix}
|
|
219506
|
+
* \begin{bmatrix}0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0\end{bmatrix}
|
|
219421
219507
|
* ```
|
|
219422
219508
|
*/
|
|
219423
219509
|
static createZero() {
|
|
@@ -219425,13 +219511,14 @@ class Matrix3d {
|
|
|
219425
219511
|
retVal.inverseState = InverseMatrixState.singular;
|
|
219426
219512
|
return retVal;
|
|
219427
219513
|
}
|
|
219428
|
-
/**
|
|
219429
|
-
*
|
|
219430
|
-
* *
|
|
219431
|
-
* *
|
|
219514
|
+
/**
|
|
219515
|
+
* Create an identity matrix.
|
|
219516
|
+
* * All diagonal entries (xx,yy,zz) are one
|
|
219517
|
+
* * All others are zero.
|
|
219518
|
+
* * This (rather than "all zeros") is the useful state for most graphics transformations.
|
|
219432
219519
|
* ```
|
|
219433
219520
|
* equation
|
|
219434
|
-
* \begin{bmatrix}1 0 0 \\ 0 1 0 \\ 0 0 1\end{bmatrix}
|
|
219521
|
+
* \begin{bmatrix}1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1\end{bmatrix}
|
|
219435
219522
|
* ```
|
|
219436
219523
|
*
|
|
219437
219524
|
*/
|
|
@@ -219441,55 +219528,7 @@ class Matrix3d {
|
|
|
219441
219528
|
return result;
|
|
219442
219529
|
}
|
|
219443
219530
|
/**
|
|
219444
|
-
* Create a matrix with
|
|
219445
|
-
* For scale factor _s_,
|
|
219446
|
-
* ```
|
|
219447
|
-
* equation
|
|
219448
|
-
* \begin{bmatrix}s & 0 & 0 \\ 0 & s & 0\\ 0 & 0 & s\end{bmatrix}
|
|
219449
|
-
* ```
|
|
219450
|
-
*/
|
|
219451
|
-
static createUniformScale(scaleFactor) {
|
|
219452
|
-
return Matrix3d.createScale(scaleFactor, scaleFactor, scaleFactor);
|
|
219453
|
-
}
|
|
219454
|
-
/**
|
|
219455
|
-
* Construct a rigid matrix using createPerpendicularVectorFavorXYPlane to generate a vector perpendicular to vectorA.
|
|
219456
|
-
* *
|
|
219457
|
-
*/
|
|
219458
|
-
static createRigidHeadsUp(vectorA, axisOrder = _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.ZXY, result) {
|
|
219459
|
-
const vectorB = Matrix3d.createPerpendicularVectorFavorXYPlane(vectorA);
|
|
219460
|
-
const matrix = Matrix3d.createRigidFromColumns(vectorA, vectorB, axisOrder, result);
|
|
219461
|
-
if (matrix) {
|
|
219462
|
-
matrix.setupInverseTranspose();
|
|
219463
|
-
return matrix;
|
|
219464
|
-
}
|
|
219465
|
-
return Matrix3d.createIdentity(result);
|
|
219466
|
-
}
|
|
219467
|
-
/**
|
|
219468
|
-
* return a vector that is perpendicular to the input direction.
|
|
219469
|
-
* * Among the infinite number of perpendiculars possible, this method
|
|
219470
|
-
* favors having one in the xy plane.
|
|
219471
|
-
* * Hence, when vectorA is NOT close to the Z axis, the returned vector is Z cross vectorA.
|
|
219472
|
-
* * But vectorA is close to the Z axis, the returned vector is unitY cross vectorA.
|
|
219473
|
-
*/
|
|
219474
|
-
static createPerpendicularVectorFavorXYPlane(vector, result) {
|
|
219475
|
-
const a = vector.magnitude();
|
|
219476
|
-
const b = a / 64.0; // A constant from the dawn of time in the CAD industry.
|
|
219477
|
-
if (Math.abs(vector.x) < b && Math.abs(vector.y) < b) {
|
|
219478
|
-
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.createCrossProduct(vector.x, vector.y, vector.z, 0, -1, 0, result);
|
|
219479
|
-
}
|
|
219480
|
-
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.createCrossProduct(0, 0, 1, vector.x, vector.y, vector.z, result);
|
|
219481
|
-
}
|
|
219482
|
-
/**
|
|
219483
|
-
* return a vector that is perpendicular to the input direction.
|
|
219484
|
-
* * Among the infinite number of perpendiculars possible, this method
|
|
219485
|
-
* favors having one near the Z.
|
|
219486
|
-
* That is achieved by crossing "this" vector with the result of createPerpendicularVectorFavorXYPlane.
|
|
219487
|
-
*/
|
|
219488
|
-
static createPerpendicularVectorFavorPlaneContainingZ(vector, result) {
|
|
219489
|
-
result = Matrix3d.createPerpendicularVectorFavorXYPlane(vector, result);
|
|
219490
|
-
return vector.crossProduct(result, result);
|
|
219491
|
-
}
|
|
219492
|
-
/** Create a matrix with distinct x,y,z diagonal (scale) entries.
|
|
219531
|
+
* Create a matrix with distinct x,y,z diagonal (scale) entries.
|
|
219493
219532
|
* ```
|
|
219494
219533
|
* equation
|
|
219495
219534
|
* \begin{bmatrix}s_x & 0 & 0 \\ 0 & s_y & 0\\ 0 & 0 & s_z\end{bmatrix}
|
|
@@ -219514,7 +219553,101 @@ class Matrix3d {
|
|
|
219514
219553
|
}
|
|
219515
219554
|
return result;
|
|
219516
219555
|
}
|
|
219517
|
-
/**
|
|
219556
|
+
/**
|
|
219557
|
+
* Create a matrix with uniform scale factors for scale factor "s"
|
|
219558
|
+
* ```
|
|
219559
|
+
* equation
|
|
219560
|
+
* \begin{bmatrix}s & 0 & 0 \\ 0 & s & 0\\ 0 & 0 & s\end{bmatrix}
|
|
219561
|
+
* ```
|
|
219562
|
+
*/
|
|
219563
|
+
static createUniformScale(scaleFactor) {
|
|
219564
|
+
return Matrix3d.createScale(scaleFactor, scaleFactor, scaleFactor);
|
|
219565
|
+
}
|
|
219566
|
+
/**
|
|
219567
|
+
* Return a vector that is perpendicular to the input `vectorA`.
|
|
219568
|
+
* * Among the infinite number of perpendiculars possible, this method favors having one in the xy plane.
|
|
219569
|
+
* * Hence, when `vectorA` is close to the Z axis, the returned vector is `vectorA cross -unitY`
|
|
219570
|
+
* but when `vectorA` is NOT close to the Z axis, the returned vector is `unitZ cross vectorA`.
|
|
219571
|
+
*/
|
|
219572
|
+
static createPerpendicularVectorFavorXYPlane(vectorA, result) {
|
|
219573
|
+
const a = vectorA.magnitude();
|
|
219574
|
+
const scale = 64.0; // A constant from the dawn of time in the CAD industry
|
|
219575
|
+
const b = a / scale;
|
|
219576
|
+
// if vectorA is close to the Z axis
|
|
219577
|
+
if (Math.abs(vectorA.x) < b && Math.abs(vectorA.y) < b) {
|
|
219578
|
+
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.createCrossProduct(vectorA.x, vectorA.y, vectorA.z, 0, -1, 0, result);
|
|
219579
|
+
}
|
|
219580
|
+
// if vectorA is NOT close to the Z axis
|
|
219581
|
+
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.createCrossProduct(0, 0, 1, vectorA.x, vectorA.y, vectorA.z, result);
|
|
219582
|
+
}
|
|
219583
|
+
/**
|
|
219584
|
+
* Return a vector that is perpendicular to the input `vectorA`.
|
|
219585
|
+
* * Among the infinite number of perpendiculars possible, this method favors having one near the plane
|
|
219586
|
+
* containing Z.
|
|
219587
|
+
* That is achieved by cross product of `this` vector with the result of createPerpendicularVectorFavorXYPlane.
|
|
219588
|
+
*/
|
|
219589
|
+
static createPerpendicularVectorFavorPlaneContainingZ(vectorA, result) {
|
|
219590
|
+
/**
|
|
219591
|
+
* vectorA, result (below), and "vectorA cross result" form a coordinate system where "result" is located on
|
|
219592
|
+
* the XY-plane. Once you've got a coordinate system with an axis in the XY-plane, your other two axes form
|
|
219593
|
+
* a plane that includes the z-axis.
|
|
219594
|
+
*/
|
|
219595
|
+
result = Matrix3d.createPerpendicularVectorFavorXYPlane(vectorA, result);
|
|
219596
|
+
return vectorA.crossProduct(result, result);
|
|
219597
|
+
}
|
|
219598
|
+
/**
|
|
219599
|
+
* Create a matrix from column vectors, shuffled into place per axisOrder
|
|
219600
|
+
* For example, if axisOrder = XYZ then it returns [vectorU, vectorV, vectorW]
|
|
219601
|
+
* Another example, if axisOrder = YZX then it returns [vectorW, vectorU, vectorV] because
|
|
219602
|
+
* Y is at index 0 so vectorU goes to the column Y (column 2), Z is at index 1 so vectorV goes
|
|
219603
|
+
* to the column Z (column 3), and X is at index 2 so vectorW goes to the column X (column 1)
|
|
219604
|
+
*/
|
|
219605
|
+
static createShuffledColumns(vectorU, vectorV, vectorW, axisOrder, result) {
|
|
219606
|
+
const target = Matrix3d._create(result);
|
|
219607
|
+
target.setColumn(_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.axisOrderToAxis(axisOrder, 0), vectorU);
|
|
219608
|
+
target.setColumn(_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.axisOrderToAxis(axisOrder, 1), vectorV);
|
|
219609
|
+
target.setColumn(_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.axisOrderToAxis(axisOrder, 2), vectorW);
|
|
219610
|
+
return target;
|
|
219611
|
+
}
|
|
219612
|
+
/**
|
|
219613
|
+
* Create a new orthogonal matrix (perpendicular columns, unit length, transpose is inverse).
|
|
219614
|
+
* * `vectorA1 = Normalized vectorA` is placed in the column specified by **first** letter in
|
|
219615
|
+
* the AxisOrder name.
|
|
219616
|
+
* * Normalized `vectorC1 = vectorA1 cross vectorB` is placed in the column specified by **third**
|
|
219617
|
+
* letter in the AxisOrder name.
|
|
219618
|
+
* * Normalized `vectorC1 cross vectorA` is placed in the column specified by **second**
|
|
219619
|
+
* letter in the AxisOrder name.
|
|
219620
|
+
* * This function internally uses createShuffledColumns.
|
|
219621
|
+
*/
|
|
219622
|
+
static createRigidFromColumns(vectorA, vectorB, axisOrder, result) {
|
|
219623
|
+
const vectorA1 = vectorA.normalize();
|
|
219624
|
+
if (vectorA1) {
|
|
219625
|
+
const vectorC1 = vectorA1.unitCrossProduct(vectorB);
|
|
219626
|
+
if (vectorC1) {
|
|
219627
|
+
const vectorB1 = vectorC1.unitCrossProduct(vectorA);
|
|
219628
|
+
if (vectorB1) {
|
|
219629
|
+
const retVal = Matrix3d.createShuffledColumns(vectorA1, vectorB1, vectorC1, axisOrder, result);
|
|
219630
|
+
retVal.setupInverseTranspose();
|
|
219631
|
+
return retVal;
|
|
219632
|
+
}
|
|
219633
|
+
}
|
|
219634
|
+
}
|
|
219635
|
+
return undefined;
|
|
219636
|
+
}
|
|
219637
|
+
/**
|
|
219638
|
+
* Construct a rigid matrix using vectorA and its 2 perpendicular.
|
|
219639
|
+
* * This function internally uses createPerpendicularVectorFavorXYPlane and createRigidFromColumns.
|
|
219640
|
+
*/
|
|
219641
|
+
static createRigidHeadsUp(vectorA, axisOrder = _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.ZXY, result) {
|
|
219642
|
+
const vectorB = Matrix3d.createPerpendicularVectorFavorXYPlane(vectorA);
|
|
219643
|
+
const matrix = Matrix3d.createRigidFromColumns(vectorA, vectorB, axisOrder, result);
|
|
219644
|
+
if (matrix) {
|
|
219645
|
+
matrix.setupInverseTranspose();
|
|
219646
|
+
return matrix;
|
|
219647
|
+
}
|
|
219648
|
+
return Matrix3d.createIdentity(result);
|
|
219649
|
+
}
|
|
219650
|
+
/** Return the matrix for rotation of `angle` around `axis` */
|
|
219518
219651
|
static createRotationAroundVector(axis, angle, result) {
|
|
219519
219652
|
// Rodriguez formula (matrix form), https://mathworld.wolfram.com/RodriguesRotationFormula.html
|
|
219520
219653
|
const c = angle.cos();
|
|
@@ -219532,6 +219665,7 @@ class Matrix3d {
|
|
|
219532
219665
|
* @param axisIndex index of axis (AxisIndex.X, AxisIndex.Y, AxisIndex.Z) kept fixed by the rotation.
|
|
219533
219666
|
* @param angle angle of rotation
|
|
219534
219667
|
* @param result optional result matrix.
|
|
219668
|
+
* * Math details of 3d rotation matrices derivation can be found at docs/learning/geometry/Angle.md
|
|
219535
219669
|
*/
|
|
219536
219670
|
static createRotationAroundAxisIndex(axisIndex, angle, result) {
|
|
219537
219671
|
const c = angle.cos();
|
|
@@ -219549,27 +219683,77 @@ class Matrix3d {
|
|
|
219549
219683
|
myResult.setupInverseTranspose();
|
|
219550
219684
|
return myResult;
|
|
219551
219685
|
}
|
|
219686
|
+
/**
|
|
219687
|
+
* Replace current columns Ui and Uj with (c*Ui - s*Uj) and (c*Uj + s*Ui).
|
|
219688
|
+
* * There is no checking for i,j being 0,1,2.
|
|
219689
|
+
* * This is used in compute intensive inner loops
|
|
219690
|
+
* @param i first row index. **must be 0,1,2** (unchecked)
|
|
219691
|
+
* @param j second row index. **must be 0,1,2** (unchecked)
|
|
219692
|
+
* @param c fist coefficient
|
|
219693
|
+
* @param s second coefficient
|
|
219694
|
+
*/
|
|
219695
|
+
applyGivensColumnOp(i, j, c, s) {
|
|
219696
|
+
const limit = i + 9;
|
|
219697
|
+
for (; i < limit; i += 3, j += 3) {
|
|
219698
|
+
const a = this.coffs[i];
|
|
219699
|
+
const b = this.coffs[j];
|
|
219700
|
+
this.coffs[i] = a * c + b * s;
|
|
219701
|
+
this.coffs[j] = -a * s + b * c;
|
|
219702
|
+
}
|
|
219703
|
+
}
|
|
219704
|
+
/**
|
|
219705
|
+
* Create a matrix from column vectors.
|
|
219706
|
+
* ```
|
|
219707
|
+
* equation
|
|
219708
|
+
* \begin{bmatrix}U_x & V_x & W_x \\ U_y & V_y & W_y \\ U_z & V_z & W_z \end{bmatrix}
|
|
219709
|
+
* ```
|
|
219710
|
+
*/
|
|
219711
|
+
static createColumns(vectorU, vectorV, vectorW, result) {
|
|
219712
|
+
return Matrix3d.createRowValues(vectorU.x, vectorV.x, vectorW.x, vectorU.y, vectorV.y, vectorW.y, vectorU.z, vectorV.z, vectorW.z, result);
|
|
219713
|
+
}
|
|
219714
|
+
/** Create a matrix with each column's _x,y_ parts given `XAndY` and separate numeric z values.
|
|
219715
|
+
* ```
|
|
219716
|
+
* equation
|
|
219717
|
+
* \begin{bmatrix}U_x & V_x & W_x \\ U_y & V_y & W_y \\ u & v & w \end{bmatrix}
|
|
219718
|
+
* ```
|
|
219719
|
+
*/
|
|
219720
|
+
static createColumnsXYW(vectorU, u, vectorV, v, vectorW, w, result) {
|
|
219721
|
+
return Matrix3d.createRowValues(vectorU.x, vectorV.x, vectorW.x, vectorU.y, vectorV.y, vectorW.y, u, v, w, result);
|
|
219722
|
+
}
|
|
219552
219723
|
/** Create a matrix from "as viewed" right and up vectors.
|
|
219553
219724
|
* * ColumnX points in the rightVector direction
|
|
219554
|
-
* * ColumnY points in
|
|
219555
|
-
* * ColumnZ is a unit cross product.
|
|
219556
|
-
* Optionally rotate the standard cube by 45 to bring its left or right vertical edge to center
|
|
219557
|
-
* *
|
|
219558
|
-
* *
|
|
219559
|
-
*
|
|
219560
|
-
*
|
|
219561
|
-
*
|
|
219562
|
-
*
|
|
219563
|
-
*
|
|
219564
|
-
*
|
|
219565
|
-
*
|
|
219566
|
-
*
|
|
219567
|
-
* @
|
|
219725
|
+
* * ColumnY points in the upVector direction
|
|
219726
|
+
* * ColumnZ is a unit cross product of ColumnX and ColumnY.
|
|
219727
|
+
* * Optionally rotate the standard cube by 45 degrees ccw around Y to bring its left or right vertical edge to center.
|
|
219728
|
+
* * Optionally rotate the standard cube by 35.264 degrees ccw around X (isometric rotation).
|
|
219729
|
+
* * This is expected to be used with various principal unit vectors that are perpendicular to each other.
|
|
219730
|
+
* * STANDARD TOP VIEW: createViewedAxes(Vector3d.unitX(), Vector3d.unitY(), 0, 0)
|
|
219731
|
+
* * STANDARD FRONT VIEW: createViewedAxes(Vector3d.unitX(), Vector3d.unitZ(), 0, 0)
|
|
219732
|
+
* * STANDARD BACK VIEW: createViewedAxes(Vector3d.unitX(-1), Vector3d.unitZ(), 0, 0)
|
|
219733
|
+
* * STANDARD RIGHT VIEW: createViewedAxes(Vector3d.unitY(), Vector3d.unitZ(), 0, 0)
|
|
219734
|
+
* * STANDARD LEFT VIEW: createViewedAxes(Vector3d.unitY(-1), Vector3d.unitZ(), 0, 0)
|
|
219735
|
+
* * STANDARD BOTTOM VIEW: createViewedAxes(Vector3d.unitX(), Vector3d.unitY(-1), 0, 0)
|
|
219736
|
+
* * Note: createViewedAxes is column-based so always returns local to world
|
|
219737
|
+
*
|
|
219738
|
+
* @param rightVector ColumnX of the returned matrix. Expected to be perpendicular to upVector.
|
|
219739
|
+
* @param upVector ColumnY of the returned matrix. Expected to be perpendicular to rightVector.
|
|
219740
|
+
* @param leftNoneRight Specifies the ccw rotation around Y axis. Normally one of "-1", "0", and "1", where
|
|
219741
|
+
* "-1" indicates rotation by 45 degrees to bring the left vertical edge to center, "0" means no rotation,
|
|
219742
|
+
* and "1" indicates rotation by 45 degrees to bring the right vertical edge to center. Other numbers are
|
|
219743
|
+
* used as multiplier for this 45 degree rotation.
|
|
219744
|
+
* @param topNoneBottom Specifies the ccw rotation around X axis. Normally one of "-1", "0", and "1", where
|
|
219745
|
+
* "-1" indicates isometric rotation (35.264 degrees) to bring the bottom upward, "0" means no rotation,
|
|
219746
|
+
* and "1" indicates isometric rotation (35.264 degrees) to bring the top downward. Other numbers are
|
|
219747
|
+
* used as multiplier for the 35.264 degree rotation.
|
|
219748
|
+
* @returns matrix = [rightVector, upVector, rightVector cross upVector] with the applied rotations specified
|
|
219749
|
+
* by leftNoneRight and topNoneBottom. Returns undefined if rightVector and upVector are parallel.
|
|
219568
219750
|
*/
|
|
219569
219751
|
static createViewedAxes(rightVector, upVector, leftNoneRight = 0, topNoneBottom = 0) {
|
|
219570
219752
|
const columnZ = rightVector.crossProduct(upVector);
|
|
219571
219753
|
if (columnZ.normalizeInPlace()) {
|
|
219572
|
-
|
|
219754
|
+
// matrix = [rightVector, upVector, rightVector cross upVector]
|
|
219755
|
+
const matrix = Matrix3d.createColumns(rightVector, upVector, columnZ);
|
|
219756
|
+
// "45 degrees * leftNoneRight" rotation around Y
|
|
219573
219757
|
if (leftNoneRight !== 0.0) {
|
|
219574
219758
|
let c = Math.sqrt(0.5);
|
|
219575
219759
|
let s = leftNoneRight < 0.0 ? -c : c;
|
|
@@ -219578,51 +219762,63 @@ class Matrix3d {
|
|
|
219578
219762
|
c = Math.cos(radians);
|
|
219579
219763
|
s = Math.sin(radians);
|
|
219580
219764
|
}
|
|
219581
|
-
|
|
219765
|
+
matrix.applyGivensColumnOp(2, 0, c, s); // rotate around Y (equivalent to matrix*rotationY)
|
|
219582
219766
|
}
|
|
219767
|
+
// "35.264 degrees * topNoneBottom" rotation around X
|
|
219583
219768
|
if (topNoneBottom !== 0.0) {
|
|
219584
219769
|
const theta = topNoneBottom * Math.atan(Math.sqrt(0.5));
|
|
219585
219770
|
const c = Math.cos(theta);
|
|
219586
219771
|
const s = Math.sin(theta);
|
|
219587
|
-
|
|
219772
|
+
matrix.applyGivensColumnOp(1, 2, c, -s); // rotate around X (equivalent to matrix*rotationX)
|
|
219588
219773
|
}
|
|
219589
|
-
return
|
|
219774
|
+
return matrix;
|
|
219590
219775
|
}
|
|
219591
219776
|
return undefined;
|
|
219592
219777
|
}
|
|
219593
219778
|
/**
|
|
219594
219779
|
* Create a rotation matrix for one of the 8 standard views.
|
|
219595
|
-
* *
|
|
219596
|
-
* *
|
|
219780
|
+
* * Default is TOP view (`local X = world X`, `local Y = world Y`, `local Z = world Z`).
|
|
219781
|
+
* * To change view from the TOP to one of the other 7 standard views, we need to multiply "world data" to
|
|
219782
|
+
* the corresponding matrix1 provided by `createStandardWorldToView(index, false)` and then
|
|
219783
|
+
* `matrix1.multiply(world data)` will returns "local data".
|
|
219784
|
+
* * To change view back to the TOP, we need to multiply "local data" to the corresponding matrix2 provided
|
|
219785
|
+
* by `createStandardWorldToView(index, true)` and then `matrix2.multiply(local data)` will returns "world data".
|
|
219597
219786
|
*
|
|
219598
|
-
* @param index standard view index `StandardViewIndex.Top, Bottom,
|
|
219599
|
-
* @param invert if false (default), the
|
|
219787
|
+
* @param index standard view index `StandardViewIndex.Top, Bottom, Left, Right, Front, Back, Iso, RightIso`
|
|
219788
|
+
* @param invert if false (default), the return matrix is world to local (view) and if true, the the return
|
|
219789
|
+
* matrix is local (view) to world.
|
|
219600
219790
|
* @param result optional result.
|
|
219601
219791
|
*/
|
|
219602
219792
|
static createStandardWorldToView(index, invert = false, result) {
|
|
219603
219793
|
switch (index) {
|
|
219794
|
+
// start with TOP view, ccw rotation by 180 degrees around X
|
|
219604
219795
|
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.Bottom:
|
|
219605
219796
|
result = Matrix3d.createRowValues(1, 0, 0, 0, -1, 0, 0, 0, -1);
|
|
219606
219797
|
break;
|
|
219798
|
+
// start with TOP view, ccw rotation by -90 degrees around X and by 90 degrees around Z
|
|
219607
219799
|
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.Left:
|
|
219608
219800
|
result = Matrix3d.createRowValues(0, -1, 0, 0, 0, 1, -1, 0, 0);
|
|
219609
219801
|
break;
|
|
219802
|
+
// start with TOP view, ccw rotation by -90 degrees around X and by -90 degrees around Z
|
|
219610
219803
|
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.Right:
|
|
219611
219804
|
result = Matrix3d.createRowValues(0, 1, 0, 0, 0, 1, 1, 0, 0);
|
|
219612
219805
|
break;
|
|
219613
|
-
|
|
219806
|
+
// start with TOP view, ccw rotation by -90 degrees around X
|
|
219807
|
+
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.Front:
|
|
219614
219808
|
result = Matrix3d.createRowValues(1, 0, 0, 0, 0, 1, 0, -1, 0);
|
|
219615
219809
|
break;
|
|
219616
|
-
|
|
219810
|
+
// start with TOP view, ccw rotation by -90 degrees around X and by 180 degrees around Z
|
|
219811
|
+
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.Back:
|
|
219617
219812
|
result = Matrix3d.createRowValues(-1, 0, 0, 0, 0, 1, 0, 1, 0);
|
|
219618
219813
|
break;
|
|
219619
219814
|
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.Iso:
|
|
219815
|
+
// start with FRONT view, ccw rotation by -45 degrees around Y and by 35.264 degrees around X
|
|
219620
219816
|
result = Matrix3d.createRowValues(0.707106781186548, -0.70710678118654757, 0.00000000000000000, 0.408248290463863, 0.40824829046386302, 0.81649658092772603, -0.577350269189626, -0.57735026918962573, 0.57735026918962573);
|
|
219621
219817
|
break;
|
|
219622
219818
|
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.RightIso:
|
|
219623
219819
|
result = Matrix3d.createRowValues(0.707106781186548, 0.70710678118654757, 0.00000000000000000, -0.408248290463863, 0.40824829046386302, 0.81649658092772603, 0.577350269189626, -0.57735026918962573, 0.57735026918962573);
|
|
219624
219820
|
break;
|
|
219625
|
-
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.Top:
|
|
219821
|
+
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.Top: // no rotation
|
|
219626
219822
|
default:
|
|
219627
219823
|
result = Matrix3d.createIdentity(result);
|
|
219628
219824
|
}
|
|
@@ -219699,7 +219895,7 @@ class Matrix3d {
|
|
|
219699
219895
|
*/
|
|
219700
219896
|
/**
|
|
219701
219897
|
* Compute the (unit vector) axis and angle of rotation.
|
|
219702
|
-
* @returns Returns with result.ok === true when the conversion succeeded.
|
|
219898
|
+
* @returns Returns axis and angle of rotation with result.ok === true when the conversion succeeded.
|
|
219703
219899
|
*/
|
|
219704
219900
|
getAxisAndAngleOfRotation() {
|
|
219705
219901
|
const trace = this.coffs[0] + this.coffs[4] + this.coffs[8];
|
|
@@ -219882,7 +220078,7 @@ class Matrix3d {
|
|
|
219882
220078
|
columnZCrossVector(vector, result) {
|
|
219883
220079
|
return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.crossProductXYZXYZ(this.coffs[2], this.coffs[5], this.coffs[8], vector.x, vector.y, vector.z, result);
|
|
219884
220080
|
}
|
|
219885
|
-
|
|
220081
|
+
/*
|
|
219886
220082
|
* Replace current rows Ui Uj with (c*Ui - s*Uj) and (c*Uj + s*Ui).
|
|
219887
220083
|
* @param i first row index. must be 0,1,2 (unchecked)
|
|
219888
220084
|
* @param j second row index. must be 0,1,2 (unchecked)
|
|
@@ -219900,23 +220096,6 @@ class Matrix3d {
|
|
|
219900
220096
|
this.coffs[jj] = -a * s + b * c;
|
|
219901
220097
|
}
|
|
219902
220098
|
}
|
|
219903
|
-
/**
|
|
219904
|
-
* Replace current columns Ui Uj with (c*Ui - s*Uj) and (c*Uj + s*Ui).
|
|
219905
|
-
* * This is used in compute intensive inner loops -- there is no checking for i,j being 0,1,2.
|
|
219906
|
-
* @param i first row index. must be 0,1,2 (unchecked)
|
|
219907
|
-
* @param j second row index. must be 0,1,2 (unchecked)
|
|
219908
|
-
* @param c fist coefficient
|
|
219909
|
-
* @param s second coefficient
|
|
219910
|
-
*/
|
|
219911
|
-
applyGivensColumnOp(i, j, c, s) {
|
|
219912
|
-
const limit = i + 9;
|
|
219913
|
-
for (; i < limit; i += 3, j += 3) {
|
|
219914
|
-
const a = this.coffs[i];
|
|
219915
|
-
const b = this.coffs[j];
|
|
219916
|
-
this.coffs[i] = a * c + b * s;
|
|
219917
|
-
this.coffs[j] = -a * s + b * c;
|
|
219918
|
-
}
|
|
219919
|
-
}
|
|
219920
220099
|
/**
|
|
219921
220100
|
* create a rigid coordinate frame column z parallel to (_x_,_y_,_z_) and column x in the xy plane.
|
|
219922
220101
|
* * column z points from origin to x,y,z
|
|
@@ -220149,33 +220328,14 @@ class Matrix3d {
|
|
|
220149
220328
|
}
|
|
220150
220329
|
return false;
|
|
220151
220330
|
}
|
|
220152
|
-
/**
|
|
220153
|
-
* Create a matrix from column vectors.
|
|
220154
|
-
* ```
|
|
220155
|
-
* equation
|
|
220156
|
-
* \begin{bmatrix}U_x & V_x & W_x \\ U_y & V_y & W_y \\ U_z & V_z & W_z \end{bmatrix}
|
|
220157
|
-
* ```
|
|
220158
|
-
*/
|
|
220159
|
-
static createColumns(vectorU, vectorV, vectorW, result) {
|
|
220160
|
-
return Matrix3d.createRowValues(vectorU.x, vectorV.x, vectorW.x, vectorU.y, vectorV.y, vectorW.y, vectorU.z, vectorV.z, vectorW.z, result);
|
|
220161
|
-
}
|
|
220162
|
-
/** Create a matrix with each column's _x,y_ parts given `XAndY` and separate numeric z values.
|
|
220163
|
-
* ```
|
|
220164
|
-
* equation
|
|
220165
|
-
* \begin{bmatrix}U_x & V_x & W_x \\ U_y & V_y & W_y \\ u & v & w \end{bmatrix}
|
|
220166
|
-
* ```
|
|
220167
|
-
*/
|
|
220168
|
-
static createColumnsXYW(vectorU, u, vectorV, v, vectorW, w, result) {
|
|
220169
|
-
return Matrix3d.createRowValues(vectorU.x, vectorV.x, vectorW.x, vectorU.y, vectorV.y, vectorW.y, u, v, w, result);
|
|
220170
|
-
}
|
|
220171
220331
|
/** Install data from xyz parts of Point4d (w part of Point4d ignored) */
|
|
220172
220332
|
setColumnsPoint4dXYZ(vectorU, vectorV, vectorW) {
|
|
220173
220333
|
this.inverseState = InverseMatrixState.unknown;
|
|
220174
220334
|
this.setRowValues(vectorU.x, vectorV.x, vectorW.x, vectorU.y, vectorV.y, vectorW.y, vectorU.z, vectorV.z, vectorW.z);
|
|
220175
220335
|
}
|
|
220176
220336
|
/**
|
|
220177
|
-
*
|
|
220178
|
-
* @param columnIndex column index
|
|
220337
|
+
* Set entries in one column of the matrix.
|
|
220338
|
+
* @param columnIndex column index (this is interpreted cyclically. See Geometry.cyclic3dAxis for more info).
|
|
220179
220339
|
* @param value x,yz, values for column. If undefined, zeros are installed.
|
|
220180
220340
|
*/
|
|
220181
220341
|
setColumn(columnIndex, value) {
|
|
@@ -220224,14 +220384,6 @@ class Matrix3d {
|
|
|
220224
220384
|
const index = 3 * _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.cyclic3dAxis(columnIndex);
|
|
220225
220385
|
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.create(this.coffs[index], this.coffs[index + 1], this.coffs[index + 2], result);
|
|
220226
220386
|
}
|
|
220227
|
-
/** Create a matrix from column vectors, shuffled into place per AxisTriple */
|
|
220228
|
-
static createShuffledColumns(vectorU, vectorV, vectorW, axisOrder, result) {
|
|
220229
|
-
const target = Matrix3d._create(result);
|
|
220230
|
-
target.setColumn(_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.axisOrderToAxis(axisOrder, 0), vectorU);
|
|
220231
|
-
target.setColumn(_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.axisOrderToAxis(axisOrder, 1), vectorV);
|
|
220232
|
-
target.setColumn(_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.axisOrderToAxis(axisOrder, 2), vectorW);
|
|
220233
|
-
return target;
|
|
220234
|
-
}
|
|
220235
220387
|
/** Create a matrix from row vectors.
|
|
220236
220388
|
* ```
|
|
220237
220389
|
* equation
|
|
@@ -220663,7 +220815,11 @@ class Matrix3d {
|
|
|
220663
220815
|
this.multiplyMatrixMatrix(other.matrix, result.matrix);
|
|
220664
220816
|
return result;
|
|
220665
220817
|
}
|
|
220666
|
-
/**
|
|
220818
|
+
/**
|
|
220819
|
+
* Return the transpose of `this` matrix.
|
|
220820
|
+
* If `result` is passed as argument, then the function copies the transpose of `this` into `result`
|
|
220821
|
+
* `this` is not changed unless also passed as the result, i.e., this.transpose(this) transposes `this` in place
|
|
220822
|
+
*/
|
|
220667
220823
|
transpose(result) {
|
|
220668
220824
|
if (!result)
|
|
220669
220825
|
result = new Matrix3d();
|
|
@@ -220678,8 +220834,8 @@ class Matrix3d {
|
|
|
220678
220834
|
}
|
|
220679
220835
|
return result;
|
|
220680
220836
|
}
|
|
220681
|
-
/**
|
|
220682
|
-
*
|
|
220837
|
+
/**
|
|
220838
|
+
* Transpose this matrix in place.
|
|
220683
220839
|
*/
|
|
220684
220840
|
transposeInPlace() {
|
|
220685
220841
|
PackedMatrix3dOps.transposeInPlace(this.coffs);
|
|
@@ -220710,18 +220866,6 @@ class Matrix3d {
|
|
|
220710
220866
|
result.inverseState = this.inverseState;
|
|
220711
220867
|
return result;
|
|
220712
220868
|
}
|
|
220713
|
-
/** copy the transpose of the coffs to the inverseCoffs.
|
|
220714
|
-
* * mark the matrix as inverseStored.
|
|
220715
|
-
*/
|
|
220716
|
-
setupInverseTranspose() {
|
|
220717
|
-
const coffs = this.coffs;
|
|
220718
|
-
this.inverseState = InverseMatrixState.inverseStored;
|
|
220719
|
-
this.inverseCoffs = Float64Array.from([
|
|
220720
|
-
coffs[0], coffs[3], coffs[6],
|
|
220721
|
-
coffs[1], coffs[4], coffs[7],
|
|
220722
|
-
coffs[2], coffs[5], coffs[8]
|
|
220723
|
-
]);
|
|
220724
|
-
}
|
|
220725
220869
|
/* Alternate implementation of computedCachedInverse - more direct addressing of arrays.
|
|
220726
220870
|
This is indeed 10% faster than using static work areas. */
|
|
220727
220871
|
// take the cross product of two rows of source.
|
|
@@ -220829,8 +220973,10 @@ class Matrix3d {
|
|
|
220829
220973
|
markSingular() {
|
|
220830
220974
|
this.inverseState = InverseMatrixState.singular;
|
|
220831
220975
|
}
|
|
220832
|
-
/**
|
|
220833
|
-
*
|
|
220976
|
+
/**
|
|
220977
|
+
* Create the inverseCoffs member (filled with zeros)
|
|
220978
|
+
* This is for use by matrix * matrix multiplications which need to be sure the member is there to be
|
|
220979
|
+
* filled with method-specific content.
|
|
220834
220980
|
*/
|
|
220835
220981
|
createInverseCoffsWithZeros() {
|
|
220836
220982
|
if (!this.inverseCoffs) {
|
|
@@ -220979,7 +221125,7 @@ class Matrix3d {
|
|
|
220979
221125
|
/**
|
|
220980
221126
|
* add scaled values from other Matrix3d to this Matrix3d
|
|
220981
221127
|
* @param other Matrix3d with values to be added
|
|
220982
|
-
* @param scale scale factor to apply to
|
|
221128
|
+
* @param scale scale factor to apply to the added values.
|
|
220983
221129
|
*/
|
|
220984
221130
|
addScaledInPlace(other, scale) {
|
|
220985
221131
|
for (let i = 0; i < 9; i++)
|
|
@@ -221042,18 +221188,18 @@ class Matrix3d {
|
|
|
221042
221188
|
/** Return the sum of squares of all entries */
|
|
221043
221189
|
sumSquares() {
|
|
221044
221190
|
let i = 0;
|
|
221045
|
-
let
|
|
221191
|
+
let sum = 0;
|
|
221046
221192
|
for (i = 0; i < 9; i++)
|
|
221047
|
-
|
|
221048
|
-
return
|
|
221193
|
+
sum += this.coffs[i] * this.coffs[i];
|
|
221194
|
+
return sum;
|
|
221049
221195
|
}
|
|
221050
221196
|
/** Return the sum of squares of diagonal entries */
|
|
221051
221197
|
sumDiagonalSquares() {
|
|
221052
221198
|
let i = 0;
|
|
221053
|
-
let
|
|
221199
|
+
let sum = 0;
|
|
221054
221200
|
for (i = 0; i < 9; i += 4)
|
|
221055
|
-
|
|
221056
|
-
return
|
|
221201
|
+
sum += this.coffs[i] * this.coffs[i];
|
|
221202
|
+
return sum;
|
|
221057
221203
|
}
|
|
221058
221204
|
/** Return the sum of diagonal entries (also known as the trace) */
|
|
221059
221205
|
sumDiagonal() {
|
|
@@ -221062,18 +221208,18 @@ class Matrix3d {
|
|
|
221062
221208
|
/** Return the Maximum absolute value of any single entry */
|
|
221063
221209
|
maxAbs() {
|
|
221064
221210
|
let i = 0;
|
|
221065
|
-
let
|
|
221211
|
+
let max = 0;
|
|
221066
221212
|
for (i = 0; i < 9; i++)
|
|
221067
|
-
|
|
221068
|
-
return
|
|
221213
|
+
max = Math.max(max, Math.abs(this.coffs[i]));
|
|
221214
|
+
return max;
|
|
221069
221215
|
}
|
|
221070
|
-
/** Return the maximum absolute difference between corresponding entries */
|
|
221216
|
+
/** Return the maximum absolute difference between corresponding entries of `this` and `other` */
|
|
221071
221217
|
maxDiff(other) {
|
|
221072
221218
|
let i = 0;
|
|
221073
|
-
let
|
|
221219
|
+
let max = 0;
|
|
221074
221220
|
for (i = 0; i < 9; i++)
|
|
221075
|
-
|
|
221076
|
-
return
|
|
221221
|
+
max = Math.max(max, Math.abs(this.coffs[i] - other.coffs[i]));
|
|
221222
|
+
return max;
|
|
221077
221223
|
}
|
|
221078
221224
|
/** Test if the matrix is (very near to) an identity */
|
|
221079
221225
|
get isIdentity() {
|
|
@@ -221164,25 +221310,6 @@ class Matrix3d {
|
|
|
221164
221310
|
const product = this.multiplyMatrixMatrixTranspose(this);
|
|
221165
221311
|
return product.isIdentity;
|
|
221166
221312
|
}
|
|
221167
|
-
/** create a new orthogonal matrix (perpendicular columns, unit length, transpose is inverse).
|
|
221168
|
-
* vectorA is placed in the first column of the axis order.
|
|
221169
|
-
* vectorB is projected perpendicular to vectorA within their plane and placed in the second column.
|
|
221170
|
-
*/
|
|
221171
|
-
static createRigidFromColumns(vectorA, vectorB, axisOrder, result) {
|
|
221172
|
-
const vectorA1 = vectorA.normalize();
|
|
221173
|
-
if (vectorA1) {
|
|
221174
|
-
const vectorC1 = vectorA1.unitCrossProduct(vectorB);
|
|
221175
|
-
if (vectorC1) {
|
|
221176
|
-
const vectorB1 = vectorC1.unitCrossProduct(vectorA);
|
|
221177
|
-
if (vectorB1) {
|
|
221178
|
-
const retVal = Matrix3d.createShuffledColumns(vectorA1, vectorB1, vectorC1, axisOrder, result);
|
|
221179
|
-
retVal.setupInverseTranspose();
|
|
221180
|
-
return retVal;
|
|
221181
|
-
}
|
|
221182
|
-
}
|
|
221183
|
-
}
|
|
221184
|
-
return undefined;
|
|
221185
|
-
}
|
|
221186
221313
|
/** Adjust the matrix in place so that:
|
|
221187
221314
|
* * columns are perpendicular and have unit length
|
|
221188
221315
|
* * transpose equals inverse
|
|
@@ -221223,8 +221350,8 @@ class Matrix3d {
|
|
|
221223
221350
|
return coff;
|
|
221224
221351
|
}
|
|
221225
221352
|
/** create a matrix from a quaternion.
|
|
221226
|
-
* WARNING
|
|
221227
|
-
* WARNING
|
|
221353
|
+
* **WARNING:** There is frequent confusion over whether a "from quaternion" matrix is organized by rows and columns.
|
|
221354
|
+
* **WARNING:** If you find that the matrix seems to rotate by the opposite angle expect it, transpose it.
|
|
221228
221355
|
*/
|
|
221229
221356
|
static createFromQuaternion(quat) {
|
|
221230
221357
|
const qqx = quat.x * quat.x;
|
|
@@ -221243,8 +221370,8 @@ class Matrix3d {
|
|
|
221243
221370
|
}
|
|
221244
221371
|
/** convert the matrix to a quaternion.
|
|
221245
221372
|
* @note This calculation requires the matrix to have unit length rows and columns.
|
|
221246
|
-
* WARNING
|
|
221247
|
-
* WARNING
|
|
221373
|
+
* **WARNING:** There is frequent confusion over whether a "from quaternion" matrix is organized by rows and columns.
|
|
221374
|
+
* **WARNING:** If you find that the matrix seems to rotate by the opposite angle expect it, transpose it.
|
|
221248
221375
|
*/
|
|
221249
221376
|
toQuaternion() {
|
|
221250
221377
|
const result = _geometry4d_Point4d__WEBPACK_IMPORTED_MODULE_4__.Point4d.createZero();
|
|
@@ -221298,9 +221425,9 @@ class Matrix3d {
|
|
|
221298
221425
|
}
|
|
221299
221426
|
/** Control flag for whether this class uses cached inverse of matrices. */
|
|
221300
221427
|
Matrix3d.useCachedInverse = true; // cached inverse can be suppressed for testing.
|
|
221301
|
-
/**
|
|
221428
|
+
/** Total number of times a cached inverse was used to avoid recompute */
|
|
221302
221429
|
Matrix3d.numUseCache = 0;
|
|
221303
|
-
/**
|
|
221430
|
+
/** Total number of times a cached inverse was computed. */
|
|
221304
221431
|
Matrix3d.numComputeCache = 0;
|
|
221305
221432
|
Matrix3d._productBuffer = new Float64Array(9);
|
|
221306
221433
|
|
|
@@ -286393,7 +286520,7 @@ class TestContext {
|
|
|
286393
286520
|
this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
|
|
286394
286521
|
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` } });
|
|
286395
286522
|
await core_frontend_1.NoRenderApp.startup({
|
|
286396
|
-
applicationVersion: "3.6.0-dev.
|
|
286523
|
+
applicationVersion: "3.6.0-dev.50",
|
|
286397
286524
|
applicationId: this.settings.gprid,
|
|
286398
286525
|
authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.adminUserAccessToken),
|
|
286399
286526
|
hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),
|
|
@@ -305558,7 +305685,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
|
|
|
305558
305685
|
/***/ ((module) => {
|
|
305559
305686
|
|
|
305560
305687
|
"use strict";
|
|
305561
|
-
module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"3.6.0-dev.
|
|
305688
|
+
module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"3.6.0-dev.50","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:^3.6.0-dev.50","@itwin/core-bentley":"workspace:^3.6.0-dev.50","@itwin/core-common":"workspace:^3.6.0-dev.50","@itwin/core-geometry":"workspace:^3.6.0-dev.50","@itwin/core-orbitgt":"workspace:^3.6.0-dev.50","@itwin/core-quantity":"workspace:^3.6.0-dev.50","@itwin/webgl-compatibility":"workspace:^3.6.0-dev.50"},"//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:*","@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"}}]}}');
|
|
305562
305689
|
|
|
305563
305690
|
/***/ }),
|
|
305564
305691
|
|