@itwin/rpcinterface-full-stack-tests 4.0.0-dev.66 → 4.0.0-dev.68
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/_d48c.bundled-tests.js.map +1 -1
- package/lib/dist/bundled-tests.js +546 -364
- package/lib/dist/bundled-tests.js.map +1 -1
- package/lib/dist/core_frontend_lib_esm_ApproximateTerrainHeightsProps_js.bundled-tests.js.map +1 -1
- package/lib/dist/object-storage.bundled-tests.js.map +1 -1
- package/lib/dist/vendors-common_temp_node_modules_pnpm_itwin_object-storage-azure_1_5_0_node_modules_itwin_obj-e3e81d.bundled-tests.js.map +1 -1
- package/lib/dist/vendors-common_temp_node_modules_pnpm_loaders_gl_draco_3_3_1_node_modules_loaders_gl_draco_di-d3af41.bundled-tests.js.map +1 -1
- package/lib/dist/vendors-common_temp_node_modules_pnpm_reflect-metadata_0_1_13_node_modules_reflect-metadata_R-610cb3.bundled-tests.js.map +1 -1
- package/package.json +13 -13
|
@@ -175870,7 +175870,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
175870
175870
|
/**
|
|
175871
175871
|
* Enumeration of the 6 possible orderings of XYZ axis order
|
|
175872
175872
|
* * **Note:** There are 3 axis order with right hand system (XYZ = 0, YZX = 1, ZXY = 2) and 3 axis order with
|
|
175873
|
-
* left hand system (XZY = 4, YXZ = 5, ZYX = 6). Note that AxisOrder is encoding the handedness as well. Cross
|
|
175873
|
+
* left hand system (XZY = 4, YXZ = 5, ZYX = 6). Note that `AxisOrder` is encoding the handedness as well. Cross
|
|
175874
175874
|
* 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
|
|
175875
175875
|
* axis in that ordering.
|
|
175876
175876
|
* @public
|
|
@@ -175903,7 +175903,8 @@ var AxisIndex;
|
|
|
175903
175903
|
/** 2 axis is index 2 */
|
|
175904
175904
|
AxisIndex[AxisIndex["Z"] = 2] = "Z";
|
|
175905
175905
|
})(AxisIndex || (AxisIndex = {}));
|
|
175906
|
-
/**
|
|
175906
|
+
/**
|
|
175907
|
+
* Standard views. Used in `Matrix3d.createStandardViewAxes(index: StandardViewIndex, invert: boolean)`
|
|
175907
175908
|
* @public
|
|
175908
175909
|
*/
|
|
175909
175910
|
var StandardViewIndex;
|
|
@@ -175912,20 +175913,21 @@ var StandardViewIndex;
|
|
|
175912
175913
|
StandardViewIndex[StandardViewIndex["Top"] = 1] = "Top";
|
|
175913
175914
|
/** X to right, negative Y up */
|
|
175914
175915
|
StandardViewIndex[StandardViewIndex["Bottom"] = 2] = "Bottom";
|
|
175915
|
-
/**
|
|
175916
|
+
/** Negative Y to right, Z up */
|
|
175916
175917
|
StandardViewIndex[StandardViewIndex["Left"] = 3] = "Left";
|
|
175917
|
-
/**
|
|
175918
|
+
/** Y to right, Z up */
|
|
175918
175919
|
StandardViewIndex[StandardViewIndex["Right"] = 4] = "Right";
|
|
175919
175920
|
/** X to right, Z up */
|
|
175920
175921
|
StandardViewIndex[StandardViewIndex["Front"] = 5] = "Front";
|
|
175921
|
-
/**
|
|
175922
|
+
/** Negative X to right, Z up */
|
|
175922
175923
|
StandardViewIndex[StandardViewIndex["Back"] = 6] = "Back";
|
|
175923
|
-
/**
|
|
175924
|
+
/** Isometric: view towards origin from (-1,-1,1) */
|
|
175924
175925
|
StandardViewIndex[StandardViewIndex["Iso"] = 7] = "Iso";
|
|
175925
|
-
/**
|
|
175926
|
+
/** Right isometric: view towards origin from (1,-1,1) */
|
|
175926
175927
|
StandardViewIndex[StandardViewIndex["RightIso"] = 8] = "RightIso";
|
|
175927
175928
|
})(StandardViewIndex || (StandardViewIndex = {}));
|
|
175928
|
-
/**
|
|
175929
|
+
/**
|
|
175930
|
+
* Enumeration among choice for how a coordinate transformation should incorporate scaling.
|
|
175929
175931
|
* @public
|
|
175930
175932
|
*/
|
|
175931
175933
|
var AxisScaleSelect;
|
|
@@ -175937,7 +175939,8 @@ var AxisScaleSelect;
|
|
|
175937
175939
|
/** On each axis, the vector length matches he length of the corresponding edge of the range. */
|
|
175938
175940
|
AxisScaleSelect[AxisScaleSelect["NonUniformRangeContainment"] = 2] = "NonUniformRangeContainment";
|
|
175939
175941
|
})(AxisScaleSelect || (AxisScaleSelect = {}));
|
|
175940
|
-
/**
|
|
175942
|
+
/**
|
|
175943
|
+
* Enumeration of possible locations of a point in the plane of a polygon.
|
|
175941
175944
|
* @public
|
|
175942
175945
|
*/
|
|
175943
175946
|
var PolygonLocation;
|
|
@@ -175970,18 +175973,26 @@ var PolygonLocation;
|
|
|
175970
175973
|
* @public
|
|
175971
175974
|
*/
|
|
175972
175975
|
class Geometry {
|
|
175973
|
-
/** Test if absolute value of x is
|
|
175974
|
-
|
|
175976
|
+
/** Test if absolute value of x is large (larger than `Geometry.largeCoordinateResult`) */
|
|
175977
|
+
static isLargeCoordinateResult(x) {
|
|
175978
|
+
return x > this.largeCoordinateResult || x < -this.largeCoordinateResult;
|
|
175979
|
+
}
|
|
175980
|
+
/**
|
|
175981
|
+
* Test if absolute value of x is large (larger than `Geometry.largeCoordinateResult`).
|
|
175982
|
+
* @deprecated in 4.x. Use `isLargeCoordinateResult`.
|
|
175975
175983
|
*/
|
|
175976
175984
|
static isHugeCoordinate(x) {
|
|
175977
|
-
return
|
|
175985
|
+
return Geometry.isLargeCoordinateResult(x);
|
|
175978
175986
|
}
|
|
175979
|
-
/** Test if a number is odd
|
|
175980
|
-
*/
|
|
175987
|
+
/** Test if a number is odd */
|
|
175981
175988
|
static isOdd(x) {
|
|
175982
|
-
return (x & (0x01)) === 1;
|
|
175989
|
+
return (x & (0x01)) === 1; // bitwise operation
|
|
175983
175990
|
}
|
|
175984
|
-
/**
|
|
175991
|
+
/**
|
|
175992
|
+
* Correct distance to zero.
|
|
175993
|
+
* * If `distance` magnitude is `undefined` or smaller than `smallMetricDistance`, then return `replacement`
|
|
175994
|
+
* (or 0 if replacement is not passed). Otherwise return `distance`.
|
|
175995
|
+
*/
|
|
175985
175996
|
static correctSmallMetricDistance(distance, replacement = 0.0) {
|
|
175986
175997
|
if (distance === undefined || Math.abs(distance) < Geometry.smallMetricDistance) {
|
|
175987
175998
|
return replacement;
|
|
@@ -175989,64 +176000,119 @@ class Geometry {
|
|
|
175989
176000
|
return distance;
|
|
175990
176001
|
}
|
|
175991
176002
|
/**
|
|
175992
|
-
|
|
175993
|
-
|
|
175994
|
-
|
|
175995
|
-
|
|
175996
|
-
|
|
176003
|
+
* Correct `fraction` to `replacement` if `fraction` is undefined or too small.
|
|
176004
|
+
* @param fraction number to test
|
|
176005
|
+
* @param replacement value to return if `fraction` is too small
|
|
176006
|
+
* @returns `fraction` if its absolute value is at least `Geometry.smallFraction`; otherwise returns `replacement`
|
|
176007
|
+
*/
|
|
176008
|
+
static correctSmallFraction(fraction, replacement = 0.0) {
|
|
176009
|
+
if (fraction === undefined || Math.abs(fraction) < Geometry.smallFraction) {
|
|
176010
|
+
return replacement;
|
|
176011
|
+
}
|
|
176012
|
+
return fraction;
|
|
176013
|
+
}
|
|
176014
|
+
/**
|
|
176015
|
+
* Return the inverse of `distance`.
|
|
176016
|
+
* * If `distance` magnitude is smaller than `smallMetricDistance` (i.e. distance is large enough for safe division),
|
|
176017
|
+
* then return `1/distance`. Otherwise return `undefined`.
|
|
176018
|
+
*/
|
|
176019
|
+
static inverseMetricDistance(distance) {
|
|
176020
|
+
return (Math.abs(distance) <= Geometry.smallMetricDistance) ? undefined : 1.0 / distance;
|
|
175997
176021
|
}
|
|
175998
176022
|
/**
|
|
175999
|
-
*
|
|
176000
|
-
*
|
|
176023
|
+
* Return the inverse of `distanceSquared`.
|
|
176024
|
+
* * If `distanceSquared ` magnitude is smaller than `smallMetricDistanceSquared` (i.e. distanceSquared is large
|
|
176025
|
+
* enough for safe division), then return `1/distanceSquared `. Otherwise return `undefined`.
|
|
176001
176026
|
*/
|
|
176002
|
-
static inverseMetricDistanceSquared(
|
|
176003
|
-
return (Math.abs(
|
|
176027
|
+
static inverseMetricDistanceSquared(distanceSquared) {
|
|
176028
|
+
return (Math.abs(distanceSquared) <= Geometry.smallMetricDistanceSquared) ? undefined : 1.0 / distanceSquared;
|
|
176004
176029
|
}
|
|
176005
176030
|
/**
|
|
176006
|
-
* Boolean test for metric coordinate near-equality (i.e., if x and y are almost equal)
|
|
176007
|
-
* `Geometry.smallMetricDistance` is used
|
|
176031
|
+
* Boolean test for metric coordinate near-equality (i.e., if `x` and `y` are almost equal) using `tolerance`.
|
|
176032
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
176008
176033
|
*/
|
|
176009
|
-
static isSameCoordinate(x, y,
|
|
176010
|
-
|
|
176011
|
-
|
|
176012
|
-
|
|
176034
|
+
static isSameCoordinate(x, y, tolerance = Geometry.smallMetricDistance) {
|
|
176035
|
+
let d = x - y;
|
|
176036
|
+
if (d < 0)
|
|
176037
|
+
d = -d;
|
|
176038
|
+
return d <= tolerance;
|
|
176013
176039
|
}
|
|
176014
|
-
/**
|
|
176040
|
+
/**
|
|
176041
|
+
* Boolean test for metric coordinate near-equality (i.e., if `x` and `y` are almost equal) using
|
|
176042
|
+
* `tolerance = toleranceFactor * smallMetricDistance`
|
|
176043
|
+
* */
|
|
176015
176044
|
static isSameCoordinateWithToleranceFactor(x, y, toleranceFactor) {
|
|
176016
176045
|
return Geometry.isSameCoordinate(x, y, toleranceFactor * Geometry.smallMetricDistance);
|
|
176017
176046
|
}
|
|
176018
|
-
/**
|
|
176019
|
-
|
|
176047
|
+
/**
|
|
176048
|
+
* Boolean test for metric coordinate pair near-equality (i.e., if `x0` and `x1` are almost equal
|
|
176049
|
+
* and `y0` and `y1` are almost equal) using `tolerance`.
|
|
176050
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
176051
|
+
*/
|
|
176052
|
+
static isSameCoordinateXY(x0, y0, x1, y1, tolerance = Geometry.smallMetricDistance) {
|
|
176020
176053
|
let d = x1 - x0;
|
|
176021
176054
|
if (d < 0)
|
|
176022
176055
|
d = -d;
|
|
176023
|
-
if (d >
|
|
176056
|
+
if (d > tolerance)
|
|
176024
176057
|
return false;
|
|
176025
176058
|
d = y1 - y0;
|
|
176026
176059
|
if (d < 0)
|
|
176027
176060
|
d = -d;
|
|
176028
|
-
return d
|
|
176029
|
-
}
|
|
176030
|
-
/**
|
|
176031
|
-
|
|
176032
|
-
|
|
176033
|
-
|
|
176034
|
-
|
|
176035
|
-
static
|
|
176036
|
-
|
|
176037
|
-
|
|
176038
|
-
|
|
176039
|
-
|
|
176040
|
-
|
|
176041
|
-
|
|
176042
|
-
|
|
176043
|
-
|
|
176044
|
-
|
|
176045
|
-
|
|
176046
|
-
|
|
176047
|
-
|
|
176048
|
-
|
|
176049
|
-
|
|
176061
|
+
return d <= tolerance;
|
|
176062
|
+
}
|
|
176063
|
+
/**
|
|
176064
|
+
* Boolean test for squared metric coordinate near-equality (i.e., if `sqrt(x)` and `sqrt(y)` are
|
|
176065
|
+
* almost equal) using `tolerance`.
|
|
176066
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
176067
|
+
*/
|
|
176068
|
+
static isSameCoordinateSquared(x, y, tolerance = Geometry.smallMetricDistance) {
|
|
176069
|
+
return Math.abs(Math.sqrt(x) - Math.sqrt(y)) <= tolerance;
|
|
176070
|
+
}
|
|
176071
|
+
/**
|
|
176072
|
+
* Boolean test for small `dataA.distance(dataB)` within `tolerance`.
|
|
176073
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
176074
|
+
*/
|
|
176075
|
+
static isSamePoint3d(dataA, dataB, tolerance = Geometry.smallMetricDistance) {
|
|
176076
|
+
return dataA.distance(dataB) <= tolerance;
|
|
176077
|
+
}
|
|
176078
|
+
/**
|
|
176079
|
+
* Boolean test for small xyz-distance within `tolerance`.
|
|
176080
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
176081
|
+
* * Note that Point3d and Vector3d are both derived from XYZ, so this method tolerates mixed types.
|
|
176082
|
+
*/
|
|
176083
|
+
static isSameXYZ(dataA, dataB, tolerance = Geometry.smallMetricDistance) {
|
|
176084
|
+
return dataA.distance(dataB) <= tolerance;
|
|
176085
|
+
}
|
|
176086
|
+
/**
|
|
176087
|
+
* Boolean test for small xy-distance (ignoring z) within `tolerance`.
|
|
176088
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
176089
|
+
*/
|
|
176090
|
+
static isSamePoint3dXY(dataA, dataB, tolerance = Geometry.smallMetricDistance) {
|
|
176091
|
+
return dataA.distanceXY(dataB) <= tolerance;
|
|
176092
|
+
}
|
|
176093
|
+
/**
|
|
176094
|
+
* Boolean test for small xyz-distance within `tolerance`.
|
|
176095
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
176096
|
+
*/
|
|
176097
|
+
static isSameVector3d(dataA, dataB, tolerance = Geometry.smallMetricDistance) {
|
|
176098
|
+
return dataA.distance(dataB) <= tolerance;
|
|
176099
|
+
}
|
|
176100
|
+
/**
|
|
176101
|
+
* Boolean test for small xy-distance within `tolerance`.
|
|
176102
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
176103
|
+
*/
|
|
176104
|
+
static isSamePoint2d(dataA, dataB, tolerance = Geometry.smallMetricDistance) {
|
|
176105
|
+
return dataA.distance(dataB) <= tolerance;
|
|
176106
|
+
}
|
|
176107
|
+
/**
|
|
176108
|
+
* Boolean test for small xy-distance within `tolerance`.
|
|
176109
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
176110
|
+
*/
|
|
176111
|
+
static isSameVector2d(dataA, dataB, tolerance = Geometry.smallMetricDistance) {
|
|
176112
|
+
return dataA.distance(dataB) <= tolerance;
|
|
176113
|
+
}
|
|
176114
|
+
/**
|
|
176115
|
+
* Lexical comparison of (a.x, a.y) and (b.x, b.y) with x as first test and y as second (z is ignored).
|
|
176050
176116
|
* * This is appropriate for a horizontal sweep in the plane.
|
|
176051
176117
|
*/
|
|
176052
176118
|
static lexicalXYLessThan(a, b) {
|
|
@@ -176061,7 +176127,7 @@ class Geometry {
|
|
|
176061
176127
|
return 0;
|
|
176062
176128
|
}
|
|
176063
176129
|
/**
|
|
176064
|
-
* Lexical comparison of (a.x,a.y) (b.x,b.y) with y as first test
|
|
176130
|
+
* Lexical comparison of (a.x, a.y) and (b.x, b.y) with y as first test and x as second (z is ignored).
|
|
176065
176131
|
* * This is appropriate for a vertical sweep in the plane.
|
|
176066
176132
|
*/
|
|
176067
176133
|
static lexicalYXLessThan(a, b) {
|
|
@@ -176075,9 +176141,7 @@ class Geometry {
|
|
|
176075
176141
|
return 1;
|
|
176076
176142
|
return 0;
|
|
176077
176143
|
}
|
|
176078
|
-
/**
|
|
176079
|
-
* Lexical test, based on x first, y second, z third.
|
|
176080
|
-
*/
|
|
176144
|
+
/** Lexical comparison of (a.x, a.y, a.z) and (b.x, b.y, b.z) with x as first test, y as second, and z as third. */
|
|
176081
176145
|
static lexicalXYZLessThan(a, b) {
|
|
176082
176146
|
if (a.x < b.x)
|
|
176083
176147
|
return -1;
|
|
@@ -176093,19 +176157,21 @@ class Geometry {
|
|
|
176093
176157
|
return 1;
|
|
176094
176158
|
return 0;
|
|
176095
176159
|
}
|
|
176096
|
-
/**
|
|
176160
|
+
/**
|
|
176161
|
+
* Test if `value` is small compared to `smallFraction`.
|
|
176097
176162
|
* * This is appropriate if `value` is know to be a typical 0..1 fraction.
|
|
176098
176163
|
*/
|
|
176099
176164
|
static isSmallRelative(value) {
|
|
176100
|
-
return Math.abs(value) < Geometry.
|
|
176165
|
+
return Math.abs(value) < Geometry.smallFraction;
|
|
176101
176166
|
}
|
|
176102
176167
|
/** Test if `value` is small compared to `smallAngleRadians` */
|
|
176103
176168
|
static isSmallAngleRadians(value) {
|
|
176104
176169
|
return Math.abs(value) < Geometry.smallAngleRadians;
|
|
176105
176170
|
}
|
|
176106
|
-
/**
|
|
176107
|
-
*
|
|
176108
|
-
|
|
176171
|
+
/**
|
|
176172
|
+
* Returns `true` if both values are `undefined` or if both are defined and almost equal within tolerance.
|
|
176173
|
+
* If one is `undefined` and the other is not, then `false` is returned.
|
|
176174
|
+
*/
|
|
176109
176175
|
static isAlmostEqualOptional(a, b, tolerance) {
|
|
176110
176176
|
if (a !== undefined && b !== undefined) {
|
|
176111
176177
|
if (Math.abs(a - b) > tolerance)
|
|
@@ -176117,44 +176183,43 @@ class Geometry {
|
|
|
176117
176183
|
}
|
|
176118
176184
|
return true;
|
|
176119
176185
|
}
|
|
176120
|
-
/**
|
|
176121
|
-
*
|
|
176122
|
-
|
|
176123
|
-
|
|
176186
|
+
/**
|
|
176187
|
+
* Toleranced equality test using tolerance `tolerance * ( 1 + abs(a) + abs(b) )`.
|
|
176188
|
+
* * `Geometry.smallAngleRadians` is used if tolerance is `undefined`.
|
|
176189
|
+
*/
|
|
176190
|
+
static isAlmostEqualNumber(a, b, tolerance = Geometry.smallAngleRadians) {
|
|
176124
176191
|
const sumAbs = 1.0 + Math.abs(a) + Math.abs(b);
|
|
176125
|
-
return Math.abs(a - b) <=
|
|
176192
|
+
return Math.abs(a - b) <= tolerance * sumAbs;
|
|
176126
176193
|
}
|
|
176127
|
-
/**
|
|
176128
|
-
*
|
|
176129
|
-
|
|
176130
|
-
|
|
176131
|
-
|
|
176132
|
-
const
|
|
176133
|
-
return Math.abs(a.x - b.x) <=
|
|
176194
|
+
/**
|
|
176195
|
+
* Toleranced equality test using tolerance `tolerance * ( 1 + abs(a.x) + abs(a.y) + abs(b.x) + abs(b.y) )`.
|
|
176196
|
+
* * `Geometry.smallAngleRadians` is used if tolerance is `undefined`.
|
|
176197
|
+
*/
|
|
176198
|
+
static isAlmostEqualXAndY(a, b, tolerance = Geometry.smallAngleRadians) {
|
|
176199
|
+
const tol = tolerance * (1.0 + Math.abs(a.x) + Math.abs(b.x) + Math.abs(a.y) + Math.abs(b.y));
|
|
176200
|
+
return (Math.abs(a.x - b.x) <= tol) && (Math.abs(a.y - b.y) <= tol);
|
|
176134
176201
|
}
|
|
176135
176202
|
/**
|
|
176136
|
-
* Toleranced equality test
|
|
176137
|
-
*
|
|
176203
|
+
* Toleranced equality test using caller-supplied `tolerance`.
|
|
176204
|
+
* * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.
|
|
176138
176205
|
*/
|
|
176139
|
-
static isDistanceWithinTol(distance,
|
|
176140
|
-
|
|
176141
|
-
return Math.abs(distance) <= Math.abs(tol);
|
|
176142
|
-
return Math.abs(distance) <= Geometry.smallMetricDistance;
|
|
176206
|
+
static isDistanceWithinTol(distance, tolerance = Geometry.smallMetricDistance) {
|
|
176207
|
+
return Math.abs(distance) <= tolerance;
|
|
176143
176208
|
}
|
|
176144
|
-
/** Toleranced equality test
|
|
176209
|
+
/** Toleranced equality test using `smallMetricDistance` tolerance. */
|
|
176145
176210
|
static isSmallMetricDistance(distance) {
|
|
176146
176211
|
return Math.abs(distance) <= Geometry.smallMetricDistance;
|
|
176147
176212
|
}
|
|
176148
|
-
/** Toleranced equality
|
|
176213
|
+
/** Toleranced equality test using `smallMetricDistanceSquared` tolerance. */
|
|
176149
176214
|
static isSmallMetricDistanceSquared(distanceSquared) {
|
|
176150
176215
|
return Math.abs(distanceSquared) <= Geometry.smallMetricDistanceSquared;
|
|
176151
176216
|
}
|
|
176152
176217
|
/**
|
|
176153
176218
|
* Return `axis modulo 3` with proper handling of negative indices
|
|
176154
176219
|
* ..., -3:x, -2:y, -1:z, 0:x, 1:y, 2:z, 3:x, 4:y, 5:z, 6:x, 7:y, 8:z, ...
|
|
176155
|
-
|
|
176220
|
+
*/
|
|
176156
176221
|
static cyclic3dAxis(axis) {
|
|
176157
|
-
/* Direct test for the most common cases
|
|
176222
|
+
/* Direct test for the most common cases to avoid more expensive modulo operation */
|
|
176158
176223
|
if (axis >= 0) {
|
|
176159
176224
|
if (axis < 3)
|
|
176160
176225
|
return axis;
|
|
@@ -176167,7 +176232,8 @@ class Geometry {
|
|
|
176167
176232
|
return j;
|
|
176168
176233
|
return 2 - ((-axis - 1) % 3);
|
|
176169
176234
|
}
|
|
176170
|
-
/**
|
|
176235
|
+
/**
|
|
176236
|
+
* Return the `AxisOrder` for which `axisIndex` is the first named axis.
|
|
176171
176237
|
* * `axisIndex === 0` returns `AxisOrder.XYZ`
|
|
176172
176238
|
* * `axisIndex === 1` returns `AxisOrder.YZX`
|
|
176173
176239
|
* * `axisIndex === 2` returns `AxisOrder.ZXY`
|
|
@@ -176181,32 +176247,55 @@ class Geometry {
|
|
|
176181
176247
|
return AxisOrder.ZXY;
|
|
176182
176248
|
return Geometry.axisIndexToRightHandedAxisOrder(Geometry.cyclic3dAxis(axisIndex));
|
|
176183
176249
|
}
|
|
176184
|
-
/** Return the largest
|
|
176185
|
-
static
|
|
176186
|
-
|
|
176250
|
+
/** Return the largest signed value among `a`, `b`, and `c` */
|
|
176251
|
+
static maxXYZ(a, b, c) {
|
|
176252
|
+
let max = a;
|
|
176253
|
+
if (b > max)
|
|
176254
|
+
max = b;
|
|
176255
|
+
if (c > max)
|
|
176256
|
+
max = c;
|
|
176257
|
+
return max;
|
|
176187
176258
|
}
|
|
176188
|
-
/** Return the
|
|
176259
|
+
/** Return the smallest signed value among `a`, `b`, and `c` */
|
|
176260
|
+
static minXYZ(a, b, c) {
|
|
176261
|
+
let min = a;
|
|
176262
|
+
if (b < min)
|
|
176263
|
+
min = b;
|
|
176264
|
+
if (c < min)
|
|
176265
|
+
min = c;
|
|
176266
|
+
return min;
|
|
176267
|
+
}
|
|
176268
|
+
/** Return the largest signed value among `a` and `b` */
|
|
176269
|
+
static maxXY(a, b) {
|
|
176270
|
+
let max = a;
|
|
176271
|
+
if (b > max)
|
|
176272
|
+
max = b;
|
|
176273
|
+
return max;
|
|
176274
|
+
}
|
|
176275
|
+
/** Return the smallest signed value among `a` and `b` */
|
|
176276
|
+
static minXY(a, b) {
|
|
176277
|
+
let min = a;
|
|
176278
|
+
if (b < min)
|
|
176279
|
+
min = b;
|
|
176280
|
+
return min;
|
|
176281
|
+
}
|
|
176282
|
+
/** Return the largest absolute value among `x`, `y`, and `z` */
|
|
176189
176283
|
static maxAbsXYZ(x, y, z) {
|
|
176190
176284
|
return Geometry.maxXYZ(Math.abs(x), Math.abs(y), Math.abs(z));
|
|
176191
176285
|
}
|
|
176192
|
-
/** Return the largest absolute
|
|
176286
|
+
/** Return the largest absolute value among `x` and `y` */
|
|
176193
176287
|
static maxAbsXY(x, y) {
|
|
176194
176288
|
return Geometry.maxXY(Math.abs(x), Math.abs(y));
|
|
176195
176289
|
}
|
|
176196
|
-
/** Return the largest
|
|
176197
|
-
static
|
|
176198
|
-
|
|
176199
|
-
if (b > q)
|
|
176200
|
-
q = b;
|
|
176201
|
-
if (c > q)
|
|
176202
|
-
q = c;
|
|
176203
|
-
return q;
|
|
176290
|
+
/** Return the largest absolute distance from `a` to either of `b0` or `b1` */
|
|
176291
|
+
static maxAbsDiff(a, b0, b1) {
|
|
176292
|
+
return Math.max(Math.abs(a - b0), Math.abs(a - b1));
|
|
176204
176293
|
}
|
|
176205
176294
|
/**
|
|
176206
|
-
* Examine the
|
|
176207
|
-
* * If x is negative, return outNegative
|
|
176208
|
-
* * If x is true zero, return outZero
|
|
176209
|
-
* * If x is positive, return outPositive
|
|
176295
|
+
* Examine the sign of `x`.
|
|
176296
|
+
* * If `x` is negative, return `outNegative`
|
|
176297
|
+
* * If `x` is true zero, return `outZero`
|
|
176298
|
+
* * If `x` is positive, return `outPositive`
|
|
176210
176299
|
*/
|
|
176211
176300
|
static split3WaySign(x, outNegative, outZero, outPositive) {
|
|
176212
176301
|
if (x < 0)
|
|
@@ -176228,45 +176317,40 @@ class Geometry {
|
|
|
176228
176317
|
return -1;
|
|
176229
176318
|
return 0;
|
|
176230
176319
|
}
|
|
176231
|
-
/** Return the
|
|
176232
|
-
static
|
|
176233
|
-
|
|
176234
|
-
if (b > q)
|
|
176235
|
-
q = b;
|
|
176236
|
-
return q;
|
|
176237
|
-
}
|
|
176238
|
-
/** Return the smallest signed value among a, b */
|
|
176239
|
-
static minXY(a, b) {
|
|
176240
|
-
let q = a;
|
|
176241
|
-
if (b < q)
|
|
176242
|
-
q = b;
|
|
176243
|
-
return q;
|
|
176320
|
+
/** Return the square of x */
|
|
176321
|
+
static square(x) {
|
|
176322
|
+
return x * x;
|
|
176244
176323
|
}
|
|
176245
|
-
/**
|
|
176324
|
+
/**
|
|
176325
|
+
* Return the hypotenuse (i.e., `sqrt(x*x + y*y)`).
|
|
176326
|
+
* * This is much faster than `Math.hypot(x,y)`.
|
|
176327
|
+
*/
|
|
176246
176328
|
static hypotenuseXY(x, y) {
|
|
176247
176329
|
return Math.sqrt(x * x + y * y);
|
|
176248
176330
|
}
|
|
176249
|
-
/** Return the squared
|
|
176331
|
+
/** Return the squared hypotenuse (i.e., `x*x + y*y`). */
|
|
176250
176332
|
static hypotenuseSquaredXY(x, y) {
|
|
176251
176333
|
return x * x + y * y;
|
|
176252
176334
|
}
|
|
176253
|
-
/**
|
|
176254
|
-
|
|
176255
|
-
|
|
176256
|
-
|
|
176257
|
-
/** Return the hypotenuse `sqrt(x*x + y*y + z*z)`. This is much faster than `Math.hypot(x,y,z)`. */
|
|
176335
|
+
/**
|
|
176336
|
+
* Return the hypotenuse (i.e., `sqrt(x*x + y*y + z*z)`).
|
|
176337
|
+
* * This is much faster than `Math.hypot(x,y,z)`.
|
|
176338
|
+
*/
|
|
176258
176339
|
static hypotenuseXYZ(x, y, z) {
|
|
176259
176340
|
return Math.sqrt(x * x + y * y + z * z);
|
|
176260
176341
|
}
|
|
176261
|
-
/** Return the squared hypotenuse `
|
|
176342
|
+
/** Return the squared hypotenuse (i.e., `x*x + y*y + z*z`). */
|
|
176262
176343
|
static hypotenuseSquaredXYZ(x, y, z) {
|
|
176263
176344
|
return x * x + y * y + z * z;
|
|
176264
176345
|
}
|
|
176265
|
-
/**
|
|
176346
|
+
/**
|
|
176347
|
+
* Return the full 4d hypotenuse (i.e., `sqrt(x*x + y*y + z*z + w*w)`).
|
|
176348
|
+
* * This is much faster than `Math.hypot(x,y,z,w)`.
|
|
176349
|
+
*/
|
|
176266
176350
|
static hypotenuseXYZW(x, y, z, w) {
|
|
176267
176351
|
return Math.sqrt(x * x + y * y + z * z + w * w);
|
|
176268
176352
|
}
|
|
176269
|
-
/** Return the squared hypotenuse `
|
|
176353
|
+
/** Return the squared hypotenuse (i.e., `x*x + y*y + z*z + w*w`). */
|
|
176270
176354
|
static hypotenuseSquaredXYZW(x, y, z, w) {
|
|
176271
176355
|
return x * x + y * y + z * z + w * w;
|
|
176272
176356
|
}
|
|
@@ -176292,8 +176376,8 @@ class Geometry {
|
|
|
176292
176376
|
static distanceXYZXYZ(x0, y0, z0, x1, y1, z1) {
|
|
176293
176377
|
return Geometry.hypotenuseXYZ(x1 - x0, y1 - y0, z1 - z0);
|
|
176294
176378
|
}
|
|
176295
|
-
/**
|
|
176296
|
-
*
|
|
176379
|
+
/**
|
|
176380
|
+
* Returns the triple product of 3 vectors provided as x,y,z number sequences.
|
|
176297
176381
|
* * The triple product is the determinant of the 3x3 matrix with the 9 numbers (3 vectors placed in 3 rows).
|
|
176298
176382
|
* * The triple product is positive if the 3 vectors form a right handed coordinate system.
|
|
176299
176383
|
* * The triple product is negative if the 3 vectors form a left handed coordinate system.
|
|
@@ -176301,170 +176385,196 @@ class Geometry {
|
|
|
176301
176385
|
* * U dot (V cross W)
|
|
176302
176386
|
* * V dot (W cross U)
|
|
176303
176387
|
* * W dot (U cross V)
|
|
176304
|
-
* *
|
|
176305
|
-
* *
|
|
176306
|
-
* *
|
|
176307
|
-
* *
|
|
176388
|
+
* * -U dot (W cross V)
|
|
176389
|
+
* * -V dot (U cross W)
|
|
176390
|
+
* * -W dot (V cross U)
|
|
176391
|
+
* * Note the negative in the last 3 formulas. Reversing cross product order changes the sign.
|
|
176392
|
+
* * The triple product is 6 times the (signed) volume of the tetrahedron with the three vectors as edges from a
|
|
176393
|
+
* common vertex.
|
|
176308
176394
|
*/
|
|
176309
176395
|
static tripleProduct(ux, uy, uz, vx, vy, vz, wx, wy, wz) {
|
|
176310
176396
|
return ux * (vy * wz - vz * wy)
|
|
176311
176397
|
+ uy * (vz * wx - vx * wz)
|
|
176312
176398
|
+ uz * (vx * wy - vy * wx);
|
|
176313
176399
|
}
|
|
176314
|
-
/** Returns the determinant of the 4x4 matrix unrolled as the 16 parameters
|
|
176315
|
-
*/
|
|
176400
|
+
/** Returns the determinant of the 4x4 matrix unrolled as the 16 parameters */
|
|
176316
176401
|
static determinant4x4(xx, xy, xz, xw, yx, yy, yz, yw, zx, zy, zz, zw, wx, wy, wz, ww) {
|
|
176317
176402
|
return xx * this.tripleProduct(yy, yz, yw, zy, zz, zw, wy, wz, ww)
|
|
176318
176403
|
- yx * this.tripleProduct(xy, xz, xw, zy, zz, zw, wy, wz, ww)
|
|
176319
176404
|
+ zx * this.tripleProduct(xy, xz, xw, yy, yz, yw, wy, wz, ww)
|
|
176320
176405
|
- wx * this.tripleProduct(xy, xz, xw, yy, yz, yw, zy, zz, zw);
|
|
176321
176406
|
}
|
|
176322
|
-
/** Return the mean curvature for two radii, with 0 radius implying 0 curvature */
|
|
176323
|
-
static meanCurvatureOfRadii(r0, r1) {
|
|
176324
|
-
return 0.5 * (this.safeDivideFraction(1, r0, 0) + this.safeDivideFraction(1, r1, 0));
|
|
176325
|
-
}
|
|
176326
176407
|
/**
|
|
176327
|
-
|
|
176328
|
-
|
|
176329
|
-
|
|
176330
|
-
|
|
176331
|
-
|
|
176332
|
-
* @param vy second derivative y component
|
|
176333
|
-
* @param vz second derivative z component
|
|
176334
|
-
*/
|
|
176335
|
-
static curvatureMagnitude(ux, uy, uz, vx, vy, vz) {
|
|
176336
|
-
let q = uy * vz - uz * vy;
|
|
176337
|
-
let sum = q * q;
|
|
176338
|
-
q = uz * vx - ux * vz;
|
|
176339
|
-
sum += q * q;
|
|
176340
|
-
q = ux * vy - uy * vx;
|
|
176341
|
-
sum += q * q;
|
|
176342
|
-
const a = Math.sqrt(ux * ux + uy * uy + uz * uz);
|
|
176343
|
-
const b = Math.sqrt(sum);
|
|
176344
|
-
// (sum and a are both nonnegative)
|
|
176345
|
-
const aaa = a * a * a;
|
|
176346
|
-
// radius of curvature = aaa / b;
|
|
176347
|
-
// curvature = b/aaa
|
|
176348
|
-
const tol = Geometry.smallAngleRadians;
|
|
176349
|
-
if (aaa > tol * b)
|
|
176350
|
-
return b / aaa;
|
|
176351
|
-
return 0; // hm.. maybe should be infinite?
|
|
176352
|
-
}
|
|
176353
|
-
/** Returns the determinant of 3x3 matrix with x and y rows taken from 3 points, third row from corresponding numbers.
|
|
176354
|
-
*
|
|
176408
|
+
* Returns the determinant of 3x3 matrix with first and second rows created from the 3 xy points and the third
|
|
176409
|
+
* row created from the 3 numbers:
|
|
176410
|
+
* [columnA.x columnB.x columnC.x]
|
|
176411
|
+
* [columnA.y columnB.y columnC.y]
|
|
176412
|
+
* [ weightA weightB weightC ]
|
|
176355
176413
|
*/
|
|
176356
176414
|
static tripleProductXYW(columnA, weightA, columnB, weightB, columnC, weightC) {
|
|
176357
176415
|
return Geometry.tripleProduct(columnA.x, columnB.x, columnC.x, columnA.y, columnB.y, columnC.y, weightA, weightB, weightC);
|
|
176358
176416
|
}
|
|
176359
|
-
/**
|
|
176360
|
-
*
|
|
176417
|
+
/**
|
|
176418
|
+
* Returns the determinant of 3x3 matrix columns created by the given `Point4d` ignoring the z part:
|
|
176419
|
+
* [columnA.x columnB.x columnC.x]
|
|
176420
|
+
* [columnA.y columnB.y columnC.y]
|
|
176421
|
+
* [columnA.w columnB.w columnC.w]
|
|
176361
176422
|
*/
|
|
176362
176423
|
static tripleProductPoint4dXYW(columnA, columnB, columnC) {
|
|
176363
176424
|
return Geometry.tripleProduct(columnA.x, columnB.x, columnC.x, columnA.y, columnB.y, columnC.y, columnA.w, columnB.w, columnC.w);
|
|
176364
176425
|
}
|
|
176365
|
-
/** 2D cross product of vectors
|
|
176426
|
+
/** 2D cross product of vectors with the vectors presented as numbers. */
|
|
176366
176427
|
static crossProductXYXY(ux, uy, vx, vy) {
|
|
176367
176428
|
return ux * vy - uy * vx;
|
|
176368
176429
|
}
|
|
176369
|
-
/** 3D cross product of vectors
|
|
176430
|
+
/** 3D cross product of vectors with the vectors presented as numbers. */
|
|
176370
176431
|
static crossProductXYZXYZ(ux, uy, uz, vx, vy, vz, result) {
|
|
176371
176432
|
return _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Vector3d.create(uy * vz - uz * vy, uz * vx - ux * vz, ux * vy - uy * vx, result);
|
|
176372
176433
|
}
|
|
176373
|
-
/**
|
|
176434
|
+
/** Magnitude of 3D cross product of vectors with the vectors presented as numbers. */
|
|
176374
176435
|
static crossProductMagnitude(ux, uy, uz, vx, vy, vz) {
|
|
176375
176436
|
return Geometry.hypotenuseXYZ(uy * vz - uz * vy, uz * vx - ux * vz, ux * vy - uy * vx);
|
|
176376
176437
|
}
|
|
176377
|
-
/**
|
|
176438
|
+
/** 2D dot product of vectors with the vectors presented as numbers. */
|
|
176439
|
+
static dotProductXYXY(ux, uy, vx, vy) {
|
|
176440
|
+
return ux * vx + uy * vy;
|
|
176441
|
+
}
|
|
176442
|
+
/** 3D dot product of vectors with the vectors presented as numbers. */
|
|
176378
176443
|
static dotProductXYZXYZ(ux, uy, uz, vx, vy, vz) {
|
|
176379
176444
|
return ux * vx + uy * vy + uz * vz;
|
|
176380
176445
|
}
|
|
176381
|
-
/**
|
|
176382
|
-
|
|
176383
|
-
|
|
176446
|
+
/**
|
|
176447
|
+
* Return the mean curvature for two radii.
|
|
176448
|
+
* * Curvature is the reciprocal of radius.
|
|
176449
|
+
* * 0 radius implies 0 curvature.
|
|
176450
|
+
* @param r0 first radius
|
|
176451
|
+
* @param r1 second radius
|
|
176452
|
+
*/
|
|
176453
|
+
static meanCurvatureOfRadii(r0, r1) {
|
|
176454
|
+
return 0.5 * (this.safeDivideFraction(1, r0, 0) + this.safeDivideFraction(1, r1, 0));
|
|
176384
176455
|
}
|
|
176385
176456
|
/**
|
|
176386
|
-
*
|
|
176387
|
-
* *
|
|
176388
|
-
*
|
|
176389
|
-
*
|
|
176390
|
-
* @param
|
|
176457
|
+
* Returns curvature from the first and second derivative vectors.
|
|
176458
|
+
* * If U is the first derivative and V is the second derivative, the curvature is defined as:
|
|
176459
|
+
* * `|| U x V || / || U ||^3`.
|
|
176460
|
+
* * Math details can be found at https://en.wikipedia.org/wiki/Curvature#General_expressions
|
|
176461
|
+
* @param ux first derivative x component
|
|
176462
|
+
* @param uy first derivative y component
|
|
176463
|
+
* @param uz first derivative z component
|
|
176464
|
+
* @param vx second derivative x component
|
|
176465
|
+
* @param vy second derivative y component
|
|
176466
|
+
* @param vz second derivative z component
|
|
176467
|
+
*/
|
|
176468
|
+
static curvatureMagnitude(ux, uy, uz, vx, vy, vz) {
|
|
176469
|
+
let q = uy * vz - uz * vy;
|
|
176470
|
+
let sum = q * q;
|
|
176471
|
+
q = uz * vx - ux * vz;
|
|
176472
|
+
sum += q * q;
|
|
176473
|
+
q = ux * vy - uy * vx;
|
|
176474
|
+
sum += q * q;
|
|
176475
|
+
const magUxV = Math.sqrt(sum);
|
|
176476
|
+
const magU = Math.sqrt(ux * ux + uy * uy + uz * uz);
|
|
176477
|
+
const magUCubed = magU * magU * magU;
|
|
176478
|
+
if (magUCubed > Geometry.smallAngleRadians * magUxV)
|
|
176479
|
+
return magUxV / magUCubed;
|
|
176480
|
+
return 0;
|
|
176481
|
+
}
|
|
176482
|
+
/**
|
|
176483
|
+
* Clamp to (min(a,b), max(a,b)).
|
|
176484
|
+
* * Always returns a number between `a` and `b`.
|
|
176485
|
+
* @param value value to clamp
|
|
176486
|
+
* @param a smallest allowed output if `a < b` or largest allowed output if `a > b`
|
|
176487
|
+
* @param b largest allowed output if `a < b` or smallest allowed output if `a > b`
|
|
176391
176488
|
*/
|
|
176392
|
-
static clampToStartEnd(
|
|
176489
|
+
static clampToStartEnd(value, a, b) {
|
|
176393
176490
|
if (a > b)
|
|
176394
|
-
return Geometry.clampToStartEnd(
|
|
176395
|
-
if (
|
|
176491
|
+
return Geometry.clampToStartEnd(value, b, a);
|
|
176492
|
+
if (value < a)
|
|
176396
176493
|
return a;
|
|
176397
|
-
if (b <
|
|
176494
|
+
if (b < value)
|
|
176398
176495
|
return b;
|
|
176399
|
-
return
|
|
176496
|
+
return value;
|
|
176400
176497
|
}
|
|
176401
176498
|
/**
|
|
176402
|
-
* Clamp value to (min,max) with no test for order of (min,max)
|
|
176499
|
+
* Clamp value to (min, max) with no test for order of (min, max).
|
|
176500
|
+
* * Always returns a number between `min` and `max`.
|
|
176403
176501
|
* @param value value to clamp
|
|
176404
176502
|
* @param min smallest allowed output
|
|
176405
|
-
* @param max largest allowed
|
|
176503
|
+
* @param max largest allowed output
|
|
176406
176504
|
*/
|
|
176407
|
-
static clamp(value, min, max) {
|
|
176408
|
-
|
|
176505
|
+
static clamp(value, min, max) {
|
|
176506
|
+
return Math.max(min, Math.min(max, value));
|
|
176507
|
+
}
|
|
176508
|
+
/** If given a `value`, return it. If given `undefined`, return `defaultValue`. */
|
|
176409
176509
|
static resolveNumber(value, defaultValue = 0) {
|
|
176410
176510
|
return value !== undefined ? value : defaultValue;
|
|
176411
176511
|
}
|
|
176412
|
-
/** If given a value
|
|
176512
|
+
/** If given a `value`, return it. If given `undefined`, return `defaultValue`. */
|
|
176413
176513
|
static resolveValue(value, defaultValue) {
|
|
176414
176514
|
return value !== undefined ? value : defaultValue;
|
|
176415
176515
|
}
|
|
176416
|
-
/** If given value matches
|
|
176516
|
+
/** If given `value` matches the `targetValue`, return `undefined`. Otherwise return the `value`. */
|
|
176417
176517
|
static resolveToUndefined(value, targetValue) {
|
|
176418
176518
|
return value === targetValue ? undefined : value;
|
|
176419
176519
|
}
|
|
176420
176520
|
/**
|
|
176421
|
-
* Simple interpolation between values
|
|
176422
|
-
* point for maximum accuracy.
|
|
176521
|
+
* Simple interpolation between values `a` and `b` with fraction `f`.
|
|
176423
176522
|
* * If `f = 0`, then `a` is returned and if `f = 1`, then `b` is returned.
|
|
176523
|
+
* * For maximum accuracy, we choose `a` or `b` as starting point based on fraction `f`.
|
|
176424
176524
|
*/
|
|
176425
176525
|
static interpolate(a, f, b) {
|
|
176426
176526
|
return f <= 0.5 ? a + f * (b - a) : b - (1.0 - f) * (b - a);
|
|
176427
176527
|
}
|
|
176428
176528
|
/**
|
|
176429
|
-
* Given an axisOrder (e.g. XYZ, YZX, etc) and an index
|
|
176430
|
-
* * For example, if axisOrder = XYZ
|
|
176431
|
-
* Y (or axis
|
|
176432
|
-
*
|
|
176433
|
-
*
|
|
176434
|
-
*
|
|
176435
|
-
*
|
|
176529
|
+
* Given an `axisOrder` (e.g. XYZ, YZX, etc) and an `index`, return the `axis` at the given index.
|
|
176530
|
+
* * For example, if `axisOrder = XYZ`, then for index 0 return `X` (or axis 0), for index 1 return
|
|
176531
|
+
* `Y` (or axis 1), and for index 2 return `Z` (or axis 2).
|
|
176532
|
+
* * Another example: if `axisOrder = ZXY`, then for index 0 return `Z` (or axis 2), for index 1 return
|
|
176533
|
+
* `X` (or axis 0), and for index 2 return `Y` (or axis 1).
|
|
176534
|
+
* * For indexes greater than 2 or smaller than 0, it return cyclic axis. See [[Geometry.cyclic3dAxis]]
|
|
176535
|
+
* for more info.
|
|
176536
|
+
*/
|
|
176436
176537
|
static axisOrderToAxis(order, index) {
|
|
176437
176538
|
const axis = order <= AxisOrder.ZXY ? order + index : (order - AxisOrder.XZY) - index;
|
|
176438
176539
|
return Geometry.cyclic3dAxis(axis);
|
|
176439
176540
|
}
|
|
176440
|
-
/**
|
|
176541
|
+
/**
|
|
176542
|
+
* Return `a` modulo `period`.
|
|
176543
|
+
* * Both `a` and `period` can be negative.
|
|
176544
|
+
* * This function can be faster than the `%` operator for the common case when `p > 0` and `-p < a < 2p`.
|
|
176545
|
+
*/
|
|
176441
176546
|
static modulo(a, period) {
|
|
176547
|
+
// period is negative
|
|
176442
176548
|
if (period <= 0) {
|
|
176443
176549
|
if (period === 0)
|
|
176444
176550
|
return a;
|
|
176445
176551
|
return -Geometry.modulo(-a, -period);
|
|
176446
176552
|
}
|
|
176553
|
+
// period is positive
|
|
176447
176554
|
if (a >= 0) {
|
|
176448
|
-
if (a < period)
|
|
176555
|
+
if (a < period) // "0 < a < period"
|
|
176449
176556
|
return a;
|
|
176450
|
-
if (a < 2 * period)
|
|
176557
|
+
if (a < 2 * period) // "0 < period < a < 2*period"
|
|
176451
176558
|
return a - period;
|
|
176452
176559
|
}
|
|
176453
|
-
else {
|
|
176454
|
-
a += period;
|
|
176560
|
+
else { // "-period < a < 0"
|
|
176561
|
+
a += period;
|
|
176455
176562
|
if (a > 0)
|
|
176456
176563
|
return a;
|
|
176457
176564
|
}
|
|
176565
|
+
// "0 < 2*period < a" or "a < -period < 0"
|
|
176458
176566
|
const m = Math.floor(a / period);
|
|
176459
176567
|
return a - m * period;
|
|
176460
176568
|
}
|
|
176461
|
-
/**
|
|
176462
|
-
static defined01(value) {
|
|
176569
|
+
/** Return 0 if the value is `undefined` and 1 if the value is defined. */
|
|
176570
|
+
static defined01(value) {
|
|
176571
|
+
return value === undefined ? 0 : 1;
|
|
176572
|
+
}
|
|
176463
176573
|
/**
|
|
176464
|
-
* Return `numerator` divided by `denominator
|
|
176574
|
+
* Return `numerator` divided by `denominator`.
|
|
176465
176575
|
* @param numerator the numerator
|
|
176466
176576
|
* @param denominator the denominator
|
|
176467
|
-
* @returns return `numerator/denominator` but if the ratio
|
|
176577
|
+
* @returns return `numerator/denominator` but if the ratio exceeds `Geometry.largeFractionResult`,
|
|
176468
176578
|
* return `undefined`.
|
|
176469
176579
|
*/
|
|
176470
176580
|
static conditionalDivideFraction(numerator, denominator) {
|
|
@@ -176476,76 +176586,105 @@ class Geometry {
|
|
|
176476
176586
|
* Return `numerator` divided by `denominator`.
|
|
176477
176587
|
* @param numerator the numerator
|
|
176478
176588
|
* @param denominator the denominator
|
|
176479
|
-
* @returns return `numerator/denominator` but if the ratio
|
|
176589
|
+
* @returns return `numerator/denominator` but if the ratio exceeds `Geometry.largeFractionResult`,
|
|
176480
176590
|
* return `defaultResult`.
|
|
176481
176591
|
*/
|
|
176482
176592
|
static safeDivideFraction(numerator, denominator, defaultResult) {
|
|
176483
|
-
const
|
|
176484
|
-
if (
|
|
176485
|
-
return
|
|
176593
|
+
const ratio = Geometry.conditionalDivideFraction(numerator, denominator);
|
|
176594
|
+
if (ratio !== undefined)
|
|
176595
|
+
return ratio;
|
|
176486
176596
|
return defaultResult;
|
|
176487
176597
|
}
|
|
176488
176598
|
/**
|
|
176489
|
-
* Return `numerator` divided by `denominator` (with a given `largestResult`)
|
|
176599
|
+
* Return `numerator` divided by `denominator` (with a given `largestResult`).
|
|
176490
176600
|
* @param numerator the numerator
|
|
176491
176601
|
* @param denominator the denominator
|
|
176492
|
-
* @param largestResult the ratio threshold
|
|
176493
|
-
* @returns return `numerator/denominator` but if the ratio
|
|
176602
|
+
* @param largestResult the ratio threshold
|
|
176603
|
+
* @returns return `numerator/denominator` but if the ratio exceeds `largestResult`, return `undefined`.
|
|
176494
176604
|
*/
|
|
176495
176605
|
static conditionalDivideCoordinate(numerator, denominator, largestResult = Geometry.largeCoordinateResult) {
|
|
176496
176606
|
if (Math.abs(denominator * largestResult) > Math.abs(numerator))
|
|
176497
176607
|
return numerator / denominator;
|
|
176498
176608
|
return undefined;
|
|
176499
176609
|
}
|
|
176500
|
-
/**
|
|
176501
|
-
*
|
|
176502
|
-
*
|
|
176610
|
+
/**
|
|
176611
|
+
* Return solution(s) of equation `constCoff + cosCoff*c + sinCoff*s = 0` for `c` and `s` with the
|
|
176612
|
+
* constraint `c*c + s*s = 1`.
|
|
176613
|
+
* * There could be 0, 1, or 2 solutions. Return `undefined` if there is no solution.
|
|
176503
176614
|
*/
|
|
176504
176615
|
static solveTrigForm(constCoff, cosCoff, sinCoff) {
|
|
176505
|
-
|
|
176506
|
-
|
|
176507
|
-
|
|
176508
|
-
|
|
176509
|
-
|
|
176510
|
-
|
|
176511
|
-
|
|
176512
|
-
|
|
176513
|
-
|
|
176514
|
-
|
|
176515
|
-
|
|
176516
|
-
|
|
176517
|
-
|
|
176518
|
-
|
|
176519
|
-
|
|
176520
|
-
|
|
176521
|
-
|
|
176522
|
-
|
|
176523
|
-
|
|
176524
|
-
|
|
176525
|
-
|
|
176526
|
-
|
|
176527
|
-
|
|
176616
|
+
/**
|
|
176617
|
+
* Solutions can be found by finding the intersection of line "ax + by + d = 0" and unit circle "x^2 + y^2 = 1".
|
|
176618
|
+
* From the line equation we have "y = (-ax - d) / b". By replacing this into the circle equation we get
|
|
176619
|
+
* "x^2 + (ax+d)^2/b^2 = 1". If we solve this by quadratic formula we get
|
|
176620
|
+
* x = (-ad +- b*sqrt(a^2+b^2-d^2)) / (a^2+b^2)
|
|
176621
|
+
* y = (-ad -+ a*sqrt(a^2+b^2-d^2)) / (a^2+b^2)
|
|
176622
|
+
*
|
|
176623
|
+
* If "a^2+b^2-d^2 > 0" then there are two solutions (above).
|
|
176624
|
+
* If "a^2+b^2-d^2 = 0" then there is one solution which is (-ad/(a^2+b^2), -bd/(a^2+b^2)).
|
|
176625
|
+
* If "a^2+b^2-d^2 < 0" then there is no solution.
|
|
176626
|
+
*
|
|
176627
|
+
* Below in the code we have "a = cosCoff", "b = sinCoff", and "d = constCoff". Also equivalent criterion
|
|
176628
|
+
* is used in the code. For example, "a^2+b^2-d^2 > 0" is equivalent of "1 - d^2/(a^2+b^2) > 0".
|
|
176629
|
+
*/
|
|
176630
|
+
const a2b2 = cosCoff * cosCoff + sinCoff * sinCoff; // a^2+b^2
|
|
176631
|
+
const d2 = constCoff * constCoff; // d^2
|
|
176632
|
+
let result;
|
|
176633
|
+
if (a2b2 > 0.0) {
|
|
176634
|
+
const a2b2r = 1.0 / a2b2; // 1/(a^2+b^2)
|
|
176635
|
+
const d2a2b2 = d2 * a2b2r; // d^2/(a^2+b^2)
|
|
176636
|
+
const criteria = 1.0 - d2a2b2; // 1 - d^2/(a^2+b^2); the criteria to specify how many solutions we got
|
|
176637
|
+
if (criteria < -Geometry.smallMetricDistanceSquared) // nSolution = 0
|
|
176638
|
+
return result;
|
|
176639
|
+
const da2b2 = -constCoff * a2b2r; // -d/(a^2+b^2)
|
|
176640
|
+
const c0 = da2b2 * cosCoff; // -ad/(a^2+b^2)
|
|
176641
|
+
const s0 = da2b2 * sinCoff; // -bd/(a^2+b^2)
|
|
176642
|
+
if (criteria <= 0.0) { // nSolution = 1 (observed criteria = -2.22e-16 in rotated system)
|
|
176643
|
+
result = [_geometry3d_Point2dVector2d__WEBPACK_IMPORTED_MODULE_1__.Vector2d.create(c0, s0)];
|
|
176644
|
+
}
|
|
176645
|
+
else if (criteria > 0.0) { // nSolution = 2
|
|
176646
|
+
const s = Math.sqrt(criteria * a2b2r); // sqrt(a^2+b^2-d^2)) / (a^2+b^2)
|
|
176647
|
+
result = [
|
|
176648
|
+
_geometry3d_Point2dVector2d__WEBPACK_IMPORTED_MODULE_1__.Vector2d.create(c0 - s * sinCoff, s0 + s * cosCoff),
|
|
176649
|
+
_geometry3d_Point2dVector2d__WEBPACK_IMPORTED_MODULE_1__.Vector2d.create(c0 + s * sinCoff, s0 - s * cosCoff),
|
|
176650
|
+
];
|
|
176528
176651
|
}
|
|
176529
|
-
return result;
|
|
176530
176652
|
}
|
|
176653
|
+
return result;
|
|
176531
176654
|
}
|
|
176532
|
-
/**
|
|
176533
|
-
|
|
176534
|
-
|
|
176535
|
-
|
|
176536
|
-
|
|
176655
|
+
/**
|
|
176656
|
+
* For a line `f(x)` where `f(x0) = f0` and `f(x1) = f1`, return the `x` value at which `f(x) = fTarget`
|
|
176657
|
+
* Return `defaultResult` if `(fTarget - f0) / (f1 - f0)` exceeds `Geometry.largeFractionResult`
|
|
176658
|
+
*/
|
|
176659
|
+
static inverseInterpolate(x0, f0, x1, f1, fTarget = 0, defaultResult) {
|
|
176660
|
+
/**
|
|
176661
|
+
* Line equation is "fTarget-f0 = (f1-f0)/(x1-x0) * (x-x0)" or "(fTarget-f0)/(f1-f0) = (x-x0)/(x1-x0)".
|
|
176662
|
+
* The left hand side is known so if we call it "fr" (short for "fraction") we get "fr = (x-x0)/(x1-x0)".
|
|
176663
|
+
* Therefore, "x = x0*(1-fr) + x1*fr". This is same as interpolation between "x0" and "x1" with fraction "fr".
|
|
176664
|
+
*/
|
|
176665
|
+
const fr = Geometry.conditionalDivideFraction(fTarget - f0, f1 - f0); // (fTarget-f0)/(f1-f0)
|
|
176666
|
+
if (fr !== undefined)
|
|
176667
|
+
return Geometry.interpolate(x0, fr, x1); // x = x0*(1-fr) + x1*fr
|
|
176537
176668
|
return defaultResult;
|
|
176538
176669
|
}
|
|
176539
|
-
/**
|
|
176540
|
-
|
|
176541
|
-
|
|
176670
|
+
/**
|
|
176671
|
+
* For a line `f(x)` where `f(0) = f0` and `f(1) = f1`, return the `x` value at which `f(x) = fTarget`
|
|
176672
|
+
* Return `undefined` if `(fTarget - f0) / (f1 - f0)` exceeds `Geometry.largeFractionResult`
|
|
176673
|
+
*/
|
|
176674
|
+
static inverseInterpolate01(f0, f1, fTarget = 0) {
|
|
176675
|
+
/**
|
|
176676
|
+
* Line equation is "fTarget-f0 = (f1-f0)*x" so "x = (fTarget-f0)/(f1-f0)"
|
|
176677
|
+
*/
|
|
176678
|
+
return Geometry.conditionalDivideFraction(fTarget - f0, f1 - f0); // x = (fTarget-f0)/(f1-f0)
|
|
176542
176679
|
}
|
|
176543
|
-
/**
|
|
176680
|
+
/**
|
|
176681
|
+
* Return `true` if `json` is an array with at least `minEntries` entries and all entries are numbers (including
|
|
176682
|
+
* those beyond minEntries).
|
|
176683
|
+
*/
|
|
176544
176684
|
static isNumberArray(json, minEntries = 0) {
|
|
176545
176685
|
if (Array.isArray(json) && json.length >= minEntries) {
|
|
176546
176686
|
let entry;
|
|
176547
176687
|
for (entry of json) {
|
|
176548
|
-
// if (!(entry as number) && entry !== 0.0)
|
|
176549
176688
|
if (!Number.isFinite(entry))
|
|
176550
176689
|
return false;
|
|
176551
176690
|
}
|
|
@@ -176553,10 +176692,12 @@ class Geometry {
|
|
|
176553
176692
|
}
|
|
176554
176693
|
return false;
|
|
176555
176694
|
}
|
|
176556
|
-
/**
|
|
176695
|
+
/**
|
|
176696
|
+
* Return `true` if `json` is an array of at least `minArrays` arrays with at least `minEntries` entries in
|
|
176697
|
+
* each array and all entries are numbers (including those beyond minEntries).
|
|
176557
176698
|
*/
|
|
176558
|
-
static isArrayOfNumberArray(json,
|
|
176559
|
-
if (Array.isArray(json) && json.length >=
|
|
176699
|
+
static isArrayOfNumberArray(json, minArrays, minEntries = 0) {
|
|
176700
|
+
if (Array.isArray(json) && json.length >= minArrays) {
|
|
176560
176701
|
let entry;
|
|
176561
176702
|
for (entry of json)
|
|
176562
176703
|
if (!Geometry.isNumberArray(entry, minEntries))
|
|
@@ -176565,36 +176706,53 @@ class Geometry {
|
|
|
176565
176706
|
}
|
|
176566
176707
|
return false;
|
|
176567
176708
|
}
|
|
176568
|
-
/**
|
|
176569
|
-
*
|
|
176570
|
-
*
|
|
176571
|
-
|
|
176709
|
+
/**
|
|
176710
|
+
* Return the number of steps to take so that `numSteps * stepSize >= total`.
|
|
176711
|
+
* * `minCount` is returned in the following 3 cases:
|
|
176712
|
+
* * (a) `stepSize <= 0`
|
|
176713
|
+
* * (b) `stepSize >= total`
|
|
176714
|
+
* * (b) `numSteps < minCount`
|
|
176715
|
+
* * `maxCount` is returned if `numSteps > maxCount`.
|
|
176716
|
+
*/
|
|
176572
176717
|
static stepCount(stepSize, total, minCount = 1, maxCount = 101) {
|
|
176573
176718
|
if (stepSize <= 0)
|
|
176574
176719
|
return minCount;
|
|
176575
176720
|
total = Math.abs(total);
|
|
176576
176721
|
if (stepSize >= total)
|
|
176577
176722
|
return minCount;
|
|
176578
|
-
|
|
176579
|
-
|
|
176723
|
+
/**
|
|
176724
|
+
* 0.999999 is multiplied so we return the same "numSteps" if
|
|
176725
|
+
* stepSize*(numSteps-1) < total <= stepSize*numSteps.
|
|
176726
|
+
* For example, if "stepSize = 2" then we return "numSteps = 5" if 8 < total <= 10.
|
|
176727
|
+
*/
|
|
176728
|
+
const numSteps = Math.floor((total + 0.999999 * stepSize) / stepSize);
|
|
176729
|
+
if (numSteps < minCount)
|
|
176580
176730
|
return minCount;
|
|
176581
|
-
if (
|
|
176731
|
+
if (numSteps > maxCount)
|
|
176582
176732
|
return maxCount;
|
|
176583
|
-
return
|
|
176733
|
+
return numSteps;
|
|
176584
176734
|
}
|
|
176585
|
-
/**
|
|
176735
|
+
/**
|
|
176736
|
+
* Test if `x` is in the interval [0,1] (but skip the test if `apply01 = false`).
|
|
176737
|
+
* * This odd behavior is very convenient for code that sometimes does not do the filtering.
|
|
176586
176738
|
* @param x value to test.
|
|
176587
|
-
* @param apply01 if false,
|
|
176739
|
+
* @param apply01 if false, return `true` for all values of `x`.
|
|
176588
176740
|
*/
|
|
176589
|
-
static isIn01(x, apply01 = true) {
|
|
176590
|
-
|
|
176741
|
+
static isIn01(x, apply01 = true) {
|
|
176742
|
+
return apply01 ? x >= 0.0 && x <= 1.0 : true;
|
|
176743
|
+
}
|
|
176744
|
+
/**
|
|
176745
|
+
* Test if `x` is in the interval [0,1] for a given positive `tolerance`.
|
|
176746
|
+
* * Make sure to pass a positive `tolerance` because there is no check for that in the code.
|
|
176591
176747
|
* @param x value to test.
|
|
176592
|
-
* @param
|
|
176748
|
+
* @param tolerance the tolerance.
|
|
176593
176749
|
*/
|
|
176594
|
-
static isIn01WithTolerance(x, tolerance) {
|
|
176750
|
+
static isIn01WithTolerance(x, tolerance) {
|
|
176751
|
+
return x + tolerance >= 0.0 && x - tolerance <= 1.0;
|
|
176752
|
+
}
|
|
176595
176753
|
/**
|
|
176596
|
-
*
|
|
176597
|
-
* @param x
|
|
176754
|
+
* Restrict x so it is in the interval `[a,b]` (allowing `a` and `b` to be in either order).
|
|
176755
|
+
* @param x value to restrict
|
|
176598
176756
|
* @param a (usually the lower) interval limit
|
|
176599
176757
|
* @param b (usually the upper) interval limit
|
|
176600
176758
|
*/
|
|
@@ -176606,7 +176764,7 @@ class Geometry {
|
|
|
176606
176764
|
return b;
|
|
176607
176765
|
return x;
|
|
176608
176766
|
}
|
|
176609
|
-
// reversed interval
|
|
176767
|
+
// reversed interval
|
|
176610
176768
|
if (x < b)
|
|
176611
176769
|
return b;
|
|
176612
176770
|
if (x > a)
|
|
@@ -176615,12 +176773,15 @@ class Geometry {
|
|
|
176615
176773
|
}
|
|
176616
176774
|
/**
|
|
176617
176775
|
* Case-insensitive string comparison.
|
|
176618
|
-
* * Return true if the toUpperCase values match.
|
|
176776
|
+
* * Return `true` if the `toUpperCase` values of `string1` and `string2` match.
|
|
176619
176777
|
*/
|
|
176620
176778
|
static equalStringNoCase(string1, string2) {
|
|
176621
176779
|
return string1.toUpperCase() === string2.toUpperCase();
|
|
176622
176780
|
}
|
|
176623
|
-
/**
|
|
176781
|
+
/**
|
|
176782
|
+
* Test for exact match of two number arrays.
|
|
176783
|
+
* Returns `true` if both arrays have the same length and entries, or if both arrays are empty or `undefined`.
|
|
176784
|
+
*/
|
|
176624
176785
|
static exactEqualNumberArrays(a, b) {
|
|
176625
176786
|
if (Array.isArray(a) && a.length === 0)
|
|
176626
176787
|
a = undefined;
|
|
@@ -176638,7 +176799,10 @@ class Geometry {
|
|
|
176638
176799
|
}
|
|
176639
176800
|
return false;
|
|
176640
176801
|
}
|
|
176641
|
-
/**
|
|
176802
|
+
/**
|
|
176803
|
+
* Test for match of two arrays of type `T`.
|
|
176804
|
+
* Returns `true` if both arrays have the same length and have the same entries (or both are empty arrays).
|
|
176805
|
+
*/
|
|
176642
176806
|
static almostEqualArrays(a, b, testFunction) {
|
|
176643
176807
|
if (Array.isArray(a) && a.length === 0)
|
|
176644
176808
|
a = undefined;
|
|
@@ -176657,7 +176821,10 @@ class Geometry {
|
|
|
176657
176821
|
}
|
|
176658
176822
|
return false;
|
|
176659
176823
|
}
|
|
176660
|
-
/**
|
|
176824
|
+
/**
|
|
176825
|
+
* Test for match of two arrays of type number or Float64Array.
|
|
176826
|
+
* Returns `true` if both arrays have the same length and have the same entries (or both are empty arrays).
|
|
176827
|
+
*/
|
|
176661
176828
|
static almostEqualNumberArrays(a, b, testFunction) {
|
|
176662
176829
|
if (Array.isArray(a) && a.length === 0)
|
|
176663
176830
|
a = undefined;
|
|
@@ -176677,15 +176844,12 @@ class Geometry {
|
|
|
176677
176844
|
return false;
|
|
176678
176845
|
}
|
|
176679
176846
|
/**
|
|
176680
|
-
*
|
|
176681
|
-
* * true if both values are defined and equal (with ===).
|
|
176682
|
-
* * false if both defined by not equal
|
|
176683
|
-
* * return (option arg) resultIfBothUndefined when both are undefined.
|
|
176684
|
-
* * return false if one is defined and the other undefined
|
|
176847
|
+
* Test for match of two values of type `T`.
|
|
176685
176848
|
* @param a first value
|
|
176686
176849
|
* @param b second value
|
|
176687
|
-
* @param resultIfBothUndefined
|
|
176688
|
-
* @returns
|
|
176850
|
+
* @param resultIfBothUndefined returned value when both are `undefined`
|
|
176851
|
+
* @returns `true` if both values are defined and equal (with ===) and `false` if both values are defined
|
|
176852
|
+
* but not equal or if one is defined and the other undefined.
|
|
176689
176853
|
*/
|
|
176690
176854
|
static areEqualAllowUndefined(a, b, resultIfBothUndefined = true) {
|
|
176691
176855
|
if (a === undefined && b === undefined)
|
|
@@ -176694,47 +176858,53 @@ class Geometry {
|
|
|
176694
176858
|
return a === b;
|
|
176695
176859
|
return false;
|
|
176696
176860
|
}
|
|
176697
|
-
/**
|
|
176698
|
-
*
|
|
176699
|
-
|
|
176700
|
-
|
|
176701
|
-
|
|
176861
|
+
/**
|
|
176862
|
+
* Clone an array whose members have type `T`, which implements the clone method.
|
|
176863
|
+
* * If the clone method returns `undefined`, then `undefined` is forced into the cloned array.
|
|
176864
|
+
*/
|
|
176865
|
+
static cloneMembers(array) {
|
|
176866
|
+
if (array === undefined)
|
|
176702
176867
|
return undefined;
|
|
176703
|
-
const
|
|
176704
|
-
for (const
|
|
176705
|
-
|
|
176868
|
+
const clonedArray = [];
|
|
176869
|
+
for (const element of array) {
|
|
176870
|
+
clonedArray.push(element.clone());
|
|
176706
176871
|
}
|
|
176707
|
-
return
|
|
176872
|
+
return clonedArray;
|
|
176708
176873
|
}
|
|
176709
176874
|
}
|
|
176710
|
-
/** Tolerance for small distances in metric coordinates */
|
|
176875
|
+
/** Tolerance for small distances in metric coordinates. */
|
|
176711
176876
|
Geometry.smallMetricDistance = 1.0e-6;
|
|
176712
|
-
/** Square of `
|
|
176877
|
+
/** Square of `smallMetricDistance`. */
|
|
176713
176878
|
Geometry.smallMetricDistanceSquared = 1.0e-12;
|
|
176714
|
-
/**
|
|
176879
|
+
/** Tolerance for small angle measured in radians. */
|
|
176715
176880
|
Geometry.smallAngleRadians = 1.0e-12;
|
|
176716
|
-
/**
|
|
176881
|
+
/** Square of `smallAngleRadians`. */
|
|
176717
176882
|
Geometry.smallAngleRadiansSquared = 1.0e-24;
|
|
176718
|
-
/**
|
|
176883
|
+
/** Tolerance for small angle measured in degrees. */
|
|
176719
176884
|
Geometry.smallAngleDegrees = 5.7e-11;
|
|
176720
|
-
/**
|
|
176885
|
+
/** Tolerance for small angle measured in arc-seconds. */
|
|
176721
176886
|
Geometry.smallAngleSeconds = 2e-7;
|
|
176722
|
-
/**
|
|
176723
|
-
|
|
176887
|
+
/** Numeric value that may be considered zero for fractions between 0 and 1. */
|
|
176888
|
+
Geometry.smallFraction = 1.0e-10;
|
|
176889
|
+
/** Radians value for full circle 2PI radians minus `smallAngleRadians`. */
|
|
176890
|
+
Geometry.fullCircleRadiansMinusSmallAngle = 2.0 * Math.PI - Geometry.smallAngleRadians;
|
|
176891
|
+
/**
|
|
176892
|
+
* Numeric value that may be considered large for a ratio of numbers.
|
|
176893
|
+
* * Note that the allowed result value is vastly larger than 1.
|
|
176724
176894
|
*/
|
|
176725
176895
|
Geometry.largeFractionResult = 1.0e10;
|
|
176726
|
-
/**
|
|
176727
|
-
|
|
176728
|
-
/** numeric value that may considered huge for numbers expected to be coordinates.
|
|
176896
|
+
/**
|
|
176897
|
+
* Numeric value that may considered large for numbers expected to be coordinates.
|
|
176729
176898
|
* * This allows larger results than `largeFractionResult`.
|
|
176730
176899
|
*/
|
|
176731
176900
|
Geometry.largeCoordinateResult = 1.0e13;
|
|
176732
|
-
/**
|
|
176733
|
-
*
|
|
176901
|
+
/**
|
|
176902
|
+
* Numeric value that may considered infinite for metric coordinates.
|
|
176903
|
+
* @deprecated in 4.x. Use `largeCoordinateResult`.
|
|
176904
|
+
* * This coordinate should be used only as a placeholder indicating "at infinity" -- computing actual
|
|
176905
|
+
* points at this coordinate invites numerical problems.
|
|
176734
176906
|
*/
|
|
176735
176907
|
Geometry.hugeCoordinate = 1.0e12;
|
|
176736
|
-
/** Radians value for full circle 2PI radians minus `smallAngleRadians` */
|
|
176737
|
-
Geometry.fullCircleRadiansMinusSmallAngle = 2.0 * Math.PI - 1.0e-12; // smallAngleRadians less than 360degrees
|
|
176738
176908
|
|
|
176739
176909
|
|
|
176740
176910
|
|
|
@@ -185762,17 +185932,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
185762
185932
|
/* harmony export */ "ConvexClipPlaneSet": () => (/* binding */ ConvexClipPlaneSet)
|
|
185763
185933
|
/* harmony export */ });
|
|
185764
185934
|
/* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
|
|
185765
|
-
/* harmony import */ var _geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../geometry3d/Plane3dByOriginAndUnitNormal */ "../../core/geometry/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js");
|
|
185766
185935
|
/* harmony import */ var _geometry3d_GrowableFloat64Array__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../geometry3d/GrowableFloat64Array */ "../../core/geometry/lib/esm/geometry3d/GrowableFloat64Array.js");
|
|
185767
185936
|
/* harmony import */ var _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geometry3d/GrowableXYZArray */ "../../core/geometry/lib/esm/geometry3d/GrowableXYZArray.js");
|
|
185768
185937
|
/* harmony import */ var _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geometry3d/Matrix3d */ "../../core/geometry/lib/esm/geometry3d/Matrix3d.js");
|
|
185938
|
+
/* harmony import */ var _geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../geometry3d/Plane3dByOriginAndUnitNormal */ "../../core/geometry/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js");
|
|
185769
185939
|
/* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
|
|
185770
185940
|
/* harmony import */ var _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geometry3d/PolygonOps */ "../../core/geometry/lib/esm/geometry3d/PolygonOps.js");
|
|
185771
185941
|
/* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
|
|
185772
|
-
/* harmony import */ var _ClipPlane__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ClipPlane */ "../../core/geometry/lib/esm/clipping/ClipPlane.js");
|
|
185773
|
-
/* harmony import */ var _ClipUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ClipUtils */ "../../core/geometry/lib/esm/clipping/ClipUtils.js");
|
|
185774
185942
|
/* harmony import */ var _polyface_Polyface__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../polyface/Polyface */ "../../core/geometry/lib/esm/polyface/Polyface.js");
|
|
185775
185943
|
/* harmony import */ var _polyface_PolyfaceQuery__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../polyface/PolyfaceQuery */ "../../core/geometry/lib/esm/polyface/PolyfaceQuery.js");
|
|
185944
|
+
/* harmony import */ var _ClipPlane__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ClipPlane */ "../../core/geometry/lib/esm/clipping/ClipPlane.js");
|
|
185945
|
+
/* harmony import */ var _ClipUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ClipUtils */ "../../core/geometry/lib/esm/clipping/ClipUtils.js");
|
|
185776
185946
|
/*---------------------------------------------------------------------------------------------
|
|
185777
185947
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
185778
185948
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -185997,17 +186167,19 @@ class ConvexClipPlaneSet {
|
|
|
185997
186167
|
get planes() {
|
|
185998
186168
|
return this._planes;
|
|
185999
186169
|
}
|
|
186000
|
-
/**
|
|
186170
|
+
/**
|
|
186171
|
+
* Test if there is any intersection with a ray defined by origin and direction.
|
|
186001
186172
|
* * Optionally record the range (null or otherwise) in caller-allocated result.
|
|
186002
|
-
* * If the ray is unbounded inside the clip, result can contain positive or negative
|
|
186173
|
+
* * If the ray is unbounded inside the clip, result can contain positive or negative
|
|
186174
|
+
* "Geometry.largeCoordinateResult" values
|
|
186003
186175
|
* * If no result is provide, there are no object allocations.
|
|
186004
186176
|
* @param result optional Range1d to receive parameters along the ray.
|
|
186005
186177
|
*/
|
|
186006
186178
|
hasIntersectionWithRay(ray, result, tolerance = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.smallMetricDistance) {
|
|
186007
186179
|
// form low and high values in locals that do not require allocation.
|
|
186008
186180
|
// transfer to caller-supplied result at end
|
|
186009
|
-
let t0 = -_Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.
|
|
186010
|
-
let t1 = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.
|
|
186181
|
+
let t0 = -_Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.largeCoordinateResult;
|
|
186182
|
+
let t1 = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.largeCoordinateResult;
|
|
186011
186183
|
if (result)
|
|
186012
186184
|
result.setNull();
|
|
186013
186185
|
const velocityTolerance = 1.0e-13;
|
|
@@ -186618,9 +186790,11 @@ class UnionOfConvexClipPlaneSets {
|
|
|
186618
186790
|
if (toAdd)
|
|
186619
186791
|
this._convexSets.push(toAdd);
|
|
186620
186792
|
}
|
|
186621
|
-
/**
|
|
186793
|
+
/**
|
|
186794
|
+
* Test if there is any intersection with a ray defined by origin and direction.
|
|
186622
186795
|
* * Optionally record the range (null or otherwise) in caller-allocated result.
|
|
186623
|
-
* * If the ray is unbounded inside the clip, result can contain positive or negative
|
|
186796
|
+
* * If the ray is unbounded inside the clip, result can contain positive or negative
|
|
186797
|
+
* "Geometry.largeCoordinateResult" values
|
|
186624
186798
|
* * If no result is provide, there are no object allocations.
|
|
186625
186799
|
* @param maximalRange optional Range1d to receive parameters along the ray.
|
|
186626
186800
|
*/
|
|
@@ -214784,32 +214958,40 @@ class Plane3dByOriginAndUnitNormal extends _Plane3d__WEBPACK_IMPORTED_MODULE_0__
|
|
|
214784
214958
|
return Plane3dByOriginAndUnitNormal._create(origin.x, origin.y, origin.z, 0, 1, 0);
|
|
214785
214959
|
return Plane3dByOriginAndUnitNormal._create(0, 0, 0, 0, 1, 0);
|
|
214786
214960
|
}
|
|
214787
|
-
/**
|
|
214961
|
+
/** Create a new Plane3dByOriginAndUnitNormal with given origin and normal.
|
|
214788
214962
|
* * The inputs are NOT captured.
|
|
214789
|
-
* * Returns undefined if
|
|
214963
|
+
* * Returns undefined if `normal.normalize()` returns undefined.
|
|
214790
214964
|
*/
|
|
214791
214965
|
static create(origin, normal, result) {
|
|
214792
|
-
const normalized = normal.normalize();
|
|
214793
|
-
if (!normalized)
|
|
214794
|
-
return undefined;
|
|
214795
214966
|
if (result) {
|
|
214796
|
-
result.
|
|
214967
|
+
if (normal.normalize(result._normal) === undefined)
|
|
214968
|
+
return undefined;
|
|
214969
|
+
origin.clone(result._origin);
|
|
214797
214970
|
return result;
|
|
214798
214971
|
}
|
|
214972
|
+
const normalized = normal.normalize();
|
|
214973
|
+
if (normalized === undefined)
|
|
214974
|
+
return undefined;
|
|
214799
214975
|
return new Plane3dByOriginAndUnitNormal(origin.clone(), normalized);
|
|
214800
214976
|
}
|
|
214801
|
-
/**
|
|
214977
|
+
/** Create a new Plane3dByOriginAndUnitNormal from a variety of plane types.
|
|
214802
214978
|
* * The inputs are NOT captured.
|
|
214803
|
-
* * Returns undefined if
|
|
214979
|
+
* * Returns undefined if `source.getUnitNormal()` returns undefined.
|
|
214804
214980
|
*/
|
|
214805
214981
|
static createFrom(source, result) {
|
|
214806
214982
|
if (source instanceof Plane3dByOriginAndUnitNormal)
|
|
214807
214983
|
return source.clone(result);
|
|
214984
|
+
if (result) {
|
|
214985
|
+
if (source.getUnitNormal(result._normal) === undefined)
|
|
214986
|
+
return undefined;
|
|
214987
|
+
source.getAnyPointOnPlane(result._origin);
|
|
214988
|
+
return result;
|
|
214989
|
+
}
|
|
214808
214990
|
const normal = source.getUnitNormal();
|
|
214809
214991
|
if (normal === undefined)
|
|
214810
214992
|
return undefined;
|
|
214811
214993
|
const origin = source.getAnyPointOnPlane();
|
|
214812
|
-
return
|
|
214994
|
+
return new Plane3dByOriginAndUnitNormal(origin, normal);
|
|
214813
214995
|
}
|
|
214814
214996
|
/** create a new Plane3dByOriginAndUnitNormal with direct coordinates of origin and normal.
|
|
214815
214997
|
* * Returns undefined if the normal vector is all zeros.
|
|
@@ -215968,7 +216150,7 @@ class Vector2d extends XY {
|
|
|
215968
216150
|
}
|
|
215969
216151
|
/** Return a unit vector in direction of this instance (undefined if this instance has near zero length) */
|
|
215970
216152
|
normalize(result) {
|
|
215971
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.
|
|
216153
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.correctSmallFraction(this.magnitude());
|
|
215972
216154
|
result = result ? result : new Vector2d();
|
|
215973
216155
|
return this.safeDivideOrNull(mag, result);
|
|
215974
216156
|
}
|
|
@@ -216113,7 +216295,7 @@ class Vector2d extends XY {
|
|
|
216113
216295
|
}
|
|
216114
216296
|
/** Return a vector parallel to this but with specified length */
|
|
216115
216297
|
scaleToLength(length, result) {
|
|
216116
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.
|
|
216298
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.correctSmallFraction(this.magnitude());
|
|
216117
216299
|
if (mag === 0)
|
|
216118
216300
|
return undefined;
|
|
216119
216301
|
return this.scale(length / mag, result);
|
|
@@ -217308,7 +217490,12 @@ class Vector3d extends XYZ {
|
|
|
217308
217490
|
static unitZ(scale = 1) {
|
|
217309
217491
|
return new Vector3d(0, 0, scale);
|
|
217310
217492
|
}
|
|
217311
|
-
/**
|
|
217493
|
+
/**
|
|
217494
|
+
* Scale the instance by 1.0/`denominator`.
|
|
217495
|
+
* @param denominator number by which to divide the coordinates of this instance
|
|
217496
|
+
* @param result optional pre-allocated object to return
|
|
217497
|
+
* @return scaled vector, or undefined if `denominator` is exactly zero (in which case instance is untouched).
|
|
217498
|
+
*/
|
|
217312
217499
|
safeDivideOrNull(denominator, result) {
|
|
217313
217500
|
if (denominator !== 0.0) {
|
|
217314
217501
|
return this.scale(1.0 / denominator, result);
|
|
@@ -217316,15 +217503,17 @@ class Vector3d extends XYZ {
|
|
|
217316
217503
|
return undefined;
|
|
217317
217504
|
}
|
|
217318
217505
|
/**
|
|
217319
|
-
* Return a
|
|
217320
|
-
*
|
|
217321
|
-
*
|
|
217322
|
-
*
|
|
217506
|
+
* Return a normalized instance and instance length.
|
|
217507
|
+
* @param result optional pre-allocated object to return as `v` property
|
|
217508
|
+
* @returns object containing the properties:
|
|
217509
|
+
* * `v`: unit vector in the direction of the instance, or undefined if `mag` is near zero
|
|
217510
|
+
* * `mag`: length of the instance prior to normalization
|
|
217323
217511
|
*/
|
|
217324
217512
|
normalizeWithLength(result) {
|
|
217325
|
-
const
|
|
217513
|
+
const originalMagnitude = this.magnitude();
|
|
217514
|
+
const correctedMagnitude = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.correctSmallFraction(originalMagnitude);
|
|
217326
217515
|
result = result ? result : new Vector3d();
|
|
217327
|
-
return { v: this.safeDivideOrNull(
|
|
217516
|
+
return { v: this.safeDivideOrNull(correctedMagnitude, result), mag: originalMagnitude };
|
|
217328
217517
|
}
|
|
217329
217518
|
/**
|
|
217330
217519
|
* Return a unit vector parallel with this. Return undefined if this.magnitude is near zero.
|
|
@@ -217335,16 +217524,10 @@ class Vector3d extends XYZ {
|
|
|
217335
217524
|
}
|
|
217336
217525
|
/**
|
|
217337
217526
|
* If this vector has nonzero length, divide by the length to change to a unit vector.
|
|
217338
|
-
* @returns true if normalization
|
|
217527
|
+
* @returns true if normalization was successful
|
|
217339
217528
|
*/
|
|
217340
217529
|
normalizeInPlace() {
|
|
217341
|
-
|
|
217342
|
-
if (a === undefined)
|
|
217343
|
-
return false;
|
|
217344
|
-
this.x *= a;
|
|
217345
|
-
this.y *= a;
|
|
217346
|
-
this.z *= a;
|
|
217347
|
-
return true;
|
|
217530
|
+
return this.normalizeWithLength(this).v !== undefined;
|
|
217348
217531
|
}
|
|
217349
217532
|
/**
|
|
217350
217533
|
* Create a normalized vector from the inputs.
|
|
@@ -217364,7 +217547,7 @@ class Vector3d extends XYZ {
|
|
|
217364
217547
|
* Return fractional projection of this vector on the target vector.
|
|
217365
217548
|
* * It's returning the signed projection magnitude divided by the target magnitude.
|
|
217366
217549
|
* * To find the projection vector, scale the target vector by the value that this function is returning.
|
|
217367
|
-
* *
|
|
217550
|
+
* * Math details can be found at docs/learning/geometry/PointVector.md
|
|
217368
217551
|
* * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnVector
|
|
217369
217552
|
* and https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnPlane
|
|
217370
217553
|
* @param target the target vector
|
|
@@ -217579,7 +217762,7 @@ class Vector3d extends XYZ {
|
|
|
217579
217762
|
* @param result optional preallocated result
|
|
217580
217763
|
*/
|
|
217581
217764
|
scaleToLength(length, result) {
|
|
217582
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.
|
|
217765
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.correctSmallFraction(this.magnitude());
|
|
217583
217766
|
if (mag === 0)
|
|
217584
217767
|
return undefined;
|
|
217585
217768
|
return this.scale(length / mag, result);
|
|
@@ -217630,7 +217813,7 @@ class Vector3d extends XYZ {
|
|
|
217630
217813
|
* @param smallestMagnitude smallest magnitude allowed as divisor.
|
|
217631
217814
|
* @returns false if magnitude is too small. In this case the vector is unchanged.
|
|
217632
217815
|
*/
|
|
217633
|
-
tryNormalizeInPlace(smallestMagnitude = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.
|
|
217816
|
+
tryNormalizeInPlace(smallestMagnitude = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallFraction) {
|
|
217634
217817
|
const a = this.magnitude();
|
|
217635
217818
|
if (a < smallestMagnitude || a === 0.0)
|
|
217636
217819
|
return false;
|
|
@@ -226411,7 +226594,6 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
226411
226594
|
*/
|
|
226412
226595
|
static createPlaneFrom(source) {
|
|
226413
226596
|
return new Point4d(source.normalX(), source.normalY(), source.normalZ(), source.altitudeXYZ(0, 0, 0));
|
|
226414
|
-
return undefined;
|
|
226415
226597
|
}
|
|
226416
226598
|
/** Copy coordinates from `other`. */
|
|
226417
226599
|
setFrom(other) {
|
|
@@ -226554,7 +226736,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
226554
226736
|
* * other structure with members x,y and optional z,w
|
|
226555
226737
|
* * array of numbers
|
|
226556
226738
|
* * default z is 0.0
|
|
226557
|
-
* * default
|
|
226739
|
+
* * default w is 1.0 (array[3] can replace)
|
|
226558
226740
|
*/
|
|
226559
226741
|
static createFromPoint(point) {
|
|
226560
226742
|
if (point instanceof _geometry3d_Point2dVector2d__WEBPACK_IMPORTED_MODULE_3__.Point2d)
|
|
@@ -226571,10 +226753,10 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
226571
226753
|
const w1 = point.length > 3 ? point[3] : 1.0;
|
|
226572
226754
|
return new Point4d(x1, y1, z1, w1);
|
|
226573
226755
|
}
|
|
226574
|
-
const x = point.
|
|
226575
|
-
const y = point.
|
|
226756
|
+
const x = point.x;
|
|
226757
|
+
const y = point.y;
|
|
226576
226758
|
const z = point.hasOwnProperty("z") ? point.z : 0.0;
|
|
226577
|
-
const w = point.hasOwnProperty("w") ? point.w :
|
|
226759
|
+
const w = point.hasOwnProperty("w") ? point.w : 1.0;
|
|
226578
226760
|
return new Point4d(x, y, z, w);
|
|
226579
226761
|
}
|
|
226580
226762
|
/** Return `point + vector * scalar` */
|
|
@@ -226701,7 +226883,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
226701
226883
|
* @param result optional result
|
|
226702
226884
|
*/
|
|
226703
226885
|
normalizeWeight(result) {
|
|
226704
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.
|
|
226886
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.correctSmallFraction(this.xyzw[3]);
|
|
226705
226887
|
result = result ? result : new Point4d();
|
|
226706
226888
|
return this.safeDivideOrNull(mag, result);
|
|
226707
226889
|
}
|
|
@@ -226711,7 +226893,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
226711
226893
|
* @param result optional result
|
|
226712
226894
|
*/
|
|
226713
226895
|
realPoint(result) {
|
|
226714
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.
|
|
226896
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.correctSmallFraction(this.xyzw[3]);
|
|
226715
226897
|
if (mag === 0.0)
|
|
226716
226898
|
return undefined;
|
|
226717
226899
|
const a = 1.0 / mag; // in zero case everything multiplies right back to true zero.
|
|
@@ -226722,7 +226904,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
226722
226904
|
* * If `this.w` is zero, return a Vector3d `(x,y,z)`
|
|
226723
226905
|
*/
|
|
226724
226906
|
realPointOrVector() {
|
|
226725
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.
|
|
226907
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.correctSmallFraction(this.xyzw[3]);
|
|
226726
226908
|
if (mag === 0.0)
|
|
226727
226909
|
return _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.create(this.x, this.y, this.z);
|
|
226728
226910
|
const a = 1.0 / mag; // in zero case everything multiplies right back to true zero.
|
|
@@ -226738,7 +226920,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
226738
226920
|
* @param result optional result
|
|
226739
226921
|
*/
|
|
226740
226922
|
static createRealPoint3dDefault000(x, y, z, w, result) {
|
|
226741
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.
|
|
226923
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.correctSmallFraction(w);
|
|
226742
226924
|
const a = mag === 0 ? 0.0 : (1.0 / mag); // in zero case everything multiplies right back to true zero.
|
|
226743
226925
|
return _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Point3d.create(x * a, y * a, z * a, result);
|
|
226744
226926
|
}
|
|
@@ -226756,7 +226938,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
226756
226938
|
* @param result optional result
|
|
226757
226939
|
*/
|
|
226758
226940
|
static createRealDerivativeRay3dDefault000(x, y, z, w, dx, dy, dz, dw, result) {
|
|
226759
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.
|
|
226941
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.correctSmallFraction(w);
|
|
226760
226942
|
// real point is X/w.
|
|
226761
226943
|
// real derivative is (X' * w - X *w) / ww, and weight is always 0 by cross products.
|
|
226762
226944
|
const a = mag === 0 ? 0.0 : (1.0 / mag); // in zero case everything multiplies right back to true zero.
|
|
@@ -226777,7 +226959,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
226777
226959
|
* @param result optional result
|
|
226778
226960
|
*/
|
|
226779
226961
|
static createRealDerivativePlane3dByOriginAndVectorsDefault000(x, y, z, w, dx, dy, dz, dw, ddx, ddy, ddz, ddw, result) {
|
|
226780
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.
|
|
226962
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.correctSmallFraction(w);
|
|
226781
226963
|
// real point is X/w.
|
|
226782
226964
|
// real derivative is (X' * w - X *w) / ww, and weight is always 0 by cross products.
|
|
226783
226965
|
const a = mag === 0 ? 0.0 : (1.0 / mag); // in zero case everything multiplies right back to true zero.
|
|
@@ -226795,7 +226977,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
226795
226977
|
* * If this.w is zero, return 000
|
|
226796
226978
|
*/
|
|
226797
226979
|
realPointDefault000(result) {
|
|
226798
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.
|
|
226980
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.correctSmallFraction(this.xyzw[3]);
|
|
226799
226981
|
if (mag === 0.0)
|
|
226800
226982
|
return _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Point3d.create(0, 0, 0, result);
|
|
226801
226983
|
result = result ? result : new _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Point3d();
|
|
@@ -226808,7 +226990,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
|
|
|
226808
226990
|
* * Use normalizeWeight to divide by the w component.
|
|
226809
226991
|
*/
|
|
226810
226992
|
normalizeXYZW(result) {
|
|
226811
|
-
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.
|
|
226993
|
+
const mag = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.correctSmallFraction(this.magnitudeXYZW());
|
|
226812
226994
|
result = result ? result : new Point4d();
|
|
226813
226995
|
return this.safeDivideOrNull(mag, result);
|
|
226814
226996
|
}
|
|
@@ -281434,7 +281616,7 @@ class TestContext {
|
|
|
281434
281616
|
this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
|
|
281435
281617
|
const iModelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${process.env.IMJS_URL_PREFIX ?? ""}api.bentley.com/imodels` } });
|
|
281436
281618
|
await core_frontend_1.NoRenderApp.startup({
|
|
281437
|
-
applicationVersion: "4.0.0-dev.
|
|
281619
|
+
applicationVersion: "4.0.0-dev.68",
|
|
281438
281620
|
applicationId: this.settings.gprid,
|
|
281439
281621
|
authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.adminUserAccessToken),
|
|
281440
281622
|
hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),
|
|
@@ -301007,7 +301189,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
|
|
|
301007
301189
|
/***/ ((module) => {
|
|
301008
301190
|
|
|
301009
301191
|
"use strict";
|
|
301010
|
-
module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"4.0.0-dev.
|
|
301192
|
+
module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"4.0.0-dev.68","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 && 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 \\"./node_modules/@itwin/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.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:^4.0.0-dev.68","@itwin/core-bentley":"workspace:^4.0.0-dev.68","@itwin/core-common":"workspace:^4.0.0-dev.68","@itwin/core-geometry":"workspace:^4.0.0-dev.68","@itwin/core-orbitgt":"workspace:^4.0.0-dev.68","@itwin/core-quantity":"workspace:^4.0.0-dev.68"},"//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":"^4.0.0-dev.32","@itwin/webgl-compatibility":"workspace:*","@types/chai":"4.3.1","@types/chai-as-promised":"^7","@types/deep-assign":"^0.1.0","@types/mocha":"^8.2.2","@types/node":"^18.11.5","@types/qs":"^6.5.0","@types/semver":"7.3.10","@types/superagent":"^4.1.14","@types/sinon":"^9.0.0","babel-loader":"~8.2.5","babel-plugin-istanbul":"~6.1.1","chai":"^4.1.2","chai-as-promised":"^7","cpx2":"^3.0.0","eslint":"^7.11.0","glob":"^7.1.2","mocha":"^10.0.0","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^9.0.2","source-map-loader":"^4.0.0","typescript":"~5.0.2","webpack":"^5.76.0"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/object-storage-azure":"^1.5.0","@itwin/cloud-agnostic-core":"^1.5.0","@itwin/object-storage-core":"^1.5.0","@itwin/core-i18n":"workspace:*","@itwin/core-telemetry":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","deep-assign":"^2.0.0","fuse.js":"^3.3.0","qs":"^6.5.3","semver":"^7.3.5","superagent":"^7.1.5","wms-capabilities":"0.4.0","reflect-metadata":"0.1.13"},"nyc":{"extends":"./node_modules/@itwin/build-tools/.nycrc"},"eslintConfig":{"plugins":["@itwin"],"extends":"plugin:@itwin/itwinjs-recommended","rules":{"@itwin/no-internal-barrel-imports":["error",{"required-barrel-modules":["./src/tile/internal.ts"]}],"@itwin/public-extension-exports":["error",{"releaseTags":["public","preview"],"outputApiFile":false}]},"overrides":[{"files":["*.test.ts","*.test.tsx","**/test/**/*.ts"],"rules":{"@itwin/no-internal-barrel-imports":"off"}}]}}');
|
|
301011
301193
|
|
|
301012
301194
|
/***/ }),
|
|
301013
301195
|
|