@itwin/ecschema-rpcinterface-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 +383 -256
- package/lib/dist/bundled-tests.js.map +1 -1
- package/package.json +16 -16
|
@@ -191018,6 +191018,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
191018
191018
|
|
|
191019
191019
|
/* eslint-disable @typescript-eslint/naming-convention, no-empty */
|
|
191020
191020
|
/** Enumeration of the 6 possible orderings of XYZ axis order
|
|
191021
|
+
*
|
|
191022
|
+
* * **Note:** There are 3 axis order with right hand system (XYZ = 0, YZX = 1, ZXY = 2) and 3 axis order with
|
|
191023
|
+
* left hand system (XZY = 4, YXZ = 5, ZYX = 6). Note that AxisOrder is encoding the handedness as well. Cross
|
|
191024
|
+
* 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
|
|
191025
|
+
* axis in that ordering.
|
|
191021
191026
|
* @public
|
|
191022
191027
|
*/
|
|
191023
191028
|
var AxisOrder;
|
|
@@ -191047,7 +191052,7 @@ var AxisIndex;
|
|
|
191047
191052
|
/** 2 axis is index 2 */
|
|
191048
191053
|
AxisIndex[AxisIndex["Z"] = 2] = "Z";
|
|
191049
191054
|
})(AxisIndex || (AxisIndex = {}));
|
|
191050
|
-
/** Standard views.
|
|
191055
|
+
/** Standard views. Used in `Matrix3d.createStandardViewAxes(index: StandardViewIndex, invert: boolean)`
|
|
191051
191056
|
* @public
|
|
191052
191057
|
*/
|
|
191053
191058
|
var StandardViewIndex;
|
|
@@ -191064,9 +191069,9 @@ var StandardViewIndex;
|
|
|
191064
191069
|
StandardViewIndex[StandardViewIndex["Front"] = 5] = "Front";
|
|
191065
191070
|
/** negative X to right, Z up */
|
|
191066
191071
|
StandardViewIndex[StandardViewIndex["Back"] = 6] = "Back";
|
|
191067
|
-
/**
|
|
191072
|
+
/** isometric: view towards origin from (-1,-1,1) */
|
|
191068
191073
|
StandardViewIndex[StandardViewIndex["Iso"] = 7] = "Iso";
|
|
191069
|
-
/**
|
|
191074
|
+
/** right isometric: view towards origin from (1,-1,1) */
|
|
191070
191075
|
StandardViewIndex[StandardViewIndex["RightIso"] = 8] = "RightIso";
|
|
191071
191076
|
})(StandardViewIndex || (StandardViewIndex = {}));
|
|
191072
191077
|
/** Enumeration among choice for how a coordinate transformation should incorporate scaling.
|
|
@@ -191251,7 +191256,7 @@ class Geometry {
|
|
|
191251
191256
|
}
|
|
191252
191257
|
/**
|
|
191253
191258
|
* Toleranced equality test, using caller-supplied tolerance.
|
|
191254
|
-
* If no tolerance is given, use smallMetricDistance
|
|
191259
|
+
* If no tolerance is given, use smallMetricDistance.
|
|
191255
191260
|
*/
|
|
191256
191261
|
static isDistanceWithinTol(distance, tol) {
|
|
191257
191262
|
if (tol !== undefined)
|
|
@@ -191504,11 +191509,18 @@ class Geometry {
|
|
|
191504
191509
|
static resolveToUndefined(value, targetValue) {
|
|
191505
191510
|
return value === targetValue ? undefined : value;
|
|
191506
191511
|
}
|
|
191507
|
-
/**
|
|
191512
|
+
/** Simple interpolation between values, but choosing (based on fraction) a or b as starting point for maximum accuracy. */
|
|
191508
191513
|
static interpolate(a, f, b) {
|
|
191509
191514
|
return f <= 0.5 ? a + f * (b - a) : b - (1.0 - f) * (b - a);
|
|
191510
191515
|
}
|
|
191511
|
-
/**
|
|
191516
|
+
/**
|
|
191517
|
+
* Given an axisOrder (e.g. XYZ, YZX, etc) and an index, returns the axis index at the given index.
|
|
191518
|
+
* * For example, if axisOrder = XYZ, then for index 0 returns X (or axis index 0), for index 1 returns
|
|
191519
|
+
* Y (or axis index 1), and for index 2 returns Z (or axis index 2). For indexes greater than 2 or smaller
|
|
191520
|
+
* than 0, it returns cyclic axis index. See Geometry.cyclic3dAxis for more info.
|
|
191521
|
+
* * Another example: if axisOrder = ZYX, then for index 0 returns Z (or axis index 2), for index 1 returns
|
|
191522
|
+
* Y (or axis index 1), and for index 2 returns X (or axis index 0).
|
|
191523
|
+
* */
|
|
191512
191524
|
static axisOrderToAxis(order, index) {
|
|
191513
191525
|
const axis = order <= AxisOrder.ZXY ? order + index : (order - AxisOrder.XZY) - index;
|
|
191514
191526
|
return Geometry.cyclic3dAxis(axis);
|
|
@@ -226005,7 +226017,7 @@ class PackedMatrix3dOps {
|
|
|
226005
226017
|
dest[8] = a22;
|
|
226006
226018
|
}
|
|
226007
226019
|
/**
|
|
226008
|
-
*
|
|
226020
|
+
* Multiply 3x3 matrix `a*b`, store in `result`.
|
|
226009
226021
|
* * All params assumed length 9, allocated by caller.
|
|
226010
226022
|
* * c may alias either input.
|
|
226011
226023
|
*/
|
|
@@ -226016,7 +226028,7 @@ class PackedMatrix3dOps {
|
|
|
226016
226028
|
return result;
|
|
226017
226029
|
}
|
|
226018
226030
|
/**
|
|
226019
|
-
*
|
|
226031
|
+
* Multiply 3x3 matrix `a*bTranspose`, store in `result`.
|
|
226020
226032
|
* * All params assumed length 9, allocated by caller.
|
|
226021
226033
|
* * c may alias either input.
|
|
226022
226034
|
*/
|
|
@@ -226027,7 +226039,7 @@ class PackedMatrix3dOps {
|
|
|
226027
226039
|
return result;
|
|
226028
226040
|
}
|
|
226029
226041
|
/**
|
|
226030
|
-
*
|
|
226042
|
+
* Multiply 3x3 matrix `aTranspose*b`, store in `result`.
|
|
226031
226043
|
* * All params assumed length 9, allocated by caller.
|
|
226032
226044
|
* * c may alias either input.
|
|
226033
226045
|
*/
|
|
@@ -226037,7 +226049,7 @@ class PackedMatrix3dOps {
|
|
|
226037
226049
|
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]));
|
|
226038
226050
|
return result;
|
|
226039
226051
|
}
|
|
226040
|
-
/**
|
|
226052
|
+
/** Transpose 3x3 matrix `a` in place */
|
|
226041
226053
|
static transposeInPlace(a) {
|
|
226042
226054
|
let q = a[1];
|
|
226043
226055
|
a[1] = a[3];
|
|
@@ -226049,10 +226061,14 @@ class PackedMatrix3dOps {
|
|
|
226049
226061
|
a[5] = a[7];
|
|
226050
226062
|
a[7] = q;
|
|
226051
226063
|
}
|
|
226052
|
-
/**
|
|
226064
|
+
/**
|
|
226065
|
+
* Returns the transpose of 3x3 matrix `a`
|
|
226066
|
+
* * If `dest` is passed as argument, then the function copies the transpose of 3x3 matrix `a` into `dest`
|
|
226067
|
+
* * `a` is not changed unless also passed as the dest, i.e., copyTransposed(a,a) transposes `a` in place
|
|
226068
|
+
*/
|
|
226053
226069
|
static copyTransposed(a, dest) {
|
|
226054
226070
|
if (dest === a) {
|
|
226055
|
-
PackedMatrix3dOps.transposeInPlace(
|
|
226071
|
+
PackedMatrix3dOps.transposeInPlace(dest);
|
|
226056
226072
|
}
|
|
226057
226073
|
else {
|
|
226058
226074
|
if (!dest)
|
|
@@ -226069,7 +226085,7 @@ class PackedMatrix3dOps {
|
|
|
226069
226085
|
}
|
|
226070
226086
|
return dest;
|
|
226071
226087
|
}
|
|
226072
|
-
/**
|
|
226088
|
+
/** Copy matrix `a` entries into `dest` */
|
|
226073
226089
|
static copy(a, dest) {
|
|
226074
226090
|
if (dest !== a) {
|
|
226075
226091
|
dest[0] = a[0];
|
|
@@ -226087,29 +226103,31 @@ class PackedMatrix3dOps {
|
|
|
226087
226103
|
}
|
|
226088
226104
|
/** A Matrix3d is tagged indicating one of the following states:
|
|
226089
226105
|
* * unknown: it is not know if the matrix is invertible.
|
|
226090
|
-
* * inverseStored: the matrix has its inverse stored
|
|
226106
|
+
* * inverseStored: the matrix has its inverse stored.
|
|
226091
226107
|
* * singular: the matrix is known to be singular.
|
|
226092
226108
|
* @public
|
|
226093
226109
|
*/
|
|
226094
226110
|
var InverseMatrixState;
|
|
226095
226111
|
(function (InverseMatrixState) {
|
|
226096
226112
|
/**
|
|
226097
|
-
*
|
|
226098
|
-
*
|
|
226113
|
+
* The invertibility of the `coffs` array has not been determined.
|
|
226114
|
+
* Any `inverseCoffs` contents are random.
|
|
226099
226115
|
*/
|
|
226100
226116
|
InverseMatrixState[InverseMatrixState["unknown"] = 0] = "unknown";
|
|
226101
|
-
/**
|
|
226117
|
+
/**
|
|
226118
|
+
* An inverse was computed and stored as the `inverseCoffs`
|
|
226119
|
+
*/
|
|
226102
226120
|
InverseMatrixState[InverseMatrixState["inverseStored"] = 1] = "inverseStored";
|
|
226103
226121
|
/**
|
|
226104
|
-
*
|
|
226105
|
-
*
|
|
226122
|
+
* The `coffs` array is known to be singular.
|
|
226123
|
+
* Any `inverseCoffs` contents are random.
|
|
226106
226124
|
*/
|
|
226107
226125
|
InverseMatrixState[InverseMatrixState["singular"] = 2] = "singular";
|
|
226108
226126
|
})(InverseMatrixState || (InverseMatrixState = {}));
|
|
226109
226127
|
/** A Matrix3d is a 3x3 matrix.
|
|
226110
226128
|
* * A very common use is to hold a rigid body rotation (which has no scaling or skew), but the 3x3 contents can
|
|
226111
226129
|
* also hold scaling and skewing.
|
|
226112
|
-
* * The matrix with 2-dimensional layout
|
|
226130
|
+
* * The matrix with 2-dimensional layout (note: a 2d array can be shown by a matrix)
|
|
226113
226131
|
* ```
|
|
226114
226132
|
* equation
|
|
226115
226133
|
* \matrixXY{A}
|
|
@@ -226121,19 +226139,21 @@ var InverseMatrixState;
|
|
|
226121
226139
|
* ```
|
|
226122
226140
|
* * If the matrix inverse is known it is stored in the inverseCoffs array.
|
|
226123
226141
|
* * The inverse status (`unknown`, `inverseStored`, `singular`) status is indicated by the `inverseState` property.
|
|
226124
|
-
* *
|
|
226125
|
-
*
|
|
226126
|
-
*
|
|
226127
|
-
*
|
|
226142
|
+
* * Construction methods that are able to trivially construct the inverse, store it immediately and note that in
|
|
226143
|
+
* the inverseState.
|
|
226144
|
+
* * Constructions (e.g. createRowValues) for which the inverse is not immediately known mark the inverseState as
|
|
226145
|
+
* unknown.
|
|
226146
|
+
* * Later queries for the inverse, trigger full computation if needed at that time.
|
|
226128
226147
|
* * Most matrix queries are present with both "column" and "row" variants.
|
|
226129
|
-
* * Usage elsewhere in the library is typically "column" based. For example, in a Transform
|
|
226130
|
-
*
|
|
226148
|
+
* * Usage elsewhere in the library is typically "column" based. For example, in a Transform that carries a
|
|
226149
|
+
* coordinate frame, the matrix columns are the unit vectors for the axes.
|
|
226131
226150
|
* @public
|
|
226132
226151
|
*/
|
|
226133
226152
|
class Matrix3d {
|
|
226134
226153
|
/**
|
|
226135
|
-
*
|
|
226136
|
-
* @param coffs optional coefficient array.
|
|
226154
|
+
* Constructor
|
|
226155
|
+
* @param coffs optional coefficient array.
|
|
226156
|
+
* * **WARNING:** coffs is captured (i.e., is now owned by the Matrix3d object and can be modified by it).
|
|
226137
226157
|
*/
|
|
226138
226158
|
constructor(coffs) {
|
|
226139
226159
|
this.coffs = coffs ? coffs : new Float64Array(9);
|
|
@@ -226151,14 +226171,16 @@ class Matrix3d {
|
|
|
226151
226171
|
/** Freeze this Matrix3d. */
|
|
226152
226172
|
freeze() {
|
|
226153
226173
|
this.computeCachedInverse(true);
|
|
226154
|
-
/*
|
|
226174
|
+
/*
|
|
226175
|
+
hm.. can't freeze the Float64Arrays..
|
|
226155
226176
|
Object.freeze(this.coffs);
|
|
226156
226177
|
if (this.inverseCoffs)
|
|
226157
226178
|
Object.freeze(this.inverseCoffs);
|
|
226158
226179
|
*/
|
|
226159
226180
|
return Object.freeze(this);
|
|
226160
226181
|
}
|
|
226161
|
-
/**
|
|
226182
|
+
/**
|
|
226183
|
+
* Return a json object containing the 9 numeric entries as a single array in row major order,
|
|
226162
226184
|
* `[ [1, 2, 3],[ 4, 5, 6], [7, 8, 9] ]`
|
|
226163
226185
|
*/
|
|
226164
226186
|
toJSON() {
|
|
@@ -226166,46 +226188,81 @@ class Matrix3d {
|
|
|
226166
226188
|
[this.coffs[3], this.coffs[4], this.coffs[5]],
|
|
226167
226189
|
[this.coffs[6], this.coffs[7], this.coffs[8]]];
|
|
226168
226190
|
}
|
|
226169
|
-
/**
|
|
226191
|
+
/**
|
|
226192
|
+
* Copy data from various input forms to this matrix.
|
|
226170
226193
|
* The source can be:
|
|
226171
226194
|
* * Another `Matrix3d`
|
|
226172
226195
|
* * An array of 3 arrays, each of which has the 3 numbers for a row of the matrix.
|
|
226173
|
-
* * An array of 9 numbers in row major order.
|
|
226196
|
+
* * An array of 4 or 9 numbers in row major order.
|
|
226197
|
+
* * **WARNING:** if json is an array of numbers but size is not 4 or 9, the matrix is set to zeros.
|
|
226174
226198
|
*/
|
|
226175
226199
|
setFromJSON(json) {
|
|
226176
226200
|
this.inverseCoffs = undefined;
|
|
226201
|
+
// if no json is passed
|
|
226177
226202
|
if (!json) {
|
|
226178
226203
|
this.setRowValues(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
226179
226204
|
return;
|
|
226180
226205
|
}
|
|
226206
|
+
// if json is Matrix3d
|
|
226181
226207
|
if (!Array.isArray(json)) {
|
|
226182
226208
|
if (json instanceof Matrix3d)
|
|
226183
226209
|
this.setFrom(json);
|
|
226184
226210
|
return;
|
|
226185
226211
|
}
|
|
226212
|
+
// if json is Matrix3dProps and is an array of arrays
|
|
226186
226213
|
if (_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isArrayOfNumberArray(json, 3, 3)) {
|
|
226187
226214
|
const data = json;
|
|
226188
226215
|
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]);
|
|
226189
226216
|
return;
|
|
226190
226217
|
}
|
|
226218
|
+
// if json is Matrix3dProps and is an array of numbers
|
|
226191
226219
|
if (json.length === 9) {
|
|
226192
226220
|
const data = json;
|
|
226193
226221
|
this.setRowValues(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]);
|
|
226222
|
+
return;
|
|
226194
226223
|
}
|
|
226195
226224
|
else if (json.length === 4) {
|
|
226196
226225
|
const data = json;
|
|
226197
226226
|
this.setRowValues(data[0], data[1], 0, data[2], data[3], 0, 0, 0, 1);
|
|
226227
|
+
return;
|
|
226198
226228
|
}
|
|
226229
|
+
// if json is Matrix3dProps but is not the right size
|
|
226230
|
+
this.setRowValues(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
226231
|
+
return;
|
|
226199
226232
|
}
|
|
226200
|
-
/** Return a new Matrix3d constructed from contents of the json value.
|
|
226201
|
-
static fromJSON(json) {
|
|
226202
|
-
|
|
226233
|
+
/** Return a new Matrix3d constructed from contents of the json value. See `setFromJSON` for layout rules */
|
|
226234
|
+
static fromJSON(json) {
|
|
226235
|
+
const result = Matrix3d.createIdentity();
|
|
226236
|
+
result.setFromJSON(json);
|
|
226237
|
+
return result;
|
|
226238
|
+
}
|
|
226239
|
+
/**
|
|
226240
|
+
* Test if `this` and `other` are within tolerance in all numeric entries.
|
|
226203
226241
|
* @param tol optional tolerance for comparisons by Geometry.isDistanceWithinTol
|
|
226204
226242
|
*/
|
|
226205
226243
|
isAlmostEqual(other, tol) {
|
|
226206
226244
|
return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isDistanceWithinTol(this.maxDiff(other), tol);
|
|
226207
226245
|
}
|
|
226208
|
-
/**
|
|
226246
|
+
/**
|
|
226247
|
+
* Test if `this` and `other` are within tolerance in the column entries specified by `columnIndex`.
|
|
226248
|
+
* @param tol optional tolerance for comparisons by Geometry.isDistanceWithinTol
|
|
226249
|
+
*/
|
|
226250
|
+
isAlmostEqualColumn(columnIndex, other, tol) {
|
|
226251
|
+
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]);
|
|
226252
|
+
return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isDistanceWithinTol(max, tol);
|
|
226253
|
+
}
|
|
226254
|
+
/**
|
|
226255
|
+
* Test if column (specified by `columnIndex`) entries of `this` and [ax,ay,az] are within tolerance.
|
|
226256
|
+
* @param tol optional tolerance for comparisons by Geometry.isDistanceWithinTol
|
|
226257
|
+
*/
|
|
226258
|
+
isAlmostEqualColumnXYZ(columnIndex, ax, ay, az, tol) {
|
|
226259
|
+
const max = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.maxAbsXYZ(this.coffs[columnIndex] - ax, this.coffs[columnIndex + 3] - ay, this.coffs[columnIndex + 6] - az);
|
|
226260
|
+
return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isDistanceWithinTol(max, tol);
|
|
226261
|
+
}
|
|
226262
|
+
/**
|
|
226263
|
+
* Test if `this` and `other` have almost equal Z column and have X and Y columns differing only by a
|
|
226264
|
+
* rotation of the same angle around that Z.
|
|
226265
|
+
* * **WARNING:** X and Y columns have to be perpendicular to Z column in both `this` and `other`.
|
|
226209
226266
|
* @param tol optional tolerance for comparisons by Geometry.isDistanceWithinTol
|
|
226210
226267
|
*/
|
|
226211
226268
|
isAlmostEqualAllowZRotation(other, tol) {
|
|
@@ -226213,10 +226270,15 @@ class Matrix3d {
|
|
|
226213
226270
|
return true;
|
|
226214
226271
|
if (this.isAlmostEqualColumn(_Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisIndex.Z, other, tol)) {
|
|
226215
226272
|
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]);
|
|
226216
|
-
const angle = _Angle__WEBPACK_IMPORTED_MODULE_1__.Angle.createRadians(radians);
|
|
226273
|
+
const angle = _Angle__WEBPACK_IMPORTED_MODULE_1__.Angle.createRadians(radians); // angle between X columns in `this` and `other`
|
|
226217
226274
|
const columnX = this.columnX();
|
|
226218
226275
|
const columnY = this.columnY();
|
|
226219
226276
|
const columnZ = this.columnZ();
|
|
226277
|
+
/**
|
|
226278
|
+
* Here we rotate this.columnX() around this.columnZ() by "angle" and expect to get other.columnX().
|
|
226279
|
+
* Then we rotate this.columnY() around this.columnZ() by the same "angle" and if we get other.columnY(),
|
|
226280
|
+
* that means this` and `other` have X and Y columns differing only by a rotation around that Z.
|
|
226281
|
+
*/
|
|
226220
226282
|
let column = _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.createRotateVectorAroundVector(columnX, columnZ, angle);
|
|
226221
226283
|
if (other.isAlmostEqualColumnXYZ(0, column.x, column.y, column.z, tol)) {
|
|
226222
226284
|
column = _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.createRotateVectorAroundVector(columnY, columnZ, angle);
|
|
@@ -226225,16 +226287,10 @@ class Matrix3d {
|
|
|
226225
226287
|
}
|
|
226226
226288
|
return false;
|
|
226227
226289
|
}
|
|
226228
|
-
isAlmostEqualColumn(columnIndex, other, tol) {
|
|
226229
|
-
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]);
|
|
226230
|
-
return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isDistanceWithinTol(a, tol);
|
|
226231
|
-
}
|
|
226232
|
-
isAlmostEqualColumnXYZ(columnIndex, ax, ay, az, tol) {
|
|
226233
|
-
const a = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.maxAbsXYZ(this.coffs[columnIndex] - ax, this.coffs[columnIndex + 3] - ay, this.coffs[columnIndex + 6] - az);
|
|
226234
|
-
return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isDistanceWithinTol(a, tol);
|
|
226235
|
-
}
|
|
226236
226290
|
/** Test for exact (bitwise) equality with other. */
|
|
226237
|
-
isExactEqual(other) {
|
|
226291
|
+
isExactEqual(other) {
|
|
226292
|
+
return this.maxDiff(other) === 0.0;
|
|
226293
|
+
}
|
|
226238
226294
|
/** test if all entries in the z row and column are exact 001, i.e. the matrix only acts in 2d */
|
|
226239
226295
|
get isXY() {
|
|
226240
226296
|
return this.coffs[2] === 0.0
|
|
@@ -226243,10 +226299,16 @@ class Matrix3d {
|
|
|
226243
226299
|
&& this.coffs[7] === 0.0
|
|
226244
226300
|
&& this.coffs[8] === 1.0;
|
|
226245
226301
|
}
|
|
226246
|
-
|
|
226247
|
-
|
|
226248
|
-
|
|
226249
|
-
|
|
226302
|
+
/**
|
|
226303
|
+
* If result is not provided, then the method returns a new (zeroed) matrix; otherwise the result is
|
|
226304
|
+
* not zeroed first and is just returned as-is.
|
|
226305
|
+
*/
|
|
226306
|
+
static _create(result) {
|
|
226307
|
+
return result ? result : new Matrix3d();
|
|
226308
|
+
}
|
|
226309
|
+
/**
|
|
226310
|
+
* Returns a Matrix3d populated by numeric values given in row-major order.
|
|
226311
|
+
* Sets all entries in the matrix from call parameters appearing in row-major order, i.e.
|
|
226250
226312
|
* ```
|
|
226251
226313
|
* equation
|
|
226252
226314
|
* \begin{bmatrix}a_{xx}\ a_{xy}\ a_{xz}\\ a_{yx}\ a_{yy}\ a_{yz}\\ a_{zx}\ a_{zy}\ a_{zz}\end{bmatrix}
|
|
@@ -226277,7 +226339,7 @@ class Matrix3d {
|
|
|
226277
226339
|
}
|
|
226278
226340
|
/**
|
|
226279
226341
|
* Create a Matrix3d with caller-supplied coefficients and optional inverse coefficients.
|
|
226280
|
-
* * The inputs are captured into the new Matrix3d.
|
|
226342
|
+
* * The inputs are captured into (i.e., owned by) the new Matrix3d.
|
|
226281
226343
|
* * The caller is responsible for validity of the inverse coefficients.
|
|
226282
226344
|
* @param coffs (required) array of 9 coefficients.
|
|
226283
226345
|
* @param inverseCoffs (optional) array of 9 coefficients.
|
|
@@ -226295,12 +226357,15 @@ class Matrix3d {
|
|
|
226295
226357
|
return result;
|
|
226296
226358
|
}
|
|
226297
226359
|
/**
|
|
226298
|
-
*
|
|
226360
|
+
* Create a matrix by distributing vectors to columns in one of 6 orders.
|
|
226299
226361
|
* @param axisOrder identifies where the columns are placed.
|
|
226300
|
-
* @param columnA vector to place in the
|
|
226301
|
-
* @param columnB vector to place in the
|
|
226302
|
-
* @param columnC vector to place in the
|
|
226303
|
-
* @param result
|
|
226362
|
+
* @param columnA vector to place in the column specified by first letter in the AxisOrder name.
|
|
226363
|
+
* @param columnB vector to place in the column specified by second letter in the AxisOrder name.
|
|
226364
|
+
* @param columnC vector to place in the column specified by third letter in the AxisOrder name.
|
|
226365
|
+
* @param result optional result matrix3d
|
|
226366
|
+
* * Example: If you pass AxisOrder.YZX, then result will be [columnC, columnA, columnB] because
|
|
226367
|
+
* first letter Y means columnA should go to the second column, second letter Z means columnB should
|
|
226368
|
+
* go to the third column, and third letter X means columnC should go to the first column.
|
|
226304
226369
|
*/
|
|
226305
226370
|
static createColumnsInAxisOrder(axisOrder, columnA, columnB, columnC, result) {
|
|
226306
226371
|
if (!result)
|
|
@@ -226320,13 +226385,26 @@ class Matrix3d {
|
|
|
226320
226385
|
else if (axisOrder === _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.ZYX) {
|
|
226321
226386
|
result.setColumns(columnC, columnB, columnA);
|
|
226322
226387
|
}
|
|
226323
|
-
else { //
|
|
226388
|
+
else { // AxisOrder.XYZ
|
|
226324
226389
|
result.setColumns(columnA, columnB, columnC);
|
|
226325
226390
|
}
|
|
226326
226391
|
return result;
|
|
226327
226392
|
}
|
|
226328
226393
|
/**
|
|
226329
|
-
|
|
226394
|
+
* Copy the transpose of the coffs to the inverseCoffs.
|
|
226395
|
+
* * Mark the matrix as inverseStored.
|
|
226396
|
+
*/
|
|
226397
|
+
setupInverseTranspose() {
|
|
226398
|
+
const coffs = this.coffs;
|
|
226399
|
+
this.inverseState = InverseMatrixState.inverseStored;
|
|
226400
|
+
this.inverseCoffs = Float64Array.from([
|
|
226401
|
+
coffs[0], coffs[3], coffs[6],
|
|
226402
|
+
coffs[1], coffs[4], coffs[7],
|
|
226403
|
+
coffs[2], coffs[5], coffs[8],
|
|
226404
|
+
]);
|
|
226405
|
+
}
|
|
226406
|
+
/**
|
|
226407
|
+
* Set all entries in the matrix from call parameters appearing in row-major order.
|
|
226330
226408
|
* @param axx Row x, column x (0,0) entry
|
|
226331
226409
|
* @param axy Row x, column y (0,1) entry
|
|
226332
226410
|
* @param axz Row x, column z (0,2) entry
|
|
@@ -226350,15 +226428,22 @@ class Matrix3d {
|
|
|
226350
226428
|
this.inverseState = InverseMatrixState.unknown;
|
|
226351
226429
|
}
|
|
226352
226430
|
/** Set the matrix to an identity. */
|
|
226353
|
-
setIdentity() {
|
|
226431
|
+
setIdentity() {
|
|
226432
|
+
this.setRowValues(1, 0, 0, 0, 1, 0, 0, 0, 1);
|
|
226433
|
+
this.setupInverseTranspose();
|
|
226434
|
+
}
|
|
226354
226435
|
/** Set the matrix to all zeros. */
|
|
226355
|
-
setZero() {
|
|
226356
|
-
|
|
226436
|
+
setZero() {
|
|
226437
|
+
this.setRowValues(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
226438
|
+
this.inverseState = InverseMatrixState.singular;
|
|
226439
|
+
}
|
|
226440
|
+
/** Copy contents from another matrix. */
|
|
226357
226441
|
setFrom(other) {
|
|
226358
226442
|
if (other === undefined) {
|
|
226359
226443
|
this.setIdentity();
|
|
226444
|
+
return;
|
|
226360
226445
|
}
|
|
226361
|
-
|
|
226446
|
+
if (other !== this) {
|
|
226362
226447
|
for (let i = 0; i < 9; i++)
|
|
226363
226448
|
this.coffs[i] = other.coffs[i];
|
|
226364
226449
|
if (other.inverseState === InverseMatrixState.inverseStored && other.inverseCoffs !== undefined) {
|
|
@@ -226370,28 +226455,29 @@ class Matrix3d {
|
|
|
226370
226455
|
else if (other.inverseState !== InverseMatrixState.inverseStored) {
|
|
226371
226456
|
this.inverseState = other.inverseState;
|
|
226372
226457
|
}
|
|
226373
|
-
else { // This is reached
|
|
226458
|
+
else { // This is reached when other says stored but does not have coffs. This should not happen.
|
|
226374
226459
|
this.inverseState = InverseMatrixState.unknown;
|
|
226375
226460
|
}
|
|
226376
226461
|
}
|
|
226377
226462
|
}
|
|
226378
|
-
/**
|
|
226379
|
-
*
|
|
226380
|
-
* *
|
|
226381
|
-
* * inverse status
|
|
226463
|
+
/**
|
|
226464
|
+
* Return a clone of this matrix.
|
|
226465
|
+
* * Coefficients are copied.
|
|
226466
|
+
* * Inverse coefficients and inverse status are copied if stored by `this`.
|
|
226382
226467
|
*/
|
|
226383
226468
|
clone(result) {
|
|
226384
226469
|
result = result ? result : new Matrix3d();
|
|
226385
226470
|
result.setFrom(this);
|
|
226386
226471
|
return result;
|
|
226387
226472
|
}
|
|
226388
|
-
/**
|
|
226473
|
+
/**
|
|
226474
|
+
* Create a matrix with all zeros.
|
|
226389
226475
|
* * Note that for geometry transformations "all zeros" is not a useful default state.
|
|
226390
|
-
* * Hence almost always use `createIdentity` for graphics transformations.
|
|
226391
|
-
* * "
|
|
226476
|
+
* * Hence, almost always use `createIdentity` for graphics transformations.
|
|
226477
|
+
* * "All zeros" is appropriate for summing moment data.
|
|
226392
226478
|
* ```
|
|
226393
226479
|
* equation
|
|
226394
|
-
* \begin{bmatrix}0 0 0 \\ 0 0 0 \\ 0 0 0\end{bmatrix}
|
|
226480
|
+
* \begin{bmatrix}0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0\end{bmatrix}
|
|
226395
226481
|
* ```
|
|
226396
226482
|
*/
|
|
226397
226483
|
static createZero() {
|
|
@@ -226399,13 +226485,14 @@ class Matrix3d {
|
|
|
226399
226485
|
retVal.inverseState = InverseMatrixState.singular;
|
|
226400
226486
|
return retVal;
|
|
226401
226487
|
}
|
|
226402
|
-
/**
|
|
226403
|
-
*
|
|
226404
|
-
* *
|
|
226405
|
-
* *
|
|
226488
|
+
/**
|
|
226489
|
+
* Create an identity matrix.
|
|
226490
|
+
* * All diagonal entries (xx,yy,zz) are one
|
|
226491
|
+
* * All others are zero.
|
|
226492
|
+
* * This (rather than "all zeros") is the useful state for most graphics transformations.
|
|
226406
226493
|
* ```
|
|
226407
226494
|
* equation
|
|
226408
|
-
* \begin{bmatrix}1 0 0 \\ 0 1 0 \\ 0 0 1\end{bmatrix}
|
|
226495
|
+
* \begin{bmatrix}1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1\end{bmatrix}
|
|
226409
226496
|
* ```
|
|
226410
226497
|
*
|
|
226411
226498
|
*/
|
|
@@ -226415,55 +226502,7 @@ class Matrix3d {
|
|
|
226415
226502
|
return result;
|
|
226416
226503
|
}
|
|
226417
226504
|
/**
|
|
226418
|
-
* Create a matrix with
|
|
226419
|
-
* For scale factor _s_,
|
|
226420
|
-
* ```
|
|
226421
|
-
* equation
|
|
226422
|
-
* \begin{bmatrix}s & 0 & 0 \\ 0 & s & 0\\ 0 & 0 & s\end{bmatrix}
|
|
226423
|
-
* ```
|
|
226424
|
-
*/
|
|
226425
|
-
static createUniformScale(scaleFactor) {
|
|
226426
|
-
return Matrix3d.createScale(scaleFactor, scaleFactor, scaleFactor);
|
|
226427
|
-
}
|
|
226428
|
-
/**
|
|
226429
|
-
* Construct a rigid matrix using createPerpendicularVectorFavorXYPlane to generate a vector perpendicular to vectorA.
|
|
226430
|
-
* *
|
|
226431
|
-
*/
|
|
226432
|
-
static createRigidHeadsUp(vectorA, axisOrder = _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.ZXY, result) {
|
|
226433
|
-
const vectorB = Matrix3d.createPerpendicularVectorFavorXYPlane(vectorA);
|
|
226434
|
-
const matrix = Matrix3d.createRigidFromColumns(vectorA, vectorB, axisOrder, result);
|
|
226435
|
-
if (matrix) {
|
|
226436
|
-
matrix.setupInverseTranspose();
|
|
226437
|
-
return matrix;
|
|
226438
|
-
}
|
|
226439
|
-
return Matrix3d.createIdentity(result);
|
|
226440
|
-
}
|
|
226441
|
-
/**
|
|
226442
|
-
* return a vector that is perpendicular to the input direction.
|
|
226443
|
-
* * Among the infinite number of perpendiculars possible, this method
|
|
226444
|
-
* favors having one in the xy plane.
|
|
226445
|
-
* * Hence, when vectorA is NOT close to the Z axis, the returned vector is Z cross vectorA.
|
|
226446
|
-
* * But vectorA is close to the Z axis, the returned vector is unitY cross vectorA.
|
|
226447
|
-
*/
|
|
226448
|
-
static createPerpendicularVectorFavorXYPlane(vector, result) {
|
|
226449
|
-
const a = vector.magnitude();
|
|
226450
|
-
const b = a / 64.0; // A constant from the dawn of time in the CAD industry.
|
|
226451
|
-
if (Math.abs(vector.x) < b && Math.abs(vector.y) < b) {
|
|
226452
|
-
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.createCrossProduct(vector.x, vector.y, vector.z, 0, -1, 0, result);
|
|
226453
|
-
}
|
|
226454
|
-
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.createCrossProduct(0, 0, 1, vector.x, vector.y, vector.z, result);
|
|
226455
|
-
}
|
|
226456
|
-
/**
|
|
226457
|
-
* return a vector that is perpendicular to the input direction.
|
|
226458
|
-
* * Among the infinite number of perpendiculars possible, this method
|
|
226459
|
-
* favors having one near the Z.
|
|
226460
|
-
* That is achieved by crossing "this" vector with the result of createPerpendicularVectorFavorXYPlane.
|
|
226461
|
-
*/
|
|
226462
|
-
static createPerpendicularVectorFavorPlaneContainingZ(vector, result) {
|
|
226463
|
-
result = Matrix3d.createPerpendicularVectorFavorXYPlane(vector, result);
|
|
226464
|
-
return vector.crossProduct(result, result);
|
|
226465
|
-
}
|
|
226466
|
-
/** Create a matrix with distinct x,y,z diagonal (scale) entries.
|
|
226505
|
+
* Create a matrix with distinct x,y,z diagonal (scale) entries.
|
|
226467
226506
|
* ```
|
|
226468
226507
|
* equation
|
|
226469
226508
|
* \begin{bmatrix}s_x & 0 & 0 \\ 0 & s_y & 0\\ 0 & 0 & s_z\end{bmatrix}
|
|
@@ -226488,7 +226527,101 @@ class Matrix3d {
|
|
|
226488
226527
|
}
|
|
226489
226528
|
return result;
|
|
226490
226529
|
}
|
|
226491
|
-
/**
|
|
226530
|
+
/**
|
|
226531
|
+
* Create a matrix with uniform scale factors for scale factor "s"
|
|
226532
|
+
* ```
|
|
226533
|
+
* equation
|
|
226534
|
+
* \begin{bmatrix}s & 0 & 0 \\ 0 & s & 0\\ 0 & 0 & s\end{bmatrix}
|
|
226535
|
+
* ```
|
|
226536
|
+
*/
|
|
226537
|
+
static createUniformScale(scaleFactor) {
|
|
226538
|
+
return Matrix3d.createScale(scaleFactor, scaleFactor, scaleFactor);
|
|
226539
|
+
}
|
|
226540
|
+
/**
|
|
226541
|
+
* Return a vector that is perpendicular to the input `vectorA`.
|
|
226542
|
+
* * Among the infinite number of perpendiculars possible, this method favors having one in the xy plane.
|
|
226543
|
+
* * Hence, when `vectorA` is close to the Z axis, the returned vector is `vectorA cross -unitY`
|
|
226544
|
+
* but when `vectorA` is NOT close to the Z axis, the returned vector is `unitZ cross vectorA`.
|
|
226545
|
+
*/
|
|
226546
|
+
static createPerpendicularVectorFavorXYPlane(vectorA, result) {
|
|
226547
|
+
const a = vectorA.magnitude();
|
|
226548
|
+
const scale = 64.0; // A constant from the dawn of time in the CAD industry
|
|
226549
|
+
const b = a / scale;
|
|
226550
|
+
// if vectorA is close to the Z axis
|
|
226551
|
+
if (Math.abs(vectorA.x) < b && Math.abs(vectorA.y) < b) {
|
|
226552
|
+
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.createCrossProduct(vectorA.x, vectorA.y, vectorA.z, 0, -1, 0, result);
|
|
226553
|
+
}
|
|
226554
|
+
// if vectorA is NOT close to the Z axis
|
|
226555
|
+
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.createCrossProduct(0, 0, 1, vectorA.x, vectorA.y, vectorA.z, result);
|
|
226556
|
+
}
|
|
226557
|
+
/**
|
|
226558
|
+
* Return a vector that is perpendicular to the input `vectorA`.
|
|
226559
|
+
* * Among the infinite number of perpendiculars possible, this method favors having one near the plane
|
|
226560
|
+
* containing Z.
|
|
226561
|
+
* That is achieved by cross product of `this` vector with the result of createPerpendicularVectorFavorXYPlane.
|
|
226562
|
+
*/
|
|
226563
|
+
static createPerpendicularVectorFavorPlaneContainingZ(vectorA, result) {
|
|
226564
|
+
/**
|
|
226565
|
+
* vectorA, result (below), and "vectorA cross result" form a coordinate system where "result" is located on
|
|
226566
|
+
* the XY-plane. Once you've got a coordinate system with an axis in the XY-plane, your other two axes form
|
|
226567
|
+
* a plane that includes the z-axis.
|
|
226568
|
+
*/
|
|
226569
|
+
result = Matrix3d.createPerpendicularVectorFavorXYPlane(vectorA, result);
|
|
226570
|
+
return vectorA.crossProduct(result, result);
|
|
226571
|
+
}
|
|
226572
|
+
/**
|
|
226573
|
+
* Create a matrix from column vectors, shuffled into place per axisOrder
|
|
226574
|
+
* For example, if axisOrder = XYZ then it returns [vectorU, vectorV, vectorW]
|
|
226575
|
+
* Another example, if axisOrder = YZX then it returns [vectorW, vectorU, vectorV] because
|
|
226576
|
+
* Y is at index 0 so vectorU goes to the column Y (column 2), Z is at index 1 so vectorV goes
|
|
226577
|
+
* to the column Z (column 3), and X is at index 2 so vectorW goes to the column X (column 1)
|
|
226578
|
+
*/
|
|
226579
|
+
static createShuffledColumns(vectorU, vectorV, vectorW, axisOrder, result) {
|
|
226580
|
+
const target = Matrix3d._create(result);
|
|
226581
|
+
target.setColumn(_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.axisOrderToAxis(axisOrder, 0), vectorU);
|
|
226582
|
+
target.setColumn(_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.axisOrderToAxis(axisOrder, 1), vectorV);
|
|
226583
|
+
target.setColumn(_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.axisOrderToAxis(axisOrder, 2), vectorW);
|
|
226584
|
+
return target;
|
|
226585
|
+
}
|
|
226586
|
+
/**
|
|
226587
|
+
* Create a new orthogonal matrix (perpendicular columns, unit length, transpose is inverse).
|
|
226588
|
+
* * `vectorA1 = Normalized vectorA` is placed in the column specified by **first** letter in
|
|
226589
|
+
* the AxisOrder name.
|
|
226590
|
+
* * Normalized `vectorC1 = vectorA1 cross vectorB` is placed in the column specified by **third**
|
|
226591
|
+
* letter in the AxisOrder name.
|
|
226592
|
+
* * Normalized `vectorC1 cross vectorA` is placed in the column specified by **second**
|
|
226593
|
+
* letter in the AxisOrder name.
|
|
226594
|
+
* * This function internally uses createShuffledColumns.
|
|
226595
|
+
*/
|
|
226596
|
+
static createRigidFromColumns(vectorA, vectorB, axisOrder, result) {
|
|
226597
|
+
const vectorA1 = vectorA.normalize();
|
|
226598
|
+
if (vectorA1) {
|
|
226599
|
+
const vectorC1 = vectorA1.unitCrossProduct(vectorB);
|
|
226600
|
+
if (vectorC1) {
|
|
226601
|
+
const vectorB1 = vectorC1.unitCrossProduct(vectorA);
|
|
226602
|
+
if (vectorB1) {
|
|
226603
|
+
const retVal = Matrix3d.createShuffledColumns(vectorA1, vectorB1, vectorC1, axisOrder, result);
|
|
226604
|
+
retVal.setupInverseTranspose();
|
|
226605
|
+
return retVal;
|
|
226606
|
+
}
|
|
226607
|
+
}
|
|
226608
|
+
}
|
|
226609
|
+
return undefined;
|
|
226610
|
+
}
|
|
226611
|
+
/**
|
|
226612
|
+
* Construct a rigid matrix using vectorA and its 2 perpendicular.
|
|
226613
|
+
* * This function internally uses createPerpendicularVectorFavorXYPlane and createRigidFromColumns.
|
|
226614
|
+
*/
|
|
226615
|
+
static createRigidHeadsUp(vectorA, axisOrder = _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.ZXY, result) {
|
|
226616
|
+
const vectorB = Matrix3d.createPerpendicularVectorFavorXYPlane(vectorA);
|
|
226617
|
+
const matrix = Matrix3d.createRigidFromColumns(vectorA, vectorB, axisOrder, result);
|
|
226618
|
+
if (matrix) {
|
|
226619
|
+
matrix.setupInverseTranspose();
|
|
226620
|
+
return matrix;
|
|
226621
|
+
}
|
|
226622
|
+
return Matrix3d.createIdentity(result);
|
|
226623
|
+
}
|
|
226624
|
+
/** Return the matrix for rotation of `angle` around `axis` */
|
|
226492
226625
|
static createRotationAroundVector(axis, angle, result) {
|
|
226493
226626
|
// Rodriguez formula (matrix form), https://mathworld.wolfram.com/RodriguesRotationFormula.html
|
|
226494
226627
|
const c = angle.cos();
|
|
@@ -226506,6 +226639,7 @@ class Matrix3d {
|
|
|
226506
226639
|
* @param axisIndex index of axis (AxisIndex.X, AxisIndex.Y, AxisIndex.Z) kept fixed by the rotation.
|
|
226507
226640
|
* @param angle angle of rotation
|
|
226508
226641
|
* @param result optional result matrix.
|
|
226642
|
+
* * Math details of 3d rotation matrices derivation can be found at docs/learning/geometry/Angle.md
|
|
226509
226643
|
*/
|
|
226510
226644
|
static createRotationAroundAxisIndex(axisIndex, angle, result) {
|
|
226511
226645
|
const c = angle.cos();
|
|
@@ -226523,27 +226657,77 @@ class Matrix3d {
|
|
|
226523
226657
|
myResult.setupInverseTranspose();
|
|
226524
226658
|
return myResult;
|
|
226525
226659
|
}
|
|
226660
|
+
/**
|
|
226661
|
+
* Replace current columns Ui and Uj with (c*Ui - s*Uj) and (c*Uj + s*Ui).
|
|
226662
|
+
* * There is no checking for i,j being 0,1,2.
|
|
226663
|
+
* * This is used in compute intensive inner loops
|
|
226664
|
+
* @param i first row index. **must be 0,1,2** (unchecked)
|
|
226665
|
+
* @param j second row index. **must be 0,1,2** (unchecked)
|
|
226666
|
+
* @param c fist coefficient
|
|
226667
|
+
* @param s second coefficient
|
|
226668
|
+
*/
|
|
226669
|
+
applyGivensColumnOp(i, j, c, s) {
|
|
226670
|
+
const limit = i + 9;
|
|
226671
|
+
for (; i < limit; i += 3, j += 3) {
|
|
226672
|
+
const a = this.coffs[i];
|
|
226673
|
+
const b = this.coffs[j];
|
|
226674
|
+
this.coffs[i] = a * c + b * s;
|
|
226675
|
+
this.coffs[j] = -a * s + b * c;
|
|
226676
|
+
}
|
|
226677
|
+
}
|
|
226678
|
+
/**
|
|
226679
|
+
* Create a matrix from column vectors.
|
|
226680
|
+
* ```
|
|
226681
|
+
* equation
|
|
226682
|
+
* \begin{bmatrix}U_x & V_x & W_x \\ U_y & V_y & W_y \\ U_z & V_z & W_z \end{bmatrix}
|
|
226683
|
+
* ```
|
|
226684
|
+
*/
|
|
226685
|
+
static createColumns(vectorU, vectorV, vectorW, result) {
|
|
226686
|
+
return Matrix3d.createRowValues(vectorU.x, vectorV.x, vectorW.x, vectorU.y, vectorV.y, vectorW.y, vectorU.z, vectorV.z, vectorW.z, result);
|
|
226687
|
+
}
|
|
226688
|
+
/** Create a matrix with each column's _x,y_ parts given `XAndY` and separate numeric z values.
|
|
226689
|
+
* ```
|
|
226690
|
+
* equation
|
|
226691
|
+
* \begin{bmatrix}U_x & V_x & W_x \\ U_y & V_y & W_y \\ u & v & w \end{bmatrix}
|
|
226692
|
+
* ```
|
|
226693
|
+
*/
|
|
226694
|
+
static createColumnsXYW(vectorU, u, vectorV, v, vectorW, w, result) {
|
|
226695
|
+
return Matrix3d.createRowValues(vectorU.x, vectorV.x, vectorW.x, vectorU.y, vectorV.y, vectorW.y, u, v, w, result);
|
|
226696
|
+
}
|
|
226526
226697
|
/** Create a matrix from "as viewed" right and up vectors.
|
|
226527
226698
|
* * ColumnX points in the rightVector direction
|
|
226528
|
-
* * ColumnY points in
|
|
226529
|
-
* * ColumnZ is a unit cross product.
|
|
226530
|
-
* Optionally rotate the standard cube by 45 to bring its left or right vertical edge to center
|
|
226531
|
-
* *
|
|
226532
|
-
* *
|
|
226533
|
-
*
|
|
226534
|
-
*
|
|
226535
|
-
*
|
|
226536
|
-
*
|
|
226537
|
-
*
|
|
226538
|
-
*
|
|
226539
|
-
*
|
|
226540
|
-
*
|
|
226541
|
-
* @
|
|
226699
|
+
* * ColumnY points in the upVector direction
|
|
226700
|
+
* * ColumnZ is a unit cross product of ColumnX and ColumnY.
|
|
226701
|
+
* * Optionally rotate the standard cube by 45 degrees ccw around Y to bring its left or right vertical edge to center.
|
|
226702
|
+
* * Optionally rotate the standard cube by 35.264 degrees ccw around X (isometric rotation).
|
|
226703
|
+
* * This is expected to be used with various principal unit vectors that are perpendicular to each other.
|
|
226704
|
+
* * STANDARD TOP VIEW: createViewedAxes(Vector3d.unitX(), Vector3d.unitY(), 0, 0)
|
|
226705
|
+
* * STANDARD FRONT VIEW: createViewedAxes(Vector3d.unitX(), Vector3d.unitZ(), 0, 0)
|
|
226706
|
+
* * STANDARD BACK VIEW: createViewedAxes(Vector3d.unitX(-1), Vector3d.unitZ(), 0, 0)
|
|
226707
|
+
* * STANDARD RIGHT VIEW: createViewedAxes(Vector3d.unitY(), Vector3d.unitZ(), 0, 0)
|
|
226708
|
+
* * STANDARD LEFT VIEW: createViewedAxes(Vector3d.unitY(-1), Vector3d.unitZ(), 0, 0)
|
|
226709
|
+
* * STANDARD BOTTOM VIEW: createViewedAxes(Vector3d.unitX(), Vector3d.unitY(-1), 0, 0)
|
|
226710
|
+
* * Note: createViewedAxes is column-based so always returns local to world
|
|
226711
|
+
*
|
|
226712
|
+
* @param rightVector ColumnX of the returned matrix. Expected to be perpendicular to upVector.
|
|
226713
|
+
* @param upVector ColumnY of the returned matrix. Expected to be perpendicular to rightVector.
|
|
226714
|
+
* @param leftNoneRight Specifies the ccw rotation around Y axis. Normally one of "-1", "0", and "1", where
|
|
226715
|
+
* "-1" indicates rotation by 45 degrees to bring the left vertical edge to center, "0" means no rotation,
|
|
226716
|
+
* and "1" indicates rotation by 45 degrees to bring the right vertical edge to center. Other numbers are
|
|
226717
|
+
* used as multiplier for this 45 degree rotation.
|
|
226718
|
+
* @param topNoneBottom Specifies the ccw rotation around X axis. Normally one of "-1", "0", and "1", where
|
|
226719
|
+
* "-1" indicates isometric rotation (35.264 degrees) to bring the bottom upward, "0" means no rotation,
|
|
226720
|
+
* and "1" indicates isometric rotation (35.264 degrees) to bring the top downward. Other numbers are
|
|
226721
|
+
* used as multiplier for the 35.264 degree rotation.
|
|
226722
|
+
* @returns matrix = [rightVector, upVector, rightVector cross upVector] with the applied rotations specified
|
|
226723
|
+
* by leftNoneRight and topNoneBottom. Returns undefined if rightVector and upVector are parallel.
|
|
226542
226724
|
*/
|
|
226543
226725
|
static createViewedAxes(rightVector, upVector, leftNoneRight = 0, topNoneBottom = 0) {
|
|
226544
226726
|
const columnZ = rightVector.crossProduct(upVector);
|
|
226545
226727
|
if (columnZ.normalizeInPlace()) {
|
|
226546
|
-
|
|
226728
|
+
// matrix = [rightVector, upVector, rightVector cross upVector]
|
|
226729
|
+
const matrix = Matrix3d.createColumns(rightVector, upVector, columnZ);
|
|
226730
|
+
// "45 degrees * leftNoneRight" rotation around Y
|
|
226547
226731
|
if (leftNoneRight !== 0.0) {
|
|
226548
226732
|
let c = Math.sqrt(0.5);
|
|
226549
226733
|
let s = leftNoneRight < 0.0 ? -c : c;
|
|
@@ -226552,51 +226736,63 @@ class Matrix3d {
|
|
|
226552
226736
|
c = Math.cos(radians);
|
|
226553
226737
|
s = Math.sin(radians);
|
|
226554
226738
|
}
|
|
226555
|
-
|
|
226739
|
+
matrix.applyGivensColumnOp(2, 0, c, s); // rotate around Y (equivalent to matrix*rotationY)
|
|
226556
226740
|
}
|
|
226741
|
+
// "35.264 degrees * topNoneBottom" rotation around X
|
|
226557
226742
|
if (topNoneBottom !== 0.0) {
|
|
226558
226743
|
const theta = topNoneBottom * Math.atan(Math.sqrt(0.5));
|
|
226559
226744
|
const c = Math.cos(theta);
|
|
226560
226745
|
const s = Math.sin(theta);
|
|
226561
|
-
|
|
226746
|
+
matrix.applyGivensColumnOp(1, 2, c, -s); // rotate around X (equivalent to matrix*rotationX)
|
|
226562
226747
|
}
|
|
226563
|
-
return
|
|
226748
|
+
return matrix;
|
|
226564
226749
|
}
|
|
226565
226750
|
return undefined;
|
|
226566
226751
|
}
|
|
226567
226752
|
/**
|
|
226568
226753
|
* Create a rotation matrix for one of the 8 standard views.
|
|
226569
|
-
* *
|
|
226570
|
-
* *
|
|
226754
|
+
* * Default is TOP view (`local X = world X`, `local Y = world Y`, `local Z = world Z`).
|
|
226755
|
+
* * To change view from the TOP to one of the other 7 standard views, we need to multiply "world data" to
|
|
226756
|
+
* the corresponding matrix1 provided by `createStandardWorldToView(index, false)` and then
|
|
226757
|
+
* `matrix1.multiply(world data)` will returns "local data".
|
|
226758
|
+
* * To change view back to the TOP, we need to multiply "local data" to the corresponding matrix2 provided
|
|
226759
|
+
* by `createStandardWorldToView(index, true)` and then `matrix2.multiply(local data)` will returns "world data".
|
|
226571
226760
|
*
|
|
226572
|
-
* @param index standard view index `StandardViewIndex.Top, Bottom,
|
|
226573
|
-
* @param invert if false (default), the
|
|
226761
|
+
* @param index standard view index `StandardViewIndex.Top, Bottom, Left, Right, Front, Back, Iso, RightIso`
|
|
226762
|
+
* @param invert if false (default), the return matrix is world to local (view) and if true, the the return
|
|
226763
|
+
* matrix is local (view) to world.
|
|
226574
226764
|
* @param result optional result.
|
|
226575
226765
|
*/
|
|
226576
226766
|
static createStandardWorldToView(index, invert = false, result) {
|
|
226577
226767
|
switch (index) {
|
|
226768
|
+
// start with TOP view, ccw rotation by 180 degrees around X
|
|
226578
226769
|
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.Bottom:
|
|
226579
226770
|
result = Matrix3d.createRowValues(1, 0, 0, 0, -1, 0, 0, 0, -1);
|
|
226580
226771
|
break;
|
|
226772
|
+
// start with TOP view, ccw rotation by -90 degrees around X and by 90 degrees around Z
|
|
226581
226773
|
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.Left:
|
|
226582
226774
|
result = Matrix3d.createRowValues(0, -1, 0, 0, 0, 1, -1, 0, 0);
|
|
226583
226775
|
break;
|
|
226776
|
+
// start with TOP view, ccw rotation by -90 degrees around X and by -90 degrees around Z
|
|
226584
226777
|
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.Right:
|
|
226585
226778
|
result = Matrix3d.createRowValues(0, 1, 0, 0, 0, 1, 1, 0, 0);
|
|
226586
226779
|
break;
|
|
226587
|
-
|
|
226780
|
+
// start with TOP view, ccw rotation by -90 degrees around X
|
|
226781
|
+
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.Front:
|
|
226588
226782
|
result = Matrix3d.createRowValues(1, 0, 0, 0, 0, 1, 0, -1, 0);
|
|
226589
226783
|
break;
|
|
226590
|
-
|
|
226784
|
+
// start with TOP view, ccw rotation by -90 degrees around X and by 180 degrees around Z
|
|
226785
|
+
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.Back:
|
|
226591
226786
|
result = Matrix3d.createRowValues(-1, 0, 0, 0, 0, 1, 0, 1, 0);
|
|
226592
226787
|
break;
|
|
226593
226788
|
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.Iso:
|
|
226789
|
+
// start with FRONT view, ccw rotation by -45 degrees around Y and by 35.264 degrees around X
|
|
226594
226790
|
result = Matrix3d.createRowValues(0.707106781186548, -0.70710678118654757, 0.00000000000000000, 0.408248290463863, 0.40824829046386302, 0.81649658092772603, -0.577350269189626, -0.57735026918962573, 0.57735026918962573);
|
|
226595
226791
|
break;
|
|
226596
226792
|
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.RightIso:
|
|
226597
226793
|
result = Matrix3d.createRowValues(0.707106781186548, 0.70710678118654757, 0.00000000000000000, -0.408248290463863, 0.40824829046386302, 0.81649658092772603, 0.577350269189626, -0.57735026918962573, 0.57735026918962573);
|
|
226598
226794
|
break;
|
|
226599
|
-
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.Top:
|
|
226795
|
+
case _Geometry__WEBPACK_IMPORTED_MODULE_0__.StandardViewIndex.Top: // no rotation
|
|
226600
226796
|
default:
|
|
226601
226797
|
result = Matrix3d.createIdentity(result);
|
|
226602
226798
|
}
|
|
@@ -226673,7 +226869,7 @@ class Matrix3d {
|
|
|
226673
226869
|
*/
|
|
226674
226870
|
/**
|
|
226675
226871
|
* Compute the (unit vector) axis and angle of rotation.
|
|
226676
|
-
* @returns Returns with result.ok === true when the conversion succeeded.
|
|
226872
|
+
* @returns Returns axis and angle of rotation with result.ok === true when the conversion succeeded.
|
|
226677
226873
|
*/
|
|
226678
226874
|
getAxisAndAngleOfRotation() {
|
|
226679
226875
|
const trace = this.coffs[0] + this.coffs[4] + this.coffs[8];
|
|
@@ -226856,7 +227052,7 @@ class Matrix3d {
|
|
|
226856
227052
|
columnZCrossVector(vector, result) {
|
|
226857
227053
|
return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.crossProductXYZXYZ(this.coffs[2], this.coffs[5], this.coffs[8], vector.x, vector.y, vector.z, result);
|
|
226858
227054
|
}
|
|
226859
|
-
|
|
227055
|
+
/*
|
|
226860
227056
|
* Replace current rows Ui Uj with (c*Ui - s*Uj) and (c*Uj + s*Ui).
|
|
226861
227057
|
* @param i first row index. must be 0,1,2 (unchecked)
|
|
226862
227058
|
* @param j second row index. must be 0,1,2 (unchecked)
|
|
@@ -226874,23 +227070,6 @@ class Matrix3d {
|
|
|
226874
227070
|
this.coffs[jj] = -a * s + b * c;
|
|
226875
227071
|
}
|
|
226876
227072
|
}
|
|
226877
|
-
/**
|
|
226878
|
-
* Replace current columns Ui Uj with (c*Ui - s*Uj) and (c*Uj + s*Ui).
|
|
226879
|
-
* * This is used in compute intensive inner loops -- there is no checking for i,j being 0,1,2.
|
|
226880
|
-
* @param i first row index. must be 0,1,2 (unchecked)
|
|
226881
|
-
* @param j second row index. must be 0,1,2 (unchecked)
|
|
226882
|
-
* @param c fist coefficient
|
|
226883
|
-
* @param s second coefficient
|
|
226884
|
-
*/
|
|
226885
|
-
applyGivensColumnOp(i, j, c, s) {
|
|
226886
|
-
const limit = i + 9;
|
|
226887
|
-
for (; i < limit; i += 3, j += 3) {
|
|
226888
|
-
const a = this.coffs[i];
|
|
226889
|
-
const b = this.coffs[j];
|
|
226890
|
-
this.coffs[i] = a * c + b * s;
|
|
226891
|
-
this.coffs[j] = -a * s + b * c;
|
|
226892
|
-
}
|
|
226893
|
-
}
|
|
226894
227073
|
/**
|
|
226895
227074
|
* create a rigid coordinate frame column z parallel to (_x_,_y_,_z_) and column x in the xy plane.
|
|
226896
227075
|
* * column z points from origin to x,y,z
|
|
@@ -227123,33 +227302,14 @@ class Matrix3d {
|
|
|
227123
227302
|
}
|
|
227124
227303
|
return false;
|
|
227125
227304
|
}
|
|
227126
|
-
/**
|
|
227127
|
-
* Create a matrix from column vectors.
|
|
227128
|
-
* ```
|
|
227129
|
-
* equation
|
|
227130
|
-
* \begin{bmatrix}U_x & V_x & W_x \\ U_y & V_y & W_y \\ U_z & V_z & W_z \end{bmatrix}
|
|
227131
|
-
* ```
|
|
227132
|
-
*/
|
|
227133
|
-
static createColumns(vectorU, vectorV, vectorW, result) {
|
|
227134
|
-
return Matrix3d.createRowValues(vectorU.x, vectorV.x, vectorW.x, vectorU.y, vectorV.y, vectorW.y, vectorU.z, vectorV.z, vectorW.z, result);
|
|
227135
|
-
}
|
|
227136
|
-
/** Create a matrix with each column's _x,y_ parts given `XAndY` and separate numeric z values.
|
|
227137
|
-
* ```
|
|
227138
|
-
* equation
|
|
227139
|
-
* \begin{bmatrix}U_x & V_x & W_x \\ U_y & V_y & W_y \\ u & v & w \end{bmatrix}
|
|
227140
|
-
* ```
|
|
227141
|
-
*/
|
|
227142
|
-
static createColumnsXYW(vectorU, u, vectorV, v, vectorW, w, result) {
|
|
227143
|
-
return Matrix3d.createRowValues(vectorU.x, vectorV.x, vectorW.x, vectorU.y, vectorV.y, vectorW.y, u, v, w, result);
|
|
227144
|
-
}
|
|
227145
227305
|
/** Install data from xyz parts of Point4d (w part of Point4d ignored) */
|
|
227146
227306
|
setColumnsPoint4dXYZ(vectorU, vectorV, vectorW) {
|
|
227147
227307
|
this.inverseState = InverseMatrixState.unknown;
|
|
227148
227308
|
this.setRowValues(vectorU.x, vectorV.x, vectorW.x, vectorU.y, vectorV.y, vectorW.y, vectorU.z, vectorV.z, vectorW.z);
|
|
227149
227309
|
}
|
|
227150
227310
|
/**
|
|
227151
|
-
*
|
|
227152
|
-
* @param columnIndex column index
|
|
227311
|
+
* Set entries in one column of the matrix.
|
|
227312
|
+
* @param columnIndex column index (this is interpreted cyclically. See Geometry.cyclic3dAxis for more info).
|
|
227153
227313
|
* @param value x,yz, values for column. If undefined, zeros are installed.
|
|
227154
227314
|
*/
|
|
227155
227315
|
setColumn(columnIndex, value) {
|
|
@@ -227198,14 +227358,6 @@ class Matrix3d {
|
|
|
227198
227358
|
const index = 3 * _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.cyclic3dAxis(columnIndex);
|
|
227199
227359
|
return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.create(this.coffs[index], this.coffs[index + 1], this.coffs[index + 2], result);
|
|
227200
227360
|
}
|
|
227201
|
-
/** Create a matrix from column vectors, shuffled into place per AxisTriple */
|
|
227202
|
-
static createShuffledColumns(vectorU, vectorV, vectorW, axisOrder, result) {
|
|
227203
|
-
const target = Matrix3d._create(result);
|
|
227204
|
-
target.setColumn(_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.axisOrderToAxis(axisOrder, 0), vectorU);
|
|
227205
|
-
target.setColumn(_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.axisOrderToAxis(axisOrder, 1), vectorV);
|
|
227206
|
-
target.setColumn(_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.axisOrderToAxis(axisOrder, 2), vectorW);
|
|
227207
|
-
return target;
|
|
227208
|
-
}
|
|
227209
227361
|
/** Create a matrix from row vectors.
|
|
227210
227362
|
* ```
|
|
227211
227363
|
* equation
|
|
@@ -227637,7 +227789,11 @@ class Matrix3d {
|
|
|
227637
227789
|
this.multiplyMatrixMatrix(other.matrix, result.matrix);
|
|
227638
227790
|
return result;
|
|
227639
227791
|
}
|
|
227640
|
-
/**
|
|
227792
|
+
/**
|
|
227793
|
+
* Return the transpose of `this` matrix.
|
|
227794
|
+
* If `result` is passed as argument, then the function copies the transpose of `this` into `result`
|
|
227795
|
+
* `this` is not changed unless also passed as the result, i.e., this.transpose(this) transposes `this` in place
|
|
227796
|
+
*/
|
|
227641
227797
|
transpose(result) {
|
|
227642
227798
|
if (!result)
|
|
227643
227799
|
result = new Matrix3d();
|
|
@@ -227652,8 +227808,8 @@ class Matrix3d {
|
|
|
227652
227808
|
}
|
|
227653
227809
|
return result;
|
|
227654
227810
|
}
|
|
227655
|
-
/**
|
|
227656
|
-
*
|
|
227811
|
+
/**
|
|
227812
|
+
* Transpose this matrix in place.
|
|
227657
227813
|
*/
|
|
227658
227814
|
transposeInPlace() {
|
|
227659
227815
|
PackedMatrix3dOps.transposeInPlace(this.coffs);
|
|
@@ -227684,18 +227840,6 @@ class Matrix3d {
|
|
|
227684
227840
|
result.inverseState = this.inverseState;
|
|
227685
227841
|
return result;
|
|
227686
227842
|
}
|
|
227687
|
-
/** copy the transpose of the coffs to the inverseCoffs.
|
|
227688
|
-
* * mark the matrix as inverseStored.
|
|
227689
|
-
*/
|
|
227690
|
-
setupInverseTranspose() {
|
|
227691
|
-
const coffs = this.coffs;
|
|
227692
|
-
this.inverseState = InverseMatrixState.inverseStored;
|
|
227693
|
-
this.inverseCoffs = Float64Array.from([
|
|
227694
|
-
coffs[0], coffs[3], coffs[6],
|
|
227695
|
-
coffs[1], coffs[4], coffs[7],
|
|
227696
|
-
coffs[2], coffs[5], coffs[8]
|
|
227697
|
-
]);
|
|
227698
|
-
}
|
|
227699
227843
|
/* Alternate implementation of computedCachedInverse - more direct addressing of arrays.
|
|
227700
227844
|
This is indeed 10% faster than using static work areas. */
|
|
227701
227845
|
// take the cross product of two rows of source.
|
|
@@ -227803,8 +227947,10 @@ class Matrix3d {
|
|
|
227803
227947
|
markSingular() {
|
|
227804
227948
|
this.inverseState = InverseMatrixState.singular;
|
|
227805
227949
|
}
|
|
227806
|
-
/**
|
|
227807
|
-
*
|
|
227950
|
+
/**
|
|
227951
|
+
* Create the inverseCoffs member (filled with zeros)
|
|
227952
|
+
* This is for use by matrix * matrix multiplications which need to be sure the member is there to be
|
|
227953
|
+
* filled with method-specific content.
|
|
227808
227954
|
*/
|
|
227809
227955
|
createInverseCoffsWithZeros() {
|
|
227810
227956
|
if (!this.inverseCoffs) {
|
|
@@ -227953,7 +228099,7 @@ class Matrix3d {
|
|
|
227953
228099
|
/**
|
|
227954
228100
|
* add scaled values from other Matrix3d to this Matrix3d
|
|
227955
228101
|
* @param other Matrix3d with values to be added
|
|
227956
|
-
* @param scale scale factor to apply to
|
|
228102
|
+
* @param scale scale factor to apply to the added values.
|
|
227957
228103
|
*/
|
|
227958
228104
|
addScaledInPlace(other, scale) {
|
|
227959
228105
|
for (let i = 0; i < 9; i++)
|
|
@@ -228016,18 +228162,18 @@ class Matrix3d {
|
|
|
228016
228162
|
/** Return the sum of squares of all entries */
|
|
228017
228163
|
sumSquares() {
|
|
228018
228164
|
let i = 0;
|
|
228019
|
-
let
|
|
228165
|
+
let sum = 0;
|
|
228020
228166
|
for (i = 0; i < 9; i++)
|
|
228021
|
-
|
|
228022
|
-
return
|
|
228167
|
+
sum += this.coffs[i] * this.coffs[i];
|
|
228168
|
+
return sum;
|
|
228023
228169
|
}
|
|
228024
228170
|
/** Return the sum of squares of diagonal entries */
|
|
228025
228171
|
sumDiagonalSquares() {
|
|
228026
228172
|
let i = 0;
|
|
228027
|
-
let
|
|
228173
|
+
let sum = 0;
|
|
228028
228174
|
for (i = 0; i < 9; i += 4)
|
|
228029
|
-
|
|
228030
|
-
return
|
|
228175
|
+
sum += this.coffs[i] * this.coffs[i];
|
|
228176
|
+
return sum;
|
|
228031
228177
|
}
|
|
228032
228178
|
/** Return the sum of diagonal entries (also known as the trace) */
|
|
228033
228179
|
sumDiagonal() {
|
|
@@ -228036,18 +228182,18 @@ class Matrix3d {
|
|
|
228036
228182
|
/** Return the Maximum absolute value of any single entry */
|
|
228037
228183
|
maxAbs() {
|
|
228038
228184
|
let i = 0;
|
|
228039
|
-
let
|
|
228185
|
+
let max = 0;
|
|
228040
228186
|
for (i = 0; i < 9; i++)
|
|
228041
|
-
|
|
228042
|
-
return
|
|
228187
|
+
max = Math.max(max, Math.abs(this.coffs[i]));
|
|
228188
|
+
return max;
|
|
228043
228189
|
}
|
|
228044
|
-
/** Return the maximum absolute difference between corresponding entries */
|
|
228190
|
+
/** Return the maximum absolute difference between corresponding entries of `this` and `other` */
|
|
228045
228191
|
maxDiff(other) {
|
|
228046
228192
|
let i = 0;
|
|
228047
|
-
let
|
|
228193
|
+
let max = 0;
|
|
228048
228194
|
for (i = 0; i < 9; i++)
|
|
228049
|
-
|
|
228050
|
-
return
|
|
228195
|
+
max = Math.max(max, Math.abs(this.coffs[i] - other.coffs[i]));
|
|
228196
|
+
return max;
|
|
228051
228197
|
}
|
|
228052
228198
|
/** Test if the matrix is (very near to) an identity */
|
|
228053
228199
|
get isIdentity() {
|
|
@@ -228138,25 +228284,6 @@ class Matrix3d {
|
|
|
228138
228284
|
const product = this.multiplyMatrixMatrixTranspose(this);
|
|
228139
228285
|
return product.isIdentity;
|
|
228140
228286
|
}
|
|
228141
|
-
/** create a new orthogonal matrix (perpendicular columns, unit length, transpose is inverse).
|
|
228142
|
-
* vectorA is placed in the first column of the axis order.
|
|
228143
|
-
* vectorB is projected perpendicular to vectorA within their plane and placed in the second column.
|
|
228144
|
-
*/
|
|
228145
|
-
static createRigidFromColumns(vectorA, vectorB, axisOrder, result) {
|
|
228146
|
-
const vectorA1 = vectorA.normalize();
|
|
228147
|
-
if (vectorA1) {
|
|
228148
|
-
const vectorC1 = vectorA1.unitCrossProduct(vectorB);
|
|
228149
|
-
if (vectorC1) {
|
|
228150
|
-
const vectorB1 = vectorC1.unitCrossProduct(vectorA);
|
|
228151
|
-
if (vectorB1) {
|
|
228152
|
-
const retVal = Matrix3d.createShuffledColumns(vectorA1, vectorB1, vectorC1, axisOrder, result);
|
|
228153
|
-
retVal.setupInverseTranspose();
|
|
228154
|
-
return retVal;
|
|
228155
|
-
}
|
|
228156
|
-
}
|
|
228157
|
-
}
|
|
228158
|
-
return undefined;
|
|
228159
|
-
}
|
|
228160
228287
|
/** Adjust the matrix in place so that:
|
|
228161
228288
|
* * columns are perpendicular and have unit length
|
|
228162
228289
|
* * transpose equals inverse
|
|
@@ -228197,8 +228324,8 @@ class Matrix3d {
|
|
|
228197
228324
|
return coff;
|
|
228198
228325
|
}
|
|
228199
228326
|
/** create a matrix from a quaternion.
|
|
228200
|
-
* WARNING
|
|
228201
|
-
* WARNING
|
|
228327
|
+
* **WARNING:** There is frequent confusion over whether a "from quaternion" matrix is organized by rows and columns.
|
|
228328
|
+
* **WARNING:** If you find that the matrix seems to rotate by the opposite angle expect it, transpose it.
|
|
228202
228329
|
*/
|
|
228203
228330
|
static createFromQuaternion(quat) {
|
|
228204
228331
|
const qqx = quat.x * quat.x;
|
|
@@ -228217,8 +228344,8 @@ class Matrix3d {
|
|
|
228217
228344
|
}
|
|
228218
228345
|
/** convert the matrix to a quaternion.
|
|
228219
228346
|
* @note This calculation requires the matrix to have unit length rows and columns.
|
|
228220
|
-
* WARNING
|
|
228221
|
-
* WARNING
|
|
228347
|
+
* **WARNING:** There is frequent confusion over whether a "from quaternion" matrix is organized by rows and columns.
|
|
228348
|
+
* **WARNING:** If you find that the matrix seems to rotate by the opposite angle expect it, transpose it.
|
|
228222
228349
|
*/
|
|
228223
228350
|
toQuaternion() {
|
|
228224
228351
|
const result = _geometry4d_Point4d__WEBPACK_IMPORTED_MODULE_4__.Point4d.createZero();
|
|
@@ -228272,9 +228399,9 @@ class Matrix3d {
|
|
|
228272
228399
|
}
|
|
228273
228400
|
/** Control flag for whether this class uses cached inverse of matrices. */
|
|
228274
228401
|
Matrix3d.useCachedInverse = true; // cached inverse can be suppressed for testing.
|
|
228275
|
-
/**
|
|
228402
|
+
/** Total number of times a cached inverse was used to avoid recompute */
|
|
228276
228403
|
Matrix3d.numUseCache = 0;
|
|
228277
|
-
/**
|
|
228404
|
+
/** Total number of times a cached inverse was computed. */
|
|
228278
228405
|
Matrix3d.numComputeCache = 0;
|
|
228279
228406
|
Matrix3d._productBuffer = new Float64Array(9);
|
|
228280
228407
|
|
|
@@ -302798,7 +302925,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
|
|
|
302798
302925
|
/***/ ((module) => {
|
|
302799
302926
|
|
|
302800
302927
|
"use strict";
|
|
302801
|
-
module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"3.6.0-dev.
|
|
302928
|
+
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"}}]}}');
|
|
302802
302929
|
|
|
302803
302930
|
/***/ })
|
|
302804
302931
|
|