POV-Ray : Newsgroups : povray.general : 3D Math (Reply to Spider) : Re: 3D Math (Reply to Spider) Server Time
12 Aug 2024 23:15:23 EDT (-0400)
  Re: 3D Math (Reply to Spider)  
From: Abe
Date: 15 Dec 1998 13:05:40
Message: <3676A52D.8F5B6F13@atmos.albany.edu>
Pardon me for being intrusive . . . but I wanted to share an alternate
solution to this problem which occured to me. It is a bit cheaper in parsing
time (though not much) and loop cycles.


#declare Radius = 11;
#declare N = 2500;
#declare C = <0,8,0>;
#declare s = seed(pi);
#while (N>0)
  sphere {
    <0, 0, 0>
    0.25
    pigment { rgb <1,1,1>} finish { ambient 0.2 diffuse 0.6 }
    #local D =  pow(rand(s), 1/3)*Radius;        // cube root accounts for
increase in rad. wrt vol. Changing this can change the radial distr. of
spheres.
    #local R = < rand(s)*360, rand(s)*360, rand(s)*360,>;
    translate x*D
    rotate 45
    rotate R
    translate C
   }
   #declare N=N-1;
 #end

. . . for what it's worth. :-)

Abe


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.