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.

SEE ALSO

Math::PlanePath, Math::PlanePath::SacksSpiral

HOME PAGE

http://user42.tuxfamily.org/math-planepath/index.html

LICENSE

Math-PlanePath is Copyright 2010 Kevin Ryde

Math-PlanePath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Math-PlanePath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.