Commit 401a9af9 authored by Neil Gershenfeld's avatar Neil Gershenfeld
Browse files

wip

parent 5621e00a
......@@ -300,10 +300,11 @@ function calculate_path_worker() {
//
var toolsize = Math.floor(diameter*w/(mmunits*(xmax-xmin)))
var tooloffset = new Float32Array(toolsize*toolsize)
var toolmiddle = Math.floor(toolsize/2)
for (var x = 0; x < toolsize; ++x)
for (var y = 0; y < toolsize; ++y) {
var r = Math.sqrt((x-toolsize/2)*(x-toolsize/2)+(y-toolsize/2)*(y-toolsize/2))
if (r <= toolsize/2)
var r = Math.sqrt((x-toolmiddle)*(x-toolmiddle)+(y-toolmiddle)*(y-toolmiddle))
if (r <= toolmiddle)
tooloffset[y*toolsize+x] = 0
else
tooloffset[y*toolsize+x] = Number.MAX_VALUE
......@@ -311,15 +312,15 @@ function calculate_path_worker() {
//
// loop over lines
//
xstart = 0
ystart = h-1
zstart = Math.floor((map[ystart*w+xstart]-zmax)*w/(xmax-xmin))
var xstart = 0
var ystart = h-1
var zstart = (map[ystart*w+xstart]-zmax)*w/(xmax-xmin)
path[0].push([xstart,h-1-ystart,zstart])
xcur = 1
ycur = h-1
zcur = Math.floor((map[ycur*w+xcur]-zmax)*w/(xmax-xmin))
dx = 1
dy = 0
var xcur = 1
var ycur = h-1
var zcur = (map[ycur*w+xcur]-zmax)*w/(xmax-xmin)
var dx = 1
var dy = 0
while (1) {
//
// move to next point
......@@ -334,9 +335,12 @@ function calculate_path_worker() {
//
// 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))
for (var xoffset = 0; xoffset < toolsize; ++xoffset)
for (var yoffset = 0; yoffset < toolsize; ++yoffset) {
var x = xcur+(xoffset-toolmiddle)
var y = ycur+(yoffset-toolmiddle)
var offset = tooloffset[yoffset*toolsize+xoffset]
znext = (map[ynext*w+xnext]-zmax)*w/(xmax-xmin)
}
//
// vectorize
......
Supports Markdown
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