++ed by:
Kevin Ryde
and 1 contributors

# NAME

Math::PlanePath::VogelFloret -- circular spiral like a sunflower

# SYNOPSIS

`````` use Math::PlanePath::VogelFloret;
my \$path = Math::PlanePath::VogelFloret->new;
my (\$x, \$y) = \$path->n_to_xy (123);``````

# DESCRIPTION

The Vogel spiral arranges integer points in a spiraling pattern so they align to resemble the pattern of seeds found in the head of a sunflower.

The polar coordinates are

``````    R = sqrt(N) * FACTOR
theta = (N / (PHI**2)) * 2pi``````

where PHI is the golden ratio (1+sqrt(5))/2 and FACTOR is a scaling factor of about 1.6 designed to put the points 1 apart (or a little more).

Most of the other PlanePaths are implicitly quadratic, but the VogelFloret is instead essentially based on near-integer multiples of PHI**2 (which is PHI+1)..

The fibonacci numbers fall close to the X axis to the right because they're roughly powers of the golden ratio, F(k) ~= (PHI**k)/sqrt(5). The exponential grows faster than the sqrt in the R radial distance so they soon become widely spaced though. The Lucas numbers similarly.

# FUNCTIONS

`\$path = Math::PlanePath::VogelFloret->new ()`

Create and return a new path object.

`(\$x,\$y) = \$path->n_to_xy (\$n)`

Return the x,y coordinates of point number `\$n` on the path.

`\$n` can be any value `\$n >= 0` and fractions give positions on the spiral in between the integer points.

For `\$n < 0` the return is an empty list, it being considered there are no negative points in the spiral.

`\$n = \$path->xy_to_n (\$x,\$y)`

Return an integer point number for coordinates `\$x,\$y`. Each integer N is considered the centre of a circle of diameter 1 and an `\$x,\$y` within that circle returns N.

The path is scaled so no two points are closer than 1 apart so the circles don't overlap, but they also don't cover the plane and if `\$x,\$y` is not within one of those circles then the return is `undef`.