Skip to content
Snippets Groups Projects
Commit 3bcd4b7d authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

organization

parent 3c696516
No related branches found
No related tags found
No related merge requests found
...@@ -60,11 +60,11 @@ FillGeometry = Backbone.Model.extend({ ...@@ -60,11 +60,11 @@ FillGeometry = Backbone.Model.extend({
var direction = new THREE.Vector3(0,0,1); var direction = new THREE.Vector3(0,0,1);
var mesh = this.get("mesh"); var mesh = this.get("mesh");
raycaster.near = 0; raycaster.near = 0;
raycaster.far = bounds.max-bounds.min+10;//add some padding just in case raycaster.far = bounds.max-bounds.min+2;//add some padding just in case
for (var x=minIndex.x;x<=maxIndex.x;x++){ for (var x=minIndex.x;x<=maxIndex.x;x++){
for (var y=minIndex.y;y<=maxIndex.y;y++){ for (var y=minIndex.y;y<=maxIndex.y;y++){
var origin = dmaGlobals.lattice.getPositionForIndex({x:x, y:y, z:minIndex.z}); var origin = dmaGlobals.lattice.getPositionForIndex({x:x, y:y, z:minIndex.z});
origin.z = bounds.min.z-1; origin.z = bounds.min.z-1;//more padding
raycaster.set(origin, direction); raycaster.set(origin, direction);
var intersections = raycaster.intersectObject(mesh); var intersections = raycaster.intersectObject(mesh);
if (intersections.length == 0) continue; if (intersections.length == 0) continue;
...@@ -78,24 +78,20 @@ FillGeometry = Backbone.Model.extend({ ...@@ -78,24 +78,20 @@ FillGeometry = Backbone.Model.extend({
if (position.z<nextIntersection) continue; if (position.z<nextIntersection) continue;
else { else {
inside = true; inside = true;
dmaGlobals.lattice.addCellAtIndex(index, true); dmaGlobals.lattice.addCellAtIndex(index, true, true);
var next = this._getNextIntersection(position, intersections, nextIntersectionIndex, inside);
if (!next) break;
inside = next.inside;
nextIntersection = next.nextIntersection;
nextIntersectionIndex = next.nextIntersetcionIndex;
} }
} else { } else {
if (position.z<nextIntersection) dmaGlobals.lattice.addCellAtIndex(index, true); if (position.z<nextIntersection) {
else { dmaGlobals.lattice.addCellAtIndex(index, true, true);
inside = false; continue;
var next = this._getNextIntersection(position, intersections, nextIntersectionIndex, inside);
if (!next) break;
inside = next.inside;
nextIntersection = next.nextIntersection;
nextIntersectionIndex = next.nextIntersetcionIndex;
} }
else inside = false;
} }
var next = this._getNextIntersection(position, intersections, nextIntersectionIndex, inside);
if (!next) break;
inside = next.inside;
nextIntersection = next.nextIntersection;
nextIntersectionIndex = next.nextIntersetcionIndex;
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment