POV-Ray : Newsgroups : povray.newusers : random shapes : Re: random shapes Server Time
31 Jul 2024 06:13:25 EDT (-0400)
  Re: random shapes  
From: Warp
Date: 11 Dec 2002 09:51:12
Message: <3df750df@news.povray.org>
Lenx <lenx_@hotmail.com> wrote:
> difference{
>    box ( <0,-1,-1> <2,1,1> )
>    box ( <1,-2,-2> <2,2,2> rotate z*...)  //this box needs a random rotation
>    }

  Declare a rand stream like this:

#declare S = seed(0); // or whatever value you wish

  Then you can use the rand() function to get random values. For example
if you want to rotate randomly between -20 and 20 degrees, you can do it
like this:

  rotate z*(-20+40*rand(S))

  If you create the boxes inside a #while-loop, each one will have a different
rotation.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

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