@equinor/videx-3d 3.1.0 → 3.2.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,4 +1,4 @@
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";
1
+ import { At as e, Ct as t, Dt as n, E as r, En as i, Rt as a, T as o, Tn as s, Yt as c, _ as l, _n as u, dt as d, hn as f, jt as p, nn as m, nt as h, rt as g, u as _, un as v, wn as y, wt as b, xt as x } from "./chunk-r8Ybij6M.js";
2
2
  import { n as S } from "./chunk-DsUZyEG_.js";
3
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
4
  import { transfer as k } from "comlink";
@@ -6,10 +6,10 @@ import { clamp as A } from "curve-interpolator";
6
6
  import { mergeBufferGeometries as j } from "three-stdlib";
7
7
  import { group as te } from "d3-array";
8
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));
9
+ async function ne(e, n, r = 0, i, a = !1) {
10
+ let o = t(e, await this.get("position-logs", e));
11
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;
12
+ let s = i === void 0 ? 0 : f((i - o.measuredTop) / o.measuredLength, 0, 1), c = p(o.curve, s, 1, n, r), l = new Float32Array(c.length * 3), u = a ? new Float32Array(c.length) : null;
13
13
  c.forEach((e, t) => {
14
14
  let n = o.curve.getPointAt(e);
15
15
  l[t * 3] = n[0], l[t * 3 + 1] = n[1], l[t * 3 + 2] = n[2], u && (u[t] = e);
@@ -22,17 +22,17 @@ async function ne(e, t, r = 0, i, a = !1) {
22
22
  array: u,
23
23
  itemSize: 1
24
24
  });
25
- let [p, h] = g({ attributes: d });
26
- return k(p, h);
25
+ let [m, h] = g({ attributes: d });
26
+ return k(m, h);
27
27
  }
28
28
  //#endregion
29
29
  //#region src/generators/casing-annotations-generator.ts
30
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);
31
+ let n = await this.get("casings", e);
32
+ if (!n) return null;
33
+ let r = t(e, await this.get("position-logs", e));
34
+ return r ? n.filter((e) => e.mdBottomMsl > r.measuredTop).map((e) => {
35
+ let t = f((e.mdTopMsl + (e.mdBottomMsl - e.mdTopMsl) / 2 - r.measuredTop) / r.measuredLength, 0, 1);
36
36
  return {
37
37
  name: `${e.properties.Diameter} ${e.properties.Type}`,
38
38
  data: {
@@ -50,13 +50,13 @@ async function re(e) {
50
50
  var M = new ee();
51
51
  function N(e, t, n) {
52
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);
53
+ let r = n[0] - t[0], i = f((e - t[0]) / r, 0, 1);
54
+ return u(t[1], n[1], i);
55
55
  }
56
56
  function P(t, n, r, i, a, o) {
57
57
  let s = [];
58
58
  i.sort((e, t) => e[0] - t[0]);
59
- let c = [], l = f(t, n, r, a, o), u = 0, d = l[u];
59
+ let c = [], l = p(t, n, r, a, o), u = 0, d = l[u];
60
60
  for (let e = 0; e < i.length - 1; e++) {
61
61
  let t = e + 1, [n, r] = i[e], [a, o] = i[t];
62
62
  for (c.push([n, r]); d <= n && u < l.length - 1;) d = l[++u];
@@ -66,38 +66,38 @@ function P(t, n, r, i, a, o) {
66
66
  }
67
67
  t === i.length - 1 && c.push([a, o]);
68
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]);
69
+ let m = e(t, c.map((e) => e[0])), h = r - n;
70
+ return m.forEach((e, t) => {
71
+ s.push(...e.position, ...e.normal, ...e.tangent, f((e.curvePosition - n) / h, 0, 1), e.curvePosition, c[t][1]);
72
72
  }), Float32Array.from(s);
73
73
  }
74
- async function ie(e, t, r = 2, i = .1, a = 0) {
74
+ async function ie(e, n, r = 2, i = .1, a = 0) {
75
75
  let o = await this.get("casings", e);
76
76
  if (!o) return null;
77
- let s = n(e, await this.get("position-logs", e));
77
+ let s = t(e, await this.get("position-logs", e));
78
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) => ({
79
+ let c = n === void 0 ? 0 : f((n - s.measuredTop) / s.measuredLength, 0, 1), l = o.filter((e) => e.mdBottomMsl > s.measuredTop && (n === void 0 || e.mdBottomMsl > n)).map((e) => ({
80
80
  ...e,
81
81
  mdTopMsl: Math.max(e.mdTopMsl, s.measuredTop)
82
82
  })).sort((e, t) => e.outerDiameter - t.outerDiameter || e.mdTopMsl - t.mdTopMsl);
83
83
  if (l.length === 0) return null;
84
- let u = 1 / s.measuredLength, d = [], f = [];
84
+ let u = 1 / s.measuredLength, d = [], p = [];
85
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 = [];
86
+ let t = f(e.mdBottomMsl - e.mdTopMsl, 1e-4, s.measuredLength), n = Math.max(c, f((e.mdTopMsl - s.measuredTop) / s.measuredLength, 0, 1)), o = f((e.mdBottomMsl - s.measuredTop) / s.measuredLength, 0, 1), l = e.outerDiameter / 2, m = e.innerDiameter ? e.innerDiameter / 2 : l * .95, h = [];
87
87
  if (e.isShoe) {
88
88
  let e = l * r;
89
89
  h.push([n, l], [n + (o - n) / 4, l], [o, e]);
90
90
  } else {
91
- let e = l - (l - p) / 4;
91
+ let e = l - (l - m) / 4;
92
92
  h.push([n, e]);
93
93
  let r = Math.min((l - e) * 2, t / 3) * u;
94
94
  h.push([n + r, l]), h.push([o - r, l]), h.push([o, e]);
95
95
  }
96
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({
97
+ new C(new O(..._.min), new O(..._.max)).getBoundingSphere(M), p.push({
98
98
  type: e.type,
99
99
  radius: l,
100
- innerRadius: p,
100
+ innerRadius: m,
101
101
  length: t,
102
102
  top: n,
103
103
  bottom: o,
@@ -108,16 +108,16 @@ async function ie(e, t, r = 2, i = .1, a = 0) {
108
108
  radius: M.radius
109
109
  }
110
110
  }), d.push(g.buffer);
111
- }), k(f, d);
111
+ }), k(p, d);
112
112
  }
113
113
  //#endregion
114
114
  //#region src/generators/completion-annotations-generator.ts
115
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);
116
+ let n = await this.get("completion-tools", e);
117
+ if (!n) return null;
118
+ let r = t(e, await this.get("position-logs", e));
119
+ return r ? n.filter((e) => e.mdBottomMsl > r.measuredTop).map((e) => {
120
+ let t = f((e.mdTopMsl + e.length / 2 - r.measuredTop) / r.measuredLength, 0, 1);
121
121
  return {
122
122
  name: e.name,
123
123
  position: r.curve.getPointAt(t),
@@ -128,11 +128,11 @@ async function ae(e) {
128
128
  }
129
129
  //#endregion
130
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);
131
+ function oe(e, t, r, i, a) {
132
+ let o = f(t.length, 1e-4, e.measuredLength), s = 1 / e.measuredLength, c = [], l = f((t.mdTopMsl - e.measuredTop) / e.measuredLength, 0, 1), u = f((t.mdBottomMsl - e.measuredTop) / e.measuredLength, 0, 1), d = r * ((t.diameterTop || t.diameterBottom) / 2), p = r * ((t.diameterBottom || t.diameterTop) / 2), m = r * ((t.diameterMax || t.diameterTop) / 2), h = Math.min(d, p, m);
133
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, {
134
+ let g = Math.min((m - h) * 2, o / 3) * s;
135
+ return m > h && (c.push([l + g, m]), c.push([u - g, m])), c.push([u, p]), n(e.curve, {
136
136
  ...a,
137
137
  from: Math.max(l, i),
138
138
  to: u,
@@ -143,12 +143,12 @@ function oe(e, t, n, i, a) {
143
143
  }
144
144
  });
145
145
  }
146
- async function se(e, t, r = 16, i = 1, a = .1, o = 0) {
146
+ async function se(e, n, r = 16, i = 1, a = .1, o = 0) {
147
147
  let s = await this.get("completion-tools", e);
148
148
  if (!s) return null;
149
- let c = n(e, await this.get("position-logs", e));
149
+ let c = t(e, await this.get("position-logs", e));
150
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 = {
151
+ let l = n === void 0 ? 0 : f((n - c.measuredTop) / c.measuredLength, 0, 1), u = te(s.filter((e) => e.mdBottomMsl > c.measuredTop && (n === void 0 || e.mdBottomMsl > n)).sort((e, t) => e.mdTopMsl - t.mdTopMsl), (e) => e.category), d = {
152
152
  startCap: !0,
153
153
  endCap: !0,
154
154
  radialSegments: r,
@@ -157,24 +157,24 @@ async function se(e, t, r = 16, i = 1, a = .1, o = 0) {
157
157
  segmentsPerMeter: a,
158
158
  simplificationThreshold: o,
159
159
  radius: 0
160
- }, f = [], p = [];
160
+ }, p = [], m = [];
161
161
  if (u.forEach((e, t) => {
162
162
  let n = e.map((e) => oe(c, e, i, l, d)).filter((e) => e);
163
- p.push(S[t]);
163
+ m.push(S[t]);
164
164
  let r = j(n, !1);
165
- r && f.push(r);
166
- }), !f.length) return null;
167
- let g = j(f, !0);
165
+ r && p.push(r);
166
+ }), !p.length) return null;
167
+ let g = j(p, !0);
168
168
  if (!g) return null;
169
169
  g.groups.forEach((e, t) => {
170
- e.materialIndex = p[t];
170
+ e.materialIndex = m[t];
171
171
  });
172
172
  let [_, v] = h(g);
173
173
  return k(_, v);
174
174
  }
175
175
  //#endregion
176
176
  //#region src/generators/depth-markers-generator.ts
177
- async function ce(e, t, r = "MSL", i) {
177
+ async function ce(e, n, r = "MSL", i) {
178
178
  let a = await this.get("position-logs", e);
179
179
  if (!a || a.length < 8) return null;
180
180
  let o = 0;
@@ -182,12 +182,12 @@ async function ce(e, t, r = "MSL", i) {
182
182
  let t = await this.get("wellbore-headers", e);
183
183
  t && (o = t.depthReferenceElevation);
184
184
  }
185
- let s = n(e, a);
185
+ let s = t(e, a);
186
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;
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 / n) * n;
188
+ for (d <= l && (d += n); d < c;) u.push(d), d += n;
189
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);
190
+ let n = f((t - o - s.measuredTop) / s.measuredLength, 0, 1), r = s.curve.getPointAt(n), i = s.curve.getTangentAt(n);
191
191
  return {
192
192
  id: `${e}_${t}`,
193
193
  name: (Math.round(t * 10) / 10).toString(),
@@ -198,15 +198,15 @@ async function ce(e, t, r = "MSL", i) {
198
198
  }
199
199
  //#endregion
200
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));
201
+ var F = new O(), I = new O(), L = new O(), le = new O(0, 1, 0), R = new D(), ue = new D().makeRotationX(v), z = new E();
202
+ async function B(e, n, r, i = 10) {
203
+ let a = await s(e, n, this, r);
204
+ if (!a) return null;
205
+ let o = y(a);
206
+ if (!o.length) return null;
207
+ let c = t(e, await this.get("position-logs", e));
208
208
  if (!c) return null;
209
- let l = s.map((e) => {
209
+ let l = o.map((e) => {
210
210
  let t = A((e.mdMsl - c.measuredTop) / c.measuredLength, 0, 1);
211
211
  return {
212
212
  ...e,
@@ -216,10 +216,10 @@ async function B(e, r, i, a = 10) {
216
216
  }), u = new Float32Array(l.length * 16), d = new Float32Array(l.length * 3), f = [];
217
217
  return l.forEach((t, n) => {
218
218
  F.set(...t.position), R.identity();
219
- let r = a;
219
+ let r = i;
220
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
221
  id: `${e}_${n}`,
222
- name: `${t.name} ${v(t.type)}`,
222
+ name: `${t.name} ${_(t.type)}`,
223
223
  depth: t.mdMsl,
224
224
  tvd: t.tvdMsl,
225
225
  level: t.level,
@@ -233,52 +233,52 @@ async function B(e, r, i, a = 10) {
233
233
  }
234
234
  //#endregion
235
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);
236
+ var V = new O(), H = new O(), U = new O(), de = new O(0, 1, 0), W = new D(), fe = new D().makeRotationX(v);
237
+ async function pe(n, i, s = 1) {
238
+ let c = await this.get("perforations", n);
239
239
  if (!c) return null;
240
- let l = n(t, await this.get("position-logs", t));
240
+ let l = t(n, await this.get("position-logs", n));
241
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);
242
+ U.set(Math.max(1, s / 2), s, Math.max(1, s / 2));
243
+ let u = [], d = c.filter((e) => e.status === "Open" && e.mdBottomMsl > l.measuredTop && (i === void 0 || e.mdBottomMsl > i)).sort((e, t) => e.mdTopMsl - t.mdTopMsl);
244
244
  for (let e = 0; e < d.length; e++) {
245
245
  let t = d[e];
246
246
  t.mdBottomMsl <= l.measuredTop || (!u.length || u[u.length - 1].bottom !== t.mdTopMsl ? u.push({
247
247
  type: t.type,
248
248
  top: Math.max(l.measuredTop, t.mdTopMsl),
249
249
  bottom: t.mdBottomMsl,
250
- density: i(t.density || 0),
250
+ density: r(t.density || 0),
251
251
  phase: t.phase || 0,
252
252
  innerDiameter: 0,
253
253
  outerDiameter: 0
254
254
  }) : u.length && (u[u.length - 1].bottom = t.mdBottomMsl));
255
255
  }
256
- let f = [];
256
+ let p = [];
257
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;
258
+ let n = u[t], r = n.bottom - n.top, i = Math.max(1, Math.floor(r * n.density)), s = f((n.top - l.measuredTop) / l.measuredLength, 0, 1), c = (f((n.bottom - l.measuredTop) / l.measuredLength, 0, 1) - s) / i, d = [];
259
+ for (let e = 0; e < i; e++) d.push(s + c * e);
260
+ let h = e(l.curve, d), g = v;
261
261
  for (let e = 0; e < h.length; e++) {
262
- let t = h[e], r = _(o(t.tangent, [
262
+ let t = h[e], r = m(a(t.tangent, [
263
263
  0,
264
264
  -1,
265
265
  0
266
266
  ]), t.tangent, g);
267
- f.push({
267
+ p.push({
268
268
  name: n.type,
269
269
  position: t.position,
270
270
  normal: r,
271
271
  tangent: t.tangent
272
- }), g += s(n.phase);
272
+ }), g += o(n.phase);
273
273
  }
274
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
275
+ let h = new Float32Array(p.length * 16), g = [];
276
+ for (let e = 0; e < p.length; e++) {
277
+ let t = p[e];
278
+ V.set(...t.position), H.set(V.x + t.normal[0], V.y + t.normal[1], V.z + t.normal[2]), U.setY(s + s * (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: `${n}_${e}`,
280
+ name: t.name,
281
+ direction: t.tangent
282
282
  };
283
283
  }
284
284
  return k({
@@ -288,8 +288,8 @@ async function pe(t, r, a = 1) {
288
288
  }
289
289
  //#endregion
290
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));
291
+ async function me(e, r, i = .1, a = 0) {
292
+ let o = t(e, await this.get("position-logs", e));
293
293
  if (!o) return null;
294
294
  let s = {
295
295
  from: 0,
@@ -301,46 +301,46 @@ async function me(e, t, i = .1, a = 0) {
301
301
  computeUvs: !0,
302
302
  segmentsPerMeter: i,
303
303
  simplificationThreshold: a,
304
- radius: t
305
- }, c = r(o.curve, s);
304
+ radius: r
305
+ }, c = n(o.curve, s);
306
306
  if (!c) return null;
307
307
  let [l, u] = h(c);
308
308
  return k(l, u);
309
309
  }
310
310
  //#endregion
311
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));
312
+ var G = new O(), K = new O(), q = new O(), he = new O(0, 1, 0), J = new D(), ge = new D().makeRotationX(v);
313
+ async function _e(e, n, r, i) {
314
+ let a = t(e, await this.get("position-logs", e));
315
315
  if (!a) return null;
316
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
317
  for (u <= c && (u += r); u < o;) l.push(u), u += r;
318
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);
319
+ let d = new Float32Array(l.length * 16), p = [];
320
+ return l.forEach((t, r) => {
321
+ let i = f((t - a.measuredTop) / s, 0, 1), o = a.curve.getPointAt(i), c = a.curve.getTangentAt(i);
322
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] = {
323
+ let l = n + 2 / n;
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), p[r] = {
325
325
  id: `${e}_${r}`,
326
- depth: n,
326
+ depth: t,
327
327
  position: o
328
328
  };
329
329
  }), k({
330
- data: f,
330
+ data: p,
331
331
  transformations: d
332
332
  }, [d.buffer]);
333
333
  }
334
334
  //#endregion
335
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) {
336
+ var Y = new O(), X = new O(), Z = new O(), ve = new O(0, 1, 0), Q = new D(), ye = new D().makeRotationX(v);
337
+ async function be(e, n, r) {
338
338
  let i = await this.get("casings", e);
339
339
  if (!i) return null;
340
- let a = n(e, await this.get("position-logs", e));
340
+ let a = t(e, await this.get("position-logs", e));
341
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);
342
+ let o = i.filter((e) => e.isShoe && e.mdBottomMsl > a.measuredTop && (n === void 0 || e.mdBottomMsl > n)).map((e) => {
343
+ let t = f((e.mdBottomMsl - a.measuredTop) / a.measuredLength, 0, 1);
344
344
  return {
345
345
  name: `${e.properties.Diameter} ${e.properties.Type}`,
346
346
  data: e.properties,
@@ -382,36 +382,36 @@ async function Se(e, t = 5) {
382
382
  if (!n) return null;
383
383
  let r = n.max, i = await this.get("surface-values", e);
384
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);
385
+ let { header: a } = n, o = new T(), { positions: s, uvs: c, indices: l } = d(i, a.nx, a.xinc, a.yinc, $, t);
386
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);
387
+ let [u, f] = h(o);
388
+ return k(u, f);
389
389
  }
390
390
  //#endregion
391
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));
392
+ async function Ce(e, r, i = 0, a, o = .5, s = 16, c = !1) {
393
+ let l = t(e, await this.get("position-logs", e));
394
394
  if (!l) return null;
395
395
  let u = {
396
- from: a === void 0 ? 0 : m((a - l.measuredTop) / l.measuredLength, 0, 1),
396
+ from: a === void 0 ? 0 : f((a - l.measuredTop) / l.measuredLength, 0, 1),
397
397
  radius: o,
398
398
  startCap: !0,
399
399
  endCap: !0,
400
- segmentsPerMeter: t,
400
+ segmentsPerMeter: r,
401
401
  simplificationThreshold: i,
402
402
  computeNormals: !0,
403
403
  computeUvs: !0,
404
404
  computeLengths: !!c,
405
405
  radialSegments: s
406
- }, d = r(l.curve, u);
406
+ }, d = n(l.curve, u);
407
407
  if (!d) return null;
408
- let [f, p] = h(d);
409
- return k(f, p);
408
+ let [p, m] = h(d);
409
+ return k(p, m);
410
410
  }
411
411
  //#endregion
412
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 = {
413
+ async function we(e, n, r = 250) {
414
+ let i = await this.get("position-logs", e), a = {
415
415
  main: {
416
416
  center: [
417
417
  0,
@@ -423,60 +423,60 @@ async function we(e, t, r = 250) {
423
423
  sampled: []
424
424
  };
425
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([
426
+ let o = t(e, i);
427
+ if (o) {
428
+ let e = n === void 0 ? 0 : f((n - o.measuredTop) / o.measuredLength, 0, 1), t = o.curve.getBoundingBox(e), i = (t.max[0] - t.min[0]) / 2, s = (t.max[1] - t.min[1]) / 2, l = (t.max[2] - t.min[2]) / 2, u = c([
429
429
  i,
430
- c,
430
+ s,
431
431
  l
432
432
  ]) + r * 2, d = [
433
- n.min[0] + i,
434
- n.min[1] + c,
435
- n.min[2] + l
433
+ t.min[0] + i,
434
+ t.min[1] + s,
435
+ t.min[2] + l
436
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 = [];
437
+ if (a.main.center = d, a.main.radius = u, r > 0) {
438
+ let t = Math.max(2, Math.ceil((1 - e) * o.curve.length / r)), n = o.curve.getPoints(t, e, 1), i = [];
439
439
  n.forEach((e) => {
440
440
  i.push({
441
441
  center: e,
442
442
  radius: r
443
443
  });
444
- }), o.sampled = i;
444
+ }), a.sampled = i;
445
445
  }
446
446
  }
447
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]);
448
+ let o = new Float32Array(4 + a.sampled.length * 4), s = 0;
449
+ o[s] = a.main.center[0], o[s + 1] = a.main.center[1], o[s + 2] = a.main.center[2], o[s + 3] = a.main.radius, s = 4;
450
+ for (let e = 0; e < a.sampled.length; e++, s += 4) o[s] = a.sampled[e].center[0], o[s + 1] = a.sampled[e].center[1], o[s + 2] = a.sampled[e].center[2], o[s + 3] = a.sampled[e].radius;
451
+ return k(o, [o.buffer]);
452
452
  }
453
453
  //#endregion
454
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;
455
+ async function Te(e, r, a, o, c, l, u = .5, d = 2, f = !0, p = 16, m = 0) {
456
+ let g = await s(e, r, this);
457
+ if (!g) return null;
458
+ let _ = g.filter((e) => (l === void 0 || e.type && l.includes(e.type)) && (c === void 0 || c.includes(e.name)));
459
+ if (!_.length) return null;
460
+ let v = i(_), y = t(e, await this.get("position-logs", e));
461
+ if (!y) return null;
462
462
  let b = {
463
- startCap: d,
464
- endCap: d,
465
- segmentsPerMeter: i,
466
- simplificationThreshold: p,
467
- radialSegments: f,
463
+ startCap: f,
464
+ endCap: f,
465
+ segmentsPerMeter: a,
466
+ simplificationThreshold: m,
467
+ radialSegments: p,
468
468
  computeRelativeLengths: !0
469
469
  }, x = [];
470
- if (_.forEach((e) => {
471
- if (a === void 0 || e.mdMslTo > a) {
470
+ if (v.forEach((e) => {
471
+ if (o === void 0 || e.mdMslTo > o) {
472
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, {
473
+ o !== void 0 && o > t && (t = o);
474
+ let r = y.getPositionAtDepth(t, !0), i = y.getPositionAtDepth(e.mdMslTo, !0);
475
+ if (r !== null && i !== null) {
476
+ let t = d + u, a = new E(e.color), o = n(y.curve, {
477
477
  ...b,
478
478
  radius: t,
479
- from: n,
479
+ from: r,
480
480
  to: i
481
481
  });
482
482
  if (o?.attributes.position.count) {
@@ -494,13 +494,13 @@ async function Te(e, t, i, a, o, s, l = .5, u = 2, d = !0, f = 16, p = 0) {
494
494
  }
495
495
  //#endregion
496
496
  //#region src/generators/wellbore-label-generator.ts
497
- async function Ee(e, t, r) {
497
+ async function Ee(e, n, r) {
498
498
  let i = await this.get("wellbore-headers", e);
499
499
  if (!i) return null;
500
- let a = n(e, await this.get("position-logs", e));
500
+ let a = t(e, await this.get("position-logs", e));
501
501
  if (!a) return null;
502
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)), [{
503
+ return n === "top" ? o = f(((r || s) - s) / c, 0, 1) : n === "center" && (o = f(((r || s) + (c - (r || s)) / 2 - s) / c, 0, 1)), [{
504
504
  id: e,
505
505
  name: `${i.name.replace("NO ", "")}`,
506
506
  position: l.getPointAt(o),