Skip to content

Commit

Permalink
fix: Remove duplicate vertex's from well path. May cause crash
Browse files Browse the repository at this point in the history
  • Loading branch information
nilscb committed Sep 25, 2023
1 parent c0a9938 commit 1294711
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,31 @@ export function splineRefine(data_in: FeatureCollection): FeatureCollection {
continue;
}

const coords = lineString.coordinates as Position3D[];
let coords = lineString.coordinates as Position3D[];

// Filter out consecutive duplicate vertex's.
const keep = coords.map((e, index, arr) => {
if (index < arr.length - 1) {
return (
e[1] !== arr[index + 1][1] &&
e[1] !== arr[index + 1][1] &&
e[2] !== arr[index + 1][2]
);
}
return true;
});
coords = coords.filter((_e, index) => {
return keep[index];
});
mds[0] = mds[0].filter((_e: number, index: number) => {
return keep[index];
});

const n = coords.length;
if (n <= 1) {
continue;
}

const ts = n > 3 ? steps : [];

// Point before first.
Expand Down

0 comments on commit 1294711

Please sign in to comment.