fix z offset

This commit is contained in:
casperlamboo 2017-11-16 23:32:50 +01:00
parent 8e5e000a12
commit 8c546e31b3

View File

@ -17,15 +17,15 @@ export default function calculateLayersIntersections(lines, settings) {
if (isFlat) continue; if (isFlat) continue;
const min = Math.ceil(Math.min(line.start.y, line.end.y) / layerHeight); const min = Math.ceil((Math.min(line.start.y, line.end.y) - zOffset) / layerHeight);
const max = Math.floor(Math.max(line.start.y, line.end.y) / layerHeight); const max = Math.floor((Math.max(line.start.y, line.end.y) - zOffset) / layerHeight);
for (let layerIndex = min; layerIndex <= max; layerIndex ++) { for (let layerIndex = min; layerIndex <= max; layerIndex ++) {
if (layerIndex >= 0 && layerIndex < numLayers) { if (layerIndex >= 0 && layerIndex < numLayers) {
layerIntersectionIndexes[layerIndex].push(lineIndex); layerIntersectionIndexes[layerIndex].push(lineIndex);
const y = layerIndex * layerHeight; const y = layerIndex * layerHeight + zOffset;
let x, z; let x, z;
if (line.start.y === line.end.y) { if (line.start.y === line.end.y) {