@ohif/app 3.14.0-beta.71 → 3.14.0-beta.73

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.
Files changed (44) hide show
  1. package/dist/{8199.bundle.25557805.js → 1153.bundle.efd8a415.js} +4482 -731
  2. package/dist/{1566.bundle.e9f5d851.js → 1566.bundle.d58db206.js} +47 -9
  3. package/dist/{1645.bundle.618a2886.js → 1645.bundle.a8ee81ea.js} +82 -46
  4. package/dist/{1793.bundle.7b6d510f.js → 1793.bundle.27458a55.js} +2 -2
  5. package/dist/{1862.bundle.10bed54a.js → 1862.bundle.79bfe469.js} +1 -1
  6. package/dist/{2717.bundle.4167aa16.js → 2717.bundle.e4bad54f.js} +2 -2
  7. package/dist/{2748.bundle.a90b290d.js → 2748.bundle.eaa94e2e.js} +0 -805
  8. package/dist/{3004.bundle.cbd2e499.js → 3004.bundle.c6734d77.js} +2 -2
  9. package/dist/3723.bundle.eab70100.js +808 -0
  10. package/dist/{3771.bundle.1c9e74f3.js → 3771.bundle.6cb07c14.js} +2 -2
  11. package/dist/{3044.bundle.039294b9.js → 4449.bundle.3e4b07e6.js} +1067 -85
  12. package/dist/{4606.bundle.05282205.js → 4606.bundle.a2a1aa34.js} +1 -1
  13. package/dist/{5076.bundle.157252dd.js → 5076.bundle.95c07142.js} +50 -8
  14. package/dist/{5143.bundle.67167d39.js → 5143.bundle.2ea0b15d.js} +1211 -176
  15. package/dist/{5320.bundle.0c7b2cb7.js → 5320.bundle.335efd86.js} +263 -235
  16. package/dist/{5914.bundle.00f408d2.js → 5914.bundle.f6e9fc4a.js} +37 -9
  17. package/dist/{5989.bundle.f8096a4e.js → 5989.bundle.2999d206.js} +336 -256
  18. package/dist/{1283.bundle.f2c2bb56.js → 6133.bundle.d4f7403f.js} +7802 -504
  19. package/dist/{3386.bundle.61e687a7.js → 6289.bundle.2795699d.js} +107 -29
  20. package/dist/{4018.bundle.48c288e5.js → 6847.bundle.5a087332.js} +59 -9
  21. package/dist/{7604.bundle.2d399cf0.js → 7604.bundle.e703a54d.js} +1 -1
  22. package/dist/{7464.bundle.492c83ce.js → 8037.bundle.8b5f4114.js} +4148 -1047
  23. package/dist/{1724.bundle.59b20c59.js → 8699.bundle.024fb1bc.js} +480 -87
  24. package/dist/{9187.bundle.237037e4.js → 9187.bundle.7d18bb1c.js} +4 -4
  25. package/dist/{9481.bundle.027aa5ca.js → 9481.bundle.f443c81b.js} +4 -4
  26. package/dist/{9620.bundle.67375c83.js → 9620.bundle.24273cf3.js} +4 -4
  27. package/dist/{9886.bundle.5c1ff898.js → 9886.bundle.cabb4a24.js} +2 -2
  28. package/dist/{9892.bundle.8c1ccb0e.js → 9892.bundle.9bc28476.js} +5 -5
  29. package/dist/{9948.bundle.29548cec.js → 9948.bundle.b4ff610d.js} +2 -2
  30. package/dist/app-config.js +2 -0
  31. package/dist/{app.bundle.7ff9e2bc.js → app.bundle.220fbf72.js} +40 -37
  32. package/dist/{compute.bundle.79a2d455.js → compute.bundle.19cf1283.js} +10 -10
  33. package/dist/customizations/gpu/high-texture-4096.jsonc +9 -0
  34. package/dist/customizations/gpu/high.jsonc +8 -0
  35. package/dist/customizations/gpu/low-tablet.jsonc +7 -0
  36. package/dist/customizations/gpu/low.jsonc +7 -0
  37. package/dist/customizations/gpu/medium.jsonc +7 -0
  38. package/dist/customizations/index.html +39 -0
  39. package/dist/{histogram-worker.bundle.a8bb873a.js → histogram-worker.bundle.58e60d7c.js} +4 -4
  40. package/dist/index.html +1 -1
  41. package/dist/{interpolation.bundle.302d242b.js → interpolation.bundle.7b3850e6.js} +7 -7
  42. package/dist/{polySeg.bundle.aaf002b1.js → polySeg.bundle.157e1e17.js} +11 -11
  43. package/dist/sw.js +1 -1
  44. package/package.json +6 -6
@@ -2753,811 +2753,6 @@ __webpack_require__.d(__webpack_exports__, {
2753
2753
  });
2754
2754
 
2755
2755
 
2756
- },
2757
- 28710(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
2758
- "use strict";
2759
- /* import */ var _Core_Math_js__rspack_import_0 = __webpack_require__(90655);
2760
- /* import */ var _Plane_js__rspack_import_1 = __webpack_require__(98281);
2761
- /* import */ var gl_matrix__rspack_import_2 = __webpack_require__(50341);
2762
-
2763
-
2764
-
2765
- //#region Sources/Common/DataModel/BoundingBox/index.js
2766
- var INIT_BOUNDS = [
2767
- Number.MAX_VALUE,
2768
- -Number.MAX_VALUE,
2769
- Number.MAX_VALUE,
2770
- -Number.MAX_VALUE,
2771
- Number.MAX_VALUE,
2772
- -Number.MAX_VALUE
2773
- ];
2774
- function equals(a, b) {
2775
- return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5];
2776
- }
2777
- function isValid(bounds) {
2778
- return bounds?.length >= 6 && bounds[0] <= bounds[1] && bounds[2] <= bounds[3] && bounds[4] <= bounds[5];
2779
- }
2780
- function setBounds(bounds, otherBounds) {
2781
- bounds[0] = otherBounds[0];
2782
- bounds[1] = otherBounds[1];
2783
- bounds[2] = otherBounds[2];
2784
- bounds[3] = otherBounds[3];
2785
- bounds[4] = otherBounds[4];
2786
- bounds[5] = otherBounds[5];
2787
- return bounds;
2788
- }
2789
- function reset(bounds) {
2790
- return setBounds(bounds, INIT_BOUNDS);
2791
- }
2792
- function addPoint(bounds, xOrPoint, y, z) {
2793
- const [xMin, xMax, yMin, yMax, zMin, zMax] = bounds;
2794
- if (typeof xOrPoint === "number") {
2795
- bounds[0] = xMin < xOrPoint ? xMin : xOrPoint;
2796
- bounds[1] = xMax > xOrPoint ? xMax : xOrPoint;
2797
- bounds[2] = yMin < y ? yMin : y;
2798
- bounds[3] = yMax > y ? yMax : y;
2799
- bounds[4] = zMin < z ? zMin : z;
2800
- bounds[5] = zMax > z ? zMax : z;
2801
- } else {
2802
- bounds[0] = xMin < xOrPoint[0] ? xMin : xOrPoint[0];
2803
- bounds[1] = xMax > xOrPoint[0] ? xMax : xOrPoint[0];
2804
- bounds[2] = yMin < xOrPoint[1] ? yMin : xOrPoint[1];
2805
- bounds[3] = yMax > xOrPoint[1] ? yMax : xOrPoint[1];
2806
- bounds[4] = zMin < xOrPoint[2] ? zMin : xOrPoint[2];
2807
- bounds[5] = zMax > xOrPoint[2] ? zMax : xOrPoint[2];
2808
- }
2809
- return bounds;
2810
- }
2811
- function addPoints(bounds, points) {
2812
- if (points.length === 0) return bounds;
2813
- if (Array.isArray(points[0])) for (let i = 0; i < points.length; ++i) addPoint(bounds, ...points[i]);
2814
- else for (let i = 0; i < points.length; i += 3) addPoint(bounds, ...points.slice(i, i + 3));
2815
- return bounds;
2816
- }
2817
- function addBounds(bounds, xMin, xMax, yMin, yMax, zMin, zMax) {
2818
- const [_xMin, _xMax, _yMin, _yMax, _zMin, _zMax] = bounds;
2819
- if (zMax === void 0) {
2820
- bounds[0] = Math.min(xMin[0], _xMin);
2821
- bounds[1] = Math.max(xMin[1], _xMax);
2822
- bounds[2] = Math.min(xMin[2], _yMin);
2823
- bounds[3] = Math.max(xMin[3], _yMax);
2824
- bounds[4] = Math.min(xMin[4], _zMin);
2825
- bounds[5] = Math.max(xMin[5], _zMax);
2826
- } else {
2827
- bounds[0] = Math.min(xMin, _xMin);
2828
- bounds[1] = Math.max(xMax, _xMax);
2829
- bounds[2] = Math.min(yMin, _yMin);
2830
- bounds[3] = Math.max(yMax, _yMax);
2831
- bounds[4] = Math.min(zMin, _zMin);
2832
- bounds[5] = Math.max(zMax, _zMax);
2833
- }
2834
- return bounds;
2835
- }
2836
- function setMinPoint(bounds, x, y, z) {
2837
- const [xMin, xMax, yMin, yMax, zMin, zMax] = bounds;
2838
- bounds[0] = x;
2839
- bounds[1] = x > xMax ? x : xMax;
2840
- bounds[2] = y;
2841
- bounds[3] = y > yMax ? y : yMax;
2842
- bounds[4] = z;
2843
- bounds[5] = z > zMax ? z : zMax;
2844
- return xMin !== x || yMin !== y || zMin !== z;
2845
- }
2846
- function setMaxPoint(bounds, x, y, z) {
2847
- const [xMin, xMax, yMin, yMax, zMin, zMax] = bounds;
2848
- bounds[0] = x < xMin ? x : xMin;
2849
- bounds[1] = x;
2850
- bounds[2] = y < yMin ? y : yMin;
2851
- bounds[3] = y;
2852
- bounds[4] = z < zMin ? z : zMin;
2853
- bounds[5] = z;
2854
- return xMax !== x || yMax !== y || zMax !== z;
2855
- }
2856
- function inflate(bounds, delta) {
2857
- if (delta == null) return minInflate(bounds);
2858
- bounds[0] -= delta;
2859
- bounds[1] += delta;
2860
- bounds[2] -= delta;
2861
- bounds[3] += delta;
2862
- bounds[4] -= delta;
2863
- bounds[5] += delta;
2864
- return bounds;
2865
- }
2866
- function minInflate(bounds) {
2867
- const nonZero = [
2868
- 0,
2869
- 0,
2870
- 0
2871
- ];
2872
- let maxIdx = -1;
2873
- let max = 0;
2874
- let w = 0;
2875
- for (let i = 0; i < 3; ++i) {
2876
- w = bounds[i * 2 + 1] - bounds[i * 2];
2877
- if (w > max) {
2878
- max = w;
2879
- maxIdx = i;
2880
- }
2881
- nonZero[i] = w > 0 ? 1 : 0;
2882
- }
2883
- if (maxIdx < 0) return inflate(bounds, .5);
2884
- for (let i = 0; i < 3; ++i) if (!nonZero[i]) {
2885
- const d = .005 * max;
2886
- bounds[i * 2] -= d;
2887
- bounds[i * 2 + 1] += d;
2888
- }
2889
- return bounds;
2890
- }
2891
- function scale(bounds, sx, sy, sz) {
2892
- if (!isValid(bounds)) return false;
2893
- if (sx >= 0) {
2894
- bounds[0] *= sx;
2895
- bounds[1] *= sx;
2896
- } else {
2897
- bounds[0] = sx * bounds[1];
2898
- bounds[1] = sx * bounds[0];
2899
- }
2900
- if (sy >= 0) {
2901
- bounds[2] *= sy;
2902
- bounds[3] *= sy;
2903
- } else {
2904
- bounds[2] = sy * bounds[3];
2905
- bounds[3] = sy * bounds[2];
2906
- }
2907
- if (sz >= 0) {
2908
- bounds[4] *= sz;
2909
- bounds[5] *= sz;
2910
- } else {
2911
- bounds[4] = sz * bounds[5];
2912
- bounds[5] = sz * bounds[4];
2913
- }
2914
- return true;
2915
- }
2916
- function getCenter(bounds) {
2917
- return [
2918
- .5 * (bounds[0] + bounds[1]),
2919
- .5 * (bounds[2] + bounds[3]),
2920
- .5 * (bounds[4] + bounds[5])
2921
- ];
2922
- }
2923
- function scaleAboutCenter(bounds, sx, sy, sz) {
2924
- if (!isValid(bounds)) return false;
2925
- const center = getCenter(bounds);
2926
- bounds[0] -= center[0];
2927
- bounds[1] -= center[0];
2928
- bounds[2] -= center[1];
2929
- bounds[3] -= center[1];
2930
- bounds[4] -= center[2];
2931
- bounds[5] -= center[2];
2932
- scale(bounds, sx, sy, sz);
2933
- bounds[0] += center[0];
2934
- bounds[1] += center[0];
2935
- bounds[2] += center[1];
2936
- bounds[3] += center[1];
2937
- bounds[4] += center[2];
2938
- bounds[5] += center[2];
2939
- return true;
2940
- }
2941
- function getLength(bounds, index) {
2942
- return bounds[index * 2 + 1] - bounds[index * 2];
2943
- }
2944
- function getLengths(bounds) {
2945
- return [
2946
- getLength(bounds, 0),
2947
- getLength(bounds, 1),
2948
- getLength(bounds, 2)
2949
- ];
2950
- }
2951
- function getXRange(bounds) {
2952
- return bounds.slice(0, 2);
2953
- }
2954
- function getYRange(bounds) {
2955
- return bounds.slice(2, 4);
2956
- }
2957
- function getZRange(bounds) {
2958
- return bounds.slice(4, 6);
2959
- }
2960
- function getMaxLength(bounds) {
2961
- const l = getLengths(bounds);
2962
- if (l[0] > l[1]) {
2963
- if (l[0] > l[2]) return l[0];
2964
- return l[2];
2965
- }
2966
- if (l[1] > l[2]) return l[1];
2967
- return l[2];
2968
- }
2969
- function getDiagonalLength2(bounds) {
2970
- if (isValid(bounds)) {
2971
- const l = getLengths(bounds);
2972
- return l[0] * l[0] + l[1] * l[1] + l[2] * l[2];
2973
- }
2974
- return null;
2975
- }
2976
- function getDiagonalLength(bounds) {
2977
- const lenght2 = getDiagonalLength2(bounds);
2978
- return lenght2 !== null ? Math.sqrt(lenght2) : null;
2979
- }
2980
- function getMinPoint(bounds) {
2981
- return [
2982
- bounds[0],
2983
- bounds[2],
2984
- bounds[4]
2985
- ];
2986
- }
2987
- function getMaxPoint(bounds) {
2988
- return [
2989
- bounds[1],
2990
- bounds[3],
2991
- bounds[5]
2992
- ];
2993
- }
2994
- function oppositeSign(a, b) {
2995
- return a <= 0 && b >= 0 || a >= 0 && b <= 0;
2996
- }
2997
- function getCorners(bounds, corners) {
2998
- corners[0] = [
2999
- bounds[0],
3000
- bounds[2],
3001
- bounds[4]
3002
- ];
3003
- corners[1] = [
3004
- bounds[0],
3005
- bounds[2],
3006
- bounds[5]
3007
- ];
3008
- corners[2] = [
3009
- bounds[0],
3010
- bounds[3],
3011
- bounds[4]
3012
- ];
3013
- corners[3] = [
3014
- bounds[0],
3015
- bounds[3],
3016
- bounds[5]
3017
- ];
3018
- corners[4] = [
3019
- bounds[1],
3020
- bounds[2],
3021
- bounds[4]
3022
- ];
3023
- corners[5] = [
3024
- bounds[1],
3025
- bounds[2],
3026
- bounds[5]
3027
- ];
3028
- corners[6] = [
3029
- bounds[1],
3030
- bounds[3],
3031
- bounds[4]
3032
- ];
3033
- corners[7] = [
3034
- bounds[1],
3035
- bounds[3],
3036
- bounds[5]
3037
- ];
3038
- return corners;
3039
- }
3040
- function computeCornerPoints(bounds, point1, point2) {
3041
- point1[0] = bounds[0];
3042
- point1[1] = bounds[2];
3043
- point1[2] = bounds[4];
3044
- point2[0] = bounds[1];
3045
- point2[1] = bounds[3];
3046
- point2[2] = bounds[5];
3047
- return point1;
3048
- }
3049
- function transformBounds(bounds, transform, out = []) {
3050
- const corners = getCorners(bounds, []);
3051
- for (let i = 0; i < corners.length; ++i) gl_matrix__rspack_import_2/* .vec3.transformMat4 */.eR.Z0(corners[i], corners[i], transform);
3052
- reset(out);
3053
- return addPoints(out, corners);
3054
- }
3055
- function computeScale3(bounds, scale3 = []) {
3056
- scale3[0] = .5 * (bounds[1] - bounds[0]);
3057
- scale3[1] = .5 * (bounds[3] - bounds[2]);
3058
- scale3[2] = .5 * (bounds[5] - bounds[4]);
3059
- return scale3;
3060
- }
3061
- /**
3062
- * Compute local bounds.
3063
- * Not as fast as vtkPoints.getBounds() if u, v, w form a natural basis.
3064
- * @param {vtkPoints} points
3065
- * @param {array} u first vector
3066
- * @param {array} v second vector
3067
- * @param {array} w third vector
3068
- */
3069
- function computeLocalBounds(points, u, v, w) {
3070
- const bounds = [].concat(INIT_BOUNDS);
3071
- const pointsData = points.getData();
3072
- for (let i = 0; i < pointsData.length; i += 3) {
3073
- const point = [
3074
- pointsData[i],
3075
- pointsData[i + 1],
3076
- pointsData[i + 2]
3077
- ];
3078
- const du = (0,_Core_Math_js__rspack_import_0/* .dot */.Om)(point, u);
3079
- bounds[0] = Math.min(du, bounds[0]);
3080
- bounds[1] = Math.max(du, bounds[1]);
3081
- const dv = (0,_Core_Math_js__rspack_import_0/* .dot */.Om)(point, v);
3082
- bounds[2] = Math.min(dv, bounds[2]);
3083
- bounds[3] = Math.max(dv, bounds[3]);
3084
- const dw = (0,_Core_Math_js__rspack_import_0/* .dot */.Om)(point, w);
3085
- bounds[4] = Math.min(dw, bounds[4]);
3086
- bounds[5] = Math.max(dw, bounds[5]);
3087
- }
3088
- return bounds;
3089
- }
3090
- function intersectBox(bounds, origin, dir, coord, tolerance) {
3091
- let inside = true;
3092
- const quadrant = [];
3093
- let whichPlane = 0;
3094
- const maxT = [];
3095
- const candidatePlane = [
3096
- 0,
3097
- 0,
3098
- 0
3099
- ];
3100
- const RIGHT = 0;
3101
- const LEFT = 1;
3102
- const MIDDLE = 2;
3103
- for (let i = 0; i < 3; i++) if (origin[i] < bounds[2 * i]) {
3104
- quadrant[i] = LEFT;
3105
- candidatePlane[i] = bounds[2 * i];
3106
- inside = false;
3107
- } else if (origin[i] > bounds[2 * i + 1]) {
3108
- quadrant[i] = RIGHT;
3109
- candidatePlane[i] = bounds[2 * i + 1];
3110
- inside = false;
3111
- } else quadrant[i] = MIDDLE;
3112
- if (inside) {
3113
- coord[0] = origin[0];
3114
- coord[1] = origin[1];
3115
- coord[2] = origin[2];
3116
- tolerance[0] = 0;
3117
- return 1;
3118
- }
3119
- for (let i = 0; i < 3; i++) if (quadrant[i] !== MIDDLE && dir[i] !== 0) maxT[i] = (candidatePlane[i] - origin[i]) / dir[i];
3120
- else maxT[i] = -1;
3121
- for (let i = 0; i < 3; i++) if (maxT[whichPlane] < maxT[i]) whichPlane = i;
3122
- if (maxT[whichPlane] > 1 || maxT[whichPlane] < 0) return 0;
3123
- tolerance[0] = maxT[whichPlane];
3124
- for (let i = 0; i < 3; i++) if (whichPlane !== i) {
3125
- coord[i] = origin[i] + maxT[whichPlane] * dir[i];
3126
- if (coord[i] < bounds[2 * i] || coord[i] > bounds[2 * i + 1]) return 0;
3127
- } else coord[i] = candidatePlane[i];
3128
- return 1;
3129
- }
3130
- function intersectPlane(bounds, origin, normal) {
3131
- const p = [];
3132
- let d = 0;
3133
- let sign = 1;
3134
- let firstOne = 1;
3135
- for (let z = 4; z <= 5; ++z) {
3136
- p[2] = bounds[z];
3137
- for (let y = 2; y <= 3; ++y) {
3138
- p[1] = bounds[y];
3139
- for (let x = 0; x <= 1; ++x) {
3140
- p[0] = bounds[x];
3141
- d = _Plane_js__rspack_import_1/* ["default"].evaluate */.Ay.evaluate(normal, origin, p);
3142
- if (firstOne) {
3143
- sign = d >= 0 ? 1 : -1;
3144
- firstOne = 0;
3145
- }
3146
- if (d === 0 || sign > 0 && d < 0 || sign < 0 && d > 0) return 1;
3147
- }
3148
- }
3149
- }
3150
- return 0;
3151
- }
3152
- function intersect(bounds, bBounds) {
3153
- if (!(isValid(bounds) && isValid(bBounds))) return false;
3154
- const newBounds = [
3155
- 0,
3156
- 0,
3157
- 0,
3158
- 0,
3159
- 0,
3160
- 0
3161
- ];
3162
- let intersection;
3163
- for (let i = 0; i < 3; i++) {
3164
- intersection = false;
3165
- if (bBounds[i * 2] >= bounds[i * 2] && bBounds[i * 2] <= bounds[i * 2 + 1]) {
3166
- intersection = true;
3167
- newBounds[i * 2] = bBounds[i * 2];
3168
- } else if (bounds[i * 2] >= bBounds[i * 2] && bounds[i * 2] <= bBounds[i * 2 + 1]) {
3169
- intersection = true;
3170
- newBounds[i * 2] = bounds[i * 2];
3171
- }
3172
- if (bBounds[i * 2 + 1] >= bounds[i * 2] && bBounds[i * 2 + 1] <= bounds[i * 2 + 1]) {
3173
- intersection = true;
3174
- newBounds[i * 2 + 1] = bBounds[2 * i + 1];
3175
- } else if (bounds[i * 2 + 1] >= bBounds[i * 2] && bounds[i * 2 + 1] <= bBounds[i * 2 + 1]) {
3176
- intersection = true;
3177
- newBounds[i * 2 + 1] = bounds[i * 2 + 1];
3178
- }
3179
- if (!intersection) return false;
3180
- }
3181
- bounds[0] = newBounds[0];
3182
- bounds[1] = newBounds[1];
3183
- bounds[2] = newBounds[2];
3184
- bounds[3] = newBounds[3];
3185
- bounds[4] = newBounds[4];
3186
- bounds[5] = newBounds[5];
3187
- return true;
3188
- }
3189
- function intersects(bounds, bBounds) {
3190
- if (!(isValid(bounds) && isValid(bBounds))) return false;
3191
- for (let i = 0; i < 3; i++) {
3192
- if (bBounds[i * 2] >= bounds[i * 2] && bBounds[i * 2] <= bounds[i * 2 + 1]) continue;
3193
- else if (bounds[i * 2] >= bBounds[i * 2] && bounds[i * 2] <= bBounds[i * 2 + 1]) continue;
3194
- if (bBounds[i * 2 + 1] >= bounds[i * 2] && bBounds[i * 2 + 1] <= bounds[i * 2 + 1]) continue;
3195
- else if (bounds[i * 2 + 1] >= bBounds[i * 2] && bounds[i * 2 + 1] <= bBounds[i * 2 + 1]) continue;
3196
- return false;
3197
- }
3198
- return true;
3199
- }
3200
- function containsPoint(bounds, x, y, z) {
3201
- if (x < bounds[0] || x > bounds[1]) return false;
3202
- if (y < bounds[2] || y > bounds[3]) return false;
3203
- if (z < bounds[4] || z > bounds[5]) return false;
3204
- return true;
3205
- }
3206
- function contains(bounds, otherBounds) {
3207
- if (!intersects(bounds, otherBounds)) return false;
3208
- if (!containsPoint(bounds, ...getMinPoint(otherBounds))) return false;
3209
- if (!containsPoint(bounds, ...getMaxPoint(otherBounds))) return false;
3210
- return true;
3211
- }
3212
- /**
3213
- * Returns true if plane intersects bounding box.
3214
- * If so, the box is cut by the plane
3215
- * @param {array} origin
3216
- * @param {array} normal
3217
- */
3218
- function cutWithPlane(bounds, origin, normal) {
3219
- const index = [
3220
- [
3221
- 0,
3222
- 1,
3223
- 2,
3224
- 3,
3225
- 4,
3226
- 5,
3227
- 6,
3228
- 7
3229
- ],
3230
- [
3231
- 0,
3232
- 1,
3233
- 4,
3234
- 5,
3235
- 2,
3236
- 3,
3237
- 6,
3238
- 7
3239
- ],
3240
- [
3241
- 0,
3242
- 2,
3243
- 4,
3244
- 6,
3245
- 1,
3246
- 3,
3247
- 5,
3248
- 7
3249
- ]
3250
- ];
3251
- const d = [
3252
- 0,
3253
- 0,
3254
- 0,
3255
- 0,
3256
- 0,
3257
- 0,
3258
- 0,
3259
- 0
3260
- ];
3261
- let idx = 0;
3262
- for (let ix = 0; ix < 2; ix++) for (let iy = 2; iy < 4; iy++) for (let iz = 4; iz < 6; iz++) {
3263
- const x = [
3264
- bounds[ix],
3265
- bounds[iy],
3266
- bounds[iz]
3267
- ];
3268
- d[idx++] = _Plane_js__rspack_import_1/* ["default"].evaluate */.Ay.evaluate(normal, origin, x);
3269
- }
3270
- let dir = 2;
3271
- while (dir--) if (oppositeSign(d[index[dir][0]], d[index[dir][4]]) && oppositeSign(d[index[dir][1]], d[index[dir][5]]) && oppositeSign(d[index[dir][2]], d[index[dir][6]]) && oppositeSign(d[index[dir][3]], d[index[dir][7]])) break;
3272
- if (dir < 0) return false;
3273
- const sign = Math.sign(normal[dir]);
3274
- const size = Math.abs((bounds[dir * 2 + 1] - bounds[dir * 2]) * normal[dir]);
3275
- let t = sign > 0 ? 1 : 0;
3276
- for (let i = 0; i < 4; i++) {
3277
- if (size === 0) continue;
3278
- const ti = Math.abs(d[index[dir][i]]) / size;
3279
- if (sign > 0 && ti < t) t = ti;
3280
- if (sign < 0 && ti > t) t = ti;
3281
- }
3282
- const bound = (1 - t) * bounds[dir * 2] + t * bounds[dir * 2 + 1];
3283
- if (sign > 0) bounds[dir * 2] = bound;
3284
- else bounds[dir * 2 + 1] = bound;
3285
- return true;
3286
- }
3287
- /**
3288
- * Clamp the divisions to ensure the total number doesn't exceed targetBins
3289
- * @param {Number} targetBins - Maximum number of bins allowed
3290
- * @param {Array} divs - Divisions array to adjust [divX, divY, divZ]
3291
- */
3292
- function clampDivisions(targetBins, divs) {
3293
- for (let i = 0; i < 3; ++i) divs[i] = divs[i] < 1 ? 1 : divs[i];
3294
- let numBins = divs[0] * divs[1] * divs[2];
3295
- while (numBins > targetBins) {
3296
- for (let i = 0; i < 3; ++i) divs[i] = divs[i] > 1 ? divs[i] - 1 : 1;
3297
- numBins = divs[0] * divs[1] * divs[2];
3298
- }
3299
- }
3300
- /**
3301
- * Compute the number of divisions given the current bounding box and a
3302
- * target number of buckets/bins. Handles degenerate bounding boxes properly.
3303
- * @param {Bounds} bounds - The bounding box
3304
- * @param {Number} totalBins - Target number of bins
3305
- * @param {Array} divs - Output array to store divisions [divX, divY, divZ]
3306
- * @param {Array} [adjustedBounds] - Output array to store adjusted bounds if needed
3307
- * @returns {Number} The actual total number of bins
3308
- */
3309
- function computeDivisions(bounds, totalBins, divs, adjustedBounds = []) {
3310
- totalBins = totalBins <= 0 ? 1 : totalBins;
3311
- let numNonZero = 0;
3312
- const nonZero = [
3313
- 0,
3314
- 0,
3315
- 0
3316
- ];
3317
- let maxIdx = -1;
3318
- let max = 0;
3319
- const lengths = getLengths(bounds);
3320
- const totLen = lengths[0] + lengths[1] + lengths[2];
3321
- const zeroDetectionTolerance = totLen * (.001 / 3);
3322
- for (let i = 0; i < 3; ++i) {
3323
- if (lengths[i] > max) {
3324
- maxIdx = i;
3325
- max = lengths[i];
3326
- }
3327
- if (lengths[i] > zeroDetectionTolerance) {
3328
- nonZero[i] = 1;
3329
- numNonZero++;
3330
- } else nonZero[i] = 0;
3331
- }
3332
- const minPoint = getMinPoint(bounds);
3333
- const maxPoint = getMaxPoint(bounds);
3334
- if (numNonZero < 1) {
3335
- divs[0] = 1;
3336
- divs[1] = 1;
3337
- divs[2] = 1;
3338
- adjustedBounds[0] = minPoint[0] - .5;
3339
- adjustedBounds[1] = maxPoint[0] + .5;
3340
- adjustedBounds[2] = minPoint[1] - .5;
3341
- adjustedBounds[3] = maxPoint[1] + .5;
3342
- adjustedBounds[4] = minPoint[2] - .5;
3343
- adjustedBounds[5] = maxPoint[2] + .5;
3344
- return 1;
3345
- }
3346
- let f = totalBins;
3347
- f /= nonZero[0] ? lengths[0] / totLen : 1;
3348
- f /= nonZero[1] ? lengths[1] / totLen : 1;
3349
- f /= nonZero[2] ? lengths[2] / totLen : 1;
3350
- f **= 1 / numNonZero;
3351
- for (let i = 0; i < 3; ++i) {
3352
- divs[i] = nonZero[i] ? Math.floor(f * lengths[i] / totLen) : 1;
3353
- divs[i] = divs[i] < 1 ? 1 : divs[i];
3354
- }
3355
- clampDivisions(totalBins, divs);
3356
- const delta = .5 * lengths[maxIdx] / divs[maxIdx];
3357
- for (let i = 0; i < 3; ++i) if (nonZero[i]) {
3358
- adjustedBounds[2 * i] = minPoint[i];
3359
- adjustedBounds[2 * i + 1] = maxPoint[i];
3360
- } else {
3361
- adjustedBounds[2 * i] = minPoint[i] - delta;
3362
- adjustedBounds[2 * i + 1] = maxPoint[i] + delta;
3363
- }
3364
- return divs[0] * divs[1] * divs[2];
3365
- }
3366
- /**
3367
- * Calculate the squared distance from point x to the specified bounds.
3368
- * @param {Vector3} x The point coordinates
3369
- * @param {Bounds} bounds The bounding box coordinates
3370
- * @returns {Number} The squared distance to the bounds
3371
- */
3372
- function distance2ToBounds(x, bounds) {
3373
- if (x[0] >= bounds[0] && x[0] <= bounds[1] && x[1] >= bounds[2] && x[1] <= bounds[3] && x[2] >= bounds[4] && x[2] <= bounds[5]) return 0;
3374
- const deltas = [
3375
- 0,
3376
- 0,
3377
- 0
3378
- ];
3379
- if (x[0] < bounds[0]) deltas[0] = bounds[0] - x[0];
3380
- else if (x[0] > bounds[1]) deltas[0] = x[0] - bounds[1];
3381
- if (x[1] < bounds[2]) deltas[1] = bounds[2] - x[1];
3382
- else if (x[1] > bounds[3]) deltas[1] = x[1] - bounds[3];
3383
- if (x[2] < bounds[4]) deltas[2] = bounds[4] - x[2];
3384
- else if (x[2] > bounds[5]) deltas[2] = x[2] - bounds[5];
3385
- return (0,_Core_Math_js__rspack_import_0/* .dot */.Om)(deltas, deltas);
3386
- }
3387
- var BoundingBox = class {
3388
- constructor(refBounds) {
3389
- this.bounds = refBounds;
3390
- if (!this.bounds) this.bounds = new Float64Array(INIT_BOUNDS);
3391
- }
3392
- getBounds() {
3393
- return this.bounds;
3394
- }
3395
- equals(otherBounds) {
3396
- return equals(this.bounds, otherBounds);
3397
- }
3398
- isValid() {
3399
- return isValid(this.bounds);
3400
- }
3401
- setBounds(otherBounds) {
3402
- return setBounds(this.bounds, otherBounds);
3403
- }
3404
- reset() {
3405
- return reset(this.bounds);
3406
- }
3407
- addPoint(...xyz) {
3408
- return addPoint(this.bounds, ...xyz);
3409
- }
3410
- addPoints(points) {
3411
- return addPoints(this.bounds, points);
3412
- }
3413
- addBounds(xMin, xMax, yMin, yMax, zMin, zMax) {
3414
- return addBounds(this.bounds, xMin, xMax, yMin, yMax, zMin, zMax);
3415
- }
3416
- setMinPoint(x, y, z) {
3417
- return setMinPoint(this.bounds, x, y, z);
3418
- }
3419
- setMaxPoint(x, y, z) {
3420
- return setMaxPoint(this.bounds, x, y, z);
3421
- }
3422
- inflate(delta) {
3423
- return inflate(this.bounds, delta);
3424
- }
3425
- scale(sx, sy, sz) {
3426
- return scale(this.bounds, sx, sy, sz);
3427
- }
3428
- getCenter() {
3429
- return getCenter(this.bounds);
3430
- }
3431
- getLength(index) {
3432
- return getLength(this.bounds, index);
3433
- }
3434
- getLengths() {
3435
- return getLengths(this.bounds);
3436
- }
3437
- getMaxLength() {
3438
- return getMaxLength(this.bounds);
3439
- }
3440
- getDiagonalLength() {
3441
- return getDiagonalLength(this.bounds);
3442
- }
3443
- getDiagonalLength2() {
3444
- return getDiagonalLength2(this.bounds);
3445
- }
3446
- getMinPoint() {
3447
- return getMinPoint(this.bounds);
3448
- }
3449
- getMaxPoint() {
3450
- return getMaxPoint(this.bounds);
3451
- }
3452
- getXRange() {
3453
- return getXRange(this.bounds);
3454
- }
3455
- getYRange() {
3456
- return getYRange(this.bounds);
3457
- }
3458
- getZRange() {
3459
- return getZRange(this.bounds);
3460
- }
3461
- getCorners(corners) {
3462
- return getCorners(this.bounds, corners);
3463
- }
3464
- computeCornerPoints(point1, point2) {
3465
- return computeCornerPoints(this.bounds, point1, point2);
3466
- }
3467
- computeLocalBounds(u, v, w) {
3468
- return computeLocalBounds(this.bounds, u, v, w);
3469
- }
3470
- transformBounds(transform, out = []) {
3471
- return transformBounds(this.bounds, transform, out);
3472
- }
3473
- computeScale3(scale3) {
3474
- return computeScale3(this.bounds, scale3);
3475
- }
3476
- cutWithPlane(origin, normal) {
3477
- return cutWithPlane(this.bounds, origin, normal);
3478
- }
3479
- intersectBox(origin, dir, coord, tolerance) {
3480
- return intersectBox(this.bounds, origin, dir, coord, tolerance);
3481
- }
3482
- intersectPlane(origin, normal) {
3483
- return intersectPlane(this.bounds, origin, normal);
3484
- }
3485
- intersect(otherBounds) {
3486
- return intersect(this.bounds, otherBounds);
3487
- }
3488
- intersects(otherBounds) {
3489
- return intersects(this.bounds, otherBounds);
3490
- }
3491
- containsPoint(x, y, z) {
3492
- return containsPoint(this.bounds, x, y, z);
3493
- }
3494
- contains(otherBounds) {
3495
- return intersects(this.bounds, otherBounds);
3496
- }
3497
- computeDivisions(totalBins, divs, adjustedBounds = []) {
3498
- return computeDivisions(this.bounds, totalBins, divs, adjustedBounds);
3499
- }
3500
- distance2ToBounds(x) {
3501
- return distance2ToBounds(x, this.bounds);
3502
- }
3503
- };
3504
- function newInstance(initialValues) {
3505
- return new BoundingBox(initialValues && initialValues.bounds);
3506
- }
3507
- var STATIC = {
3508
- equals,
3509
- isValid,
3510
- setBounds,
3511
- reset,
3512
- addPoint,
3513
- addPoints,
3514
- addBounds,
3515
- setMinPoint,
3516
- setMaxPoint,
3517
- inflate,
3518
- scale,
3519
- scaleAboutCenter,
3520
- getCenter,
3521
- getLength,
3522
- getLengths,
3523
- getMaxLength,
3524
- getDiagonalLength,
3525
- getDiagonalLength2,
3526
- getMinPoint,
3527
- getMaxPoint,
3528
- getXRange,
3529
- getYRange,
3530
- getZRange,
3531
- getCorners,
3532
- computeCornerPoints,
3533
- computeLocalBounds,
3534
- transformBounds,
3535
- computeScale3,
3536
- cutWithPlane,
3537
- intersectBox,
3538
- intersectPlane,
3539
- intersect,
3540
- intersects,
3541
- containsPoint,
3542
- contains,
3543
- computeDivisions,
3544
- clampDivisions,
3545
- distance2ToBounds,
3546
- INIT_BOUNDS
3547
- };
3548
- var BoundingBox_default = {
3549
- newInstance,
3550
- ...STATIC
3551
- };
3552
- //#endregion
3553
-
3554
-
3555
- //# sourceMappingURL=BoundingBox.js.map
3556
- __webpack_require__.d(__webpack_exports__, {
3557
- Ay: () => (BoundingBox_default)
3558
- });
3559
-
3560
-
3561
2756
  },
3562
2757
  29879(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
3563
2758
  "use strict";