Algorithm for Generating the Flower of Life Pattern

Section 2. A Generalized Algorithm.

While section 1 of this article concentrated on specific algorithms for the first few rotations, we will now move toward generalizing these algorithms. We will define as intersects all the outermost points (with respect to the center of the first circle) where two or more circles intersect. These are all the points, where two or more circles intersect, that are most distant from the center of the first circle. We will define radius rm and r to be the distance from the center of the first circle to these intersect points. A unit circle is defined as a circle with the same radius as the first circle, that is, a radius equal to 1. All subsequent circles are drawn with this radius. The locations of unit circles are computed in polar coordinates with the center of the first circle taken as the origin. First we will look at odd numbered rotations, followed by even numbered rotations.

2.1 Odd Numbered Rotations

First note that all odd numbered rotations follow the same pattern. Six circles are always drawn at the same angular coordinates as in the previous, odd rotation. Only the radius r, the distance from the center of the first circle, changes for each rotation. Looking at figure 2.1, each pair of adjacent, red colored line segments defines an equilateral triangle. Hence, rotating around the pattern, each intersect point occurs at a π/3 angular increment from the previous intersect point. By induction, each intersect point is located a distance r = (n + 1)/2 from the origin, where n is the number of the rotation. With this information we have enough to define the following algorithm.


Figure 2.1 - 3rd rotation
  1. γ ← π/2
  2. r ← (n + 1)/2
  3. draw unit circle centered at (r, γ)
  4. γ ← γ + π/3
  5. repeat steps 3 and 4 a total of five more times

2.2 Even Numbered Rotations

We divide even numbered rotations into two cases. First, we consider even numbered rotations that have an even number of intersects in any given sector. A sector is defined as a sequence of intersects, a unit distance apart, that are mutually co-linear with each other. Second, we consider even numbered rotations that have an odd number of intersects in any given sector.

Case 1. An Even Number of Intersects.

Looking at figure 2.2, note that the number of intersects per sector equals n/2, where n is the rotation number. By symmetry, we need only consider the intersects above line segment b. The line segments b, hm, and rm form a right triangle. By induction, the line segment b has a length of √3(n/4 + ½), and the height hm equals (m + ½), where m equals 0, … , (n/4 - 1). Therefore, the angle φm equals arctan[hm  / b], and by the Pythagorean Theorem, the radius rm equals (b2 + hm 2)1/2. With this information we have enough to define the following algorithm.


Figure 2.2 - 4th rotation
  1. γ ← 0
  2. b ← √3(n/4 + ½)
  3. m ← 0
  4. if m ≥ n/4 go to step 12
  5. hm ← (m + ½)
  6. φm ← tan-1[hm / b]
  7. rm ← (b2 + hm 2)1/2
  8. draw unit circle centered at (rm, γ + φ m)
  9. draw unit circle centered at (rm, γ - φ m)
  10. m ← m + 1
  11. go to step 4
  12. γ ← γ + π/3
  13. repeat steps 3 through 12 a total of five more times

Case 2. An Odd Number of Intersects.

Looking at figure 2.3, note once again that the number of intersects per sector equals n/2, where n is the number of the rotation. By symmetry, we need only consider the single intersect at the end of line segment b, as well as the intersects above b. The line segments b, hm, and rm form a right triangle. By induction, the line segment b has a length of √3(n + 2)/4, and the height hm equals m, where m equals 0, … , (n - 2)/4. Therefore, the angle φm equals arctan[hm / b], and by the Pythagorean Theorem, the radius rm equals (b2 + hm2)1/2. With this information we have enough to define the following algorithm.


Figure 2.3 - 6th rotation
  1. γ ← 0
  2. b ← √3(n + 2)/4
  3. draw unit circle centered at (b, γ)
  4. m ← 1
  5. if m > (n - 2)/4 go to step 13
  6. hm ← m
  7. φm ← tan-1[hm / b]
  8. rm ← (b2 + hm2 )1/2
  9. draw unit circle centered at (rm, γ + φm)
  10. draw unit circle centered at (rm, γ - φm)
  11. m ← m + 1
  12. go to step 5
  13. γ ← γ + π/3
  14. repeat steps 3 through 13 a total of five more times