Meeting IV

The setup

Hopefully after Tuesday’s meeting, everyone has a way to access their Processing projects from class meeting to class meeting to class meeting.

Variables

Let’s take a look at the Processing reference for Using varibles. Variables can hold variables or, for the object-oriented, refer to objects. Processing follow Java’s use of primitives, arrays (look at the picture), and classes (take CSCI 201 and 202). Variable names in Processing generally conform to the rules of Java, but it’s best to stick with camelcase. You can use the underscore and dollar sign, but that is so 90’s.

Look at the Data section, both Primitive and Composite, of the Processing reference for a comlete list of the variable types. int and float will be the most common in this course. Processing also support Java classes, so you can create your own types.

Now go to the Math section and puruse all the ways to do your math. Many of these, such as lerp(), are not found in Java. By the way, in Processing you can write pow(1.8, 15) but in Java it would be Math.pow(1.8, 15).

Next visit the Control section. Tests are accomplished with conditionals, such as if and then. Loops are done with while and for. Also, look at all those relational and logical operators. Note the ≥ is written as >= and ≠ is !=.

Something to look at today

Let’s look at different ways to make a snowman. Download a collection of snowmen implementations to your sketchbook directory, and we will look at six approaches. We will return to translate(), scale() and rotate() in a couple of weeks.

This week’s Activity