The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Math::Shape::Range - a range object which has min and max values

VERSION

version 0.13

METHODS

new

Constructor, requires 2 values: minimum and maximum floating point numbers.

my $range = Math::Shape::Range->new(3.5, 4);

sort

Returns a new range object with the min and max attributes sorted.

my $sorted_range = $range->sort;

is_overlapping

Boolean method which returns 1 if the range object overlaps with another range, or 0 if not. Requires another range object as an argument.

my $range1 = Math::Shape::Range->new(1, 10);
my $range2 = Math::Shape::Range->new(11, 20);
my $range3 = Math::Shape::Range->new(15, 25);
$range1->is_overlapping($range2); # 0
$range2->is_overlapping($range3); # 1

hull

Returns a new Range object of the hull of two ranges. Requires another Math::Shape::Range object as an argument.

AUTHOR

David Farrell <sillymoos@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by David Farrell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.