The Art of Programming Math: Code Art Principles Part 2

Posted by Michelle Chandra on

Over the past year, I have been building upon a spirograph-ish program in Processing exploring different math concepts in conjunction with visual design! In Part 1 of this two-part blog series, I talked about my favorite visual design concepts in relationship to generative art.

In this "part 2", I will break down the different math concepts I have explored programmatically as an artist (listed in no particular order!) Coding tutorials (mainly by Dan Shiffman of Coding Train) linked to within each section!

Sine Waves

Probably my favorite math concept to play with is the sine wave! There are so many ways you can insert a sine wave into your generative program. Here are two ways I have used sine waves in my generative art:

  • why draw a shape or line with straight edges?! why not apply a sine wave instead to create curvy forms?!
  • map values like color or size to a sine wave for beautiful rhythmic variation in your design, especially useful if your program creates repeating patterns

Here is a design that demos both of the above principles in one spirograph-ish design:

generative spirograph art pen plotted with axidraw by michelle chandra of dirt alley design

To get started with understanding sine waves, you will need to understand the properties of a waveform (the amplitude, and the frequency). For a breakdown, check out section 3.6 Oscillation Amplitude and Period in Dan Shiffman's Nature of Code.

Probability

Probability is something I have played around with less, but is the backbone of my 10 print inspired patterns! Setting up conditions such that 40% of the time, you might draw one shape, and 60% of the time, draw another shape. Check out this Coding Train tutorial on the 10 Print algorithm for more info.

(The below print is now available in my shop! 50% of proceeds from the sale of this print will be donated to the Santa Cruz Community Foundation's Fire Response Fund.)

Noise 

Noise is a famous way to generate smooth and beautiful "random" numbers that you can plug into your program. If you have a hard coded value in your program, why not try generating values with noise instead and see what happens?

Dan Shiffman has a great breakdown on noise in Chapter 1 (section 1.6) of his Nature of Code book.

generative spirograph art by michelle chandra drawn with axidraw pen plotter and white gelly roll pen on black paper from french paper co

Geometry: Shapes!

Sure, it's nice that Processing provides built-in functions to draw circles and rectangles, but at some point, you will want to branch out to draw polygons. 

Here is a design drawn with the built-in circles provided in Processing:

generative art by michelle chandra

A similar variation of that design drawn with a function that generates polygons instead (check out the Processing function for creating regular polygons here):

creative code art by michelle chandra

Also make sure to brush up on PVectors so you can branch out into making irregular shapes!

Phyllotaxis Spiral

The famous spiral common to romanesco broccoli and sunflowers! At one point, I modulated a phyllotaxis spiral to lovely effect. Check out this Coding Train video for a breakdown on the lovely phyllotaxis spiral.

Here are a few additional math concepts you might want to explore (these are all concepts I have dabbled in with my spirograph-ish program, but that I don't necessarily have a great example for you, hopefully one day in the future!)

All Generative Art, All the Time

But what if you want to learn more?! Check out these additional blog posts:

michelle chandra of dirt alley designDirt Alley Design was founded just off a dirt alley in San Francisco in December of 2016 by artist Michelle Chandra. Inspired by the beauty of street grids, Michelle invented maze maps in which she transforms street grids into mazes. In 2019, she began a new project - generative spirograph prints created with code and drawn with a pen plotter. Follow her on Instagram and Twitter @dirtalleydesign where she posts new spirograph designs daily 

← Older Post Newer Post →



Leave a comment

Please note, comments must be approved before they are published