|
|
GOT IT! (You needed an Or instead of an AND for the test...) As part
of my testing, I replaced vlength with the distance formula, for
simplicity, I would suggest returning it to normal. Also, to see the
spheres better, I changed the finish. Hope this helps
Steve
#declare Radius = 11;
#declare N = 2500;
#declare C = <0,8,0>;
#declare s = seed(pi);
#while (N>0)
sphere {
C
0.25
pigment { rgb <1,1,1>} finish { ambient 0.2 diffuse 0.6 }
#local vd=<rand(s)*(Radius * 2) - Radius,rand(s)*(Radius * 2) -
Radius,rand(s)*(Radius * 2) - Radius>;
#local vld = sqrt(vd.x*vd.x + vd.y*vd.y + vd.z*vd.z);
#while((vld>Radius) | (vld<-Radius))
#local vd=<rand(s)*(Radius * 2) - Radius,rand(s)*(Radius * 2) -
Radius,rand(s)*(Radius * 2) - Radius>;
#local vld = sqrt(vd.x*vd.x + vd.y*vd.y + vd.z*vd.z);
#end
translate vd
}
#declare N=N-1;
#end
Stephen Lavedas wrote:
>
> I tweaked your code a bit... First thing I did was actually translate
> the spheres (which I made larger at a radius of 0.25. Then I changed
> your random functions to rand(s)*(Radius * 2) - Radius so that the
> values could be positive or negative. Now, I expected I would be
> treated to a roughly spherical shape made up of spheres. Wrong. I got
> a roughly cubical shape made up of spheres. This is baffling me,
> because your test should eliminate the corners (The corners would occur
> when all of vd's vector components were 11s (positive and negative) but
> that should end up having a distance greater than 11. I guess you could
> revert to the trig. (triangles and all...but damned if the distance
> formula shouldn't have worked...)
>
> Steve
> (I'll be messing with this, email me if you like and we'll figure this
> sucker out)
Post a reply to this message
|
|