|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
> > That is looking good indeed. I need to ponder this a bit more; I think I
> > know how to do this but I want to examine all the angles, so to speak. I
> > can see the advantage of this procedure and it would avoid the
> > subdividing of the container in discrete elements.
Here's the relevant portion that does the scanning and filling.
I haven't had a chance yet to dig up the write/save vs read code and implement
it.
#declare Min = min_extent (Object);
#declare Max = max_extent (Object);
#declare MinZ = floor(Min.z);
#declare MinY = floor(Min.y);
#declare MinX = floor(Min.x);
#declare MaxZ = ceil(Max.z);
#declare MaxY = ceil(Max.y);
#declare MaxX = ceil(Max.x);
#declare Step = 0.5;
#declare ZRange = (MaxZ - MinZ)/Step;
#declare YRange = (MaxY - MinY)/Step;
#declare XRange = (MaxX - MinX)/Step;
#declare ArraySize = XRange*YRange*ZRange;
#declare TestArray = array [ArraySize];
#declare N = 0;
#for (Z, MinZ, MaxZ, Step)
#for (Y, MinY, MaxY, Step)
#for (X, MinX, MaxX, Step)
#if(inside (Object, <X, Y, Z>))
#declare TestArray [N] = <X, Y, Z>;
//#debug concat ( "Point ", str (N, 3, 1), " = ", vstr(3, TestArray[N], ",
", 3, 0), " \n")
#declare N = N +1;
#end
#end
#end
#end
#declare InSize = N - 1;
#declare Stream = seed (123456789);
#declare Stream1 = seed (456123789);
#declare Stream2 = seed (789456123);
#declare Stream3 = seed (135791113);
#declare Stream4 = seed (987654321);
#declare Stream5 = seed (987654321);
#declare ScaleRange = 3;
#declare Tries = 2000;
#for (N, 1, Tries)
#declare P = int(rand (Stream5)*InSize);
#declare rx = rand(Stream1)*90;
#declare ry = rand(Stream2)*90;
#declare rz = rand(Stream3)*90;
#declare Scale = rand(Stream4)*ScaleRange;
#declare TexNum = int (rand (Stream4) * dimension_size (TexArray, 1) );
object {Jack rotate <rx, ry, rz> scale Scale translate TestArray [P] texture
{TexArray[TexNum]} }
#end
Post a reply to this message
|
 |