@equinor/esv-intersection 3.0.1 → 3.0.3
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.
- package/dist/control/ExtendedCurveInterpolator.d.ts +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2240 -1936
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/layers/schematicInterfaces.d.ts +1 -0
- package/dist/utils/arc-length.d.ts +1 -1
- package/package.json +21 -22
- package/src/control/ExtendedCurveInterpolator.ts +1 -1
- package/src/control/IntersectionReferenceSystem.ts +1 -1
- package/src/datautils/schematicShapeGenerator.ts +28 -27
- package/src/layers/GeomodelLabelsLayer.ts +2 -2
- package/src/layers/SchematicLayer.ts +5 -4
- package/src/layers/schematicInterfaces.ts +3 -1
- package/src/utils/arc-length.ts +1 -1
|
@@ -118,6 +118,7 @@ export declare function isSubkindCasedHoleGravelPack(perf: Perforation): boolean
|
|
|
118
118
|
export declare function isSubKindPerforation(perf: Perforation): boolean;
|
|
119
119
|
export declare function isSubKindCasedHoleFracPack(perf: Perforation): boolean;
|
|
120
120
|
export declare function isOpenHoleFracPack(perf: Perforation): boolean;
|
|
121
|
+
export declare const isSubKindCasedHoleFracturation: (perf: Perforation) => boolean;
|
|
121
122
|
export declare const intersect: (a: Perforation, b: Perforation) => boolean;
|
|
122
123
|
export interface SchematicData {
|
|
123
124
|
holeSizes: HoleSize[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/esv-intersection",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "Intersection component package with testing and automatic documentation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -47,29 +47,29 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://github.com/equinor/esv-intersection#readme",
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@storybook/addon-storysource": "^7.0.
|
|
51
|
-
"@storybook/html-vite": "^7.0.
|
|
50
|
+
"@storybook/addon-storysource": "^7.0.2",
|
|
51
|
+
"@storybook/html-vite": "^7.0.2",
|
|
52
52
|
"@types/d3": "^7.4.0",
|
|
53
53
|
"@types/mock-raf": "^1.0.3",
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
55
|
-
"@typescript-eslint/parser": "^5.
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^5.57.0",
|
|
55
|
+
"@typescript-eslint/parser": "^5.57.0",
|
|
56
56
|
"copyfiles": "^2.4.1",
|
|
57
|
-
"eslint": "^8.
|
|
58
|
-
"eslint-config-prettier": "^8.
|
|
57
|
+
"eslint": "^8.37.0",
|
|
58
|
+
"eslint-config-prettier": "^8.8.0",
|
|
59
59
|
"eslint-plugin-prettier": "^4.2.1",
|
|
60
|
-
"eslint-plugin-storybook": "^0.6.
|
|
60
|
+
"eslint-plugin-storybook": "^0.6.11",
|
|
61
61
|
"mock-raf": "^1.0.1",
|
|
62
|
-
"pixi.js": "^7.
|
|
63
|
-
"prettier": "^2.8.
|
|
64
|
-
"rimraf": "^
|
|
65
|
-
"storybook": "^7.0.
|
|
66
|
-
"storybook-dark-mode": "^
|
|
62
|
+
"pixi.js": "^7.2.3",
|
|
63
|
+
"prettier": "^2.8.7",
|
|
64
|
+
"rimraf": "^5.0.0",
|
|
65
|
+
"storybook": "^7.0.2",
|
|
66
|
+
"storybook-dark-mode": "^3.0.0",
|
|
67
67
|
"tslib": "^2.5.0",
|
|
68
|
-
"typedoc": "^0.
|
|
69
|
-
"typescript": "^
|
|
70
|
-
"vite": "^4.1
|
|
71
|
-
"vite-plugin-dts": "^1.
|
|
72
|
-
"vitest": "^0.
|
|
68
|
+
"typedoc": "^0.24.1",
|
|
69
|
+
"typescript": "^5.0.2",
|
|
70
|
+
"vite": "^4.2.1",
|
|
71
|
+
"vite-plugin-dts": "^2.1.0",
|
|
72
|
+
"vitest": "^0.30.0",
|
|
73
73
|
"vitest-canvas-mock": "^0.2.2"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
@@ -78,13 +78,12 @@
|
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@equinor/videx-math": "^1.1.0",
|
|
80
80
|
"@equinor/videx-vector2": "^1.0.44",
|
|
81
|
-
"curve-interpolator": "3.
|
|
82
|
-
"d3-array": "^3.2.
|
|
81
|
+
"curve-interpolator": "3.1.1",
|
|
82
|
+
"d3-array": "^3.2.3",
|
|
83
83
|
"d3-axis": "^3.0.0",
|
|
84
84
|
"d3-scale": "^4.0.2",
|
|
85
85
|
"d3-selection": "^3.0.0",
|
|
86
86
|
"d3-shape": "^3.2.0",
|
|
87
|
-
"d3-zoom": "^3.0.0"
|
|
88
|
-
"jest-canvas-mock": "^2.4.0"
|
|
87
|
+
"d3-zoom": "^3.0.0"
|
|
89
88
|
}
|
|
90
89
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Vector2 from '@equinor/videx-vector2';
|
|
2
2
|
import { clamp } from '@equinor/videx-math';
|
|
3
3
|
import { CurveInterpolator } from 'curve-interpolator';
|
|
4
|
-
import { Vector } from 'curve-interpolator/dist/src/interfaces';
|
|
4
|
+
import { Vector } from 'curve-interpolator/dist/src/core/interfaces';
|
|
5
5
|
import { CurveInterpolatorOptions } from 'curve-interpolator/dist/src/curve-interpolator';
|
|
6
6
|
|
|
7
7
|
import { RootFinder } from '../utils/root-finder';
|
|
@@ -195,7 +195,7 @@ export class IntersectionReferenceSystem {
|
|
|
195
195
|
return length + (displacementFromStart - this.displacement);
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
const ls = this.interpolators.curtain.
|
|
198
|
+
const ls = this.interpolators.curtain.getIntersectsAsPositions(displacementFromStart, 0, 1);
|
|
199
199
|
if (ls && ls.length) {
|
|
200
200
|
return ls[0] * length + this._offset;
|
|
201
201
|
}
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
isSubKindCasedHoleFracPack,
|
|
22
22
|
isSubkindCasedHoleGravelPack,
|
|
23
23
|
PerforationSubKind,
|
|
24
|
+
isSubKindCasedHoleFracturation,
|
|
24
25
|
} from '../layers/schematicInterfaces';
|
|
25
26
|
import { ComplexRopeSegment } from '../layers/CustomDisplayObjects/ComplexRope';
|
|
26
27
|
import { createNormals, offsetPoints } from '../utils/vectorUtils';
|
|
@@ -652,6 +653,8 @@ const drawFracLines = (
|
|
|
652
653
|
const offsetX = 0;
|
|
653
654
|
const offsetY = startAt === 'diameter' ? 0 : spikeLength;
|
|
654
655
|
|
|
656
|
+
ctx.globalAlpha = perforationOptions.packingOpacity;
|
|
657
|
+
|
|
655
658
|
const fracLines = () => {
|
|
656
659
|
for (let i = -1; i < amountOfSpikes; i++) {
|
|
657
660
|
const bottom: [number, number] = [i * spikeWidth + offsetX + spikeWidth / 2, canvas.height / 2 - fracLineLength - offsetY - fracLineLength];
|
|
@@ -693,7 +696,6 @@ const drawFracLines = (
|
|
|
693
696
|
ctx.strokeStyle = perforationOptions.yellow;
|
|
694
697
|
ctx.lineWidth = 6;
|
|
695
698
|
ctx.save();
|
|
696
|
-
ctx.globalAlpha = perforationOptions.packingOpacity;
|
|
697
699
|
fracLines();
|
|
698
700
|
ctx.restore();
|
|
699
701
|
ctx.lineWidth = 1;
|
|
@@ -709,7 +711,7 @@ const drawSpikes = (
|
|
|
709
711
|
extendedPerfShapeDiameter: number,
|
|
710
712
|
perforationOptions: PerforationOptions,
|
|
711
713
|
) => {
|
|
712
|
-
const amountOfSpikes =
|
|
714
|
+
const amountOfSpikes = 4;
|
|
713
715
|
const spikeWidth = canvas.width / amountOfSpikes;
|
|
714
716
|
ctx.strokeStyle = perforationOptions.outline;
|
|
715
717
|
|
|
@@ -717,11 +719,10 @@ const drawSpikes = (
|
|
|
717
719
|
|
|
718
720
|
ctx.lineWidth = 1;
|
|
719
721
|
const spikeLength = diameter / 2;
|
|
720
|
-
const offsetX = 0;
|
|
721
722
|
|
|
722
723
|
// left spikes
|
|
723
724
|
for (let i = 0; i <= amountOfSpikes; i++) {
|
|
724
|
-
const left: [number, number] = [i * spikeWidth
|
|
725
|
+
const left: [number, number] = [i * spikeWidth, canvas.height / 2 - diameter / 2];
|
|
725
726
|
const bottom: [number, number] = [left[0] - spikeWidth / 2, left[1] - spikeLength];
|
|
726
727
|
const right: [number, number] = [left[0] - spikeWidth, left[1]];
|
|
727
728
|
|
|
@@ -737,7 +738,7 @@ const drawSpikes = (
|
|
|
737
738
|
|
|
738
739
|
// right spikes
|
|
739
740
|
for (let i = 0; i <= amountOfSpikes; i++) {
|
|
740
|
-
const left: [number, number] = [i * spikeWidth
|
|
741
|
+
const left: [number, number] = [i * spikeWidth, canvas.height / 2 + diameter / 2];
|
|
741
742
|
const bottom: [number, number] = [left[0] - spikeWidth / 2, left[1] + spikeLength];
|
|
742
743
|
const right: [number, number] = [left[0] - spikeWidth, left[1]];
|
|
743
744
|
|
|
@@ -806,6 +807,10 @@ const createPerforationTexture = (canvas: HTMLCanvasElement) => {
|
|
|
806
807
|
return texture;
|
|
807
808
|
};
|
|
808
809
|
|
|
810
|
+
const compareIntersectingPerforationsBy =
|
|
811
|
+
(targetPerf: Perforation, comparedPerforations: Perforation[]) => (compareFunc: (comparedPerf: Perforation) => boolean) =>
|
|
812
|
+
comparedPerforations.some((perf) => compareFunc(perf) && intersect(targetPerf, perf));
|
|
813
|
+
|
|
809
814
|
/**
|
|
810
815
|
* @Perforation
|
|
811
816
|
* If a perforation does not overlap with another perforations of type with gravel,
|
|
@@ -821,6 +826,9 @@ const createPerforationTexture = (canvas: HTMLCanvasElement) => {
|
|
|
821
826
|
*
|
|
822
827
|
* Cased Hole Gravel Pack:
|
|
823
828
|
* Yellow gravel. Makes perforations of type "Perforation" yellow if overlapping and perforation are open.
|
|
829
|
+
*
|
|
830
|
+
* Cased Hole Fracturation:
|
|
831
|
+
* Makes perforations of type "Perforation" yellow if overlapping and perforation are open.
|
|
824
832
|
*/
|
|
825
833
|
const createSubkindPerforationTexture = {
|
|
826
834
|
packing: () => errorTexture(),
|
|
@@ -833,32 +841,25 @@ const createSubkindPerforationTexture = {
|
|
|
833
841
|
): Texture => {
|
|
834
842
|
const { canvas, ctx } = createPerforationCanvas(perfShape, perforationOptions);
|
|
835
843
|
|
|
836
|
-
const
|
|
837
|
-
(perf) => isSubkindCasedHoleGravelPack(perf) && intersect(perforation, perf),
|
|
838
|
-
);
|
|
844
|
+
const compareBy = compareIntersectingPerforationsBy(perforation, otherPerforations);
|
|
839
845
|
|
|
840
|
-
const
|
|
841
|
-
(perf) => isSubKindCasedHoleFracPack(perf) && intersect(perforation, perf),
|
|
842
|
-
);
|
|
846
|
+
const intersectionsWithCasedHoleGravel: boolean = compareBy(isSubkindCasedHoleGravelPack);
|
|
843
847
|
|
|
844
|
-
const
|
|
848
|
+
const intersectsWithCasedHoleFracturation: boolean = compareBy(isSubKindCasedHoleFracturation);
|
|
845
849
|
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
850
|
+
const intersectionsWithCasedHoleFracPack: boolean = compareBy(isSubKindCasedHoleFracPack);
|
|
851
|
+
|
|
852
|
+
const intersectsWithPerforation = intersectionsWithCasedHoleGravel || intersectsWithCasedHoleFracturation || intersectionsWithCasedHoleFracPack;
|
|
853
|
+
|
|
854
|
+
const openPerforationSpikeColor = intersectsWithPerforation ? perforationOptions.yellow : perforationOptions.red;
|
|
855
|
+
|
|
856
|
+
ctx.globalAlpha = perforationOptions.packingOpacity;
|
|
857
|
+
if (perforation.isOpen) {
|
|
858
|
+
ctx.fillStyle = openPerforationSpikeColor;
|
|
859
|
+
ctx.strokeStyle = openPerforationSpikeColor;
|
|
854
860
|
} else {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
ctx.strokeStyle = perforationOptions.red;
|
|
858
|
-
} else {
|
|
859
|
-
ctx.fillStyle = perforationOptions.grey;
|
|
860
|
-
ctx.strokeStyle = perforationOptions.grey;
|
|
861
|
-
}
|
|
861
|
+
ctx.fillStyle = perforationOptions.grey;
|
|
862
|
+
ctx.strokeStyle = perforationOptions.grey;
|
|
862
863
|
}
|
|
863
864
|
|
|
864
865
|
drawSpikes(canvas, ctx, perfShape.diameter, perforationOptions);
|
|
@@ -577,11 +577,11 @@ export class GeomodelLabelsLayer<T extends SurfaceData> extends CanvasLayer<T> {
|
|
|
577
577
|
const [dx1, dx2] = xScale.domain();
|
|
578
578
|
const [dy1, dy2] = yScale.domain();
|
|
579
579
|
|
|
580
|
-
let top = referenceSystem.interpolators.curtain.
|
|
580
|
+
let top = referenceSystem.interpolators.curtain.getIntersects(dy1, 1, 0) as number[][];
|
|
581
581
|
if (top.length === 0) {
|
|
582
582
|
top = [referenceSystem.interpolators.curtain.getPointAt(0.0) as number[]];
|
|
583
583
|
}
|
|
584
|
-
let bottom = referenceSystem.interpolators.curtain.
|
|
584
|
+
let bottom = referenceSystem.interpolators.curtain.getIntersects(dy2, 1, 0) as number[][];
|
|
585
585
|
if (bottom.length === 0) {
|
|
586
586
|
bottom = [referenceSystem.interpolators.curtain.getPointAt(1.0) as number[]];
|
|
587
587
|
}
|
|
@@ -452,7 +452,7 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
452
452
|
});
|
|
453
453
|
});
|
|
454
454
|
|
|
455
|
-
|
|
455
|
+
spikes.forEach((perforation) => {
|
|
456
456
|
const perfShapes = this.createPerforationShape(perforation, casings, holeSizes);
|
|
457
457
|
const thiccPerfShapes = perfShapes.map((ps) => ({ ...ps, diameter: ps.diameter * 3 }));
|
|
458
458
|
const perfShapesByDiameter: { [key: number]: ComplexRopeSegment[] } = thiccPerfShapes.reduce(
|
|
@@ -467,13 +467,14 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
467
467
|
);
|
|
468
468
|
Object.values(perfShapesByDiameter).forEach((perfShapesWithSameDiameter) => {
|
|
469
469
|
perfShapesWithSameDiameter.forEach((perfShape) => {
|
|
470
|
-
const texture =
|
|
470
|
+
const texture = createPerforationSpikeTexture(perforation, perforations, perfShape, perforationOptions);
|
|
471
471
|
const rope = this.drawComplexRope([perfShape], texture);
|
|
472
472
|
this.perforationRopeAndTextureReferences.push({ rope, texture });
|
|
473
473
|
});
|
|
474
474
|
});
|
|
475
475
|
});
|
|
476
|
-
|
|
476
|
+
|
|
477
|
+
fracLines.forEach((perforation) => {
|
|
477
478
|
const perfShapes = this.createPerforationShape(perforation, casings, holeSizes);
|
|
478
479
|
const thiccPerfShapes = perfShapes.map((ps) => ({ ...ps, diameter: ps.diameter * 3 }));
|
|
479
480
|
const perfShapesByDiameter: { [key: number]: ComplexRopeSegment[] } = thiccPerfShapes.reduce(
|
|
@@ -488,7 +489,7 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
488
489
|
);
|
|
489
490
|
Object.values(perfShapesByDiameter).forEach((perfShapesWithSameDiameter) => {
|
|
490
491
|
perfShapesWithSameDiameter.forEach((perfShape) => {
|
|
491
|
-
const texture =
|
|
492
|
+
const texture = createPerforationFracLineTexture(perforation, perfShape, perforationOptions);
|
|
492
493
|
const rope = this.drawComplexRope([perfShape], texture);
|
|
493
494
|
this.perforationRopeAndTextureReferences.push({ rope, texture });
|
|
494
495
|
});
|
|
@@ -303,6 +303,8 @@ export function isOpenHoleFracPack(perf: Perforation) {
|
|
|
303
303
|
);
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
+
export const isSubKindCasedHoleFracturation = (perf: Perforation): boolean => perf.subKind === 'Cased hole fracturation';
|
|
307
|
+
|
|
306
308
|
export const intersect = (a: Perforation, b: Perforation): boolean => {
|
|
307
309
|
return a.start < b.end && a.end > b.start;
|
|
308
310
|
};
|
|
@@ -405,7 +407,7 @@ export const defaultPerforationOptions: PerforationOptions = {
|
|
|
405
407
|
transparent: 'rgba(255, 255, 255, 0)',
|
|
406
408
|
spikeWidth: 50,
|
|
407
409
|
spikeLength: 50,
|
|
408
|
-
packingOpacity: 0.
|
|
410
|
+
packingOpacity: 0.7,
|
|
409
411
|
fracLineCurve: 10,
|
|
410
412
|
fracLineLength: 25,
|
|
411
413
|
scalingFactor: 25,
|
package/src/utils/arc-length.ts
CHANGED