// blobify.inc // // Ryan Budge // budgery@yahoo.com // // April 27,2004 /* Blobify usage : Blobify ( obj, vec1, vec2, res, elrad, thresh ) obj - object to blobify vec1 - one corner of scan box (obj should be contained within scan box) vec2 - far corner of scan box (order of vec1 and vec2 interchangable) res - scan resolution (higher=better, slower; lower=uglier, faster; upper limit 256?) elrad - radius of blob elements thresh - blob threshold (higher=smoother; if set too high, blob will disappear) Inner details : Step 1 : Scan object, store all points inside obj into arrA Step 2 : For each point in arrA, eliminate points surrounded by other points, effectively leaving only the surface of obj, store those points in arrB Step 3 : Input arrB points into blob */ #macro Blobify ( obj, vec1, vec2, res, elrad, thresh ) //Step 1 #local i=0; #local j=0; #local k=0; #local arrA = array[res][res][res]; #local arrA[0][0][0]=0; #while (i/(res-1))*(vec2-vec1)+vec1; #local arrA[i][j][k]=inside(obj, rel_coord); #local k=k+1; #end #local j=j+1; #end #local i=i+1; #end //End Step 1 //Step 2 #local i=0; #local j=0; #local k=0; #local edge_points=0; #local arrB = array[pow(res,3)]; #local arrB[0]=<0,0,0>; #local edge=1; #while (i+-1; #if (scanx=1 * scany=1 * scanz=1) //nothing #else #if ( (i=0)+(j=0)+(k=0)+(i=res-1)+(j=res-1)+(k=res-1) ) #local edge=0; #local scanx=2; #local scany=2; #local scanz=2; #else #local edge=edge*arrA[rel_coord.x][rel_coord.y][rel_coord.z]; #end #end #local scanz=scanz+1; #end #local scany=scany+1; #end #local scanx=scanx+1; #end #if (edge=0) #local arrB[edge_points]=; #local edge_points=edge_points+1; #end #local edge=1; #end #local k=k+1; #end #local j=j+1; #end #local i=i+1; #end //End Step 2 //Step 3 blob { threshold thresh #local i=0; #while (i