Generative Design Variations M.3.2.4 Drawing a mesh using u-v-coördinates

This is the fourth example of the ‘Formulated bodies’ chapter. The Generative Design book describes this example as follows: ‘Obtaining the values of x and y becomes much simpler if they are calculated using a formula rather than taken directly. The shapes that can be generated use the same formulas and are also rotated the same way in space. The different value ranges for u and v make sure that a different part of the formula’s entire surface is drawn.’ Here is the original code:

I have prepared a Flickr Album which contains all the images I have made during this assignment. You can find that clicking this url:

And because these programs do not work in JavaScript I have prepared the code on my loftmatic page. When you click on the previews you get to see the Processing code only:

I was so impolite to remove the arrow left / right: uMin, uMax – / + and replace the arrow down / up with: Zoom – / +. They were used twofold (you can find the same functionality under the keys 1-8). I did this because I needed those keys for my zoom in and out functionality. It seems that you can make pretty abstract objects with this program. Let’s see where we are going this time.

I tried to reconstruct the examples of M.3.2.4  from the Generative Design book. But the settings from the book gave me totally different objects than the printed examples. And because that did not work out I started working on more than one object. Using a for loop I have repeated the object 9 times. Horizontal and vertical. This gives me the possibility to make complex patterns with 81 3-dimensional objects.

I am trying to get the total number of 81 higher. Of course this is a tradeoff between the amount of objects and the image quality / H & V GridDefinition. I have now 18 objects horizontal and vertical = 324 objects in total. And they are still listening to my keystrokes of 1 – 8.

Made some variations by adjusting the horizontal and vertical min-max value range.

Used a small modification on line 128 and 135. Changed that setting from 0.75 to 1.01.

What if I decrease the H & V GridDefinition to 1? Than I can increase the complexity again. But 1 gives me a dull flat object. 2 Makes a difference. Doubled the amount of objects.

Introduced a second field with meshes. And this makes the program terribly slow. Rotated one field 45 degrees. Because this is not working I decreased the H & V GridDefinition to 10.

The same two objects but now one of them is rotated on the x-angle.

Increased the amount of objects to 100 (-50, 50). Kept the H & V GridDefinition to a very low 4. This gives me plenty of room to use more objects. And because I will not be close with the camera I am able to do this without losing image quality. Used 1 * 1.5, 2.0, 2.5, 3.0 and 3.5 for bending the object. Now I can use the original objects to put a structure on the model. After a while I found out that it was no problem to go up closer with the camera into the object. The image quality is good enough.

Introduced a copy of the first object. Rotated it on the y. And mostly made screendumps on the inside of the object. I think the object itself is too complicated for showing it totally. But the separate parts close-up are fine.

Generative Design Variations M.3.2.3 A second coördinate system

I quote the Generative Design book here: ‘Especially with complicated formulas, it’s easiest to keep track of the original grid and the three-dimensional form using two different coördinate systems: one for the original two-dimensional grid and another for the positions in the three-dimensional space. From now on, u and v will be used to represent the axes of the grid coördinate system, x, y, and z will continue to be used for the three-dimensional space. The values uMin, uMax, vMin and vMax are used to define the value range for u and v. The introduction of a second coördinate system becomes especially noticeable in the source code, in the new names for some variables.’ Here is the original code:

I have made a summary page on Flickr. Almost all images I made during this assignment can be found there.

And because none of the programs I changed work in JavaScript you can find my variations of the original code if you click on the previews of this loftmatic page.

I found it very confusing to introduce a second coördinate system. And why using u for horizontal an v for the vertical grid definition? V I could understand as an abbreviation of vertical. But U for horizontal? I changed that to H for the global variable H_GridDefinition. But maybe after working with those two coordinate systems it will all fall in its place. We will see. I used the same tactics as in the earlier examples. Repeated the shape four times. Which lead to a bit boring setup if you ask me. Increased the H & V_GridDefinition to 300. But in a later stage I found a GridDefinition of 400 better. I changed that afterwards. And because I need sometimes to zoom in and out of an object I gave the up and down key’s zoom functionality.

Increasing the H & V Min and MaxValueRange from 40 to 80 leads to a combination of the four objects. Which on itself leads to interesting patterns.

Rotated the four rectangles 45 degrees.

Instead of rotate I used a combination of rotateX and rotateY in this example.

I increased the H & V GridDefinition to 600. Increased it again to 800. I think this is hard work for my system. The response is very tiresome. But it gives interesting images. And that is where I am after.

I have thrown all my earlier copied objects away until there was only one left. It would be interesting to see what you can do with just one object. I increased the z-value 6 times.

Added a second copy of the same object. The only difference is that it is rotated at the x-axis for 90 degrees.

Added a third copy of the same object. The only difference is that it is rotated at the y-axis for 90 degrees.

I have now five identical objects intersecting each other. The first one is not rotated at all. Second one is rotated on the x-side for 90 degrees. The third one rotated on the y-side for 90 degrees. Forth rotated-y 135 degrees and the fifth shape is y-rotated for 225 degrees.

I could add two more shapes to this which complete the object. Added a shape rotated x with a rotation of 135 degrees and one shape rotated on the x with a rotation of 225.

Generative Design Variations M.3.2.2 Bending the grid with a radial wave

I have been working on the third example of the M.3 Formulated bodies chapter. The Generative Design book describes this example as follows: ‘This is the second example of the effects of two different formulas. In this example the x- and y-coordinates served as the parameter. It is also possible to use formulas for the x- and y-coordinates in order to move a point to an arbitrary location in space.’ You can find the original code here:

I made a Flickr summary page with all the images I made during this assignment. And because JavaScript does not work with these programs you find the slightly changed code on my loftmatic page.

In the earlier example I could perfectly match 4 rectangles together without any gaps between them. In this example the rectangles and the waves in it are not symmetrical so they cannot match perfectly to each other. That means that I have to find another solution. But sometimes you don’t have to find another solution. Because when the separate rectangles cannot match then I can make a proposal with rectangles that do not match to each other. That doesn’t solve the matching problem but it gives you new opportunities to create other images with new compositions.

I had an object drawn in my sketchbook but during the making of it turned out that an unfinished version of it would be much more suitable to make good compositions. Those happy incidents sometimes happen. ‘These happy instincts which do occur to one sometimes so unaccountably & fortunately.’ as Ada Lovelace wrote in one of her letters to Charles Babbage. I do not know if that quote makes sense in this context. But there are similarities in it.

Some background information. Because the objects are all the same (only their positions in 3D space are different) I have given them bright colors to recognize them better during the positioning. When the position of the rectangles is fine I comment out those colors and restore the light settings.

A fence! And I have increased the grid points to 400. Oops! I get another java.lang.ArrayindexOutOfBoundsException when I hit the ‘p’ key. So I will not be able to save .pdf-s. Knowing that error from the previous session I just save every image as png.

Until now I have only worked with squares. Used rectangels of different sizes in this example.

I have taken my ‘old’ ModifyDistance variable from the previous M.3.2.1 session into this sketch. Fact is that the values of ModifyDistance can be used to open up the objects. Because the objects have patterns made of parallel lines you sometimes get interesting moiré patterns. But I will try to use that optical illusion better in the next variation.

In this sketch the rectangles are overlapping each other. Which makes the chance on chaos or interesting moiré patterns even greater. Made a few variations with it.

In the previous sketch the gaps in the rectangles were pretty close to each other. I doubled the size of the gaps. And I used rotateX for two of the rectangles. Increased the grid points from 100 to 200. This might give me more moiré patterns.

I have connected all four rectangles to the same origin point (which is in the middle of the display screen). This gives me fewer options to see unexpected compositions. But it is also less chaotic in that way. Experimented with rotateX and rotateY.

Used rotateZ too. Increased the number of grid points from 100 to 150. Which made the program slow. But it gave me a few extra variations.

Generative Design Variations M.3.2.1 Bending the grid

I am continuing with the second example of the M.3 Formulated bodies chapter. The Generative Design book describes this example as follows: ‘The next step to creating a three-dimensional form is easy. The values of x and y are used to find a value for the z-position–the grid point is now transferred into the third dimension. This kind of transformation is an ‘elevation contour’ since the x- and y-coordinates of the grid points are not altered.’ You can find the original code here:

I made a Flickr summary page with all the images I made during this assignment. And because JavaScript does not work with these programs you find the slightly changed code on this loftmatic page.

When I started I was a little confused by the fact that a formula was discussed in the Generative Design book while I could not find that formula in the code. The formula should be on line 87 of the program but that line says: float z = sin(x); So I thought that it would be worth a try to use the formula from the book in the program in a later stage. But then I saw that this formula was used in the next program (M_3_2_02). For changing the code I will go through the same routine as I used in M_3_1_01. I put the origin point in the middle of the display window. Copy and paste the mesh four times. Ok… I have a large curtain now. Used the same light settings as I used in M_3_1_01. And writing everything away as a .pdf Which gives me a java.lang.ArrayindexOutOfBoundsException. So I write it to .png

I have introduced a global value called ModifyDistance. Which multiplies the value of a variable. This is not something new but it gives you the possibility to modify certain parts of the grid curtain. And what’s even more notable is that it gives you the possibility to make interesting compositions with it. I also found a way to break the curtain. Which might come in handy.

I’ve broken up another part of the curtain. This might be a good theme to continue.

So now it’s not alone about bending the grid but also about breaking the mesh.

Made all the loops the same. Which is of course a bit silly. But although this change is very simple it still gives me interesting images. Switched off all the strokes. Which gives even nicer images. The object has now changed from a curtain to a kind of windshield.

Used x + 2 for the z value. Which makes the windshield a bit more complex than the earlier version.

Used x / 2 for the z value.

Made a filled rectangle which is located horizontal. At least that is what I thought at that moment. But what I saw at a later stage is that it is not 1 rectangle but there are 16 rectangles located each above each other.

Used rotation for this sketch. Used ModifyDistance for the amount of radians.

I did not change much here. I only replaced the rotate command for rotateY in the for loops. And that makes a big difference for the images. Finally there is not much left from the grid. But it sure is bended and broken apart.

Generative Design Variations M.3.1 Creating a grid

Creating a grid is not a spectacular job but it is very helpful to design things which have to look functional. I use grids all the time. So this example should be familiar to me. The Generative Design book explains it a follows: ‘Before a three-dimensional object can be created, we need a grid of points in a two-dimensional plane to be ‘bent’ to form closed areas. The easiest way to do this is to arrange the points in a regular grid. The first step is to find the most flexible way to draw such a grid. Processing enables tiles to be drawn with QUAD_STRIP or TRIANGLE_STRIP. This is a reasonable choice since the grid points should be individually movable later on.’ You can find the original program here:

All the images I have made during this assignment I gathered in a Flickr album. And (some) JavaScript and code can be found on my loftmatic page.

When I first ran the program I got a totally different image than the attached pict-file in the programs folder showed me. Lines were extremely thick. So I checked if there was a strokeWeight involved. And that was not the case. Then I checked if there was something wrong with the QUAD_STRIP parameters. But everything seemed to be fine. I checked the next program (M.3.2). And it had the same extremely thick lines in it. But here there was a strokeWeight involved. So I changed the strokeWeight to 0.01 pixels. And than it seemed ok. So back to M.3.1 I added a strokeWeight of 0.01 pixels too. Changed the global variable names for readability and understanding purposes. Switched the background to black and the lines to white. Added functionality to the s-key for making screen grabs. Started with a .png. But the image quality was poor. Imported Marius Watz ImageTiler. But the image was still not very good. I think that saving as a pdf might help. It helps but it does not render the background black. So I have to restore everything in Photoshop. TileSaver works. Pdf doesn’t. After cranking up the horizontal and vertical tiles to 20 pdf gives me am indexoutofboundserror. So .pdf is no option. Continued with the TileSaver class.

The origin is now in the middle of the display window. That is where the coördinate system begins. It evolves down and to the right. But I find it a difficult to handle the grid. It is connected to the top left of the grid-mesh. So I copied the existing for loop with a translation to the left and with the same amount of horizontal and vertical tiles.

I have now 4 grids of 40 x 40. To make that clear I added 1 grid-unit in between.

I could make the 4 grids of a different size. And put them together as if it was one object. I have to apologize for the terrible image quality JavaScript delivers. In Processing it looks better.

JavaScript stopped working after the previous file. From now on you only see the Processing code in the links. And because I can now fill the grids in as if it were 4 different grids I have the idea to make different objects that use the grid as a base. Very simple object of course. I have drawn 16 variations of this system on paper. Would it be possible to import those light settings from M_2_4 again? That sure is possible. It is now just a matter of making those variations. And maybe I find any new ideas during that work. For the rest of the programs go to my loftmatic page. And click on the previews for the Processing code.

I found some more ideas. But I think it is better to continue to the next example instead of making more variations on the grid theme.

Generative Design Variations M.2.6 A drawing tool

In this example I will use a drawing tool. The Generative Design book gives the following description: ‘The aforementioned method of connecting points is not limited to Lissajous figures but can be applied to any set of points, regardless of how they were generated. It therefore makes sense to create a small drawing tool to connect points drawn with the mouse in this manner. Although this drawing tool no longer has anything to do with oscillation figures, the example demonstrates how easily a method used in one context can be translated into another to expand its design repertoire in a novel way. Two versions of this drawing tool are available: one for mouse operation and the other for a pen tablet. With the tablet version, the pressure with which a point is drawn determines how this point is connected to the other points, allowing for far more differentiated shading.’ I used  the pen tablet tool. I always work with a pen and tablet because I think it works better than a block of soap (mouse). Here you can find the program with which I worked with.

Now this is a bit different example than the earlier examples I worked on. I changed some of the global variable names and a few names within the program so that I could better understand how the program worked. But because this is a tool I think it would be a good idea to use it as a tool. And instead of concentrating on changing the program I concentrate on working with the tool. But when I reset the program I get an: Mar 01, 2015 12:29:08 PM controlP5.ControlBroadcaster printMethodError SEVERE: An error occurred while forwarding a Controller event, please check your code at reset java.lang.reflect.InvocationTargetException in the message window. Beside this message the program keeps still running. So I don’t mind.

Back to the drawing tool. What do I draw? I could trace images which you can import in the program. But I think I try something else. How about just drawing lines? And that is how I started and ended. I made 38 drawings with lines. And because I did not change any essential code there is also no need to check any. You can find the drawings in the GDV_M_2_6 album on my Flickr page.

Generative Design Variations M.2.5 Drawing Lissajous figures

To begin with here is the original text from the Generative Design book: ‘Extremely attractive forms are created when the points on the Lissajous curve are not connected in the usual manner (i.e. one point only to the next point) but rather when each point is connected with all others. To avoid black clump–after all, many lines have to be drawn–it is necessary to ensure that the farther apart the points are, the more transparent the lines become, as Keith Peters demonstrates in ‘Random Lissajous Webs’ on his website.’ This is what the Generative Design book tells us. In this assignment there are two programs. The first one is a program. The second one is a tool (which is also a program). Here they are:

I have made a collection page on Flickr were (almost) all images are gathered which I have made during the study of the Generative Design book. The first images are from November 3, 2013. They are sorted by album with reference names to the programs which appear in the Generative Design book and on my loftmatic website. And I have made an album on Flickr with all the images I made during this assignment. On the loftmatic site you can find all programs of this assignment. Only the first 15 programs work with JavaScript. The last 10 programs use the controlP5 library and this is not supported by JavaScript. Or controlP5 does not support JavaScript. The final result is the same.

For the first program I’ve cleaned up the code a bit. I don’t mean I made the code better than it is but it’s now more readable to me. I don’t know what the global variable ConnectionRamp does. So I commented that out. Nothing serious seems to happen. I also found the local variable h on line 111. It is not used? I commented that out too. Still everything seems to work. Changed the LineColor to white and the background to black. Made the LineWeight 0.5. Doubled the PointCount. Lowered the PhaseShift to 4. Repeated the code which draws the line (on line 143) 6 times with a for loop. Which makes the program very slow. I will mention the time it takes to render. This one takes 3 seconds to come up.

Because I found the images much to complex I left out 3 loops of the image. On line 143 I added the values of i to the 2.x and 2.y points. This makes the object less cluttered. I set all frequencies and phase-shifts to 0. Wich does not give me any image. Put them on 1 it renders a diagonal line. I’ve changed the initial value for Frequency_X to 7, Frequency_Y to 5 and PhaseShift to 6.0. Rendertime: 2 seconds.

In line 143 I changed point_1.y – i and point_2.y + 1. LineAlpha  is now 16 and I decreased the LineWeight to 0.6. That seems silly. Because that means that the LineWeight is 0.6 pixels. But it really makes a difference compared to a setting of LineWeight 1.0. Rendertime: 2 seconds.

Just for fun I have left out the line connection. Only point_2.x and point_2.y (+ i) are now displayed. Rendertime: 14 seconds. Which is strange because it does not have to connect the points.

Removed the point. Re-introduced the lines again. But I left the for loop in with the same numbers as I used with the points. Every time it renders a frame it takes 18 seconds. But for now I keep the settings like that.

Let’s see if I can introduce some color. Hmmm… this is not what I had in mind but I think its worth to continue. I made a mistake in line 143. I have put the stroke color on 0. Black that is. Rendertime: 5 seconds.

I have removed line 141 and 142 out of the for loop. Rendertime just 2 seconds.

I have the impression that the images are almost always the same. So I used the for loop again to introduce some variations. Rendertime: 6 seconds.

Put an extra line command (on line 145). Rendertime: 10 seconds.

Introduced some colors again. I think I have lost some refinement in the end. Maybe I can get that back in the next examples. Rendertime: 9 seconds.

I just start with the first sketch (M_2_5_01). Checking what I did wrong. And why the image quality got worse during this session. Another point is that all these sketches should work in JavaScript. But they are very slow as I mentioned before. I have to improve that too in one way or another. I see that LineAlpha is 100 in M_2_5_01. That brings a bit more detail into the image. I also removed the for loop which slows the program down. And that solved the problem. What can I do to make the images look different from the original. In the previous sketches I tried one example with points. Maybe I can combine those points with the image I already have. No! Points did not work because they were too prominent. So I replaced them by ellipses. I will not mention the rendertimes because the problem is solved.

I am trying to get away from those symmetrical shapes. On line 103 I replaced the TWO_PI by 90 radians.

Another example to get away from symmetry. Increased the radians to 180 on line 103.

Keeping it as simple as possible. Decreased the radians to 90 again. Translated 0.01 in the x- and y-axes. There is a problem with displaying the images in the middle of the display window. But it also has something nice to it because it’s is not in the center. So i keep it like it is. You can use the left and right keys to get the image a bit in position.

Simple but not too complex. Increased the display size to decrease the image later to keep a good image-quality. And I decreased them back to 800 x 800 for these examples.

The second part of M.2.5 Drawing with Lissajous figures is about using ‘The Lissajous Tool’. I quote the Generative Design book: ‘All the possible ways of working with two-dimensional Lissajous figures can be combined in one program, which also contains additional parameters used to modify the figures. The value randomOffset offsets the x- and y-coordinates of all points by a random value between -randomOffset and +randomOffset. The parameters modFreq2X, modFreq2Y, and modFreq2Strength are a bit more difficult to understand. These parameters modulate the frequencies of the harmonic oscillations. This means the frequencies freqX and freqY are no longer constant, but sometimes higher or lower.’

During the changing of the variable names I came across the variable i1 or it could also be il. What does that do? Ok… I found out by doing a search whitin the program that il is as in illustration. But search did not find it als a variable. So it must be i1 (aai-one that is). And I found an i2 too. It is used in a while and a for loop. And it has a connection with creating .pdf files? I just create a .pdf file. It says: saving to pdf – step 954/1500… saving to pdf – step 1500/1500 – saving to pdf – finishing – saving to pdf – done. I’m not sure but I think that i1 stands for the begin or starting points and i2 is the total amount of points (which is the same number as the global variable PointCount). So I rename i1 to StartingPoints and i2 to totalPoints (with a starting lowercase because i2 is a local variable). I leave the controlP5 variables as they are. I have to study the controlP5 library first before I make any changes. But that’s for a later occasion. I think when you enter the calculateLissajousPoints function the variable names are getting to abstract for me. Float t, x, y, rx, ry. What do they do? What does t do? It seems it is not used. So I comment it out. In the drawLine function there are also 3 variables of which I do not know what they are doing. But I found out that d is the distance between points, a is the transparency/alpha value and h is the hueValue. Changed their names to make the program more clear to me. Ok. Now all what is left is to change the names in the controlP5 interface according the global variable names. Otherwise the user interface will not react on any input. In this example I started exploring the different parameters. To begin with I will only work with the Frequency_X, Frequency_Y sliders. Oh… and if you follow the links under the paragraphs from now on you will see the Processing code.

I started to create these images by using the Frequency_X, Frequency_Y and PhaseShift sliders only but it seems that adding PhaseShift makes not much difference for the global image. It just shifts the image. So I added ModulatedFrequency_X and ModulatedFrequency_ Y to it. And that does make a lot of difference. The best images are generated when Frequency_X and Frequenc_Y are very low in their numbers. PhaseShift can be used to make the image a-symmetrical. ModulationFrequency_X and ModulationFrequency_Y ar also best in their lows from what I have seen until now.

If you use ModulationFrequency_X2 and ModulationFrequency_Y2 with a very low Frequency_X and Frequency_Y setting it has almost no influence. It works only if you pull the ModulationFrequency_2Strength slider. And it results in chaotic images if you ask me.

Used RandomOffset. It spreads points from a straight line to random positioned points in the neighborhood of the original positions. It makes fluent and straight lines rougher. The other sliders I have tried but in the end I did not use them very much. It seems that using very low numbers in all frequencies and modulationfrequencies and combined with a full modulation_2Strength gives interesting images.

It turns out that I almost never use Frequency_X and Frequency_Y above 5. ModuationFrequency_X and Modulation Frequency_Y are always between 1 and 5. ModulationFrequency_X2 and ModulationFrequency_Y2 are always on 1. And ModulationFrequency_2Strength is always on 1.00. RandomOffset is always off. LineWeight is always on 1. LineAlpha on 100. The HueRange is on 100, 200. SaturationValue and BrightnesValue are always on 100. And finally ConnectionRadius is always on 125.

I would like to check if it is possible to change the ranges of the controlP5 sliders to match them better with my preferences. If that is possible I can have more possibilities within my preferences range. Sounds complex but if I never use a higher point count as 1500 why should my slider then go until 8000? It would be better to let the slider cover the range from 0 to 1500. Fortunately that is easy in controlP5. Just enter the number range in the lines which cover the sliders in the GUI tab. Another thing is that I now can decrease the length of the sliders which gives me more space to judge my image.

Made some more variations with the smaller controlP5-slider version.

I made a program change in line 214. Replaced TWO_PI by 90 radians. But that was not a good idea. So I changed it to 180 radians. Nope. No improvement. I bring TWO_PI back in line 214. But I think I increase Frequency_X and Frequency_Y to a 10 steps slider.

Added some other variations.

And finally I did make some color variations. Why did I not think of that before?

ControlP5 is a very interesting library. It gives you a lot more possibilities on top of the things I ever might learn about programming with Processing. But it also makes the images more general. You might say: ‘Hey! Anyone can pull a slider or check a checkbox!’ Then I think you are right. But to solve that problem I think you just have to define more sliders and checkboxes. Still these examples were very helpful to learn more about the controlP5 library. I will certainly use controlP5 again in de future.