Math-InterpolationCompiler

 view release on metacpan or  search on metacpan

lib/Math/InterpolationCompiler.pm  view on Meta::CPAN

use Carp;
use Exporter 'import';

our @EXPORT_OK= qw( linear_clamp_fn linear_extrapolate_fn );

our $VERSION= '0.002000';

# ABSTRACT: Compile interpolations into perl coderefs


has domain        => ( is => 'ro', isa => Types::Standard::ArrayRef, required => 1 );
has range         => ( is => 'ro', isa => Types::Standard::ArrayRef, required => 1 );
has algorithm     => ( is => 'ro', default => sub { 'linear' } );
has beyond_domain => ( is => 'ro', default => sub { 'clamp' } );
has perl_code     => ( is => 'lazy' );
has fn            => ( is => 'lazy' );
has sanitize      => ( is => 'ro', default => sub { 1 } );

sub BUILDARGS {
	my $self= shift;
	my $args= $self->next::method(@_);
	if ($args->{points} && !$args->{domain} && !$args->{range}) {



( run in 0.534 second using v1.01-cache-2.11-cpan-5f2e87ce722 )