Showing posts with label processing. Show all posts
Showing posts with label processing. Show all posts

Saturday, 2 May 2020

book review: Generative Design

Hartmut Bohnacker, Benedict Gross, Julia Laub, Claudius Lazzeroni.
Generative Design: visualize, program, and create with Processing.
Princeton Architectural Press. 2012

Having read Pearson’s introduction to Generative Art with Processing I was in the mood to move on to the next level. Hence this book, also based on the interactive Processing language, but with many more, and more sophisticated, projects. These cover bothart and design.

The book is in three main parts. First, Project Selection, is over 100 pages of glossy pictures, whetting the appetite for what is to come. Second, we get Basic Principles, starting with an introduction to Processing, and chapters on working with colour, shape, text and images; these projects are quite sophisticated in their own right, but each focusses on a single aspect. Finally, we get Complex Methods: more ambitious projects combining the concepts introduced earlier.

All the code is available online (in Java mode), which provides an incredibly rich resource to start working from. I didn’t directly use any of this code; I did, however, get inspiration from the Sunburst Trees project to write some of my own (Python) code to draw basins of attraction of elementary cellular automata:

a basin of attraction of N=14 ECA rule 110


A lovely book all round: great content, and beautifully typeset.




For all my book reviews, see my main website.

Monday, 27 April 2020

book review: Generative Art

Matt Pearson.
Generative Art.
Manning. 2011

This is an introduction to producing generative art using the Processing language. I had a brief fiddle around with Processing a while ago, and produced a little app for playing around with the superformula; I read this book to see how Processing is used for art. Processing was invented to be an “easy” language for artists to learn. In its original form, it is based on a stripped down version of Java. I discovered with a bit of Googling that there is also a Python Mode available, which I find preferable.

The book has an introduction to generative art, and introduction to Processing (Java Mode), and three example sections on its use for art: emergent swarming behaviour, cellular automata, and fractals. There are lots of good examples to copy and modify, and also lots of pictures of somewhat more sophisticated examples of generative art.

There is a lot of emphasis on adding noise and randomness to break away from perfection: [p51] There is a certain joylessness in perfect accuracy. Now, fractals are one area that can provide exquisite detail, but are they too accurate? I decided to take his advice, and add some randomness to the well-known Mandelbrot set: instead of a regular grid, I sampled the space at random, and plotted a random-sized dot of the appropriate colour:
It certainly has a different feel from the classic Mandelbrot set picture, but I’m not going to claim it as art. However, the Python Mode Processing code is certainly brief:
def setup():
    size(1200, 800)
    noStroke()
    background(250)
    
def draw():
    cre,cim = random(-2.4,1.3),random(-1.6,1.6)
    x,y = 0,0
    n = 0
    while x*x + y*y < 4 and n < 8 :
        n += 1
        x,y = x*x - y*y + cre, 2*x*y + cim
        
    fill((n+2)*41 %256, (256-n*101) % 256, n*71 %256)
    r = random(2,15)
    circle(cre*height/4+width/2,cim*height/4+height/2,r)

Note for publishers: don’t typeset your books in a minuscule typeface, grey text on white, with paper so thin that the text shows through, if you want anyone over the age of 25 to read it comfortably. I frankly skimmed in places. Nevertheless, this book should provide a good introduction to Processing for artists, providing basic skill that can then be incrementally upgraded as time goes by.



Friday, 25 December 2015

sequestering carbon, one Christmas at a time III

Here's what we got each other for Christmas.  Lots of reading for the New Year!


Monday, 18 May 2015

my first question

I’ve gained enormous help from Stack Overflow, reading the answers to others’ questions.  But in writing my superformula app, I had a problem with mouse events and processing.js, and I couldn't find an answer there.

So I submitted my first ever Stack Overflow question.


For all my social networking posts, see my Google+ page

Friday, 15 May 2015

six parameters in search of an app

A few days ago I came across mention of the superformula, and was intrigued enough to look it up.  I started with that source of all knowledge, wikipedia, which had the formula, and better still, a reference to the original paper, published way back in … 2003.  I always assume these sort of formulae are much older, partly from having got hooked on this kind of thing from reading an 1872 edition of Curve Tracing back when I was an undergraduate.  One thing I'd like to do at some stage is implement a web version of much of Curve Tracing.

The superformula is

Depending on the values of its six parameters, it describes curves like:


It’s not totally clear from that wikipedia figure how the formula works.  The superformula is begging for an interactive exploration tool.  There are nice apps on the web, but I decided to write my own anyway, to continue practicing with Processing.  I then used processing.js to make a web version, and have put it, with a bit of explanation and some more examples, up on my main website.

As usual, the UI took way more time than the core code.  For a language specifically designed as an interactive software sketchbook, Processing has rubbish GUI widgets.  But it is easy to write interactive code.

Using processing.js is an experience, because it is somewhat stricter than Processing itself.  So code development becomes two stage.  I use the “write a line, test a line” style, because it’s much easier to spot immediately when something has gone wrong.  Here it’s “write a line, get it to work in Processing in its IDE, then get it to work with processing.js in a browser”, which is more challenging, especially as the processing.js version error messages are all basically: “nope”.

But still, I now have a much better understanding of the superformula.  And now I can make shapes like


just by fiddling with six parameters!  (Well, seven, it actually turns out.)

Fun!

Saturday, 29 November 2014

sequestering carbon, several books at a time XXXVI

This batch we got the hard way: walking in to shops, picking books off the shelves, and physically carrying them home.


After visiting the Lego BRICK event at the ExCel, we popped into central London, first to Foyles, then to Forbidden Planet.  The Lego event explains some of the purchases...

Foyles has moved a few yards down Charing Cross Road from when I was there last.  The shop that is now in its old location has made excellent reuse of its name:


The new Foyles is rather different in style from the way it used to be.  To be fair, it had been changing even in its previous location.  But I well remember the eccentric shelving by publisher, and the three separate queues (to get the books wrapped and stored, then to pay, and then to collect the paid-for books).  Now there is only one queue, and the shelving is less idiosyncratic.  However, I did fail to find the books on Python and Processing in the Programming Languages section: the Python books were mainly under Web (and the Nutshell volumes under O'Reilly, the publisher!), and the Processing books were with Graphics.  But that’s more a problem of having to have a single physical hierarchy.

Books are heavy.

Saturday, 4 October 2014

sequestering carbon, several books at a time XXXI

The latest batch:



The Generative Design and Processing 2 are to feed my recent Processing interest.  The Good and Real and Thinking and Deciding come from recommendations on the Harry Potter and the Methods of Rationality site. (I have read all 102 chapters currently available.  I will review it once it is finished, at chapter 130.)

This weekend we are building some more bookshelves…

Tuesday, 9 September 2014

Processing Mandelbrot

I’ve just started playing with Processing and processing.js

It’s a straightforward way to build interactive graphics. I’m trying it out on that old stalwart: the Mandelbrot set.

It’s a bit slow in a browser (as it’s interpreted JavaScript, not compiled Java), but still very cool.

Processing is a dreadful name for googling for help…

screenshot


For all my social networking posts, see my Google+ page