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.

Figure 6-36. Concentric Maze sketch<br />

Before I describe the new min() <strong>and</strong> max() functions I used in the sketch, I just want to<br />

make sure you fully underst<strong>and</strong> the following statements:<br />

float x = width-1;<br />

float y = height-1;<br />

float y2 = 0, x2 = 0;<br />

float h = 0, w = 0;<br />

In the first two lines, I subtract 1 from the width <strong>and</strong> height properties. I do this so that I<br />

can see the maze output on the right <strong>and</strong> bottom edges of the display window. Try removing<br />

the subtraction to see the difference. In the next two lines, I declare both the y2 <strong>and</strong><br />

x2 variables as floats, <strong>and</strong> do the assignment on a single line. This is just a shortcut. I<br />

could have done the assignment on two lines as well. I do the same thing on the next line<br />

with the w <strong>and</strong> h variables. All four of these lines could also have been put on one line.<br />

float y2 = 0, x2 = 0, h = 0, w = 0;<br />

However, the benefit of only having to write “float” once is offset by the visual complexity<br />

of so many assignments. Ultimately, these type of issues are a matter of personal style.<br />

LINES<br />

223<br />

6

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

Saved successfully!

Ooh no, something went wrong!