In this example you place 10 circles with a random radius between 0 and 2, the distance between each circle is calculated so that they touch each others.
a = 2 ! defines the upper limit of the random values (0<x<2)
n = 9 ! defines number of random values
x = RND ( a ) ! calculates the first random value
CIRCLE x ! draws the first circle
FOR i = 1 TO n ! beginn of loop
TRANS x , 0 , 0 ! moves the origin point by x (radius of first circle or radius of circle i-1)
x = RND ( a ) ! calculates the random value i
TRANS x , 0 , 0 ! moves the origin point by x (radius of circle i)
CIRCLE x ! draws circle i
NEXT i
(C) ALLPLAN GmbH |
Privacy policy |