Basic Elements of Progen3d

The following code explains the use of variables. The VARS rule declares the variables. The operator R is for floats and R* is for integers

VARS -> R len ( 0.3 0.8 ) R size ( 0.65 0.85 ) R* i ( 4 10 ) [ Y ]  

The Y rule instantiates the counter variable ‘i’ to a random value between 4 and 10 inclusive. YMAIN is executed once.

Y 1 i -> YMAIN

The YMAIN rule uses the counter variable ‘i’ to repeat the section ‘i’ times. The variables ‘len’ and ‘size’ are instantiated and given random values defined by R and R* operators. The start section translates the current scope. Each cube following YC is moved in the y axis 2 units every time it is instantiated. Also all cubes following are increasingly scaled by ‘size’ each time the section repeats. Hence you can see the cubes getting smaller in the x axis only since ‘size’ is less than one.

YMAIN i len size ->  T ( 0 -5 -5 ) |  T ( 0 0 2 ) S ( size 1 1 ) [  YC  ] 

Lastly each cube is distorted on one side by the distortion operator. One of the sides is ‘len’ high and the other side is 1 unit high.

YC ->  D ( 1 len 1 ) I ( CubeY 2 0 1 ) 

Leave Comment

Your email address will not be published. Required fields are marked *

en_USEnglish
Powered by TranslatePress