POV-Ray : Newsgroups : povray.general : Psuedo Random #while loop? Server Time
6 Nov 2024 04:19:38 EST (-0500)
  Psuedo Random #while loop? (Message 1 to 1 of 1)  
From: Josh Franklin
Subject: Psuedo Random #while loop?
Date: 20 Apr 1998 14:36:03
Message: <353B9593.15FC@value.net>
I am modelling a haunted mansion and for the path up to the house I have
created three different types of trees, smallTree, mediumTree and
largeTree.

My question is:

I want 2 rows of 6 trees to line the path going up to the
house...normally I would do something like this:

	#declare xLoc=0
	#declare yLoc=0  //not actual #'s, just for testing purposes
	#declare zLoc=0

	#declare numTrees=0
	#declare rowNum=1

	#while( rowNum < 1 )  //actually not sure if double #while will
		#while( numTrees < 7 )  //work...just thought to try right now 
			object{ tree translate <xLoc, yLoc, zLoc> }

			#declare xLoc = xLoc+10  //want straight line

			#declare numTrees = numTrees+1
		#end

		#declare zLoc = zLoc+25  //next row is 25 units over

		#declare rowNum = rowNum+1
	#end

This would only make one type of tree...I could change it so that every
3rd is different type, or use 3 different loops, but I would rather try
to use a random approach...eg...

	\\in #while loop
		#rand( timeSeed )
		#if( timeSeed < .3 )
			object{ largeTree translate<...> }
		#else
			#if( timeSeed > .6 )
				object{ mediumTree translate<..> }
			#else
				object{ smallTree translate<...> }
			#end
		#end

If anyone has any ideas I would greatly appreciate it.

Thanks for you time
-Josh


Post a reply to this message

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