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.

When working in a 3D coordinate system, you just add another axis, called z, which follows<br />

the same rules I’ve been discussing for 2D. The z-axis goes into the screen <strong>and</strong> is perpendicular<br />

to both the x- <strong>and</strong> y-axes—but rest assured, for now you only need to deal with the<br />

x- <strong>and</strong> y-axes.<br />

One other issue to consider when dealing with coordinate systems is local vs. world coordinates.<br />

For example, when you draw a rectangle on the screen at (100, 100), you can think<br />

of the rectangle living on the screen world at pixel address (100, 100). However, let’s imagine<br />

you then want to put a small circle on the rectangle 3 pixels to the right of the rectangle’s<br />

left edge <strong>and</strong> 3 pixels down from its top edge. What is the circle’s screen pixel<br />

address? You can consider the circle’s world address as (103, 103), <strong>and</strong> the circle’s local<br />

address, in relation to the rectangle, as (3, 3). Now this may sound a little confusing <strong>and</strong><br />

like an obscure point, but it is something that comes up fairly often. For example, it is<br />

often easier to work with a local coordinate system when you are assembling components<br />

on a larger structure. If you are drawing windows on a house, isn’t it easier to just worry<br />

about where the windows fit in relation to the rectangle of the of building, rather than<br />

keeping track of where the windows are in relation to the edges of the screen? This way, if<br />

you ever move the building, the windows will stay in the right place in relationship to the<br />

building.<br />

Anatomy of an image<br />

COMPUTER GRAPHICS, THE FUN, EASY WAY<br />

A computer screen is (very simply put) a matrix, or grid, made up of rows <strong>and</strong> columns of<br />

pixels that can each glow a certain color, giving the illusion, when enough pixels are glowing<br />

the right color, of a continuous tone image (e.g., a photograph). Fortunately, the resolution<br />

of most of our monitors is high enough <strong>and</strong> the refresh rate fast enough to allow<br />

this matrix of pixels <strong>and</strong> constant screen redrawing to remain hidden, giving the illusion of<br />

image persistence—you see what looks like a still, smooth image. When you zoom way<br />

into an image in a program like Photoshop, you can see the pixel matrix, made up of little<br />

blocks of color. If you look under a magnifying glass at printed materials, you can also see<br />

a matrix of dots of color that, when zoomed back out, creates the same illusion of a continuous<br />

image as on a monitor. Some well-known artists, such as Roy Lichtenstein <strong>and</strong><br />

Chuck Close, both exploited this phenomenon in their paintings, albeit in very different<br />

ways. Lichtenstein painted the dot pattern as an explicit visual element in his pop art work,<br />

directly referencing the commercial printing process. Close utilized a matrix structure originally<br />

as a production tool, dividing his images up, similar to a monitor, into small rectangular<br />

cells. Eventually his work began incorporating the grid as an explicit element as well.<br />

Refresh rate is the rate at which the monitor redraws the screen image. Although images<br />

on a screen look constant, they’re not. If you’ve ever shot video of your television, you’ve<br />

probably seen the screen flickering or jumping. The frequency of the video camera’s<br />

refresh rate <strong>and</strong> the frequency of the monitor’s refresh rate are not synchronized, allowing<br />

you to catch the screen refreshing. Properties like screen resolution <strong>and</strong> refresh rates<br />

are hardware-dependent <strong>and</strong> determined by the monitor <strong>and</strong> video card in your computer.<br />

You can usually select from numerous monitor display configurations through system<br />

control panels to change these properties, but actually communicating directly with<br />

the video card or monitor through the code you write in <strong>Processing</strong> is lower level than you<br />

go. Java does have a DisplayMode class, allowing you the ability to mess with this stuff<br />

111<br />

4

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

Saved successfully!

Ooh no, something went wrong!