Commit 396f4776 authored by Neil Gershenfeld's avatar Neil Gershenfeld
Browse files

two finish segs

parent 1b30a949
......@@ -306,7 +306,7 @@ function calculate_path_worker() {
var stepover = evt.data.stepover
var mmunits = evt.data.mmunits
var step = Math.floor(stepover*diameter*w/(mmunits*(xmax-xmin)))
var path = [[]]
var path = []
//
// construct tool offset
//
......@@ -325,10 +325,11 @@ function calculate_path_worker() {
// xz
//
if (evt.data.xz) {
path.push([])
var xstart = 0
var ystart = h-1
var zstart = Math.floor((map[ystart*w+xstart]-zmax)*w/(xmax-xmin))
path[0].push([xstart,h-1-ystart,zstart])
path[path.length-1].push([xstart,h-1-ystart,zstart])
var xcur = 1
var ycur = h-1
var zcur = Math.floor((map[ycur*w+xcur]-zmax)*w/(xmax-xmin))
......@@ -377,7 +378,7 @@ function calculate_path_worker() {
nznext = dznext/dnext
dot = nxcur*nxnext+nycur*nynext+nzcur*nznext
if (dot <= (1-error)) {
path[0].push([xcur,h-1-ycur,zcur])
path[path.length-1].push([xcur,h-1-ycur,zcur])
xstart = xcur
ystart = ycur
zstart = zcur
......@@ -415,10 +416,11 @@ function calculate_path_worker() {
// yz
//
if (evt.data.yz) {
path.push([])
var xstart = w-1
var ystart = 0
var zstart = Math.floor((map[ystart*w+xstart]-zmax)*w/(xmax-xmin))
path[0].push([xstart,h-1-ystart,zstart])
path[path.length-1].push([xstart,h-1-ystart,zstart])
var xcur = w-1
var ycur = 1
var zcur = Math.floor((map[ycur*w+xcur]-zmax)*w/(xmax-xmin))
......@@ -467,7 +469,7 @@ function calculate_path_worker() {
nznext = dznext/dnext
dot = nxcur*nxnext+nycur*nynext+nzcur*nznext
if (dot <= (1-error)) {
path[0].push([xcur,h-1-ycur,zcur])
path[path.length-1].push([xcur,h-1-ycur,zcur])
xstart = xcur
ystart = ycur
zstart = zcur
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment