If you are thinking of picking up a NextDraw pen plotter (the successor to the AxiDraw pen plotter), you can take 5% off a NextDraw pen plotter or accessories with discount code DIRTALLEYDESIGN2024 when you buy directly from Bantam Tools.
What is the next best thing to a square?! A cubbbeee! The cube is one of 5 platonic solids (named after Greek philosopher Plato.) Platonic solids are 3D shapes that are regular polyhedrons. What does that mean exactly? Think boxes, diamond crystal shapes, etc.
Below is an example of one of my generative designs created by rotating a cube shape. The thick black lines are actually many cubes drawn close together!
In order to quickly play around with a cube shape in my program, I at first manually drew a cube in Illustrator, then loaded the SVG in my Processing program as a PShape.
Since it would have taken me a good deal longer to figure out how to programmatically draw a cube, it was faster to start making designs with a cube shape by just quickly drawing a cube shape in Illustrator and immediately prototyping! (Once proof of concept is confirmed, spend more time fine tuning all the things is my motto.)
One of my all time favorite designs (shown below as a rainbow holographic sticker!) involves rotating a cube to create a Star of David shape in the center.
Unfortunately, on the backburner for a while now was figuring how to draw a cube programmatically! Where to even begin?
When I searched online for example code for drawing platonic solids in Processing, I hit a wall as I was only able to find examples for how to draw a cube using Processing's 3D rendering mode. In fact, Processing has a Box shape so it is only a few lines of code to make a cube.
But I wanted a 2D representation of a 3D cube! Because, you know, I plot all my designs and work as a visual artist in 2D.
Coding Train to the Rescue
Dan Shiffman of Coding Train actually had just the video for me, which I finally stumbled across. In his "3D Rendering with Rotation and Projection" coding challenge video, he shows how to create a simple 3D engine using 2D space. Woah!
This ended up being a prime example of not knowing exactly what I should have been searching for!
Dan's example code generates a 3D cube, but the code can also easily be translated to the rest of the platonic solids. All one needs to know are the vertex coordinates for each platonic solid, which, handily enough, are available on the Processing website.
Order of Operations
If you want to explore platonic solids in 2D space (or just learn all about how 3D rendering engines work!), I highly recommend watching Dan's coding challenge video and then playing with the code! After watching the video, I grabbed the PVector vertex coordinates for an Octahedron to update the code from cube to octahedron.
An octahedron has 6 vertexes rather than 8, so you will need to update the PVertex array from 6 to 8. You will then need to change out the cube vertex points to match the above octahedron vertex coordinates.
Lastly, in order to draw the outline of the shape with lines, you will need to update the connect algorithm either by figuring out the octahedron pattern and rewriting the function, or manually adding the line connections much like Dan does at first for the cube shape.
Finally, here is a new design I generated using the Octahedron shape!
All Generative Art, All the Time
But what if you want to learn more?! Check out these additional blog posts:
- How to Watercolor Paint with a Robotic Drawing Machine
- Should You Buy an Axidraw Pen Plotter?
- Applying Visual Design Principles to Generative Art: Part 1
- The Art of Programming Math: Code Art Principles Part 2
- 10 Print Postcards Drawn with a Pen Plotter
- The Art of Polar Plotters
- Sculpting with Math: 3D Printed Jewelry
- Pet Portrait Art: Experimenting with the SquiggleCam App
- How to Generative Art
- CMYK: Process Color Experiments and my Axidraw
- Favorite Pens for Axidraw, Plus How to Make Multiple Color Plots!
- How to Draw Generative Art with an Axidraw Pen Plotter
Dirt 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 geometry art created with code and drawn with a pen plotter. Follow her on Instagram and Twitter @dirtalleydesign where she posts new spirograph designs daily