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 />

124<br />

Since the graph is of a line, the slope will be constant for any two points, <strong>and</strong> thus the<br />

speed will be continuous, without any acceleration. This issue will become more relevant<br />

later on, when you begin to animate objects. If you want to create more natural motion,<br />

you need acceleration <strong>and</strong> deceleration; thus, lines <strong>and</strong> linear equations are not typically<br />

used to generate organic motion. However, you can animate any property; <strong>and</strong> for some<br />

of these properties, linear equations are the perfect solution (e.g., an object floating in<br />

space or a mechanical device operating at a steady speed). Figure 4-5 graphs speed as a<br />

linear equation, with distance <strong>and</strong> time as the y- <strong>and</strong> x-axes.<br />

Curves<br />

Figure 4-5. Plotting constant speed (distance/time) as a line<br />

Curves are much more complex than lines, <strong>and</strong> there are many varieties. Here’s a link with<br />

a collection of over 850 different curves: www.2dcurves.com/. For your purposes, you just<br />

need to underst<strong>and</strong> some basic aspects of curves <strong>and</strong> how to generate a few. As a simple<br />

rule, you can generate a smooth, continuous curve with any second-degree (or higher)<br />

polynomial. In addition, you can predict the type of curve you’ll get for some of these,<br />

especially second-degree (quadratic curve) <strong>and</strong> third-degree (cubic curve) polynomials. By<br />

predicting curves, I mean knowing how many changes in direction (or turning points) the<br />

curve can have. For example, an arc or parabola would have one change of direction,<br />

while an s-shaped curve would have two. The rule is that an even-degree curve—like a<br />

second-degree polynomial—can have an odd number of turning points one less than its<br />

degree, <strong>and</strong> an odd-degree curve—like a third-degree polynomial—can have an even<br />

number of turning points one less than its degree. I know this sounds a little confusing, but<br />

if you read it again, you’ll see it’s pretty simple. What this rule means is that a quadratic

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

Saved successfully!

Ooh no, something went wrong!