@equinor/videx-3d 2.0.0 → 3.1.0

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 (63) hide show
  1. package/dist/chunk-DKAquGKk.js +2820 -0
  2. package/dist/chunk-DsUZyEG_.js +16 -0
  3. package/dist/generators.js +512 -727
  4. package/dist/main.js +7182 -10552
  5. package/dist/sdk.js +2 -787
  6. package/dist/src/sdk/materials/shaderLib/procedural-normal.glsl +274 -0
  7. package/dist/types/components/Ocean/Ocean.d.ts +333 -0
  8. package/dist/types/components/Ocean/index.d.ts +6 -0
  9. package/dist/types/components/Ocean/ocean-bed-material.d.ts +60 -0
  10. package/dist/types/components/Ocean/ocean-contact.d.ts +39 -0
  11. package/dist/types/components/Ocean/ocean-material.d.ts +145 -0
  12. package/dist/types/components/Ocean/ocean-sampler.d.ts +93 -0
  13. package/dist/types/components/Ocean/ocean-volume-material.d.ts +54 -0
  14. package/dist/types/components/Tanker/Tanker.d.ts +47 -0
  15. package/dist/types/components/Tanker/TankerSuperstructure.d.ts +23 -0
  16. package/dist/types/components/Tanker/tanker-geometry-builder.d.ts +21 -0
  17. package/dist/types/components/Wellbores/Casings/CasingMaterial.d.ts +229 -1
  18. package/dist/types/components/Wellbores/Casings/CasingSection.d.ts +6 -1
  19. package/dist/types/components/Wellbores/Casings/Casings.d.ts +45 -4
  20. package/dist/types/components/Wellbores/Casings/casings-defs.d.ts +44 -0
  21. package/dist/types/components/Wellbores/Casings/index.d.ts +2 -1
  22. package/dist/types/main.d.ts +1 -0
  23. package/dist/types/rendering/Pass.d.ts +10 -1
  24. package/dist/types/rendering/RenderingPipeline.d.ts +10 -1
  25. package/dist/types/rendering/debug/DebugBoxOutputPass.d.ts +22 -0
  26. package/dist/types/rendering/debug/DebugPatternPass.d.ts +30 -0
  27. package/dist/types/rendering/fxaa-resolver.d.ts +25 -0
  28. package/dist/types/rendering/index.d.ts +1 -0
  29. package/dist/types/rendering/passes/AnnotationsPass.d.ts +1 -0
  30. package/dist/types/rendering/passes/FXAAPass.d.ts +11 -6
  31. package/dist/types/rendering/passes/OITRenderPass.d.ts +147 -0
  32. package/dist/types/rendering/passes/OutputPass.d.ts +9 -0
  33. package/dist/types/rendering/passes/RenderPass.d.ts +2 -0
  34. package/dist/types/rendering/passes/index.d.ts +0 -2
  35. package/dist/types/rendering/smaa-resolver.d.ts +58 -0
  36. package/dist/types/rendering/taa-resolver.d.ts +161 -0
  37. package/dist/types/rendering/temporal-resolver.d.ts +152 -0
  38. package/dist/types/sdk/geometries/boundary-loops.d.ts +38 -0
  39. package/dist/types/sdk/geometries/geometry-attributes.d.ts +37 -0
  40. package/dist/types/sdk/geometries/grid-sampling.d.ts +50 -0
  41. package/dist/types/sdk/geometries/ocean-geometry.d.ts +288 -0
  42. package/dist/types/sdk/geometries/packing.d.ts +1 -1
  43. package/dist/types/sdk/geometries/tessellation.d.ts +25 -0
  44. package/dist/types/sdk/index.d.ts +5 -0
  45. package/dist/types/sdk/utils/vector-operations.d.ts +7 -0
  46. package/package.json +11 -18
  47. package/dist/chunk-61X6qE5N.js +0 -981
  48. package/dist/chunk-ChG5d4HC.js +0 -675
  49. package/dist/chunk-DuRASjkF.js +0 -17
  50. package/dist/chunk-M-Pcc_Yg.js +0 -689
  51. package/dist/types/rendering/passes/SMAAPass.d.ts +0 -40
  52. package/dist/types/rendering/passes/TAAPass.d.ts +0 -94
  53. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/color-conversion.glsl +0 -0
  54. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/colors.glsl +0 -0
  55. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/glyphs.glsl +0 -0
  56. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/oit.glsl +0 -0
  57. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/random.glsl +0 -0
  58. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/remap.glsl +0 -0
  59. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/render-number.glsl +0 -0
  60. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/render-text.glsl +0 -0
  61. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/rotation.glsl +0 -0
  62. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/sdf-functions.glsl +0 -0
  63. /package/dist/textures/{normal_map.jpg → public/normal_map.jpg} +0 -0
@@ -1,748 +1,533 @@
1
- import { transfer as x } from "comlink";
2
- import "p-limit";
3
- import { h as A, d as b, p as ot, ac as ct, q as nt, a3 as ut, ab as E, b as N, g as st, U as lt, S as mt, af as pt, I as gt, J as ft, F as ht, a2 as dt, m as yt, al as wt } from "./chunk-61X6qE5N.js";
4
- import "three/src/math/MathUtils.js";
5
- import { Sphere as Tt, Box3 as Mt, Vector3 as v, Matrix4 as P, Color as rt, BufferGeometry as bt, BufferAttribute as W } from "three";
6
- import "proj4";
7
- import { clamp as vt } from "curve-interpolator";
8
- import { group as At } from "d3-array";
9
- import { mergeBufferGeometries as Y } from "three-stdlib";
10
- import { a as xt } from "./chunk-DuRASjkF.js";
11
- import { d as O, t as Bt, f as Lt, a as $t } from "./chunk-M-Pcc_Yg.js";
12
- async function Qt(o, i, l = 0, r, p = !1) {
13
- const t = await this.get("position-logs", o), e = A(o, t);
14
- if (!e) return null;
15
- const n = r !== void 0 ? b(
16
- (r - e.measuredTop) / e.measuredLength,
17
- 0,
18
- 1
19
- ) : 0, m = ot(
20
- e.curve,
21
- n,
22
- 1,
23
- i,
24
- l
25
- ), s = new Float32Array(m.length * 3), g = p ? new Float32Array(m.length) : null;
26
- m.forEach((f, h) => {
27
- const w = e.curve.getPointAt(f);
28
- s[h * 3] = w[0], s[h * 3 + 1] = w[1], s[h * 3 + 2] = w[2], g && (g[h] = f);
29
- });
30
- const u = {
31
- position: {
32
- array: s,
33
- itemSize: 3
34
- }
35
- };
36
- g && (u.lengths = {
37
- array: g,
38
- itemSize: 1
39
- });
40
- const [c, a] = ct({ attributes: u });
41
- return x(c, a);
1
+ import { At as e, Cn as t, Ct as n, Dt as r, E as i, Jt as a, Rt as o, T as s, Tn as c, _ as l, dt as u, gn as d, jt as f, ln as p, mn as m, nt as h, rt as g, tn as _, u as v, wn as y, wt as b, xt as x } from "./chunk-DKAquGKk.js";
2
+ import { n as S } from "./chunk-DsUZyEG_.js";
3
+ import { Box3 as C, BufferAttribute as w, BufferGeometry as T, Color as E, Matrix4 as D, Sphere as ee, Vector3 as O } from "three";
4
+ import { transfer as k } from "comlink";
5
+ import { clamp as A } from "curve-interpolator";
6
+ import { mergeBufferGeometries as j } from "three-stdlib";
7
+ import { group as te } from "d3-array";
8
+ //#region src/generators/basic-trajectory-generator.ts
9
+ async function ne(e, t, r = 0, i, a = !1) {
10
+ let o = n(e, await this.get("position-logs", e));
11
+ if (!o) return null;
12
+ let s = i === void 0 ? 0 : m((i - o.measuredTop) / o.measuredLength, 0, 1), c = f(o.curve, s, 1, t, r), l = new Float32Array(c.length * 3), u = a ? new Float32Array(c.length) : null;
13
+ c.forEach((e, t) => {
14
+ let n = o.curve.getPointAt(e);
15
+ l[t * 3] = n[0], l[t * 3 + 1] = n[1], l[t * 3 + 2] = n[2], u && (u[t] = e);
16
+ });
17
+ let d = { position: {
18
+ array: l,
19
+ itemSize: 3
20
+ } };
21
+ u && (d.lengths = {
22
+ array: u,
23
+ itemSize: 1
24
+ });
25
+ let [p, h] = g({ attributes: d });
26
+ return k(p, h);
42
27
  }
43
- async function Zt(o) {
44
- const i = await this.get("casings", o);
45
- if (!i) return null;
46
- const l = await this.get("position-logs", o), r = A(o, l);
47
- return r ? i.filter((t) => t.mdBottomMsl > r.measuredTop).map((t) => {
48
- const e = b(
49
- (t.mdTopMsl + (t.mdBottomMsl - t.mdTopMsl) / 2 - r.measuredTop) / r.measuredLength,
50
- 0,
51
- 1
52
- );
53
- return {
54
- name: `${t.properties.Diameter} ${t.properties.Type}`,
55
- data: { ...t.properties, isShoe: t.isShoe },
56
- position: r.curve.getPointAt(e),
57
- direction: r.curve.getTangentAt(e),
58
- priority: t.isShoe ? 50 : t.innerDiameter
59
- };
60
- }) : null;
28
+ //#endregion
29
+ //#region src/generators/casing-annotations-generator.ts
30
+ async function re(e) {
31
+ let t = await this.get("casings", e);
32
+ if (!t) return null;
33
+ let r = n(e, await this.get("position-logs", e));
34
+ return r ? t.filter((e) => e.mdBottomMsl > r.measuredTop).map((e) => {
35
+ let t = m((e.mdTopMsl + (e.mdBottomMsl - e.mdTopMsl) / 2 - r.measuredTop) / r.measuredLength, 0, 1);
36
+ return {
37
+ name: `${e.properties.Diameter} ${e.properties.Type}`,
38
+ data: {
39
+ ...e.properties,
40
+ isShoe: e.isShoe
41
+ },
42
+ position: r.curve.getPointAt(t),
43
+ direction: r.curve.getTangentAt(t),
44
+ priority: e.isShoe ? 50 : e.innerDiameter
45
+ };
46
+ }) : null;
61
47
  }
62
- const U = new Tt();
63
- function Pt(o, i, l) {
64
- if (i[0] === l[0]) return l[1];
65
- const r = l[0] - i[0], p = b((o - i[0]) / r, 0, 1);
66
- return ut(i[1], l[1], p);
48
+ //#endregion
49
+ //#region src/generators/casings-generator.ts
50
+ var M = new ee();
51
+ function N(e, t, n) {
52
+ if (t[0] === n[0]) return n[1];
53
+ let r = n[0] - t[0], i = m((e - t[0]) / r, 0, 1);
54
+ return d(t[1], n[1], i);
67
55
  }
68
- function Dt(o, i, l, r, p, t) {
69
- const e = [];
70
- r.sort((a, f) => a[0] - f[0]);
71
- const n = [], m = ot(
72
- o,
73
- i,
74
- l,
75
- p,
76
- t
77
- );
78
- let s = 0, g = m[s];
79
- for (let a = 0; a < r.length - 1; a++) {
80
- const f = a + 1, [h, w] = r[a], [d, y] = r[f];
81
- for (n.push([
82
- h,
83
- // curve position 0-1
84
- w
85
- // outer radius,
86
- ]); g <= h && s < m.length - 1; )
87
- g = m[++s];
88
- for (; g < d && s < m.length; ) {
89
- const T = Pt(g, r[a], r[f]);
90
- n.push([g, T]), g = m[s++];
91
- }
92
- f === r.length - 1 && n.push([d, y]);
93
- }
94
- const u = nt(
95
- o,
96
- n.map((a) => a[0])
97
- ), c = l - i;
98
- return u.forEach((a, f) => {
99
- e.push(
100
- ...a.position,
101
- ...a.normal,
102
- ...a.tangent,
103
- b((a.curvePosition - i) / c, 0, 1),
104
- // segment length 0-1
105
- a.curvePosition,
106
- // position on curve 0-1
107
- n[f][1]
108
- // outer radius
109
- );
110
- }), Float32Array.from(e);
56
+ function P(t, n, r, i, a, o) {
57
+ let s = [];
58
+ i.sort((e, t) => e[0] - t[0]);
59
+ let c = [], l = f(t, n, r, a, o), u = 0, d = l[u];
60
+ for (let e = 0; e < i.length - 1; e++) {
61
+ let t = e + 1, [n, r] = i[e], [a, o] = i[t];
62
+ for (c.push([n, r]); d <= n && u < l.length - 1;) d = l[++u];
63
+ for (; d < a && u < l.length;) {
64
+ let n = N(d, i[e], i[t]);
65
+ c.push([d, n]), d = l[u++];
66
+ }
67
+ t === i.length - 1 && c.push([a, o]);
68
+ }
69
+ let p = e(t, c.map((e) => e[0])), h = r - n;
70
+ return p.forEach((e, t) => {
71
+ s.push(...e.position, ...e.normal, ...e.tangent, m((e.curvePosition - n) / h, 0, 1), e.curvePosition, c[t][1]);
72
+ }), Float32Array.from(s);
111
73
  }
112
- async function zt(o, i, l = 2, r = 0.1, p = 0) {
113
- const t = await this.get("casings", o);
114
- if (!t) return null;
115
- const e = await this.get("position-logs", o), n = A(o, e);
116
- if (!n) return null;
117
- const m = i !== void 0 ? b(
118
- (i - n.measuredTop) / n.measuredLength,
119
- 0,
120
- 1
121
- ) : 0, s = t.filter(
122
- (a) => a.mdBottomMsl > n.measuredTop && (i === void 0 || a.mdBottomMsl > i)
123
- ).map((a) => ({
124
- ...a,
125
- mdTopMsl: Math.max(a.mdTopMsl, n.measuredTop)
126
- })).sort(
127
- (a, f) => a.outerDiameter - f.outerDiameter || a.mdTopMsl - f.mdTopMsl
128
- );
129
- if (s.length === 0) return null;
130
- const g = 1 / n.measuredLength, u = [], c = [];
131
- return s.forEach((a) => {
132
- const f = b(
133
- a.mdBottomMsl - a.mdTopMsl,
134
- 1e-4,
135
- n.measuredLength
136
- ), h = Math.max(
137
- m,
138
- b(
139
- (a.mdTopMsl - n.measuredTop) / n.measuredLength,
140
- 0,
141
- 1
142
- )
143
- ), w = b(
144
- (a.mdBottomMsl - n.measuredTop) / n.measuredLength,
145
- 0,
146
- 1
147
- ), d = a.outerDiameter / 2, y = a.innerDiameter ? a.innerDiameter / 2 : d * 0.95, T = [];
148
- if (a.isShoe) {
149
- const L = d * l;
150
- T.push(
151
- [h, d],
152
- [h + (w - h) / 4, d],
153
- [w, L]
154
- );
155
- } else {
156
- const L = d - (d - y) / 4;
157
- T.push([h, L]);
158
- const I = Math.min((d - L) * 2, f / 3) * g;
159
- T.push([h + I, d]), T.push([w - I, d]), T.push([w, L]);
160
- }
161
- const $ = Dt(
162
- n.curve,
163
- h,
164
- w,
165
- T,
166
- r,
167
- p
168
- ), M = n.curve.getBoundingBox(h, w);
169
- new Mt(new v(...M.min), new v(...M.max)).getBoundingSphere(U), c.push({
170
- type: a.type,
171
- radius: d,
172
- innerRadius: y,
173
- length: f,
174
- top: h,
175
- bottom: w,
176
- attributesBuffer: $,
177
- segments: $.length / 12,
178
- boundingSphere: {
179
- center: U.center.toArray(),
180
- radius: U.radius
181
- }
182
- }), u.push($.buffer);
183
- }), x(c, u);
74
+ async function ie(e, t, r = 2, i = .1, a = 0) {
75
+ let o = await this.get("casings", e);
76
+ if (!o) return null;
77
+ let s = n(e, await this.get("position-logs", e));
78
+ if (!s) return null;
79
+ let c = t === void 0 ? 0 : m((t - s.measuredTop) / s.measuredLength, 0, 1), l = o.filter((e) => e.mdBottomMsl > s.measuredTop && (t === void 0 || e.mdBottomMsl > t)).map((e) => ({
80
+ ...e,
81
+ mdTopMsl: Math.max(e.mdTopMsl, s.measuredTop)
82
+ })).sort((e, t) => e.outerDiameter - t.outerDiameter || e.mdTopMsl - t.mdTopMsl);
83
+ if (l.length === 0) return null;
84
+ let u = 1 / s.measuredLength, d = [], f = [];
85
+ return l.forEach((e) => {
86
+ let t = m(e.mdBottomMsl - e.mdTopMsl, 1e-4, s.measuredLength), n = Math.max(c, m((e.mdTopMsl - s.measuredTop) / s.measuredLength, 0, 1)), o = m((e.mdBottomMsl - s.measuredTop) / s.measuredLength, 0, 1), l = e.outerDiameter / 2, p = e.innerDiameter ? e.innerDiameter / 2 : l * .95, h = [];
87
+ if (e.isShoe) {
88
+ let e = l * r;
89
+ h.push([n, l], [n + (o - n) / 4, l], [o, e]);
90
+ } else {
91
+ let e = l - (l - p) / 4;
92
+ h.push([n, e]);
93
+ let r = Math.min((l - e) * 2, t / 3) * u;
94
+ h.push([n + r, l]), h.push([o - r, l]), h.push([o, e]);
95
+ }
96
+ let g = P(s.curve, n, o, h, i, a), _ = s.curve.getBoundingBox(n, o);
97
+ new C(new O(..._.min), new O(..._.max)).getBoundingSphere(M), f.push({
98
+ type: e.type,
99
+ radius: l,
100
+ innerRadius: p,
101
+ length: t,
102
+ top: n,
103
+ bottom: o,
104
+ attributesBuffer: g,
105
+ segments: g.length / 12,
106
+ boundingSphere: {
107
+ center: M.center.toArray(),
108
+ radius: M.radius
109
+ }
110
+ }), d.push(g.buffer);
111
+ }), k(f, d);
184
112
  }
185
- async function te(o) {
186
- const i = await this.get("completion-tools", o);
187
- if (!i) return null;
188
- const l = await this.get("position-logs", o), r = A(o, l);
189
- return r ? i.filter((t) => t.mdBottomMsl > r.measuredTop).map((t) => {
190
- const e = b(
191
- (t.mdTopMsl + t.length / 2 - r.measuredTop) / r.measuredLength,
192
- 0,
193
- 1
194
- );
195
- return {
196
- name: t.name,
197
- //data: d,
198
- position: r.curve.getPointAt(e),
199
- direction: r.curve.getTangentAt(e),
200
- priority: t.diameterMax
201
- };
202
- }) : null;
113
+ //#endregion
114
+ //#region src/generators/completion-annotations-generator.ts
115
+ async function ae(e) {
116
+ let t = await this.get("completion-tools", e);
117
+ if (!t) return null;
118
+ let r = n(e, await this.get("position-logs", e));
119
+ return r ? t.filter((e) => e.mdBottomMsl > r.measuredTop).map((e) => {
120
+ let t = m((e.mdTopMsl + e.length / 2 - r.measuredTop) / r.measuredLength, 0, 1);
121
+ return {
122
+ name: e.name,
123
+ position: r.curve.getPointAt(t),
124
+ direction: r.curve.getTangentAt(t),
125
+ priority: e.diameterMax
126
+ };
127
+ }) : null;
203
128
  }
204
- function Ft(o, i, l, r, p) {
205
- const t = b(i.length, 1e-4, o.measuredLength), e = 1 / o.measuredLength, n = [], m = b(
206
- (i.mdTopMsl - o.measuredTop) / o.measuredLength,
207
- 0,
208
- 1
209
- ), s = b(
210
- (i.mdBottomMsl - o.measuredTop) / o.measuredLength,
211
- 0,
212
- 1
213
- ), g = l * ((i.diameterTop || i.diameterBottom) / 2), u = l * ((i.diameterBottom || i.diameterTop) / 2), c = l * ((i.diameterMax || i.diameterTop) / 2), a = Math.min(g, u, c);
214
- n.push([m, g]);
215
- const f = Math.min((c - a) * 2, t / 3) * e;
216
- return c > a && (n.push([m + f, c]), n.push([s - f, c])), n.push([s, u]), O(o.curve, {
217
- ...p,
218
- from: Math.max(m, r),
219
- to: s,
220
- computeLengths: !0,
221
- radiusModifier: {
222
- type: "linear",
223
- steps: n
224
- }
225
- });
129
+ //#endregion
130
+ //#region src/generators/completion-tools-generator.ts
131
+ function oe(e, t, n, i, a) {
132
+ let o = m(t.length, 1e-4, e.measuredLength), s = 1 / e.measuredLength, c = [], l = m((t.mdTopMsl - e.measuredTop) / e.measuredLength, 0, 1), u = m((t.mdBottomMsl - e.measuredTop) / e.measuredLength, 0, 1), d = n * ((t.diameterTop || t.diameterBottom) / 2), f = n * ((t.diameterBottom || t.diameterTop) / 2), p = n * ((t.diameterMax || t.diameterTop) / 2), h = Math.min(d, f, p);
133
+ c.push([l, d]);
134
+ let g = Math.min((p - h) * 2, o / 3) * s;
135
+ return p > h && (c.push([l + g, p]), c.push([u - g, p])), c.push([u, f]), r(e.curve, {
136
+ ...a,
137
+ from: Math.max(l, i),
138
+ to: u,
139
+ computeLengths: !0,
140
+ radiusModifier: {
141
+ type: "linear",
142
+ steps: c
143
+ }
144
+ });
226
145
  }
227
- async function ee(o, i, l = 16, r = 1, p = 0.1, t = 0) {
228
- const e = await this.get("completion-tools", o);
229
- if (!e) return null;
230
- const n = await this.get("position-logs", o), m = A(o, n);
231
- if (!m) return null;
232
- const s = i !== void 0 ? b(
233
- (i - m.measuredTop) / m.measuredLength,
234
- 0,
235
- 1
236
- ) : 0, g = e.filter(
237
- (y) => y.mdBottomMsl > m.measuredTop && (i === void 0 || y.mdBottomMsl > i)
238
- ).sort((y, T) => y.mdTopMsl - T.mdTopMsl), u = At(g, (y) => y.category), c = {
239
- startCap: !0,
240
- endCap: !0,
241
- radialSegments: l,
242
- computeNormals: !0,
243
- computeUvs: !0,
244
- segmentsPerMeter: p,
245
- simplificationThreshold: t,
246
- radius: 0
247
- }, a = [], f = [];
248
- if (u.forEach((y, T) => {
249
- const $ = y.map((B) => Ft(
250
- m,
251
- B,
252
- r,
253
- s,
254
- c
255
- )).filter((B) => B);
256
- f.push(xt[T]);
257
- const M = Y(
258
- $,
259
- !1
260
- );
261
- M && a.push(M);
262
- }), !a.length) return null;
263
- const h = Y(a, !0);
264
- if (!h) return null;
265
- h.groups.forEach((y, T) => {
266
- y.materialIndex = f[T];
267
- });
268
- const [w, d] = E(h);
269
- return x(w, d);
146
+ async function se(e, t, r = 16, i = 1, a = .1, o = 0) {
147
+ let s = await this.get("completion-tools", e);
148
+ if (!s) return null;
149
+ let c = n(e, await this.get("position-logs", e));
150
+ if (!c) return null;
151
+ let l = t === void 0 ? 0 : m((t - c.measuredTop) / c.measuredLength, 0, 1), u = te(s.filter((e) => e.mdBottomMsl > c.measuredTop && (t === void 0 || e.mdBottomMsl > t)).sort((e, t) => e.mdTopMsl - t.mdTopMsl), (e) => e.category), d = {
152
+ startCap: !0,
153
+ endCap: !0,
154
+ radialSegments: r,
155
+ computeNormals: !0,
156
+ computeUvs: !0,
157
+ segmentsPerMeter: a,
158
+ simplificationThreshold: o,
159
+ radius: 0
160
+ }, f = [], p = [];
161
+ if (u.forEach((e, t) => {
162
+ let n = e.map((e) => oe(c, e, i, l, d)).filter((e) => e);
163
+ p.push(S[t]);
164
+ let r = j(n, !1);
165
+ r && f.push(r);
166
+ }), !f.length) return null;
167
+ let g = j(f, !0);
168
+ if (!g) return null;
169
+ g.groups.forEach((e, t) => {
170
+ e.materialIndex = p[t];
171
+ });
172
+ let [_, v] = h(g);
173
+ return k(_, v);
270
174
  }
271
- async function oe(o, i, l = "MSL", r) {
272
- const p = await this.get("position-logs", o);
273
- if (!p || p.length < 8) return null;
274
- let t = 0;
275
- if (l === "RT") {
276
- const a = await this.get("wellbore-headers", o);
277
- a && (t = a.depthReferenceElevation);
278
- }
279
- const e = A(o, p);
280
- if (!e) return null;
281
- const n = p[p.length - 1] + t, s = Math.max(
282
- e.measuredTop,
283
- r && Number.isFinite(r) ? r : e.measuredTop
284
- ) + t, g = [s];
285
- let u = Math.floor(s / i) * i;
286
- for (u <= s && (u += i); u < n; )
287
- g.push(u), u += i;
288
- return g.push(n), g.map((a) => {
289
- const f = b(
290
- (a - t - e.measuredTop) / e.measuredLength,
291
- 0,
292
- 1
293
- ), h = e.curve.getPointAt(f), w = e.curve.getTangentAt(f);
294
- return {
295
- id: `${o}_${a}`,
296
- name: (Math.round(a * 10) / 10).toString(),
297
- direction: w,
298
- position: h
299
- };
300
- });
175
+ //#endregion
176
+ //#region src/generators/depth-markers-generator.ts
177
+ async function ce(e, t, r = "MSL", i) {
178
+ let a = await this.get("position-logs", e);
179
+ if (!a || a.length < 8) return null;
180
+ let o = 0;
181
+ if (r === "RT") {
182
+ let t = await this.get("wellbore-headers", e);
183
+ t && (o = t.depthReferenceElevation);
184
+ }
185
+ let s = n(e, a);
186
+ if (!s) return null;
187
+ let c = a[a.length - 1] + o, l = Math.max(s.measuredTop, i && Number.isFinite(i) ? i : s.measuredTop) + o, u = [l], d = Math.floor(l / t) * t;
188
+ for (d <= l && (d += t); d < c;) u.push(d), d += t;
189
+ return u.push(c), u.map((t) => {
190
+ let n = m((t - o - s.measuredTop) / s.measuredLength, 0, 1), r = s.curve.getPointAt(n), i = s.curve.getTangentAt(n);
191
+ return {
192
+ id: `${e}_${t}`,
193
+ name: (Math.round(t * 10) / 10).toString(),
194
+ direction: i,
195
+ position: r
196
+ };
197
+ });
301
198
  }
302
- const D = new v(), H = new v(), J = new v(), Vt = new v(0, 1, 0), F = new P(), Ct = new P().makeRotationX(N), K = new rt();
303
- async function ne(o, i, l, r = 10) {
304
- const p = await st(
305
- o,
306
- i,
307
- this,
308
- l
309
- );
310
- if (!p) return null;
311
- const t = lt(p);
312
- if (!t.length) return null;
313
- const e = await this.get("position-logs", o), n = A(o, e);
314
- if (!n) return null;
315
- const m = t.map((c) => {
316
- const a = vt(
317
- (c.mdMsl - n.measuredTop) / n.measuredLength,
318
- 0,
319
- 1
320
- );
321
- return {
322
- ...c,
323
- position: n.curve.getPointAt(a),
324
- direction: n.curve.getTangentAt(a)
325
- };
326
- }), s = new Float32Array(m.length * 16), g = new Float32Array(m.length * 3), u = [];
327
- return m.forEach((c, a) => {
328
- D.set(...c.position), F.identity();
329
- const f = r;
330
- J.set(f, f, f), H.set(
331
- D.x + c.direction[0],
332
- D.y + c.direction[1],
333
- D.z + c.direction[2]
334
- ), F.lookAt(D, H, Vt), F.multiply(Ct), F.setPosition(D), F.scale(J), F.toArray(s, a * 16), K.set(c.color), K.toArray(g, a * 3), u[a] = {
335
- id: `${o}_${a}`,
336
- name: `${c.name} ${Bt(c.type)}`,
337
- depth: c.mdMsl,
338
- tvd: c.tvdMsl,
339
- level: c.level,
340
- direction: c.direction
341
- };
342
- }), x(
343
- {
344
- data: u,
345
- transformations: s,
346
- colors: g
347
- },
348
- [s.buffer]
349
- );
199
+ //#endregion
200
+ //#region src/generators/formation-markers-generator.ts
201
+ var F = new O(), I = new O(), L = new O(), le = new O(0, 1, 0), R = new D(), ue = new D().makeRotationX(p), z = new E();
202
+ async function B(e, r, i, a = 10) {
203
+ let o = await y(e, r, this, i);
204
+ if (!o) return null;
205
+ let s = t(o);
206
+ if (!s.length) return null;
207
+ let c = n(e, await this.get("position-logs", e));
208
+ if (!c) return null;
209
+ let l = s.map((e) => {
210
+ let t = A((e.mdMsl - c.measuredTop) / c.measuredLength, 0, 1);
211
+ return {
212
+ ...e,
213
+ position: c.curve.getPointAt(t),
214
+ direction: c.curve.getTangentAt(t)
215
+ };
216
+ }), u = new Float32Array(l.length * 16), d = new Float32Array(l.length * 3), f = [];
217
+ return l.forEach((t, n) => {
218
+ F.set(...t.position), R.identity();
219
+ let r = a;
220
+ L.set(r, r, r), I.set(F.x + t.direction[0], F.y + t.direction[1], F.z + t.direction[2]), R.lookAt(F, I, le), R.multiply(ue), R.setPosition(F), R.scale(L), R.toArray(u, n * 16), z.set(t.color), z.toArray(d, n * 3), f[n] = {
221
+ id: `${e}_${n}`,
222
+ name: `${t.name} ${v(t.type)}`,
223
+ depth: t.mdMsl,
224
+ tvd: t.tvdMsl,
225
+ level: t.level,
226
+ direction: t.direction
227
+ };
228
+ }), k({
229
+ data: f,
230
+ transformations: u,
231
+ colors: d
232
+ }, [u.buffer]);
350
233
  }
351
- const V = new v(), Q = new v(), X = new v(), Rt = new v(0, 1, 0), C = new P(), kt = new P().makeRotationX(N);
352
- async function se(o, i, l = 1) {
353
- const r = await this.get(
354
- "perforations",
355
- o
356
- );
357
- if (!r) return null;
358
- const p = await this.get("position-logs", o), t = A(o, p);
359
- if (!t) return null;
360
- X.set(
361
- Math.max(1, l / 2),
362
- l,
363
- Math.max(1, l / 2)
364
- );
365
- const e = [], n = r.filter(
366
- (u) => u.status === "Open" && u.mdBottomMsl > t.measuredTop && (i === void 0 || u.mdBottomMsl > i)
367
- ).sort((u, c) => u.mdTopMsl - c.mdTopMsl);
368
- for (let u = 0; u < n.length; u++) {
369
- const c = n[u];
370
- c.mdBottomMsl <= t.measuredTop || (!e.length || e[e.length - 1].bottom !== c.mdTopMsl ? e.push({
371
- type: c.type,
372
- top: Math.max(t.measuredTop, c.mdTopMsl),
373
- bottom: c.mdBottomMsl,
374
- density: mt(c.density || 0),
375
- phase: c.phase || 0,
376
- innerDiameter: 0,
377
- outerDiameter: 0
378
- }) : e.length && (e[e.length - 1].bottom = c.mdBottomMsl));
379
- }
380
- const m = [];
381
- for (let u = 0; u < e.length; u++) {
382
- const c = e[u], a = c.bottom - c.top, f = Math.max(
383
- 1,
384
- Math.floor(a * c.density)
385
- ), h = b(
386
- (c.top - t.measuredTop) / t.measuredLength,
387
- 0,
388
- 1
389
- ), d = (b(
390
- (c.bottom - t.measuredTop) / t.measuredLength,
391
- 0,
392
- 1
393
- ) - h) / f, y = [];
394
- for (let M = 0; M < f; M++)
395
- y.push(h + d * M);
396
- const T = nt(t.curve, y);
397
- let $ = N;
398
- for (let M = 0; M < T.length; M++) {
399
- const B = T[M], L = pt(
400
- gt(B.tangent, [0, -1, 0]),
401
- B.tangent,
402
- $
403
- );
404
- m.push({
405
- name: c.type,
406
- position: B.position,
407
- normal: L,
408
- tangent: B.tangent
409
- }), $ += ft(c.phase);
410
- }
411
- }
412
- const s = new Float32Array(m.length * 16), g = [];
413
- for (let u = 0; u < m.length; u++) {
414
- const c = m[u];
415
- V.set(...c.position), Q.set(
416
- V.x + c.normal[0],
417
- V.y + c.normal[1],
418
- V.z + c.normal[2]
419
- ), X.setY(
420
- l + l * (Math.random() - 0.5) * 0.25
421
- ), C.identity(), C.lookAt(V, Q, Rt), C.multiply(kt), C.setPosition(V), C.scale(X), C.toArray(s, u * 16), g[u] = {
422
- id: `${o}_${u}`,
423
- name: c.name,
424
- direction: c.tangent
425
- };
426
- }
427
- return x(
428
- {
429
- data: g,
430
- transformations: s
431
- },
432
- [s.buffer]
433
- );
234
+ //#endregion
235
+ //#region src/generators/perforations-generator.ts
236
+ var V = new O(), H = new O(), U = new O(), de = new O(0, 1, 0), W = new D(), fe = new D().makeRotationX(p);
237
+ async function pe(t, r, a = 1) {
238
+ let c = await this.get("perforations", t);
239
+ if (!c) return null;
240
+ let l = n(t, await this.get("position-logs", t));
241
+ if (!l) return null;
242
+ U.set(Math.max(1, a / 2), a, Math.max(1, a / 2));
243
+ let u = [], d = c.filter((e) => e.status === "Open" && e.mdBottomMsl > l.measuredTop && (r === void 0 || e.mdBottomMsl > r)).sort((e, t) => e.mdTopMsl - t.mdTopMsl);
244
+ for (let e = 0; e < d.length; e++) {
245
+ let t = d[e];
246
+ t.mdBottomMsl <= l.measuredTop || (!u.length || u[u.length - 1].bottom !== t.mdTopMsl ? u.push({
247
+ type: t.type,
248
+ top: Math.max(l.measuredTop, t.mdTopMsl),
249
+ bottom: t.mdBottomMsl,
250
+ density: i(t.density || 0),
251
+ phase: t.phase || 0,
252
+ innerDiameter: 0,
253
+ outerDiameter: 0
254
+ }) : u.length && (u[u.length - 1].bottom = t.mdBottomMsl));
255
+ }
256
+ let f = [];
257
+ for (let t = 0; t < u.length; t++) {
258
+ let n = u[t], r = n.bottom - n.top, i = Math.max(1, Math.floor(r * n.density)), a = m((n.top - l.measuredTop) / l.measuredLength, 0, 1), c = (m((n.bottom - l.measuredTop) / l.measuredLength, 0, 1) - a) / i, d = [];
259
+ for (let e = 0; e < i; e++) d.push(a + c * e);
260
+ let h = e(l.curve, d), g = p;
261
+ for (let e = 0; e < h.length; e++) {
262
+ let t = h[e], r = _(o(t.tangent, [
263
+ 0,
264
+ -1,
265
+ 0
266
+ ]), t.tangent, g);
267
+ f.push({
268
+ name: n.type,
269
+ position: t.position,
270
+ normal: r,
271
+ tangent: t.tangent
272
+ }), g += s(n.phase);
273
+ }
274
+ }
275
+ let h = new Float32Array(f.length * 16), g = [];
276
+ for (let e = 0; e < f.length; e++) {
277
+ let n = f[e];
278
+ V.set(...n.position), H.set(V.x + n.normal[0], V.y + n.normal[1], V.z + n.normal[2]), U.setY(a + a * (Math.random() - .5) * .25), W.identity(), W.lookAt(V, H, de), W.multiply(fe), W.setPosition(V), W.scale(U), W.toArray(h, e * 16), g[e] = {
279
+ id: `${t}_${e}`,
280
+ name: n.name,
281
+ direction: n.tangent
282
+ };
283
+ }
284
+ return k({
285
+ data: g,
286
+ transformations: h
287
+ }, [h.buffer]);
434
288
  }
435
- async function re(o, i, l = 0.1, r = 0) {
436
- const p = await this.get("position-logs", o), t = A(o, p);
437
- if (!t) return null;
438
- const e = {
439
- from: 0,
440
- to: 1,
441
- startCap: !1,
442
- endCap: !1,
443
- radialSegments: 32,
444
- computeLengths: !0,
445
- computeUvs: !0,
446
- segmentsPerMeter: l,
447
- simplificationThreshold: r,
448
- radius: i
449
- }, n = O(t.curve, e);
450
- if (!n) return null;
451
- const [m, s] = E(n);
452
- return x(m, s);
289
+ //#endregion
290
+ //#region src/generators/perimieter-generator.ts
291
+ async function me(e, t, i = .1, a = 0) {
292
+ let o = n(e, await this.get("position-logs", e));
293
+ if (!o) return null;
294
+ let s = {
295
+ from: 0,
296
+ to: 1,
297
+ startCap: !1,
298
+ endCap: !1,
299
+ radialSegments: 32,
300
+ computeLengths: !0,
301
+ computeUvs: !0,
302
+ segmentsPerMeter: i,
303
+ simplificationThreshold: a,
304
+ radius: t
305
+ }, c = r(o.curve, s);
306
+ if (!c) return null;
307
+ let [l, u] = h(c);
308
+ return k(l, u);
453
309
  }
454
- const R = new v(), Z = new v(), z = new v(), jt = new v(0, 1, 0), k = new P(), Gt = new P().makeRotationX(N);
455
- async function ae(o, i, l, r) {
456
- const p = await this.get("position-logs", o), t = A(o, p);
457
- if (!t) return null;
458
- const e = t.measuredBottom, n = t.measuredLength, s = Math.max(
459
- t.measuredTop,
460
- r && Number.isFinite(r) ? r : t.measuredTop
461
- ), g = [s];
462
- let u = Math.floor(s / l) * l;
463
- for (u <= s && (u += l); u < e; )
464
- g.push(u), u += l;
465
- g.push(e);
466
- const c = new Float32Array(g.length * 16), a = [];
467
- return g.forEach((f, h) => {
468
- const w = b((f - t.measuredTop) / n, 0, 1), d = t.curve.getPointAt(w), y = t.curve.getTangentAt(w);
469
- R.set(...d), k.identity();
470
- const T = i + 2 / i;
471
- z.set(T, T, T), Z.set(
472
- R.x + y[0],
473
- R.y + y[1],
474
- R.z + y[2]
475
- ), k.lookAt(R, Z, jt), k.multiply(Gt), k.setPosition(R), k.scale(z), k.toArray(c, h * 16), a[h] = {
476
- id: `${o}_${h}`,
477
- depth: f,
478
- position: d
479
- };
480
- }), x(
481
- {
482
- data: a,
483
- transformations: c
484
- },
485
- [c.buffer]
486
- );
310
+ //#endregion
311
+ //#region src/generators/position-markers-generator.ts
312
+ var G = new O(), K = new O(), q = new O(), he = new O(0, 1, 0), J = new D(), ge = new D().makeRotationX(p);
313
+ async function _e(e, t, r, i) {
314
+ let a = n(e, await this.get("position-logs", e));
315
+ if (!a) return null;
316
+ let o = a.measuredBottom, s = a.measuredLength, c = Math.max(a.measuredTop, i && Number.isFinite(i) ? i : a.measuredTop), l = [c], u = Math.floor(c / r) * r;
317
+ for (u <= c && (u += r); u < o;) l.push(u), u += r;
318
+ l.push(o);
319
+ let d = new Float32Array(l.length * 16), f = [];
320
+ return l.forEach((n, r) => {
321
+ let i = m((n - a.measuredTop) / s, 0, 1), o = a.curve.getPointAt(i), c = a.curve.getTangentAt(i);
322
+ G.set(...o), J.identity();
323
+ let l = t + 2 / t;
324
+ q.set(l, l, l), K.set(G.x + c[0], G.y + c[1], G.z + c[2]), J.lookAt(G, K, he), J.multiply(ge), J.setPosition(G), J.scale(q), J.toArray(d, r * 16), f[r] = {
325
+ id: `${e}_${r}`,
326
+ depth: n,
327
+ position: o
328
+ };
329
+ }), k({
330
+ data: f,
331
+ transformations: d
332
+ }, [d.buffer]);
487
333
  }
488
- const j = new v(), tt = new v(), et = new v(), Et = new v(0, 1, 0), G = new P(), It = new P().makeRotationX(N);
489
- async function ie(o, i, l) {
490
- const r = await this.get("casings", o);
491
- if (!r) return null;
492
- const p = await this.get("position-logs", o), t = A(o, p);
493
- if (!t) return null;
494
- const e = r.filter(
495
- (s) => s.isShoe && s.mdBottomMsl > t.measuredTop && (i === void 0 || s.mdBottomMsl > i)
496
- ).map((s) => {
497
- const g = b(
498
- (s.mdBottomMsl - t.measuredTop) / t.measuredLength,
499
- 0,
500
- 1
501
- );
502
- return {
503
- name: `${s.properties.Diameter} ${s.properties.Type}`,
504
- data: s.properties,
505
- position: t.curve.getPointAt(g),
506
- direction: t.curve.getTangentAt(g),
507
- radius: s.outerDiameter / 2
508
- };
509
- }), n = new Float32Array(e.length * 16), m = [];
510
- return e.forEach((s, g) => {
511
- j.set(...s.position), G.identity();
512
- const u = s.radius * (l || 1);
513
- et.set(u, u, u), tt.set(
514
- j.x + s.direction[0],
515
- j.y + s.direction[1],
516
- j.z + s.direction[2]
517
- ), G.lookAt(j, tt, Et), G.multiply(It), G.setPosition(j), G.scale(et), G.toArray(n, g * 16), m[g] = {
518
- id: `${o}_${g}`,
519
- name: s.name,
520
- direction: s.direction
521
- };
522
- }), x(
523
- {
524
- data: m,
525
- transformations: n
526
- },
527
- [n.buffer]
528
- );
334
+ //#endregion
335
+ //#region src/generators/shoes-generator.ts
336
+ var Y = new O(), X = new O(), Z = new O(), ve = new O(0, 1, 0), Q = new D(), ye = new D().makeRotationX(p);
337
+ async function be(e, t, r) {
338
+ let i = await this.get("casings", e);
339
+ if (!i) return null;
340
+ let a = n(e, await this.get("position-logs", e));
341
+ if (!a) return null;
342
+ let o = i.filter((e) => e.isShoe && e.mdBottomMsl > a.measuredTop && (t === void 0 || e.mdBottomMsl > t)).map((e) => {
343
+ let t = m((e.mdBottomMsl - a.measuredTop) / a.measuredLength, 0, 1);
344
+ return {
345
+ name: `${e.properties.Diameter} ${e.properties.Type}`,
346
+ data: e.properties,
347
+ position: a.curve.getPointAt(t),
348
+ direction: a.curve.getTangentAt(t),
349
+ radius: e.outerDiameter / 2
350
+ };
351
+ }), s = new Float32Array(o.length * 16), c = [];
352
+ return o.forEach((t, n) => {
353
+ Y.set(...t.position), Q.identity();
354
+ let i = t.radius * (r || 1);
355
+ Z.set(i, i, i), X.set(Y.x + t.direction[0], Y.y + t.direction[1], Y.z + t.direction[2]), Q.lookAt(Y, X, ve), Q.multiply(ye), Q.setPosition(Y), Q.scale(Z), Q.toArray(s, n * 16), c[n] = {
356
+ id: `${e}_${n}`,
357
+ name: t.name,
358
+ direction: t.direction
359
+ };
360
+ }), k({
361
+ data: c,
362
+ transformations: s
363
+ }, [s.buffer]);
529
364
  }
530
- const St = -1;
531
- async function ce(o, i = !1) {
532
- const l = await this.get("surface-meta", o);
533
- if (!l) return null;
534
- const r = await this.get("surface-values", o);
535
- if (!r) return null;
536
- const p = r, { header: t } = l, e = {
537
- elevationImageBuffer: p
538
- }, n = [p.buffer];
539
- if (i) {
540
- const m = ht(
541
- r,
542
- t.nx,
543
- t.ny,
544
- t.xinc,
545
- t.yinc
546
- );
547
- e.normalImageBuffer = m, n.push(m.buffer);
548
- }
549
- return x(e, n);
365
+ //#endregion
366
+ //#region src/generators/surface-generator.ts
367
+ var $ = -1;
368
+ async function xe(e, t = !1) {
369
+ let n = await this.get("surface-meta", e);
370
+ if (!n) return null;
371
+ let r = await this.get("surface-values", e);
372
+ if (!r) return null;
373
+ let i = r, { header: a } = n, o = { elevationImageBuffer: i }, s = [i.buffer];
374
+ if (t) {
375
+ let e = l(r, a.nx, a.ny, a.xinc, a.yinc);
376
+ o.normalImageBuffer = e, s.push(e.buffer);
377
+ }
378
+ return k(o, s);
550
379
  }
551
- async function ue(o, i = 5) {
552
- const l = await this.get("surface-meta", o);
553
- if (!l) return null;
554
- const r = l.max, p = await this.get("surface-values", o);
555
- if (!p) return null;
556
- const { header: t } = l, e = new bt(), { positions: n, uvs: m, indices: s } = Lt(
557
- p,
558
- t.nx,
559
- t.xinc,
560
- t.yinc,
561
- St,
562
- i
563
- );
564
- e.setAttribute("position", new W(n, 3)), e.setAttribute("uv", new W(m, 2)), e.setIndex(new W(s, 1)), e.translate(0, 0, -(t.ny - 1) * t.yinc), e.rotateY(t.rot * (Math.PI / 180)), e.translate(0, -r, 0);
565
- const [g, u] = E(e);
566
- return x(g, u);
380
+ async function Se(e, t = 5) {
381
+ let n = await this.get("surface-meta", e);
382
+ if (!n) return null;
383
+ let r = n.max, i = await this.get("surface-values", e);
384
+ if (!i) return null;
385
+ let { header: a } = n, o = new T(), { positions: s, uvs: c, indices: l } = u(i, a.nx, a.xinc, a.yinc, $, t);
386
+ o.setAttribute("position", new w(s, 3)), o.setAttribute("uv", new w(c, 2)), o.setIndex(new w(l, 1)), o.translate(0, 0, -(a.ny - 1) * a.yinc), o.rotateY(a.rot * (Math.PI / 180)), o.translate(0, -r, 0);
387
+ let [d, f] = h(o);
388
+ return k(d, f);
567
389
  }
568
- async function le(o, i, l = 0, r, p = 0.5, t = 16, e = !1) {
569
- const n = await this.get("position-logs", o), m = A(o, n);
570
- if (!m) return null;
571
- const g = {
572
- from: r !== void 0 ? b(
573
- (r - m.measuredTop) / m.measuredLength,
574
- 0,
575
- 1
576
- ) : 0,
577
- radius: p,
578
- startCap: !0,
579
- endCap: !0,
580
- segmentsPerMeter: i,
581
- simplificationThreshold: l,
582
- computeNormals: !0,
583
- computeUvs: !0,
584
- computeLengths: !!e,
585
- radialSegments: t
586
- }, u = O(m.curve, g);
587
- if (!u) return null;
588
- const [c, a] = E(u);
589
- return x(c, a);
390
+ //#endregion
391
+ //#region src/generators/tube-trajectory-generator.ts
392
+ async function Ce(e, t, i = 0, a, o = .5, s = 16, c = !1) {
393
+ let l = n(e, await this.get("position-logs", e));
394
+ if (!l) return null;
395
+ let u = {
396
+ from: a === void 0 ? 0 : m((a - l.measuredTop) / l.measuredLength, 0, 1),
397
+ radius: o,
398
+ startCap: !0,
399
+ endCap: !0,
400
+ segmentsPerMeter: t,
401
+ simplificationThreshold: i,
402
+ computeNormals: !0,
403
+ computeUvs: !0,
404
+ computeLengths: !!c,
405
+ radialSegments: s
406
+ }, d = r(l.curve, u);
407
+ if (!d) return null;
408
+ let [f, p] = h(d);
409
+ return k(f, p);
590
410
  }
591
- async function me(o, i, l = 250) {
592
- const r = await this.get("position-logs", o), p = {
593
- main: {
594
- center: [0, 0, 0],
595
- radius: 10
596
- },
597
- sampled: []
598
- };
599
- if (r) {
600
- const n = A(o, r);
601
- if (n) {
602
- const m = i !== void 0 ? b(
603
- (i - n.measuredTop) / n.measuredLength,
604
- 0,
605
- 1
606
- ) : 0, s = n.curve.getBoundingBox(m), g = (s.max[0] - s.min[0]) / 2, u = (s.max[1] - s.min[1]) / 2, c = (s.max[2] - s.min[2]) / 2, a = dt([g, u, c]) + l * 2, f = [
607
- s.min[0] + g,
608
- s.min[1] + u,
609
- s.min[2] + c
610
- ];
611
- if (p.main.center = f, p.main.radius = a, l > 0) {
612
- const h = Math.max(
613
- 2,
614
- Math.ceil((1 - m) * n.curve.length / l)
615
- ), w = n.curve.getPoints(h, m, 1), d = [];
616
- w.forEach((y) => {
617
- d.push({
618
- center: y,
619
- radius: l
620
- });
621
- }), p.sampled = d;
622
- }
623
- }
624
- }
625
- const t = new Float32Array(4 + p.sampled.length * 4);
626
- let e = 0;
627
- t[e] = p.main.center[0], t[e + 1] = p.main.center[1], t[e + 2] = p.main.center[2], t[e + 3] = p.main.radius, e = 4;
628
- for (let n = 0; n < p.sampled.length; n++, e += 4)
629
- t[e] = p.sampled[n].center[0], t[e + 1] = p.sampled[n].center[1], t[e + 2] = p.sampled[n].center[2], t[e + 3] = p.sampled[n].radius;
630
- return x(t, [t.buffer]);
411
+ //#endregion
412
+ //#region src/generators/wellbore-bounds-generator.ts
413
+ async function we(e, t, r = 250) {
414
+ let i = await this.get("position-logs", e), o = {
415
+ main: {
416
+ center: [
417
+ 0,
418
+ 0,
419
+ 0
420
+ ],
421
+ radius: 10
422
+ },
423
+ sampled: []
424
+ };
425
+ if (i) {
426
+ let s = n(e, i);
427
+ if (s) {
428
+ let e = t === void 0 ? 0 : m((t - s.measuredTop) / s.measuredLength, 0, 1), n = s.curve.getBoundingBox(e), i = (n.max[0] - n.min[0]) / 2, c = (n.max[1] - n.min[1]) / 2, l = (n.max[2] - n.min[2]) / 2, u = a([
429
+ i,
430
+ c,
431
+ l
432
+ ]) + r * 2, d = [
433
+ n.min[0] + i,
434
+ n.min[1] + c,
435
+ n.min[2] + l
436
+ ];
437
+ if (o.main.center = d, o.main.radius = u, r > 0) {
438
+ let t = Math.max(2, Math.ceil((1 - e) * s.curve.length / r)), n = s.curve.getPoints(t, e, 1), i = [];
439
+ n.forEach((e) => {
440
+ i.push({
441
+ center: e,
442
+ radius: r
443
+ });
444
+ }), o.sampled = i;
445
+ }
446
+ }
447
+ }
448
+ let s = new Float32Array(4 + o.sampled.length * 4), c = 0;
449
+ s[c] = o.main.center[0], s[c + 1] = o.main.center[1], s[c + 2] = o.main.center[2], s[c + 3] = o.main.radius, c = 4;
450
+ for (let e = 0; e < o.sampled.length; e++, c += 4) s[c] = o.sampled[e].center[0], s[c + 1] = o.sampled[e].center[1], s[c + 2] = o.sampled[e].center[2], s[c + 3] = o.sampled[e].radius;
451
+ return k(s, [s.buffer]);
631
452
  }
632
- async function pe(o, i, l, r, p, t, e = 0.5, n = 2, m = !0, s = 16, g = 0) {
633
- const u = await st(
634
- o,
635
- i,
636
- this
637
- );
638
- if (!u) return null;
639
- const c = u.filter(
640
- (M) => (t === void 0 || M.type && t.includes(M.type)) && (p === void 0 || p.includes(M.name))
641
- );
642
- if (!c.length) return null;
643
- const a = yt(c), f = await this.get("position-logs", o), h = A(o, f);
644
- if (!h) return null;
645
- const w = {
646
- startCap: m,
647
- endCap: m,
648
- segmentsPerMeter: l,
649
- simplificationThreshold: g,
650
- radialSegments: s,
651
- computeRelativeLengths: !0
652
- }, d = [];
653
- if (a.forEach((M) => {
654
- if (r === void 0 || M.mdMslTo > r) {
655
- let B = M.mdMslFrom;
656
- r !== void 0 && r > B && (B = r);
657
- const L = h.getPositionAtDepth(B, !0), I = h.getPositionAtDepth(M.mdMslTo, !0);
658
- if (L !== null && I !== null) {
659
- const at = n + e, it = new rt(M.color), S = O(h.curve, {
660
- ...w,
661
- radius: at,
662
- from: L,
663
- to: I
664
- });
665
- if (S?.attributes.position.count) {
666
- const q = new Float32Array(
667
- S.attributes.position.count * 3
668
- );
669
- for (let _ = 0; _ < S.attributes.position.count; _++)
670
- it.toArray(q, _ * 3);
671
- S.attributes.color = new W(q, 3), d.push(S);
672
- }
673
- }
674
- }
675
- }), !d.length) return null;
676
- const y = Y(d, !1);
677
- if (!y) return null;
678
- const [T, $] = E(y);
679
- return x(T, $);
453
+ //#endregion
454
+ //#region src/generators/wellbore-formation-column-generator.ts
455
+ async function Te(e, t, i, a, o, s, l = .5, u = 2, d = !0, f = 16, p = 0) {
456
+ let m = await y(e, t, this);
457
+ if (!m) return null;
458
+ let g = m.filter((e) => (s === void 0 || e.type && s.includes(e.type)) && (o === void 0 || o.includes(e.name)));
459
+ if (!g.length) return null;
460
+ let _ = c(g), v = n(e, await this.get("position-logs", e));
461
+ if (!v) return null;
462
+ let b = {
463
+ startCap: d,
464
+ endCap: d,
465
+ segmentsPerMeter: i,
466
+ simplificationThreshold: p,
467
+ radialSegments: f,
468
+ computeRelativeLengths: !0
469
+ }, x = [];
470
+ if (_.forEach((e) => {
471
+ if (a === void 0 || e.mdMslTo > a) {
472
+ let t = e.mdMslFrom;
473
+ a !== void 0 && a > t && (t = a);
474
+ let n = v.getPositionAtDepth(t, !0), i = v.getPositionAtDepth(e.mdMslTo, !0);
475
+ if (n !== null && i !== null) {
476
+ let t = u + l, a = new E(e.color), o = r(v.curve, {
477
+ ...b,
478
+ radius: t,
479
+ from: n,
480
+ to: i
481
+ });
482
+ if (o?.attributes.position.count) {
483
+ let e = new Float32Array(o.attributes.position.count * 3);
484
+ for (let t = 0; t < o.attributes.position.count; t++) a.toArray(e, t * 3);
485
+ o.attributes.color = new w(e, 3), x.push(o);
486
+ }
487
+ }
488
+ }
489
+ }), !x.length) return null;
490
+ let S = j(x, !1);
491
+ if (!S) return null;
492
+ let [C, T] = h(S);
493
+ return k(C, T);
680
494
  }
681
- async function ge(o, i, l) {
682
- const r = await this.get("wellbore-headers", o);
683
- if (!r) return null;
684
- const p = await this.get("position-logs", o), t = A(o, p);
685
- if (!t) return null;
686
- let e = 1;
687
- const { measuredTop: n, measuredLength: m, curve: s } = t;
688
- if (i === "top")
689
- e = b(
690
- ((l || n) - n) / m,
691
- 0,
692
- 1
693
- );
694
- else if (i === "center") {
695
- const u = (l || n) + (m - (l || n)) / 2;
696
- e = b((u - n) / m, 0, 1);
697
- }
698
- return [{
699
- id: o,
700
- name: `${r.name.replace("NO ", "")}`,
701
- position: s.getPointAt(e),
702
- direction: s.getTangentAt(e)
703
- }];
495
+ //#endregion
496
+ //#region src/generators/wellbore-label-generator.ts
497
+ async function Ee(e, t, r) {
498
+ let i = await this.get("wellbore-headers", e);
499
+ if (!i) return null;
500
+ let a = n(e, await this.get("position-logs", e));
501
+ if (!a) return null;
502
+ let o = 1, { measuredTop: s, measuredLength: c, curve: l } = a;
503
+ return t === "top" ? o = m(((r || s) - s) / c, 0, 1) : t === "center" && (o = m(((r || s) + (c - (r || s)) / 2 - s) / c, 0, 1)), [{
504
+ id: e,
505
+ name: `${i.name.replace("NO ", "")}`,
506
+ position: l.getPointAt(o),
507
+ direction: l.getTangentAt(o)
508
+ }];
704
509
  }
705
- async function fe(o, i = 3, l = 1e3, r = 1e3, p = 0) {
706
- const t = {
707
- stepSize: i,
708
- minSize: l,
709
- extension: r,
710
- defaultExtensionAngle: p
711
- }, e = await this.get(
712
- "wellbore-seismic-section",
713
- o,
714
- t
715
- );
716
- if (e === null || e.trajectory === null) return null;
717
- const { positions: n } = e.trajectory, m = -e.depthRange[0], s = -e.depthRange[1], g = wt(n), u = $t(g, m, s), [c, a] = E(u), f = {
718
- data: {
719
- array: e.values,
720
- width: e.samples[0],
721
- height: e.samples[1],
722
- min: e.valueRange[0],
723
- max: e.valueRange[1]
724
- },
725
- geometry: c
726
- }, h = [f.data.array.buffer, ...a];
727
- return x(f, h);
510
+ //#endregion
511
+ //#region src/generators/wellbore-seismic-section-generator.ts
512
+ async function De(e, t = 3, n = 1e3, r = 1e3, i = 0) {
513
+ let a = {
514
+ stepSize: t,
515
+ minSize: n,
516
+ extension: r,
517
+ defaultExtensionAngle: i
518
+ }, o = await this.get("wellbore-seismic-section", e, a);
519
+ if (o === null || o.trajectory === null) return null;
520
+ let { positions: s } = o.trajectory, c = -o.depthRange[0], l = -o.depthRange[1], [u, d] = h(x(b(s), c, l)), f = {
521
+ data: {
522
+ array: o.values,
523
+ width: o.samples[0],
524
+ height: o.samples[1],
525
+ min: o.valueRange[0],
526
+ max: o.valueRange[1]
527
+ },
528
+ geometry: u
529
+ };
530
+ return k(f, [f.data.array.buffer, ...d]);
728
531
  }
729
- export {
730
- me as calculateWellboreBounds,
731
- Qt as generateBasicTrajectory,
732
- Zt as generateCasingAnnotations,
733
- zt as generateCasings,
734
- te as generateCompletionToolAnnotations,
735
- ee as generateCompletionTools,
736
- oe as generateDepthMarkers,
737
- ne as generateFormationMarkers,
738
- se as generatePerforations,
739
- re as generatePerimeterGeometry,
740
- ae as generatePositionMarkers,
741
- ie as generateShoes,
742
- ue as generateSurfaceGeometry,
743
- ce as generateSurfaceTexturesData,
744
- le as generateTubeTrajectory,
745
- pe as generateWellboreFormationColumnGeometries,
746
- ge as generateWellboreLabel,
747
- fe as generateWellboreSeismicSection
748
- };
532
+ //#endregion
533
+ export { we as calculateWellboreBounds, ne as generateBasicTrajectory, re as generateCasingAnnotations, ie as generateCasings, ae as generateCompletionToolAnnotations, se as generateCompletionTools, ce as generateDepthMarkers, B as generateFormationMarkers, pe as generatePerforations, me as generatePerimeterGeometry, _e as generatePositionMarkers, be as generateShoes, Se as generateSurfaceGeometry, xe as generateSurfaceTexturesData, Ce as generateTubeTrajectory, Te as generateWellboreFormationColumnGeometries, Ee as generateWellboreLabel, De as generateWellboreSeismicSection };