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

656<br />

Figure 13-17. Better Extrusion Example sketch (wireframe box version)<br />

This example is lengthy in large part because of all the interactivity. Really, the only complicated<br />

problem in the sketch is in dynamically generating the equal segementation of the<br />

solid. I also wanted the shape to remain centered as it rotated. Since the solid never actually<br />

moves (remember that the rotation is the entire drawing context) as the shape<br />

increases in width, I needed to shift the vertices negatively the same distance I increased<br />

the length of the cube; I used the following block to accomplish this:<br />

// Calculate z positions of vertices<br />

float segmentWidth = extrudeLength/segments;<br />

for (int i=0; i

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

Saved successfully!

Ooh no, something went wrong!