fix gpu contour Y with inside only
This commit is contained in:
parent
188e0e2de0
commit
a4af3a9166
2 changed files with 19 additions and 4 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -182,10 +182,7 @@ export class Topo {
|
|||
for (let i=0; i<numScanlines; i++) {
|
||||
let lineStart = i * pointsPerLine;
|
||||
let lineData = pathData.slice(lineStart, lineStart + pointsPerLine);
|
||||
let points = contourY
|
||||
? Array.from(lineData).map((v,j) => 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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue