Skip to content
Snippets Groups Projects
Commit 5621e00a authored by Neil Gershenfeld's avatar Neil Gershenfeld
Browse files

ready for tool offset

parent c7481008
Branches
No related tags found
No related merge requests found
...@@ -303,7 +303,10 @@ function calculate_path_worker() { ...@@ -303,7 +303,10 @@ function calculate_path_worker() {
for (var x = 0; x < toolsize; ++x) for (var x = 0; x < toolsize; ++x)
for (var y = 0; y < toolsize; ++y) { for (var y = 0; y < toolsize; ++y) {
var r = Math.sqrt((x-toolsize/2)*(x-toolsize/2)+(y-toolsize/2)*(y-toolsize/2)) var r = Math.sqrt((x-toolsize/2)*(x-toolsize/2)+(y-toolsize/2)*(y-toolsize/2))
if (r <= toolsize/2)
tooloffset[y*toolsize+x] = 0 tooloffset[y*toolsize+x] = 0
else
tooloffset[y*toolsize+x] = Number.MAX_VALUE
} }
// //
// loop over lines // loop over lines
...@@ -319,13 +322,25 @@ function calculate_path_worker() { ...@@ -319,13 +322,25 @@ function calculate_path_worker() {
dy = 0 dy = 0
while (1) { while (1) {
// //
// vectorize // move to next point
// //
xnext = xcur+dx xnext = xcur+dx
ynext = ycur+dy ynext = ycur+dy
znext = Math.floor((map[ynext*w+xnext]-zmax)*w/(xmax-xmin))
if (ynext <= 0) if (ynext <= 0)
//
// done
//
break; break;
//
// find offset at next point
//
for (var x = 0; x < toolsize; ++x)
for (var y = 0; y < toolsize; ++y) {
znext = Math.floor((map[ynext*w+xnext]-zmax)*w/(xmax-xmin))
}
//
// vectorize
//
dxcur = xcur-xstart dxcur = xcur-xstart
dycur = ycur-ystart dycur = ycur-ystart
dzcur = zcur-zstart dzcur = zcur-zstart
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment