POV-Ray : Newsgroups : povray.advanced-users : Is there a way : Re: Is there a way Server Time
29 Jul 2024 22:29:11 EDT (-0400)
  Re: Is there a way  
From: Margus Ramst
Date: 17 Sep 2000 18:43:17
Message: <39C53ADB.23ADAC7B@peak.edu.ee>
Mick Hazelgrove wrote:
> 
> I want to translate an object. I often come across the situation where I
> want to randomly add a increment to a translation either side of zero. ie
> translate x* (+or - increment) usually in a loop.
> 

I'm still a bit unclear, but perhaps this macro will do the job:

//Seed - declared random number seed
#macro PlusMinus(Seed)
    #local U=rand(Seed);
    #if(U<.5) (-1) #else 1 #end
#end

This returns -1 or 1 at random, so basically: x*PlusMinus(Seed)*y shall
alternate between incrementing and decrementing.

-- 
Margus Ramst

Personal e-mail: mar### [at] peakeduee
TAG (Team Assistance Group) e-mail: mar### [at] tagpovrayorg


Post a reply to this message

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