Algorithm-Points-MinimumDistance

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

          my @box = $nn->box( [1, 2] );

        Returns the identifier of the box that the point lives in. A box is
        labelled by its "bottom left-hand" corner point.

    distance
          my $nn = Algorithm::Points::MinimumDistance->new( ... );
          my $nn_dist = $nn->distance( point => [1, 4] );

        Returns the distance between the specified point and its nearest
        neighbour. The point should be one of your original set. There is no
        check that this is the case. Note that if a point has no
        particularly close neighbours, then "boxsize" will be returned
        instead.

    min_distance
          my $nn = Algorithm::Points::MinimumDistance->new( ... );
          my $nn_dist = $nn->min_distance;

        Returns the minimum nearest-neighbour distance for all points in the
        set. Or "boxsize" if none of the points are close to each other.

lib/Algorithm/Points/MinimumDistance.pm  view on Meta::CPAN

    }
    return sqrt($t);
}

=item B<distance>

  my $nn = Algorithm::Points::MinimumDistance->new( ... );
  my $nn_dist = $nn->distance( point => [1, 4] );

Returns the distance between the specified point and its nearest
neighbour.  The point should be one of your original set.  There is no
check that this is the case.  Note that if a point has no particularly
close neighbours, then C<boxsize> will be returned instead.

=cut

sub distance {
    my ($self, %args) = @_;
    my $point = $args{point};
    my $key = join(",", @$point);
    return $self->{distances}{$key};



( run in 0.259 second using v1.01-cache-2.11-cpan-069f9db706d )