VectorField
use Carp;
use GD;
use WWPlot;
use VectorField;
$vf = new VectorField( dy_rule_ref);
$vf = new VectorField( dy_rule_ref , graph_reference);
$vf = new VectorField( x_rule_ref, y_rule_ref );
$vf = new VectorField( x_rule_ref, y_rule_ref, graph_ref );
This module defines a phase plane vector field. It can also be used to define direction fields for differenential equations.
The following functions are provided:
rule_reference is a reference to a subroutine which accepts a pair of numerical values and returns a numerical value. The vector field is also placed into the printing queue of the graph object pointed to by graph_reference and the domain of the vector field object is set to the domain of the graph. The graph_ref must come last.
A vector field object is created where the subroutines refered to by dx_rule_ref and dy_rule_ref define the x and y components of the vector field at (x,y). Both subroutines must be functions of two variables.
This variant inserts the vector field object into the graph object referred to by graph_ref. The domain of the vector field object is set to the domain of the graph. The graph_ref must come last.
All of the properties are set using the construction $new_value = $vf->property($new_value)
and read using $current_value = $vf->property()
The domain of the vector field defined by these values.
This gives the number of intervals in the x direction (respectively the y direction) for plotting the vector field arrows.
The colors of the arrow bodies and the dot "base" of the arrow are specified by a word such as 'orange' or 'yellow'. $vf-
arrow_color('blue'); $vf->dot_color('red');> sets the drawing color to blue for the arrow body, with a red dot at the base of the arrow. The RGB values for the color are defined in the graph object in which the vector field is drawn. If the color, e.g. 'mauve', is not defined by the graph object then the function is drawn using the color 'default_color' which is always defined (and usually black).
A reference to the subroutine used to calculate the dx value of the phase plane field. This is set to the constant function 1 when using the function object in direction field mode.
A reference to the subroutine used to calculate the dy value of the phase plane field.
The width in pixels of the pen used to draw the arrow (respectively the dot).
$array_ref = $vf->domain(-1,-2,1,2) sets xmin to -1, ymin to -2, xmax to 1, and ymax to 2.
$vf->draw($graph_ref) draws the vector field in the graph object pointed to by $graph_ref.
The graph object must respond to the methods below. The draw call is mainly for internal use by the graph object. Most users will not call it directly.
a hash containing the defined colors
a GD image object
draw line to the point (x,y) from the current position using the specified color. To obtain the color number use a construction such as $color_number = $graph_ref-
{colors}{'blue'};>
draw line to the point (x,y) using the pattern set by SetBrushed (see GD documentation)
set the current position to (x,y)