POV-Ray : Newsgroups : povray.newusers : random shapes : Re: random shapes Server Time
4 Nov 2024 19:22:10 EST (-0500)
  Re: random shapes  
From: Lenx
Date: 11 Dec 2002 10:20:03
Message: <web.3df75672e4715fd3293f3c960@news.povray.org>
Warp wrote:
>Lenx <lenx_[at]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 -
>

thx for your help. and i guess i'd better substract a plane rather then a
box.


Post a reply to this message

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