POV-Ray : Newsgroups : povray.general : Random-Placement of Objects : Re: Random-Placement of Objects Server Time
2 Aug 2024 02:27:51 EDT (-0400)
  Re: Random-Placement of Objects  
From: Tom Melly
Date: 9 Feb 2005 10:46:12
Message: <420a3044$1@news.povray.org>
"Sven Littkowski" <wrt### [at] yahoocom> wrote in message
news:web.420a2c0a5473d9f07e561af90@news.povray.org...
> Hi everyone. I need help. I have a scene in which I created an object, so
> far it works. At the end of the scene I want to create a random-generated
> number how often that object will be placed in the scene (minimum 10x,
> maximum 20x), and I also want random-generated locations (x,y,z) and
> rotation (again x, y, z axis). That I was not able to do successfully. Who
> can help me? Thanks.
>
>

Something like:

#declare Rand1 = seed(43552);
#declare ObjCount = int(rand(Rand1)*10)+10;
#declare N = 1;
#while(N<=ObjCount)
  object{
  cylinder{0,y*2,0.25 pigment{Red}}
    rotate<rand(Rand1)*360, rand(Rand1)*360, rand(Rand1)*360>
    translate<rand(Rand1)*10-5,rand(Rand1)*10-5,rand(Rand1)*10-5>
  }
  #declare N=N+1;
#end


Post a reply to this message

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