#
Algorithm for Generating the *Flower of Life* Pattern

## Section 1. Basic Geometry and Algorithms.

The alogrithms below show how to calculate the origin of each unit circle for the first few rotations. A rotation may be defined as traveling once around the perimeter of the pattern, drawing a new unit circle at the outer most point where two or more circles intersect. This process may be viewed, by analogy, as the hand of a clock sweeping around in a circle. At each intersection point a unit circle is drawn, centered at the end of the clock hand. Thus the location each unit circle in a rotation may be determined by calculating the polar coordinates of the unit circle's center.

Since the html canvas primative functions use rectangular coordinates, we translate the polar coordinates to rectangular coordinates using the equations

`x`

y

_{c}= radial distance · cos(angular offset)y

_{c}= radial distance · sin(angular offset)*x*axis.

In section 2, we will generalize on the algorithms discribed in this section. The generalized algorithm will allow drawing patterns for any arbitrary number of rotations.

### First Rotation

*φ ← π/2**r ← 1*- draw unit circle centered at
*(r, φ)* *φ ← φ + π/3*- repeat steps 3 and 4 a total of
*five*more times

### Second Rotation

*φ ← 0**r ← √3*- draw unit circle centered at
*(r, φ)* *φ ← φ + π/3*- repeat steps 3 and 4 a total of
*five*more times

### Third Rotation

*φ ← π/2**r ← 2*- draw unit circle centered at
*(r, φ)* *φ ← φ + π/3*- repeat steps 3 and 4 a total of
*five*more times

### Forth Rotation

*φ ← sin*^{-1}[1 / (2√7)]*γ ← 0**r ← √7*- draw unit circle centered at
*(r, γ + φ)* - draw unit circle centered at
*(r, γ - φ)* *γ ← γ + π/3*- repeat steps 4 through 6 a total of
*five*more times

### Fifth Rotation

*φ ← π/2**r ← 3*- draw unit circle centered at
*(r, φ)* *φ ← φ + π/3*- repeat steps 3 and 4 a total of
*five*more times

### Sixth Rotation

*φ ← sin*^{-1}(1 / √13)*γ ← 0**r*_{0}← 2√3*r*_{1}← √13- draw unit circle centered at
*(r*_{0}, γ) - draw unit circle centered at
*(r*_{1}, γ + φ) - draw unit circle centered at
*(r*_{1}, γ - φ) *γ ← γ + π/3*- repeat steps 5 through 8 a total of
*five*more times