#
# CSC 112 Ambrosia Example: random numbers for object placement
# and the number of cones to place, and the height of each, and
# now also with a randomly-colored plaster material
#
# In this case, we add 30-50 cones who sit atop the xz-plane, but
# whose x and z-coordinates are randomly chosen between -400 and
# 400 in each dimension
#
# Jim Teresco, The College of Saint Rose, Fall 2015
#
from ambrosia import *
import random
# define a cone, 50x50x50, sitting atop the xz-plane, with
# its axis along the y-axis
# but no longer specify a material here as each will be a
# different material
theCone = Cone()
theCone.scale(.5,.5,.5).translate(0,25,0)
# a floor
scene.add(Plane(), whitePlaster)
# pick a random number of cones to place
numCones = random.randint(30,50)
# place numCones of these randomly in our scene, now with
# an additional scaling factor from .5 to 2 that will result in
# cone heights ranging from 25 to 100
for coneNum in range(numCones):
# before we add, create a new material for this one
mat = Material()
mat.type('plaster')
mat.color((random.random(), random.random(), random.random()))
scene.add(theCone, scale(1,random.uniform(.5,2),1)*
translate(random.uniform(-400,400), 0,
random.uniform(-400,400)), mat)
camera.pos([0,300,-500]).shoot()