04.04.2013 Views

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

PROCESSING: CREATIVE CODING AND COMPUTATIONAL ART<br />

246<br />

As the deltaX <strong>and</strong> deltaY values become farther apart, the line visually approaches either<br />

a vertical or horizontal line. The most diagonal line (if there is such a thing) is when deltaX<br />

<strong>and</strong> deltaY are equal, or the change in x <strong>and</strong> the change in y are equal. As you might have<br />

guessed, this is also when the slope is 1. Slope is a very important property in describing<br />

motion, which I’ll cover in Chapter 11. Speed is the rate at which position is changing.<br />

When you plot a diagonal line as a function of distance <strong>and</strong> time, as shown in Figure 7-5,<br />

the slope of the plotted line is speed.<br />

Figure 7-5. Speed plot<br />

Creating your first curve<br />

Without acceleration, speed is a constant <strong>and</strong> will always generate a straight line, as the<br />

rate of change will be constant. Starting with different constant values of speed, you can<br />

change the steepness, or slope, of the line, as the previous example showed, but you can<br />

never get a curve if you keep the speed (or slope) constant. Thus, it would seem logical, if<br />

you wanted to generate a curve, to use a changing speed value—which is precisely what<br />

you’ll do next. This is also the reason why curves, with regard to motion, describe acceleration,<br />

or the change in speed. This next sketch (shown in Figure 7-6) is a curve plot:<br />

/*<br />

Curve I<br />

Ira Greenberg, December 3, 2005<br />

*/<br />

size(200, 200);<br />

background(255);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!