|
![](/i/fill.gif) |
Wasn't it [GDS|Entropy] who wrote:
>Hello,
>
>Lets assume we have an area (or areas) of undefined shape, and we wish to
>place objects everywhere *but* that spot in 3 dimensions or two.
>
>Would this normally be accomplished by some horrific inversion of the
>Trace() function, or calls to a min/max_extent vector array macro for each
>object to be tested against?
>It seems that it would be awful to test every vector against every other
>vector in two or more large arrays...so that can't be the right way to do
>it...
>
>In a more simple scenario if we knew that the space we wished to (or to NOT)
>populate was everywhere between <-5,-5,-5> and <5,5,5>, I was able to come
>up with the folowing:
> #if (((vectorArray[i].x <= vectorB.x) & (vectorArray[i].x >= vectorA.x)) &
> ((vectorArray[i].y <= vectorB.y) & (vectorArray[i].y >= vectorA.y)) &
> ((vectorArray[i].z <= vectorB.z) & (vectorArray[i].z >= vectorA.z)))
>
>This does NOT take mixed sign vectors well at all, but works nicely with
>everything else that I have tested it with.
>
>How can I fix that? Does it involve breaking the if condition up into
>seperate blocks or something?
>
>I've posted the source in p.t.s-f and image in p.b.i.
>Its nothing glorious, just something that hit me while drinking my Bass Ale
>earlier...
>
>Does anyone else have any ideas? There has to be a better way.
You can do it with inside() as long as you can create a closed object
that fits the space.
#declare Object = sphere{0,1.1}
#declare R = seed(123);
#declare N=0;
#while (N<2000)
#declare Point = <rand(R)*2-1,rand(R)*2-1,rand(R)*2-1>;
#if (inside(Object,Point))
// do nothing
#else
sphere {Point,0.1 pigment {rgbt <1,1,1,0.9>}}
#end
#declare N=N+1;
#end
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
![](/i/fill.gif) |