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.

PROCESSING: CREATIVE CODING AND COMPUTATIONAL ART<br />

712<br />

Notice the following statement at the top of the example:<br />

import processing.pdf.*;<br />

This imports <strong>Processing</strong>’s PDF library, one of <strong>Processing</strong>’s core libraries. Finally, note that<br />

the file functions will not work from a web browser.<br />

Transform<br />

Figure A-11. Hairy Brush Drawing sketch<br />

This is a very cool part of the API, <strong>and</strong> one of the feature sets that makes <strong>Processing</strong> a truly<br />

unique <strong>and</strong> powerful creative tool. However, all this coolness does come at a small price.<br />

The transform functions are a little complex <strong>and</strong> take some time to get your head around.<br />

While beginning to use them isn’t all that difficult, using them well can be a challenge. At<br />

the core of these functions is a mysterious mathematical structure called a matrix. A<br />

matrix is just a table-like structure for organizing values. Matrices (plural) are central to<br />

linear algebra (which I’m not going to go into), <strong>and</strong> they’re also central to computer<br />

graphics. What makes them so significant is the ease with which geometric transformations<br />

can be done by using them.

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

Saved successfully!

Ooh no, something went wrong!