FLEURS, Generative Flower Compositions

Fleurs plotted on paper



Spring season evokes light, joy, color, growth and rebirth.  I decided to create a generative flower composition to try to convey these qualities of Spring.  

The foundation of a single flower is a sine wave following the contour of a circle, which is created with the following formulae:

x = (R +  (a * math.sin(n * L))) * math.cos(L) + Xc

y = (R + (a * math.sin(n * L))) * math.sin(l) + Yc


(R is radius, a is amplitude, n is the number of sine waves per circle, L is the angle in radians, Xc is X center and Yc is y center.)

I also put in a noise function that creates offsets from the sinusoidal perimeter to an internal circle. 
For each angle L I collect a point from the inner and outer circles, the points are connected as a polyline for an svg.

I then create two more offset inner circles as a series of points connected in a polyline that make the inner ring in each flower.

One consideration if drawing lines radially to points on a circumference of a circle is the number of points you need to make the points appears to create a continuous line without gaps.  It depends on the size of the dot made by the pen tip and the radius of the circle.  If the pen tip is assumed to be 0.5mm for a 10mm radius circle I need 126 lines, whereas for a 20mm circle I would need 251 lines.    On the one hand, if the density of dots is too low, you will have gaps in the outer ring, although this might look interesting like gills on a mushroom cap, that is not what I was trying to achieve.  If the density is too high, then you draw too many lines which can actually tear up the paper in the center of the circle and take excessively long to draw. 

Now I have a system to make a single flower which is aesthetically pleasing but I want to make a composition of multiple flowers.  I decided to do a kind of random circle packing algorithm run several times to first get larger size circles then to go back and second get medium size range circles and lastly smaller circles, otherwise if I just do the entire range at once I will end up with too few larger flowers.  The circle packing algorithm I am using is not very clever but it works.
Color choice is the next consideration.  I looked a photos of real flowers to create a palette for the inner circle and a separate palette for the outer circle.  I observed that central areas of flowers are composed of a smaller palette of usually lighter colors  than the peripheral areas of flowers which have more variety.  The algorithm picks an inner color from the palette and then picks one from the outer palette but ensures it's not the same color for both.  I named this project FLEURS, which is French for flowers.

After running the FLEURS python script I have an svg which can be used to make gcode to plot or directly visualized with  Inkscape.  
I used vpype to fit output svg to the dimensions of A4 paper (with 2cm borders) that I will use to plot and then line merge.
Maybe I am not doing something correctly or haven't found how to set it up right, but when I run vpype I lose the color information in the svg it creates.
Therefore, I created a second python script setcolors2.py using beautiful soup that adds stroke color to each polygon element based on my color selection palette  as above (not reproducing the original colors of original svg but by the same algorithm).  This is kind of interesting too because I can take the same drawing and quickly create a variety of color versions that are fun to look at with Inkscape.  
I have a third script that splits the svg into individuals svgs based on the color called color_split1.py and multijuicy.py that I use to be able to automate running juicy-gcode on all of the color svgs. 

Example of fleurs output viewed in Inkscape


 art looked good on the screen of my computer but my first attempts to plot fleurs, inner circles with no hollow center tore up the paper.  Then I went back to look at my code, and began just playing with the parameters until I could get the inner circle to have a hollow center and not extend into the outer circle, yet still allow the variation in shape to make it interesting.  Sometimes the circles are not quite completely 360 degrees (like a pac-man shape), but at this point I am going to stop and make a plot (see top photo).




Another example of fleurs output viewed in Inkscape




Here are the python scripts I created to make this art from my google drive:

Disclaimer
The author does not make any warranties about the completeness, reliability and accuracy of this information. Any action you take upon the information on this site is strictly at your own risk, and the author will not be held liable for any losses and damages in connection with the use of this information.


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Comments