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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

curve segments<br />

noFill(); // comment this line out to see how the curve fills<br />

curve(p4.x, p4.y, p0.x, p0.y, p1.x, p1.y, p2.x, p2.y);<br />

curve(p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y);<br />

curve(p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y);<br />

curve(p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, p0.x, p0.y );<br />

//control points<br />

fill(255);<br />

ellipse(p0.x, p0.y, 5, 5);<br />

ellipse(p1.x, p1.y, 5, 5);<br />

ellipse(p2.x, p2.y, 5, 5);<br />

ellipse(p3.x, p3.y, 5, 5);<br />

ellipse(p4.x, p4.y, 5, 5);<br />

}<br />

Figure 7-31. Controlling curvature using <strong>Processing</strong>’s curveTightness() function<br />

All right, so that covers most of the theory part of curves. I realize it may have been a bit<br />

rough to get through. One of my goals in this book is to try to provide detailed <strong>and</strong> clear<br />

explanations of important concepts that are often not well articulated in existing sources<br />

(that I can find). For example, in doing research on splines, I was amazed at how<br />

inscrutable most of the explanations were. This was mostly due to the dense mathematical<br />

explanations. The concepts themselves aren’t that complicated, but when they’re<br />

explained as a page of Greek symbols, matrices, <strong>and</strong> complex graphs, well—you’re not<br />

going to entice many artists. I also expect you to move through this material pretty quickly<br />

(on the first read through), mostly just remembering that it’s covered in the book. As you<br />

progress in your work <strong>and</strong> develop more coding chops, there will be times you’ll<br />

need/want to deal with some of these more complex issues.<br />

CURVES<br />

283<br />

7

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

Saved successfully!

Ooh no, something went wrong!