NAME
Math::Project3D::Function - Generate anonymous subroutines for use as functions with Math::Project3D
SYNOPSIS
use Math::Project3D;
# Looks like a screw
my $function = Math::Project3D->new_function(
'u,v', # list of parameter names
'$u', # first component
'sin($v)', # more components
'cos($v)',
);
# or as an anonymous sub / closure!
{
# This is a sphere
my $radius = 5;
my $x_component = sub {
my $theta = shift;
my $phi = shift;
return $radius * sin($theta) * cos($phi);
};
my $y_component = sub {
my $theta = shift;
my $phi = shift;
return $radius * sin($theta) * sin($phi);
};
my $z_component = sub {
my $theta = shift;
return $radius * cos($theta);
};
$function = Math::Project3D->new_function(
$x_component, $y_component, $z_component
);
}
DESCRIPTION
This package contains the code for generating anonymous subroutines for use as functions with the Math::Project3D module. The package has no public subroutines and you should use it indirectly through the new_function
method of Math::Project3D.
Oh, yes, I almost forgot. Do not read the source. :-)
METHODS
Public methods
new
The new
method takes exactly the same arguments as the new_function
method of Math::Project3D.
It returns a new Math::Project3D::Function object.
AUTHOR
Steffen Mueller, mail at steffen-mueller dot net
COPYRIGHT
Copyright (c) 2002-2006 Steffen Mueller. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.