NAME
Math::Project_3D::Function - Generate anonymous subroutines for use as functions with Math::Project_3D
VERSION
Current version is 1.002. Beta software. Use at your own risk.
SYNOPSIS
use Math::Project_3D;
# Looks like a screw
my $function = Math::Project_3D->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::Project_3D->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::Project_3D module. The package has no public subroutines and you should use it indirectly through the new_function
method of Math::Project_3D.
Oh, yes, I almost forgot. Do not read the source. :-)
AUTHOR
Steffen Mueller, mail at steffen-mueller dot net
COPYRIGHT
Copyright (c) 2002 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.