Computer Science 112
The Art & Science of Computer Graphics
Fall 2015, The College of Saint Rose
Lecture 18: Programmed Replication
Date: Wednesday, November 4, 2015
Agenda
- Announcements
- Final Project out
- Lecture 17 assignment recap
- Programmed replication
- recap of previous examples
- loops controlling values other than positions
- loops controlling multiple parameters
- using a loop to construct a Difference
- In-class Exercise 18 - (10 lecture assignment
points) due before the end of class.
We will work together in class to develop a model of an "inverted
tower" of discs. The model should include a function that adds n
discs, each of which is 10 units tall, and is 10 units larger in
diameter than the previous, and stacked on top of the previous. An
inverted tower of 10 might look like this:
Please demonstrate your program or
submit your Python model and image by email before you leave class. Email submissions should use a meaningful
subject line, clearly indicating the course number and assignment
name.
Lecture 18 Assignment
Due at the start of class, Friday, November 6.
Please submit answers to these questions
either as a hard copy (typeset or handwritten are OK) or by email to
terescoj AT strose.edu by the start of class. Please use a clear subject line
when submitting by email (e.g., CSC 112 Lecture
18 Assignment , Joe Student). We will discuss these
questions at the start of class, so no late submissions are
accepted.
- Write a Python loop that prints out the even numbers from 2 up
to and including 1000. (5 points)
- Write a series of Python statements that computes and prints out
the sum of the even numbers from 2 up to 1000 by using a loop
similar to the one from the previous question. (5 points)
- Write an Ambrosia model that adds a series of 10 cylinders to
the scene. (10 points) The cylinders should have these properties:
- they all sit atop the xz-plane (that is, they all have an
axis parallel to the y axis, and all points in the base of each
has coordinates y=0)
- each has a base whose diameter is 10, but whose heights vary
with position
- the x-coordinates of the center of the bases of the
cylinders vary from 10 up to and including 100, and each
cylinder's height is equal to the value of its x-coordinate
Examples