NAME

App::MathImage::PlanePath::ArchimedeanSpiral -- radial spiral

SYNOPSIS

use App::MathImage::PlanePath::ArchimedeanSpiral;
my $path = App::MathImage::PlanePath::ArchimedeanSpiral->new;
my ($x, $y) = $path->n_to_xy (123);

DESCRIPTION

This path puts points on a Archimedean spiral. The spiral goes outwards by a constant 1 unit each revolution and the points are placed on it spaced 1 apart. The result is roughly

          31  30                                    
       32        29                                 
    33                 50                           
          14 13     28                              
      15        12                                  
 34                   27 49                         
    16     3  2   11                                
35      4                 48                        
                      26                            
   17           1  10                               
36     5                  47                        
                      25                            
    18   6        9                                 
37             8     24  46                         
     19     7                                       
  38              23   45                           
        20     22                                   
    39      21       44                             
       40                                           
           41 42  43                                
                                                                           

X,Y positions returned are fractional. Each revolution is approximately 2*pi longer than the previous, so the effect is a kind of "6.28" step spiralling. The "27-gonal" numbers k*(25k - 23)/2 get close to that, almost lining up, but still spiralling.

FUNCTIONS

$path = App::MathImage::PlanePath::ArchimedeanSpiral->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 unit spacing of the spiral means those circles don't overlap, but they also don't cover the plane and if $x,$y is not within one then the return is undef.

SEE ALSO

App::MathImage::PlanePath, Math::PlanePath::TheodorusSpiral, Math::PlanePath::SacksSpiral