diff --git a/modules/mesh/slice b/modules/mesh/slice index ca97d87bc09a37b0ab7969a2abeeacdb3e5e0241..1a3effa4761f0d4ea44a50fceef3cce6c678ced6 100644 --- a/modules/mesh/slice +++ b/modules/mesh/slice @@ -28,7 +28,7 @@ var init = function() { mod.rx.value = 0 mod.ry.value = 0 mod.rz.value = 0 - mod.z.value = 0 + mod.depth.value = 0 mod.width.value = 1000 } // @@ -130,10 +130,10 @@ var interface = function(div){ div.appendChild(text) mod.meshsize = text // - // slice z + // slice depth // div.appendChild(document.createElement('br')) - div.appendChild(document.createTextNode('slice z: ')) + div.appendChild(document.createTextNode('slice depth: ')) var input = document.createElement('input') input.type = 'text' input.size = 6 @@ -141,7 +141,7 @@ var interface = function(div){ slice_mesh() }) div.appendChild(input) - mod.z = input + mod.depth = input div.appendChild(document.createTextNode(' (mesh units)')) // // slice width @@ -321,7 +321,6 @@ function draw_mesh() { // slice mesh // function slice_mesh() { - return var blob = new Blob(['('+worker.toString()+'())']) var url = window.URL.createObjectURL(blob) var webworker = new Worker(url) @@ -354,7 +353,7 @@ function slice_mesh() { }) var ctx = mod.slicecanvas.getContext("2d") ctx.clearRect(0,0,mod.slicecanvas.width,mod.slicecanvas.height) - var z = parseFloat(mod.z.value) + var depth = parseFloat(mod.depth.value) var rx = parseFloat(mod.rx.value) var ry = parseFloat(mod.ry.value) var rz = parseFloat(mod.rz.value) @@ -363,8 +362,10 @@ function slice_mesh() { var ctx = mod.img.getContext("2d") var img = ctx.getImageData(0,0,mod.img.width,mod.img.height) webworker.postMessage({ - height:mod.img.height,width:mod.img.width,z:z, + height:mod.img.height,width:mod.img.width,depth:depth, imgbuffer:img.data.buffer,mesh:mod.mesh, + xmin:mod.xmin,xmax:mod.xmax, + ymin:mod.ymin,ymax:mod.ymax, zmin:mod.zmin,zmax:mod.zmax, rx:rx,ry:ry,rz:rz}, [img.data.buffer]) @@ -373,15 +374,15 @@ function worker() { self.addEventListener('message',function(evt) { var h = evt.data.height var w = evt.data.width - var z = evt.data.z + var depth = evt.data.depth var view = evt.data.mesh var rx = evt.data.rx var ry = evt.data.ry var rz = evt.data.rz - var xmin - var xmax - var ymin - var ymax + var xmin = evt.data.xmin + var xmax = evt.data.xmax + var ymin = evt.data.ymin + var ymax = evt.data.ymax var zmin = evt.data.zmin var zmax = evt.data.zmax var buf = new Uint8ClampedArray(evt.data.imgbuffer) @@ -452,10 +453,10 @@ function worker() { // // check for crossing // - if ((p[0][2] < (zmax-z)) && (p[2][2] > (zmax-z))) { + if ((p[0][2] <= (zmax-depth)) && (p[2][2] >= (zmax-depth))) { count += 1 } - /* + /* // // crossing found, check for side and save // @@ -466,7 +467,7 @@ function worker() { else { } } - */ + */ } /* //