|
 |
Hey!
I like the results you're getting.
In fact, I like the holes in the mesh so much, that maybe you could think about
exploiting that effect by randomly creating holes in the mesh to give a
"spiking" effect - I think that would be an excellent Gormley-inspired
methodology.
I think this is something Stephen would have fun playing with, and I'd have to
think about how to make it apply to DF3 files.
On the flip-side, if you wrote the points of the array to a DF3-format, then you
could create DF3 point clouds from any solid mesh or CSG construct, which would
be very cool indeed :)
I have some explanatory comments on the code below to speed you along in your
studies.
"Bald Eagle" <cre### [at] netscape net> wrote:
> #declare Min = min_extent (Object);
> #declare Max = max_extent (Object);
obviously this just gives the opposing bounding box coordinates
> #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);
Then we do some rounding up and down
> #declare Step = 0.5;
>
> #declare ZRange = (MaxZ - MinZ)/Step;
> #declare YRange = (MaxY - MinY)/Step;
> #declare XRange = (MaxX - MinX)/Step;
This compensates for any "off-origin" positioning
> #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>;
If the point being scanned is inside the object, stick that point on the array
"stack", and increment the stack pointer / array position.
If not, just keep scanning.
> //#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;
Nudge this back down to the pre-increment value to avoid unknown array element
error.
> #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;
Random seeds and a varying scale between 1 and ScaleRange
> #declare Tries = 2000;
How many objects do you want to populate the inside of the arrayed space with?
> #for (N, 1, Tries)
> #declare P = int(rand (Stream5)*InSize);
Since rand() returns 0-1, and Insize is the number of points in the array, you
get a position somewhere in that array.
> #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) );
I just had an array here to vary the textures of the jacks randomly
> object {Jack rotate <rx, ry, rz> scale Scale translate TestArray [P] texture
> {TexArray[TexNum]} }
Put an object at the randomly selected array position. It gets rotated some
random amount around x, y, and z, and given a random texture before translation.
> #end
Post a reply to this message
|
 |