POV-Ray : Newsgroups : povray.newusers : Texture declarations and object grouping : Re: Texture declarations and object grouping Server Time
5 Sep 2024 16:21:11 EDT (-0400)
  Re: Texture declarations and object grouping  
From: Margus Ramst
Date: 7 Feb 2001 10:28:37
Message: <3A816A41.E8CA931E@peak.edu.ee>
The Cegorach wrote:
> 
> When you speak of random transformations, is this achieved by a
> function with POV-Ray, such as a Do/While loop, or do you do it by
> hand?
> 

Certainly not by hand, I hate manual labour :P
POV has a rand() function, you can use this to create random transformation
vectors (as in Gail's example).
If the pillars are placed regularly, you can create them with a while loop; each
time the parser goes through the loop and encounters the rand() function, a
different random number is created (ranging from 0 to 1).
Of course you can also position the pillars by hand and give a random texture
transformation to each copy separately.
Here are two macros you might find useful (the second needs access to the first
one to run):

//Give a random number of given mean and maximum deviation
//M - mean value
//D - maximum deviation
//Seed - (declared) random number seed identifier
#macro rand_ext(M,D,Seed)
        (M+(rand(Seed)-.5)*2*D)
#end

//Give a random vector of given mean and max deviation
//M - mean (vector/float)
//D - max deviation (vector/float)
//Seed - (declared) random number seed identifier
#macro v_rand_ext(M,D,Seed)
        #local MV=M+<0,0,0>;
        #local DV=D+<0,0,0>;
       
(<rand_ext(MV.x,DV.x,Seed),rand_ext(MV.y,DV.y,Seed),rand_ext(MV.z,DV.z,Seed)>)
#end


-- 
Margus Ramst

Personal e-mail: mar### [at] peakeduee
TAG (Team Assistance Group) e-mail: mar### [at] tagpovrayorg
Home page http://www.hot.ee/margusrt


Post a reply to this message

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