POV-Ray : Newsgroups : povray.newusers : random shapes Server Time
4 Nov 2024 23:21:10 EST (-0500)
  random shapes (Message 1 to 3 of 3)  
From: Lenx
Subject: random shapes
Date: 11 Dec 2002 09:05:03
Message: <web.3df745389915702cde2a6cfb0@news.povray.org>
is there a way to make some boxes with a simple loop, but each box must have
one surface that is a bit rotated realative to the box. I thougt of making
a box and then substract another box from it. The other box needs a random
rotation (a few degrees) for each box made in the loop.


difference{
   box ( <0,-1,-1> <2,1,1> )
   box ( <1,-2,-2> <2,2,2> rotate z*...)  //this box needs a random rotation
   }

I don't know if u understand, but what i'm trying to do is get rid of all
those straight & rectangular shapes in my scene (a western barn). i need
randomness & dirt!


Post a reply to this message

From: Warp
Subject: Re: random shapes
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

From: Lenx
Subject: Re: random shapes
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.