Steffen Müller > Math-Project3D > Math::Project3D::Function

Math-Project3D-1.02.tar.gz

Dependencies

Annotate this POD

# CPAN RT

 New 1 Open 0
View/Report Bugs
Module Version: 1.02

# 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 \$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;
};

\$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