@equinor/videx-3d 1.1.1 → 2.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 (40) hide show
  1. package/README.md +120 -120
  2. package/dist/chunk-61X6qE5N.js +981 -0
  3. package/dist/chunk-ChG5d4HC.js +675 -0
  4. package/dist/{chunk-BlPg4RjP.js → chunk-M-Pcc_Yg.js} +19 -19
  5. package/dist/generators.js +271 -260
  6. package/dist/main.js +4919 -3344
  7. package/dist/sdk.js +92 -90
  8. package/dist/shaderLib/oit.glsl +106 -0
  9. package/dist/types/components/Annotations/AutoUpdate.d.ts +1 -1
  10. package/dist/types/components/Annotations/index.d.ts +2 -2
  11. package/dist/types/components/Annotations/types.d.ts +3 -1
  12. package/dist/types/components/Annotations/update-annotations.d.ts +10 -0
  13. package/dist/types/components/EventEmitter/picking-helper.d.ts +23 -1
  14. package/dist/types/components/Surfaces/Surface.d.ts +8 -1
  15. package/dist/types/components/Surfaces/SurfaceMaterial.d.ts +3 -0
  16. package/dist/types/components/Surfaces/surface-defs.d.ts +1 -0
  17. package/dist/types/generators/surface-generator.d.ts +1 -1
  18. package/dist/types/layers/layers.d.ts +4 -0
  19. package/dist/types/rendering/OitMaterial.d.ts +59 -0
  20. package/dist/types/rendering/Pass.d.ts +7 -0
  21. package/dist/types/rendering/RenderingPipeline.d.ts +37 -0
  22. package/dist/types/rendering/fullscreen-renderer.d.ts +1 -0
  23. package/dist/types/rendering/gpu-timer.d.ts +46 -0
  24. package/dist/types/rendering/index.d.ts +7 -1
  25. package/dist/types/rendering/oit-material.d.ts +122 -0
  26. package/dist/types/{components/Annotations/annotations-renderer.d.ts → rendering/passes/AnnotationsPass.d.ts} +13 -4
  27. package/dist/types/rendering/passes/FXAAPass.d.ts +12 -0
  28. package/dist/types/rendering/passes/OITRenderPass.d.ts +282 -0
  29. package/dist/types/rendering/passes/OutputPass.d.ts +10 -0
  30. package/dist/types/rendering/passes/RenderPass.d.ts +8 -0
  31. package/dist/types/rendering/passes/SMAAPass.d.ts +40 -0
  32. package/dist/types/rendering/passes/TAAPass.d.ts +94 -0
  33. package/dist/types/rendering/passes/index.d.ts +6 -0
  34. package/dist/types/rendering/rendering-state.d.ts +59 -0
  35. package/dist/types/sdk/utils/elevation-map.d.ts +23 -0
  36. package/dist/types/sdk/utils/trigonometry.d.ts +4 -1
  37. package/package.json +1 -1
  38. package/dist/chunk-CnY6Tmof.js +0 -358
  39. package/dist/chunk-iY0wQ9Z6.js +0 -887
  40. package/dist/types/rendering/render-passes.d.ts +0 -16
@@ -1,29 +1,29 @@
1
1
  import { transfer as x } from "comlink";
2
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";
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
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";
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
6
  import "proj4";
7
- import { clamp as bt } from "curve-interpolator";
8
- import { group as vt } from "d3-array";
7
+ import { clamp as vt } from "curve-interpolator";
8
+ import { group as At } from "d3-array";
9
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) {
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
13
  const t = await this.get("position-logs", o), e = A(o, t);
14
14
  if (!e) return null;
15
15
  const n = r !== void 0 ? b(
16
16
  (r - e.measuredTop) / e.measuredLength,
17
17
  0,
18
18
  1
19
- ) : 0, p = ot(
19
+ ) : 0, m = ot(
20
20
  e.curve,
21
21
  n,
22
22
  1,
23
- c,
23
+ i,
24
24
  l
25
- ), s = new Float32Array(p.length * 3), g = m ? new Float32Array(p.length) : null;
26
- p.forEach((f, h) => {
25
+ ), s = new Float32Array(m.length * 3), g = p ? new Float32Array(m.length) : null;
26
+ m.forEach((f, h) => {
27
27
  const w = e.curve.getPointAt(f);
28
28
  s[h * 3] = w[0], s[h * 3 + 1] = w[1], s[h * 3 + 2] = w[2], g && (g[h] = f);
29
29
  });
@@ -37,14 +37,14 @@ async function Kt(o, c, l = 0, r, m = !1) {
37
37
  array: g,
38
38
  itemSize: 1
39
39
  });
40
- const [i, a] = ct({ attributes: u });
41
- return x(i, a);
40
+ const [c, a] = ct({ attributes: u });
41
+ return x(c, a);
42
42
  }
43
- async function Qt(o) {
44
- const c = await this.get("casings", o);
45
- if (!c) return null;
43
+ async function Zt(o) {
44
+ const i = await this.get("casings", o);
45
+ if (!i) return null;
46
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) => {
47
+ return r ? i.filter((t) => t.mdBottomMsl > r.measuredTop).map((t) => {
48
48
  const e = b(
49
49
  (t.mdTopMsl + (t.mdBottomMsl - t.mdTopMsl) / 2 - r.measuredTop) / r.measuredLength,
50
50
  0,
@@ -59,23 +59,23 @@ async function Qt(o) {
59
59
  };
60
60
  }) : null;
61
61
  }
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);
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);
67
67
  }
68
- function Pt(o, c, l, r, m, t) {
68
+ function Dt(o, i, l, r, p, t) {
69
69
  const e = [];
70
70
  r.sort((a, f) => a[0] - f[0]);
71
- const n = [], p = ot(
71
+ const n = [], m = ot(
72
72
  o,
73
- c,
73
+ i,
74
74
  l,
75
- m,
75
+ p,
76
76
  t
77
77
  );
78
- let s = 0, g = p[s];
78
+ let s = 0, g = m[s];
79
79
  for (let a = 0; a < r.length - 1; a++) {
80
80
  const f = a + 1, [h, w] = r[a], [d, y] = r[f];
81
81
  for (n.push([
@@ -83,24 +83,24 @@ function Pt(o, c, l, r, m, t) {
83
83
  // curve position 0-1
84
84
  w
85
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++];
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
91
  }
92
92
  f === r.length - 1 && n.push([d, y]);
93
93
  }
94
94
  const u = nt(
95
95
  o,
96
96
  n.map((a) => a[0])
97
- ), i = l - c;
97
+ ), c = l - i;
98
98
  return u.forEach((a, f) => {
99
99
  e.push(
100
100
  ...a.position,
101
101
  ...a.normal,
102
102
  ...a.tangent,
103
- b((a.curvePosition - c) / i, 0, 1),
103
+ b((a.curvePosition - i) / c, 0, 1),
104
104
  // segment length 0-1
105
105
  a.curvePosition,
106
106
  // position on curve 0-1
@@ -109,17 +109,17 @@ function Pt(o, c, l, r, m, t) {
109
109
  );
110
110
  }), Float32Array.from(e);
111
111
  }
112
- async function Zt(o, c, l = 2, r = 0.1, m = 0) {
112
+ async function zt(o, i, l = 2, r = 0.1, p = 0) {
113
113
  const t = await this.get("casings", o);
114
114
  if (!t) return null;
115
115
  const e = await this.get("position-logs", o), n = A(o, e);
116
116
  if (!n) return null;
117
- const p = c !== void 0 ? b(
118
- (c - n.measuredTop) / n.measuredLength,
117
+ const m = i !== void 0 ? b(
118
+ (i - n.measuredTop) / n.measuredLength,
119
119
  0,
120
120
  1
121
121
  ) : 0, s = t.filter(
122
- (a) => a.mdBottomMsl > n.measuredTop && (c === void 0 || a.mdBottomMsl > c)
122
+ (a) => a.mdBottomMsl > n.measuredTop && (i === void 0 || a.mdBottomMsl > i)
123
123
  ).map((a) => ({
124
124
  ...a,
125
125
  mdTopMsl: Math.max(a.mdTopMsl, n.measuredTop)
@@ -127,14 +127,14 @@ async function Zt(o, c, l = 2, r = 0.1, m = 0) {
127
127
  (a, f) => a.outerDiameter - f.outerDiameter || a.mdTopMsl - f.mdTopMsl
128
128
  );
129
129
  if (s.length === 0) return null;
130
- const g = 1 / n.measuredLength, u = [], i = [];
130
+ const g = 1 / n.measuredLength, u = [], c = [];
131
131
  return s.forEach((a) => {
132
132
  const f = b(
133
133
  a.mdBottomMsl - a.mdTopMsl,
134
134
  1e-4,
135
135
  n.measuredLength
136
136
  ), h = Math.max(
137
- p,
137
+ m,
138
138
  b(
139
139
  (a.mdTopMsl - n.measuredTop) / n.measuredLength,
140
140
  0,
@@ -146,47 +146,47 @@ async function Zt(o, c, l = 2, r = 0.1, m = 0) {
146
146
  1
147
147
  ), d = a.outerDiameter / 2, y = a.innerDiameter ? a.innerDiameter / 2 : d * 0.95, T = [];
148
148
  if (a.isShoe) {
149
- const $ = d * l;
149
+ const L = d * l;
150
150
  T.push(
151
151
  [h, d],
152
152
  [h + (w - h) / 4, d],
153
- [w, $]
153
+ [w, L]
154
154
  );
155
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, $]);
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
160
  }
161
- const L = Pt(
161
+ const $ = Dt(
162
162
  n.curve,
163
163
  h,
164
164
  w,
165
165
  T,
166
166
  r,
167
- m
167
+ p
168
168
  ), M = n.curve.getBoundingBox(h, w);
169
- new Tt(new v(...M.min), new v(...M.max)).getBoundingSphere(X), i.push({
169
+ new Mt(new v(...M.min), new v(...M.max)).getBoundingSphere(U), c.push({
170
170
  type: a.type,
171
171
  radius: d,
172
172
  innerRadius: y,
173
173
  length: f,
174
174
  top: h,
175
175
  bottom: w,
176
- attributesBuffer: L,
177
- segments: L.length / 12,
176
+ attributesBuffer: $,
177
+ segments: $.length / 12,
178
178
  boundingSphere: {
179
- center: X.center.toArray(),
180
- radius: X.radius
179
+ center: U.center.toArray(),
180
+ radius: U.radius
181
181
  }
182
- }), u.push(L.buffer);
183
- }), x(i, u);
182
+ }), u.push($.buffer);
183
+ }), x(c, u);
184
184
  }
185
- async function zt(o) {
186
- const c = await this.get("completion-tools", o);
187
- if (!c) return null;
185
+ async function te(o) {
186
+ const i = await this.get("completion-tools", o);
187
+ if (!i) return null;
188
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) => {
189
+ return r ? i.filter((t) => t.mdBottomMsl > r.measuredTop).map((t) => {
190
190
  const e = b(
191
191
  (t.mdTopMsl + t.length / 2 - r.measuredTop) / r.measuredLength,
192
192
  0,
@@ -201,21 +201,21 @@ async function zt(o) {
201
201
  };
202
202
  }) : null;
203
203
  }
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,
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
207
  0,
208
208
  1
209
209
  ), s = b(
210
- (c.mdBottomMsl - o.measuredTop) / o.measuredLength,
210
+ (i.mdBottomMsl - o.measuredTop) / o.measuredLength,
211
211
  0,
212
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),
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
219
  to: s,
220
220
  computeLengths: !0,
221
221
  radiusModifier: {
@@ -224,38 +224,38 @@ function Dt(o, c, l, r, m) {
224
224
  }
225
225
  });
226
226
  }
227
- async function te(o, c, l = 16, r = 1, m = 0.1, t = 0) {
227
+ async function ee(o, i, l = 16, r = 1, p = 0.1, t = 0) {
228
228
  const e = await this.get("completion-tools", o);
229
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,
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
234
  0,
235
235
  1
236
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 = {
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
239
  startCap: !0,
240
240
  endCap: !0,
241
241
  radialSegments: l,
242
242
  computeNormals: !0,
243
243
  computeUvs: !0,
244
- segmentsPerMeter: m,
244
+ segmentsPerMeter: p,
245
245
  simplificationThreshold: t,
246
246
  radius: 0
247
247
  }, a = [], f = [];
248
248
  if (u.forEach((y, T) => {
249
- const L = y.map((B) => Dt(
250
- p,
249
+ const $ = y.map((B) => Ft(
250
+ m,
251
251
  B,
252
252
  r,
253
253
  s,
254
- i
254
+ c
255
255
  )).filter((B) => B);
256
- f.push(At[T]);
256
+ f.push(xt[T]);
257
257
  const M = Y(
258
- L,
258
+ $,
259
259
  !1
260
260
  );
261
261
  M && a.push(M);
@@ -268,23 +268,23 @@ async function te(o, c, l = 16, r = 1, m = 0.1, t = 0) {
268
268
  const [w, d] = E(h);
269
269
  return x(w, d);
270
270
  }
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;
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
274
  let t = 0;
275
275
  if (l === "RT") {
276
276
  const a = await this.get("wellbore-headers", o);
277
277
  a && (t = a.depthReferenceElevation);
278
278
  }
279
- const e = A(o, m);
279
+ const e = A(o, p);
280
280
  if (!e) return null;
281
- const n = m[m.length - 1] + t, s = Math.max(
281
+ const n = p[p.length - 1] + t, s = Math.max(
282
282
  e.measuredTop,
283
283
  r && Number.isFinite(r) ? r : e.measuredTop
284
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;
285
+ let u = Math.floor(s / i) * i;
286
+ for (u <= s && (u += i); u < n; )
287
+ g.push(u), u += i;
288
288
  return g.push(n), g.map((a) => {
289
289
  const f = b(
290
290
  (a - t - e.measuredTop) / e.measuredLength,
@@ -299,45 +299,45 @@ async function ee(o, c, l = "MSL", r) {
299
299
  };
300
300
  });
301
301
  }
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(
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
305
  o,
306
- c,
306
+ i,
307
307
  this,
308
308
  l
309
309
  );
310
- if (!m) return null;
311
- const t = lt(m);
310
+ if (!p) return null;
311
+ const t = lt(p);
312
312
  if (!t.length) return null;
313
313
  const e = await this.get("position-logs", o), n = A(o, e);
314
314
  if (!n) return null;
315
- const p = t.map((i) => {
316
- const a = bt(
317
- (i.mdMsl - n.measuredTop) / n.measuredLength,
315
+ const m = t.map((c) => {
316
+ const a = vt(
317
+ (c.mdMsl - n.measuredTop) / n.measuredLength,
318
318
  0,
319
319
  1
320
320
  );
321
321
  return {
322
- ...i,
322
+ ...c,
323
323
  position: n.curve.getPointAt(a),
324
324
  direction: n.curve.getTangentAt(a)
325
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();
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
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] = {
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
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
336
+ name: `${c.name} ${Bt(c.type)}`,
337
+ depth: c.mdMsl,
338
+ tvd: c.tvdMsl,
339
+ level: c.level,
340
+ direction: c.direction
341
341
  };
342
342
  }), x(
343
343
  {
@@ -348,80 +348,80 @@ async function oe(o, c, l, r = 10) {
348
348
  [s.buffer]
349
349
  );
350
350
  }
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) {
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
353
  const r = await this.get(
354
354
  "perforations",
355
355
  o
356
356
  );
357
357
  if (!r) return null;
358
- const m = await this.get("position-logs", o), t = A(o, m);
358
+ const p = await this.get("position-logs", o), t = A(o, p);
359
359
  if (!t) return null;
360
- U.set(
360
+ X.set(
361
361
  Math.max(1, l / 2),
362
362
  l,
363
363
  Math.max(1, l / 2)
364
364
  );
365
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);
366
+ (u) => u.status === "Open" && u.mdBottomMsl > t.measuredTop && (i === void 0 || u.mdBottomMsl > i)
367
+ ).sort((u, c) => u.mdTopMsl - c.mdTopMsl);
368
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,
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
376
  innerDiameter: 0,
377
377
  outerDiameter: 0
378
- }) : e.length && (e[e.length - 1].bottom = i.mdBottomMsl));
378
+ }) : e.length && (e[e.length - 1].bottom = c.mdBottomMsl));
379
379
  }
380
- const p = [];
380
+ const m = [];
381
381
  for (let u = 0; u < e.length; u++) {
382
- const i = e[u], a = i.bottom - i.top, f = Math.max(
382
+ const c = e[u], a = c.bottom - c.top, f = Math.max(
383
383
  1,
384
- Math.floor(a * i.density)
384
+ Math.floor(a * c.density)
385
385
  ), h = b(
386
- (i.top - t.measuredTop) / t.measuredLength,
386
+ (c.top - t.measuredTop) / t.measuredLength,
387
387
  0,
388
388
  1
389
389
  ), d = (b(
390
- (i.bottom - t.measuredTop) / t.measuredLength,
390
+ (c.bottom - t.measuredTop) / t.measuredLength,
391
391
  0,
392
392
  1
393
393
  ) - h) / f, y = [];
394
394
  for (let M = 0; M < f; M++)
395
395
  y.push(h + d * M);
396
396
  const T = nt(t.curve, y);
397
- let L = N;
397
+ let $ = N;
398
398
  for (let M = 0; M < T.length; M++) {
399
- const B = T[M], $ = pt(
399
+ const B = T[M], L = pt(
400
400
  gt(B.tangent, [0, -1, 0]),
401
401
  B.tangent,
402
- L
402
+ $
403
403
  );
404
- p.push({
405
- name: i.type,
404
+ m.push({
405
+ name: c.type,
406
406
  position: B.position,
407
- normal: $,
407
+ normal: L,
408
408
  tangent: B.tangent
409
- }), L += ft(i.phase);
409
+ }), $ += ft(c.phase);
410
410
  }
411
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(
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
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] = {
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
422
  id: `${o}_${u}`,
423
- name: i.name,
424
- direction: i.tangent
423
+ name: c.name,
424
+ direction: c.tangent
425
425
  };
426
426
  }
427
427
  return x(
@@ -432,8 +432,8 @@ async function ne(o, c, l = 1) {
432
432
  [s.buffer]
433
433
  );
434
434
  }
435
- async function se(o, c, l = 0.1, r = 0) {
436
- const m = await this.get("position-logs", o), t = A(o, m);
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
437
  if (!t) return null;
438
438
  const e = {
439
439
  from: 0,
@@ -445,15 +445,15 @@ async function se(o, c, l = 0.1, r = 0) {
445
445
  computeUvs: !0,
446
446
  segmentsPerMeter: l,
447
447
  simplificationThreshold: r,
448
- radius: c
449
- }, n = W(t.curve, e);
448
+ radius: i
449
+ }, n = O(t.curve, e);
450
450
  if (!n) return null;
451
- const [p, s] = E(n);
452
- return x(p, s);
451
+ const [m, s] = E(n);
452
+ return x(m, s);
453
453
  }
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);
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
457
  if (!t) return null;
458
458
  const e = t.measuredBottom, n = t.measuredLength, s = Math.max(
459
459
  t.measuredTop,
@@ -463,16 +463,16 @@ async function re(o, c, l, r) {
463
463
  for (u <= s && (u += l); u < e; )
464
464
  g.push(u), u += l;
465
465
  g.push(e);
466
- const i = new Float32Array(g.length * 16), a = [];
466
+ const c = new Float32Array(g.length * 16), a = [];
467
467
  return g.forEach((f, h) => {
468
468
  const w = b((f - t.measuredTop) / n, 0, 1), d = t.curve.getPointAt(w), y = t.curve.getTangentAt(w);
469
469
  R.set(...d), k.identity();
470
- const T = c + 2 / c;
470
+ const T = i + 2 / i;
471
471
  z.set(T, T, T), Z.set(
472
472
  R.x + y[0],
473
473
  R.y + y[1],
474
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] = {
475
+ ), k.lookAt(R, Z, jt), k.multiply(Gt), k.setPosition(R), k.scale(z), k.toArray(c, h * 16), a[h] = {
476
476
  id: `${o}_${h}`,
477
477
  depth: f,
478
478
  position: d
@@ -480,19 +480,19 @@ async function re(o, c, l, r) {
480
480
  }), x(
481
481
  {
482
482
  data: a,
483
- transformations: i
483
+ transformations: c
484
484
  },
485
- [i.buffer]
485
+ [c.buffer]
486
486
  );
487
487
  }
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) {
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
490
  const r = await this.get("casings", o);
491
491
  if (!r) return null;
492
- const m = await this.get("position-logs", o), t = A(o, m);
492
+ const p = await this.get("position-logs", o), t = A(o, p);
493
493
  if (!t) return null;
494
494
  const e = r.filter(
495
- (s) => s.isShoe && s.mdBottomMsl > t.measuredTop && (c === void 0 || s.mdBottomMsl > c)
495
+ (s) => s.isShoe && s.mdBottomMsl > t.measuredTop && (i === void 0 || s.mdBottomMsl > i)
496
496
  ).map((s) => {
497
497
  const g = b(
498
498
  (s.mdBottomMsl - t.measuredTop) / t.measuredLength,
@@ -506,7 +506,7 @@ async function ae(o, c, l) {
506
506
  direction: t.curve.getTangentAt(g),
507
507
  radius: s.outerDiameter / 2
508
508
  };
509
- }), n = new Float32Array(e.length * 16), p = [];
509
+ }), n = new Float32Array(e.length * 16), m = [];
510
510
  return e.forEach((s, g) => {
511
511
  j.set(...s.position), G.identity();
512
512
  const u = s.radius * (l || 1);
@@ -514,71 +514,82 @@ async function ae(o, c, l) {
514
514
  j.x + s.direction[0],
515
515
  j.y + s.direction[1],
516
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] = {
517
+ ), G.lookAt(j, tt, Et), G.multiply(It), G.setPosition(j), G.scale(et), G.toArray(n, g * 16), m[g] = {
518
518
  id: `${o}_${g}`,
519
519
  name: s.name,
520
520
  direction: s.direction
521
521
  };
522
522
  }), x(
523
523
  {
524
- data: p,
524
+ data: m,
525
525
  transformations: n
526
526
  },
527
527
  [n.buffer]
528
528
  );
529
529
  }
530
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);
531
+ async function ce(o, i = !1) {
532
+ const l = await this.get("surface-meta", o);
534
533
  if (!l) return null;
535
- const r = l;
536
- return x({
537
- elevationImageBuffer: r
538
- }, [r.buffer]);
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);
539
550
  }
540
- async function ce(o, c = 5) {
551
+ async function ue(o, i = 5) {
541
552
  const l = await this.get("surface-meta", o);
542
553
  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,
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,
547
558
  t.nx,
548
559
  t.xinc,
549
560
  t.yinc,
550
561
  St,
551
- c
562
+ i
552
563
  );
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);
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);
554
565
  const [g, u] = E(e);
555
566
  return x(g, u);
556
567
  }
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;
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;
560
571
  const g = {
561
572
  from: r !== void 0 ? b(
562
- (r - p.measuredTop) / p.measuredLength,
573
+ (r - m.measuredTop) / m.measuredLength,
563
574
  0,
564
575
  1
565
576
  ) : 0,
566
- radius: m,
577
+ radius: p,
567
578
  startCap: !0,
568
579
  endCap: !0,
569
- segmentsPerMeter: c,
580
+ segmentsPerMeter: i,
570
581
  simplificationThreshold: l,
571
582
  computeNormals: !0,
572
583
  computeUvs: !0,
573
584
  computeLengths: !!e,
574
585
  radialSegments: t
575
- }, u = W(p.curve, g);
586
+ }, u = O(m.curve, g);
576
587
  if (!u) return null;
577
- const [i, a] = E(u);
578
- return x(i, a);
588
+ const [c, a] = E(u);
589
+ return x(c, a);
579
590
  }
580
- async function le(o, c, l = 250) {
581
- const r = await this.get("position-logs", o), m = {
591
+ async function me(o, i, l = 250) {
592
+ const r = await this.get("position-logs", o), p = {
582
593
  main: {
583
594
  center: [0, 0, 0],
584
595
  radius: 10
@@ -588,52 +599,52 @@ async function le(o, c, l = 250) {
588
599
  if (r) {
589
600
  const n = A(o, r);
590
601
  if (n) {
591
- const p = c !== void 0 ? b(
592
- (c - n.measuredTop) / n.measuredLength,
602
+ const m = i !== void 0 ? b(
603
+ (i - n.measuredTop) / n.measuredLength,
593
604
  0,
594
605
  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 = [
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 = [
596
607
  s.min[0] + g,
597
608
  s.min[1] + u,
598
- s.min[2] + i
609
+ s.min[2] + c
599
610
  ];
600
- if (m.main.center = f, m.main.radius = a, l > 0) {
611
+ if (p.main.center = f, p.main.radius = a, l > 0) {
601
612
  const h = Math.max(
602
613
  2,
603
- Math.ceil((1 - p) * n.curve.length / l)
604
- ), w = n.curve.getPoints(h, p, 1), d = [];
614
+ Math.ceil((1 - m) * n.curve.length / l)
615
+ ), w = n.curve.getPoints(h, m, 1), d = [];
605
616
  w.forEach((y) => {
606
617
  d.push({
607
618
  center: y,
608
619
  radius: l
609
620
  });
610
- }), m.sampled = d;
621
+ }), p.sampled = d;
611
622
  }
612
623
  }
613
624
  }
614
- const t = new Float32Array(4 + m.sampled.length * 4);
625
+ const t = new Float32Array(4 + p.sampled.length * 4);
615
626
  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;
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;
619
630
  return x(t, [t.buffer]);
620
631
  }
621
- async function me(o, c, l, r, m, t, e = 0.5, n = 2, p = !0, s = 16, g = 0) {
632
+ async function pe(o, i, l, r, p, t, e = 0.5, n = 2, m = !0, s = 16, g = 0) {
622
633
  const u = await st(
623
634
  o,
624
- c,
635
+ i,
625
636
  this
626
637
  );
627
638
  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))
639
+ const c = u.filter(
640
+ (M) => (t === void 0 || M.type && t.includes(M.type)) && (p === void 0 || p.includes(M.name))
630
641
  );
631
- if (!i.length) return null;
632
- const a = dt(i), f = await this.get("position-logs", o), h = A(o, f);
642
+ if (!c.length) return null;
643
+ const a = yt(c), f = await this.get("position-logs", o), h = A(o, f);
633
644
  if (!h) return null;
634
645
  const w = {
635
- startCap: p,
636
- endCap: p,
646
+ startCap: m,
647
+ endCap: m,
637
648
  segmentsPerMeter: l,
638
649
  simplificationThreshold: g,
639
650
  radialSegments: s,
@@ -643,46 +654,46 @@ async function me(o, c, l, r, m, t, e = 0.5, n = 2, p = !0, s = 16, g = 0) {
643
654
  if (r === void 0 || M.mdMslTo > r) {
644
655
  let B = M.mdMslFrom;
645
656
  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, {
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, {
649
660
  ...w,
650
661
  radius: at,
651
- from: $,
652
- to: S
662
+ from: L,
663
+ to: I
653
664
  });
654
- if (I?.attributes.position.count) {
655
- const H = new Float32Array(
656
- I.attributes.position.count * 3
665
+ if (S?.attributes.position.count) {
666
+ const q = new Float32Array(
667
+ S.attributes.position.count * 3
657
668
  );
658
- for (let _ = 0; _ < I.attributes.position.count; _++)
659
- it.toArray(H, _ * 3);
660
- I.attributes.color = new O(H, 3), d.push(I);
669
+ for (let _ = 0; _ < S.attributes.position.count; _++)
670
+ it.toArray(q, _ * 3);
671
+ S.attributes.color = new W(q, 3), d.push(S);
661
672
  }
662
673
  }
663
674
  }
664
675
  }), !d.length) return null;
665
676
  const y = Y(d, !1);
666
677
  if (!y) return null;
667
- const [T, L] = E(y);
668
- return x(T, L);
678
+ const [T, $] = E(y);
679
+ return x(T, $);
669
680
  }
670
- async function pe(o, c, l) {
681
+ async function ge(o, i, l) {
671
682
  const r = await this.get("wellbore-headers", o);
672
683
  if (!r) return null;
673
- const m = await this.get("position-logs", o), t = A(o, m);
684
+ const p = await this.get("position-logs", o), t = A(o, p);
674
685
  if (!t) return null;
675
686
  let e = 1;
676
- const { measuredTop: n, measuredLength: p, curve: s } = t;
677
- if (c === "top")
687
+ const { measuredTop: n, measuredLength: m, curve: s } = t;
688
+ if (i === "top")
678
689
  e = b(
679
- ((l || n) - n) / p,
690
+ ((l || n) - n) / m,
680
691
  0,
681
692
  1
682
693
  );
683
- else if (c === "center") {
684
- const u = (l || n) + (p - (l || n)) / 2;
685
- e = b((u - n) / p, 0, 1);
694
+ else if (i === "center") {
695
+ const u = (l || n) + (m - (l || n)) / 2;
696
+ e = b((u - n) / m, 0, 1);
686
697
  }
687
698
  return [{
688
699
  id: o,
@@ -691,19 +702,19 @@ async function pe(o, c, l) {
691
702
  direction: s.getTangentAt(e)
692
703
  }];
693
704
  }
694
- async function ge(o, c = 3, l = 1e3, r = 1e3, m = 0) {
705
+ async function fe(o, i = 3, l = 1e3, r = 1e3, p = 0) {
695
706
  const t = {
696
- stepSize: c,
707
+ stepSize: i,
697
708
  minSize: l,
698
709
  extension: r,
699
- defaultExtensionAngle: m
710
+ defaultExtensionAngle: p
700
711
  }, e = await this.get(
701
712
  "wellbore-seismic-section",
702
713
  o,
703
714
  t
704
715
  );
705
716
  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 = {
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 = {
707
718
  data: {
708
719
  array: e.values,
709
720
  width: e.samples[0],
@@ -711,27 +722,27 @@ async function ge(o, c = 3, l = 1e3, r = 1e3, m = 0) {
711
722
  min: e.valueRange[0],
712
723
  max: e.valueRange[1]
713
724
  },
714
- geometry: i
725
+ geometry: c
715
726
  }, h = [f.data.array.buffer, ...a];
716
727
  return x(f, h);
717
728
  }
718
729
  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
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
737
748
  };