From a4af3a916662f21a0ca7df6e1f222055d282e302 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Mon, 22 Dec 2025 10:07:10 -0500 Subject: [PATCH] fix gpu contour Y with inside only --- src/geo/point.js | 12 ++++++++++++ src/kiri/mode/cam/topo3.js | 11 +++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/geo/point.js b/src/geo/point.js index 5751653a..f922b06f 100644 --- a/src/geo/point.js +++ b/src/geo/point.js @@ -126,6 +126,18 @@ class Point { return this; } + /** + * Swap X and Y coordinates in place + * @returns {Point} This point (for chaining) + */ + swapXY() { + let p = this, + t = p.x; + p.x = p.y; + p.y = t; + return this; + } + /** * Swap X and Z coordinates in place * @returns {Point} This point (for chaining) diff --git a/src/kiri/mode/cam/topo3.js b/src/kiri/mode/cam/topo3.js index ab8136d8..63999c71 100644 --- a/src/kiri/mode/cam/topo3.js +++ b/src/kiri/mode/cam/topo3.js @@ -182,10 +182,7 @@ export class Topo { for (let i=0; i calcPoint(i * ymult + yoff, j * xmult + xoff, v, i * xStep, j * yStep)) - : Array.from(lineData).map((v,j) => calcPoint(j * xmult + xoff, i * ymult + yoff, v, j * xStep, i * yStep)) - ; + let points = Array.from(lineData).map((v,j) => calcPoint(j * xmult + xoff, i * ymult + yoff, v, j * xStep, i * yStep)); let slice = newSlice(i); let poly = newPolygon().setOpen(); let lines = [ ]; @@ -228,6 +225,12 @@ export class Topo { if (poly.length > 1) { lines.push(poly); } + if (contourY) { + for (let poly of lines) + for (let p of poly.points) { + p.swapXY(); + } + } // raise output points when inside tab boundaries if (!inside && tabsOn && clipTab.length) for (let poly of lines) {