@equinor/videx-3d 1.1.1 → 3.0.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 (74) hide show
  1. package/README.md +120 -120
  2. package/dist/chunk-DKAquGKk.js +2820 -0
  3. package/dist/chunk-DsUZyEG_.js +16 -0
  4. package/dist/generators.js +512 -716
  5. package/dist/main.js +6909 -8947
  6. package/dist/sdk.js +2 -785
  7. package/dist/src/sdk/materials/shaderLib/oit.glsl +106 -0
  8. package/dist/types/components/Annotations/AutoUpdate.d.ts +1 -1
  9. package/dist/types/components/Annotations/index.d.ts +2 -2
  10. package/dist/types/components/Annotations/types.d.ts +3 -1
  11. package/dist/types/components/Annotations/update-annotations.d.ts +10 -0
  12. package/dist/types/components/EventEmitter/picking-helper.d.ts +23 -1
  13. package/dist/types/components/Ocean/Ocean.d.ts +333 -0
  14. package/dist/types/components/Ocean/index.d.ts +6 -0
  15. package/dist/types/components/Ocean/ocean-bed-material.d.ts +60 -0
  16. package/dist/types/components/Ocean/ocean-contact.d.ts +39 -0
  17. package/dist/types/components/Ocean/ocean-material.d.ts +145 -0
  18. package/dist/types/components/Ocean/ocean-sampler.d.ts +93 -0
  19. package/dist/types/components/Ocean/ocean-volume-material.d.ts +54 -0
  20. package/dist/types/components/Surfaces/Surface.d.ts +8 -1
  21. package/dist/types/components/Surfaces/SurfaceMaterial.d.ts +3 -0
  22. package/dist/types/components/Surfaces/surface-defs.d.ts +1 -0
  23. package/dist/types/components/Tanker/Tanker.d.ts +47 -0
  24. package/dist/types/components/Tanker/TankerSuperstructure.d.ts +23 -0
  25. package/dist/types/components/Tanker/tanker-geometry-builder.d.ts +21 -0
  26. package/dist/types/generators/surface-generator.d.ts +1 -1
  27. package/dist/types/layers/layers.d.ts +4 -0
  28. package/dist/types/main.d.ts +1 -0
  29. package/dist/types/rendering/OitMaterial.d.ts +59 -0
  30. package/dist/types/rendering/Pass.d.ts +16 -0
  31. package/dist/types/rendering/RenderingPipeline.d.ts +46 -0
  32. package/dist/types/rendering/debug/DebugBoxOutputPass.d.ts +22 -0
  33. package/dist/types/rendering/debug/DebugPatternPass.d.ts +30 -0
  34. package/dist/types/rendering/fullscreen-renderer.d.ts +1 -0
  35. package/dist/types/rendering/fxaa-resolver.d.ts +25 -0
  36. package/dist/types/rendering/gpu-timer.d.ts +46 -0
  37. package/dist/types/rendering/index.d.ts +8 -1
  38. package/dist/types/rendering/oit-material.d.ts +122 -0
  39. package/dist/types/{components/Annotations/annotations-renderer.d.ts → rendering/passes/AnnotationsPass.d.ts} +14 -4
  40. package/dist/types/rendering/passes/FXAAPass.d.ts +17 -0
  41. package/dist/types/rendering/passes/OITRenderPass.d.ts +429 -0
  42. package/dist/types/rendering/passes/OutputPass.d.ts +19 -0
  43. package/dist/types/rendering/passes/RenderPass.d.ts +10 -0
  44. package/dist/types/rendering/passes/index.d.ts +4 -0
  45. package/dist/types/rendering/rendering-state.d.ts +59 -0
  46. package/dist/types/rendering/smaa-resolver.d.ts +58 -0
  47. package/dist/types/rendering/taa-resolver.d.ts +161 -0
  48. package/dist/types/rendering/temporal-resolver.d.ts +152 -0
  49. package/dist/types/sdk/geometries/boundary-loops.d.ts +38 -0
  50. package/dist/types/sdk/geometries/geometry-attributes.d.ts +37 -0
  51. package/dist/types/sdk/geometries/grid-sampling.d.ts +50 -0
  52. package/dist/types/sdk/geometries/ocean-geometry.d.ts +288 -0
  53. package/dist/types/sdk/geometries/packing.d.ts +1 -1
  54. package/dist/types/sdk/geometries/tessellation.d.ts +25 -0
  55. package/dist/types/sdk/index.d.ts +5 -0
  56. package/dist/types/sdk/utils/elevation-map.d.ts +23 -0
  57. package/dist/types/sdk/utils/trigonometry.d.ts +4 -1
  58. package/dist/types/sdk/utils/vector-operations.d.ts +7 -0
  59. package/package.json +9 -10
  60. package/dist/chunk-BlPg4RjP.js +0 -689
  61. package/dist/chunk-CnY6Tmof.js +0 -358
  62. package/dist/chunk-DuRASjkF.js +0 -17
  63. package/dist/chunk-iY0wQ9Z6.js +0 -887
  64. package/dist/types/rendering/render-passes.d.ts +0 -16
  65. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/color-conversion.glsl +0 -0
  66. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/colors.glsl +0 -0
  67. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/glyphs.glsl +0 -0
  68. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/random.glsl +0 -0
  69. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/remap.glsl +0 -0
  70. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/render-number.glsl +0 -0
  71. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/render-text.glsl +0 -0
  72. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/rotation.glsl +0 -0
  73. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/sdf-functions.glsl +0 -0
  74. /package/dist/textures/{normal_map.jpg → public/normal_map.jpg} +0 -0
@@ -1,737 +1,533 @@
1
- import { transfer as x } from "comlink";
2
- import "p-limit";
3
- import { i as A, d as b, o as ot, a7 as ct, p as nt, $ as ut, a6 as E, b as N, g as st, O as lt, N as mt, aa as pt, F as gt, G as ft, _ as ht, h as dt, ag as yt } from "./chunk-iY0wQ9Z6.js";
4
- import "three/src/math/MathUtils.js";
5
- import { Sphere as wt, Box3 as Tt, Vector3 as v, Matrix4 as P, Color as rt, BufferGeometry as Mt, BufferAttribute as O } from "three";
6
- import "proj4";
7
- import { clamp as bt } from "curve-interpolator";
8
- import { group as vt } from "d3-array";
9
- import { mergeBufferGeometries as Y } from "three-stdlib";
10
- import { a as At } from "./chunk-DuRASjkF.js";
11
- import { d as W, t as xt, f as Bt, a as $t } from "./chunk-BlPg4RjP.js";
12
- async function Kt(o, c, l = 0, r, m = !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, p = ot(
20
- e.curve,
21
- n,
22
- 1,
23
- c,
24
- l
25
- ), s = new Float32Array(p.length * 3), g = m ? new Float32Array(p.length) : null;
26
- p.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 [i, a] = ct({ attributes: u });
41
- return x(i, 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 Qt(o) {
44
- const c = await this.get("casings", o);
45
- if (!c) return null;
46
- const l = await this.get("position-logs", o), r = A(o, l);
47
- return r ? c.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 X = new wt();
63
- function Lt(o, c, l) {
64
- if (c[0] === l[0]) return l[1];
65
- const r = l[0] - c[0], m = b((o - c[0]) / r, 0, 1);
66
- return ut(c[1], l[1], m);
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 Pt(o, c, l, r, m, t) {
69
- const e = [];
70
- r.sort((a, f) => a[0] - f[0]);
71
- const n = [], p = ot(
72
- o,
73
- c,
74
- l,
75
- m,
76
- t
77
- );
78
- let s = 0, g = p[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 < p.length - 1; )
87
- g = p[++s];
88
- for (; g < d && s < p.length; ) {
89
- const T = Lt(g, r[a], r[f]);
90
- n.push([g, T]), g = p[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
- ), i = l - c;
98
- return u.forEach((a, f) => {
99
- e.push(
100
- ...a.position,
101
- ...a.normal,
102
- ...a.tangent,
103
- b((a.curvePosition - c) / i, 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, c, l = 2, r = 0.1, m = 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 p = c !== void 0 ? b(
118
- (c - n.measuredTop) / n.measuredLength,
119
- 0,
120
- 1
121
- ) : 0, s = t.filter(
122
- (a) => a.mdBottomMsl > n.measuredTop && (c === void 0 || a.mdBottomMsl > c)
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 = [], i = [];
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
- p,
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 $ = d * l;
150
- T.push(
151
- [h, d],
152
- [h + (w - h) / 4, d],
153
- [w, $]
154
- );
155
- } else {
156
- const $ = d - (d - y) / 4;
157
- T.push([h, $]);
158
- const S = Math.min((d - $) * 2, f / 3) * g;
159
- T.push([h + S, d]), T.push([w - S, d]), T.push([w, $]);
160
- }
161
- const L = Pt(
162
- n.curve,
163
- h,
164
- w,
165
- T,
166
- r,
167
- m
168
- ), M = n.curve.getBoundingBox(h, w);
169
- new Tt(new v(...M.min), new v(...M.max)).getBoundingSphere(X), i.push({
170
- type: a.type,
171
- radius: d,
172
- innerRadius: y,
173
- length: f,
174
- top: h,
175
- bottom: w,
176
- attributesBuffer: L,
177
- segments: L.length / 12,
178
- boundingSphere: {
179
- center: X.center.toArray(),
180
- radius: X.radius
181
- }
182
- }), u.push(L.buffer);
183
- }), x(i, 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 zt(o) {
186
- const c = await this.get("completion-tools", o);
187
- if (!c) return null;
188
- const l = await this.get("position-logs", o), r = A(o, l);
189
- return r ? c.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 Dt(o, c, l, r, m) {
205
- const t = b(c.length, 1e-4, o.measuredLength), e = 1 / o.measuredLength, n = [], p = b(
206
- (c.mdTopMsl - o.measuredTop) / o.measuredLength,
207
- 0,
208
- 1
209
- ), s = b(
210
- (c.mdBottomMsl - o.measuredTop) / o.measuredLength,
211
- 0,
212
- 1
213
- ), g = l * ((c.diameterTop || c.diameterBottom) / 2), u = l * ((c.diameterBottom || c.diameterTop) / 2), i = l * ((c.diameterMax || c.diameterTop) / 2), a = Math.min(g, u, i);
214
- n.push([p, g]);
215
- const f = Math.min((i - a) * 2, t / 3) * e;
216
- return i > a && (n.push([p + f, i]), n.push([s - f, i])), n.push([s, u]), W(o.curve, {
217
- ...m,
218
- from: Math.max(p, 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 te(o, c, l = 16, r = 1, m = 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), p = A(o, n);
231
- if (!p) return null;
232
- const s = c !== void 0 ? b(
233
- (c - p.measuredTop) / p.measuredLength,
234
- 0,
235
- 1
236
- ) : 0, g = e.filter(
237
- (y) => y.mdBottomMsl > p.measuredTop && (c === void 0 || y.mdBottomMsl > c)
238
- ).sort((y, T) => y.mdTopMsl - T.mdTopMsl), u = vt(g, (y) => y.category), i = {
239
- startCap: !0,
240
- endCap: !0,
241
- radialSegments: l,
242
- computeNormals: !0,
243
- computeUvs: !0,
244
- segmentsPerMeter: m,
245
- simplificationThreshold: t,
246
- radius: 0
247
- }, a = [], f = [];
248
- if (u.forEach((y, T) => {
249
- const L = y.map((B) => Dt(
250
- p,
251
- B,
252
- r,
253
- s,
254
- i
255
- )).filter((B) => B);
256
- f.push(At[T]);
257
- const M = Y(
258
- L,
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 ee(o, c, l = "MSL", r) {
272
- const m = await this.get("position-logs", o);
273
- if (!m || m.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, m);
280
- if (!e) return null;
281
- const n = m[m.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 / c) * c;
286
- for (u <= s && (u += c); u < n; )
287
- g.push(u), u += c;
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(), q = new v(), J = new v(), Ft = new v(0, 1, 0), F = new P(), Vt = new P().makeRotationX(N), K = new rt();
303
- async function oe(o, c, l, r = 10) {
304
- const m = await st(
305
- o,
306
- c,
307
- this,
308
- l
309
- );
310
- if (!m) return null;
311
- const t = lt(m);
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 p = t.map((i) => {
316
- const a = bt(
317
- (i.mdMsl - n.measuredTop) / n.measuredLength,
318
- 0,
319
- 1
320
- );
321
- return {
322
- ...i,
323
- position: n.curve.getPointAt(a),
324
- direction: n.curve.getTangentAt(a)
325
- };
326
- }), s = new Float32Array(p.length * 16), g = new Float32Array(p.length * 3), u = [];
327
- return p.forEach((i, a) => {
328
- D.set(...i.position), F.identity();
329
- const f = r;
330
- J.set(f, f, f), q.set(
331
- D.x + i.direction[0],
332
- D.y + i.direction[1],
333
- D.z + i.direction[2]
334
- ), F.lookAt(D, q, Ft), F.multiply(Vt), F.setPosition(D), F.scale(J), F.toArray(s, a * 16), K.set(i.color), K.toArray(g, a * 3), u[a] = {
335
- id: `${o}_${a}`,
336
- name: `${i.name} ${xt(i.type)}`,
337
- depth: i.mdMsl,
338
- tvd: i.tvdMsl,
339
- level: i.level,
340
- direction: i.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(), U = new v(), Ct = new v(0, 1, 0), C = new P(), Rt = new P().makeRotationX(N);
352
- async function ne(o, c, l = 1) {
353
- const r = await this.get(
354
- "perforations",
355
- o
356
- );
357
- if (!r) return null;
358
- const m = await this.get("position-logs", o), t = A(o, m);
359
- if (!t) return null;
360
- U.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 && (c === void 0 || u.mdBottomMsl > c)
367
- ).sort((u, i) => u.mdTopMsl - i.mdTopMsl);
368
- for (let u = 0; u < n.length; u++) {
369
- const i = n[u];
370
- i.mdBottomMsl <= t.measuredTop || (!e.length || e[e.length - 1].bottom !== i.mdTopMsl ? e.push({
371
- type: i.type,
372
- top: Math.max(t.measuredTop, i.mdTopMsl),
373
- bottom: i.mdBottomMsl,
374
- density: mt(i.density || 0),
375
- phase: i.phase || 0,
376
- innerDiameter: 0,
377
- outerDiameter: 0
378
- }) : e.length && (e[e.length - 1].bottom = i.mdBottomMsl));
379
- }
380
- const p = [];
381
- for (let u = 0; u < e.length; u++) {
382
- const i = e[u], a = i.bottom - i.top, f = Math.max(
383
- 1,
384
- Math.floor(a * i.density)
385
- ), h = b(
386
- (i.top - t.measuredTop) / t.measuredLength,
387
- 0,
388
- 1
389
- ), d = (b(
390
- (i.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 L = N;
398
- for (let M = 0; M < T.length; M++) {
399
- const B = T[M], $ = pt(
400
- gt(B.tangent, [0, -1, 0]),
401
- B.tangent,
402
- L
403
- );
404
- p.push({
405
- name: i.type,
406
- position: B.position,
407
- normal: $,
408
- tangent: B.tangent
409
- }), L += ft(i.phase);
410
- }
411
- }
412
- const s = new Float32Array(p.length * 16), g = [];
413
- for (let u = 0; u < p.length; u++) {
414
- const i = p[u];
415
- V.set(...i.position), Q.set(
416
- V.x + i.normal[0],
417
- V.y + i.normal[1],
418
- V.z + i.normal[2]
419
- ), U.setY(
420
- l + l * (Math.random() - 0.5) * 0.25
421
- ), C.identity(), C.lookAt(V, Q, Ct), C.multiply(Rt), C.setPosition(V), C.scale(U), C.toArray(s, u * 16), g[u] = {
422
- id: `${o}_${u}`,
423
- name: i.name,
424
- direction: i.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 se(o, c, l = 0.1, r = 0) {
436
- const m = await this.get("position-logs", o), t = A(o, m);
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: c
449
- }, n = W(t.curve, e);
450
- if (!n) return null;
451
- const [p, s] = E(n);
452
- return x(p, 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(), kt = new v(0, 1, 0), k = new P(), jt = new P().makeRotationX(N);
455
- async function re(o, c, l, r) {
456
- const m = await this.get("position-logs", o), t = A(o, m);
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 i = 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 = c + 2 / c;
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, kt), k.multiply(jt), k.setPosition(R), k.scale(z), k.toArray(i, h * 16), a[h] = {
476
- id: `${o}_${h}`,
477
- depth: f,
478
- position: d
479
- };
480
- }), x(
481
- {
482
- data: a,
483
- transformations: i
484
- },
485
- [i.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(), Gt = new v(0, 1, 0), G = new P(), Et = new P().makeRotationX(N);
489
- async function ae(o, c, l) {
490
- const r = await this.get("casings", o);
491
- if (!r) return null;
492
- const m = await this.get("position-logs", o), t = A(o, m);
493
- if (!t) return null;
494
- const e = r.filter(
495
- (s) => s.isShoe && s.mdBottomMsl > t.measuredTop && (c === void 0 || s.mdBottomMsl > c)
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), p = [];
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, Gt), G.multiply(Et), G.setPosition(j), G.scale(et), G.toArray(n, g * 16), p[g] = {
518
- id: `${o}_${g}`,
519
- name: s.name,
520
- direction: s.direction
521
- };
522
- }), x(
523
- {
524
- data: p,
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 ie(o) {
532
- if (!await this.get("surface-meta", o)) return null;
533
- const l = await this.get("surface-values", o);
534
- if (!l) return null;
535
- const r = l;
536
- return x({
537
- elevationImageBuffer: r
538
- }, [r.buffer]);
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);
539
379
  }
540
- async function ce(o, c = 5) {
541
- const l = await this.get("surface-meta", o);
542
- if (!l) return null;
543
- const r = l.max, m = await this.get("surface-values", o);
544
- if (!m) return null;
545
- const { header: t } = l, e = new Mt(), { positions: n, uvs: p, indices: s } = Bt(
546
- m,
547
- t.nx,
548
- t.xinc,
549
- t.yinc,
550
- St,
551
- c
552
- );
553
- e.setAttribute("position", new O(n, 3)), e.setAttribute("uv", new O(p, 2)), e.setIndex(new O(s, 1)), e.translate(0, 0, -(t.ny - 1) * t.yinc), e.rotateY(t.rot * (Math.PI / 180)), e.translate(0, -r, 0);
554
- const [g, u] = E(e);
555
- 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);
556
389
  }
557
- async function ue(o, c, l = 0, r, m = 0.5, t = 16, e = !1) {
558
- const n = await this.get("position-logs", o), p = A(o, n);
559
- if (!p) return null;
560
- const g = {
561
- from: r !== void 0 ? b(
562
- (r - p.measuredTop) / p.measuredLength,
563
- 0,
564
- 1
565
- ) : 0,
566
- radius: m,
567
- startCap: !0,
568
- endCap: !0,
569
- segmentsPerMeter: c,
570
- simplificationThreshold: l,
571
- computeNormals: !0,
572
- computeUvs: !0,
573
- computeLengths: !!e,
574
- radialSegments: t
575
- }, u = W(p.curve, g);
576
- if (!u) return null;
577
- const [i, a] = E(u);
578
- return x(i, 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);
579
410
  }
580
- async function le(o, c, l = 250) {
581
- const r = await this.get("position-logs", o), m = {
582
- main: {
583
- center: [0, 0, 0],
584
- radius: 10
585
- },
586
- sampled: []
587
- };
588
- if (r) {
589
- const n = A(o, r);
590
- if (n) {
591
- const p = c !== void 0 ? b(
592
- (c - n.measuredTop) / n.measuredLength,
593
- 0,
594
- 1
595
- ) : 0, s = n.curve.getBoundingBox(p), g = (s.max[0] - s.min[0]) / 2, u = (s.max[1] - s.min[1]) / 2, i = (s.max[2] - s.min[2]) / 2, a = ht([g, u, i]) + l * 2, f = [
596
- s.min[0] + g,
597
- s.min[1] + u,
598
- s.min[2] + i
599
- ];
600
- if (m.main.center = f, m.main.radius = a, l > 0) {
601
- const h = Math.max(
602
- 2,
603
- Math.ceil((1 - p) * n.curve.length / l)
604
- ), w = n.curve.getPoints(h, p, 1), d = [];
605
- w.forEach((y) => {
606
- d.push({
607
- center: y,
608
- radius: l
609
- });
610
- }), m.sampled = d;
611
- }
612
- }
613
- }
614
- const t = new Float32Array(4 + m.sampled.length * 4);
615
- let e = 0;
616
- t[e] = m.main.center[0], t[e + 1] = m.main.center[1], t[e + 2] = m.main.center[2], t[e + 3] = m.main.radius, e = 4;
617
- for (let n = 0; n < m.sampled.length; n++, e += 4)
618
- t[e] = m.sampled[n].center[0], t[e + 1] = m.sampled[n].center[1], t[e + 2] = m.sampled[n].center[2], t[e + 3] = m.sampled[n].radius;
619
- 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]);
620
452
  }
621
- async function me(o, c, l, r, m, t, e = 0.5, n = 2, p = !0, s = 16, g = 0) {
622
- const u = await st(
623
- o,
624
- c,
625
- this
626
- );
627
- if (!u) return null;
628
- const i = u.filter(
629
- (M) => (t === void 0 || M.type && t.includes(M.type)) && (m === void 0 || m.includes(M.name))
630
- );
631
- if (!i.length) return null;
632
- const a = dt(i), f = await this.get("position-logs", o), h = A(o, f);
633
- if (!h) return null;
634
- const w = {
635
- startCap: p,
636
- endCap: p,
637
- segmentsPerMeter: l,
638
- simplificationThreshold: g,
639
- radialSegments: s,
640
- computeRelativeLengths: !0
641
- }, d = [];
642
- if (a.forEach((M) => {
643
- if (r === void 0 || M.mdMslTo > r) {
644
- let B = M.mdMslFrom;
645
- r !== void 0 && r > B && (B = r);
646
- const $ = h.getPositionAtDepth(B, !0), S = h.getPositionAtDepth(M.mdMslTo, !0);
647
- if ($ !== null && S !== null) {
648
- const at = n + e, it = new rt(M.color), I = W(h.curve, {
649
- ...w,
650
- radius: at,
651
- from: $,
652
- to: S
653
- });
654
- if (I?.attributes.position.count) {
655
- const H = new Float32Array(
656
- I.attributes.position.count * 3
657
- );
658
- for (let _ = 0; _ < I.attributes.position.count; _++)
659
- it.toArray(H, _ * 3);
660
- I.attributes.color = new O(H, 3), d.push(I);
661
- }
662
- }
663
- }
664
- }), !d.length) return null;
665
- const y = Y(d, !1);
666
- if (!y) return null;
667
- const [T, L] = E(y);
668
- return x(T, L);
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);
669
494
  }
670
- async function pe(o, c, l) {
671
- const r = await this.get("wellbore-headers", o);
672
- if (!r) return null;
673
- const m = await this.get("position-logs", o), t = A(o, m);
674
- if (!t) return null;
675
- let e = 1;
676
- const { measuredTop: n, measuredLength: p, curve: s } = t;
677
- if (c === "top")
678
- e = b(
679
- ((l || n) - n) / p,
680
- 0,
681
- 1
682
- );
683
- else if (c === "center") {
684
- const u = (l || n) + (p - (l || n)) / 2;
685
- e = b((u - n) / p, 0, 1);
686
- }
687
- return [{
688
- id: o,
689
- name: `${r.name.replace("NO ", "")}`,
690
- position: s.getPointAt(e),
691
- direction: s.getTangentAt(e)
692
- }];
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
+ }];
693
509
  }
694
- async function ge(o, c = 3, l = 1e3, r = 1e3, m = 0) {
695
- const t = {
696
- stepSize: c,
697
- minSize: l,
698
- extension: r,
699
- defaultExtensionAngle: m
700
- }, e = await this.get(
701
- "wellbore-seismic-section",
702
- o,
703
- t
704
- );
705
- if (e === null || e.trajectory === null) return null;
706
- const { positions: n } = e.trajectory, p = -e.depthRange[0], s = -e.depthRange[1], g = yt(n), u = $t(g, p, s), [i, a] = E(u), f = {
707
- data: {
708
- array: e.values,
709
- width: e.samples[0],
710
- height: e.samples[1],
711
- min: e.valueRange[0],
712
- max: e.valueRange[1]
713
- },
714
- geometry: i
715
- }, h = [f.data.array.buffer, ...a];
716
- 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]);
717
531
  }
718
- export {
719
- le as calculateWellboreBounds,
720
- Kt as generateBasicTrajectory,
721
- Qt as generateCasingAnnotations,
722
- Zt as generateCasings,
723
- zt as generateCompletionToolAnnotations,
724
- te as generateCompletionTools,
725
- ee as generateDepthMarkers,
726
- oe as generateFormationMarkers,
727
- ne as generatePerforations,
728
- se as generatePerimeterGeometry,
729
- re as generatePositionMarkers,
730
- ae as generateShoes,
731
- ce as generateSurfaceGeometry,
732
- ie as generateSurfaceTexturesData,
733
- ue as generateTubeTrajectory,
734
- me as generateWellboreFormationColumnGeometries,
735
- pe as generateWellboreLabel,
736
- ge as generateWellboreSeismicSection
737
- };
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 };