POV-Ray : Newsgroups : povray.newusers : Trig Troubles : Trig Troubles Server Time
5 Nov 2024 01:25:49 EST (-0500)
  Trig Troubles  
From: Matthew Green
Date: 3 Mar 2001 13:31:06
Message: <3aa1386a@news.povray.org>
I want to create a ring of random width made of randomly spaced particles.
What I get is random particles within a square boundary.  I've stared at
this for 45 minutes now.  Where am I screwing up?
looprun, ringminrad1, ringwidth1, seed1-4, and deftex are all previously
declared.

#while (looprun < 4000)
 #declare x1 = (ringminrad1 + (ringwidth1 * rand(seed1))) *
cos(radians(90*rand(seed2)));
 #declare z1 = (ringminrad1 + (ringwidth1 * rand(seed1))) *
sin(radians(90*rand(seed2)));
 #declare posnegx = rand(seed4);
 #if (posnegx < 0.5)
    #declare posnegx = -1;
 #else
    #declare posnegx = 1;
 #end
 #declare posnegz = rand(seed4);
 #if (posnegz < 0.5)
    #declare posnegz = -1;
 #else
    #declare posnegz = 1;
 #end
 sphere {
    <0,0,0>,1
    rotate <90*rand(seed3),90*rand(seed3),90*rand(seed3)>
    scale <rand(seed3),rand(seed3),rand(seed3)>
    translate <posnegx * x1,rand(seed3),posnegz * z1>
    texture {deftex}
 }
 #declare looprun = looprun + 1;

#end


Post a reply to this message

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