@equinor/videx-3d 1.0.0 → 1.0.2

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