Assignments | Course Home | Documentation | Lab Hours/Tutoring | Schedule | Submit

Saint Louis University

Computer Science 144
Introduction to Computer Science: Multimedia

Michael Goldwasser

Spring 2015

Dept. of Math & Computer Science

Examples and Activities: Trigonometry and Transformations

My generating code is linked in the right column, however you may choose to download a single zipfile with the entire collection, and place it within your Processing sketchbook.

The first set of images are examples discussed in class.

Sketch My Code
stopsign Version in which we compute all geometry ourselves:
regular_polygon.pde

Version akin to our text book, using Processing transformations to place the sign.
stop_sign_transform.pde
star star.pde
mandala mandala.pde

If interested, I offer this really cool animation of how the mandala is made (although it is linked as a separate web page since it may be a bit taxing on the cpu).

Great Seal great_seal.pde

I'll conclude today by leaving you with a challenge (spoiler attached). Design a function that draws a flower with a given number of elliptical petals, centered around the origin. Use the following function signature:

void flower(int numPetals, float petalLength, float petalWidth,
            color petalColor, color centerColor)

Note that there is a subtle difference between the design of the flowers on the left versus the right. Can you spot the difference? Which one looks better toyou?

Sketch My Code
flower flower.pde

And if you need one more challenge, try to reimplement the great seal, but this time choosing the angles for the centers of the characters in proportion relative to the individual textWidth() for each character.

Sketch My Code
great seal improved great_seal_improved.pde

Michael Goldwasser
CSCI 144, Spring 2015
Last modified: Monday, 09 February 2015
Assignments | Course Home | Documentation | Lab Hours/Tutoring | Schedule | Submit