

new(x,y,z)  Create a new vector with the values of x, y, z returning the appropriate object. 
vector(x,y,z)  As new but is a exported function which does not require a package reference to create a Math::VectorReal object. 
clone()  Return a completely new copy of the referring Math::VectorReal object. 
array() Return the x,y,z elements of the referring vector are an array of values. x() Return the x element of the referring vector. y() Return the y element of the referring vector. z() Return the z element of the referring vector. stringify( [ FORMAT ] ) Return the referring verctor as a string. The FORMAT if given is used to sprintf format the vector. This is used for all VectorReal to String conversions. By default this format is the same as it would be for a Math::MatrixReal object, [ %#19.12E %#19.12E %#19.12E ]\n. Note that this includes a newline character!.
However unlike Math::MatrixReal you can assign a new default sprintf format by assigning it to the packages $FORMAT variable. For Example
$Math::VectorReal::FORMAT = "{ %g, %g, %g }"Which is a good format to output vectors for use by the POVray (Persistance of Vision Raytracer) program.
length() Return the length of the given vector. As a side effect the length is saved into that vectors object to avoid the use of the expensive sqrt() function. norm() Normalise the Vector. That is scalar divide the vector by its length, so that it becomes of length one. Normal vectors are commonly use to define directions, without scale, or orientation of a 3 dimensional plane. plane( v1, v2, v3 ) Given three points defined counter clockwise on a plane, return an array in which the first element is the planes normal unit vector, and the second its distance from the origin, along that vector. NOTE: the distance may be negitive, in which case the origon is above the defined plane in 3d space. vector_matrix( nx, ny, nz ) Given the new location for the X, Y and Z vectors, concatanate them together (row wise) to create a Math::MatrixReal translation matrix. For example if the 3 vectors are othogonal to each other, the matrix created will be a rotation matrix to rotate the X, Y and Z axis to the given vectors. See above for an example.
The following functions provide links between the Math::VectorReal and Math::MatrixReal packages.NOTE: While this package is closely related to Math::MatrixReal, it does NOT require that that package to be installed unless you actually want to perform matrix operations.
Also the overload operations will automatically handle vector/matrix mathematics (See below).
vector2matrix_row( [CLASS] ) vector2matrix_col( [CLASS] ) Convert Math::VectorReal objects to a Math::MatrixReal objects. Optional argument defines the object class to be returned (defaults to Math::MatrixReal). Note that as a Math::VectorReal is internally equivelent to a Math::MatrixReal row matrix, vector2matrix_row is essentually just a bless operation, which is NOT required to use with Math::MatrixReal functions.
The vector2matrix_col performs the required transpose to convert the Math::VectorReal object into a Math::MatrixReal version of a vector (a column matrix).
matrix_row2vector( [ROW] ) matrix_col2vector( [COLUMN] ) When referred to by a Math::MatrixReal object, extracts the vector from the matrix. the optional argument defines which row or column of the matrix is to be extracted as a Math::VectorReal vector.
Overload operations are provided to perform the usual string conversion, addition, subtraction, unary minus, scalar multiplation & division. On top of this however the multiply have been expanded to look for and execute MatrixReal multiplation.The Main purpose of this package however was to provide the special vector product operations: dot product . and cross product x. In perl these operations are normally used for string operations, but if either argument is a VectorReal object, the operation will attempt the approprate vector math operation instead.
Note however that if one side of the dot . operator is already a string, then the vector will be converted to a sting and a string concatantion will be performed. The cross operator x will just croak() as it is nonsensical to either repeat the string conversion of a vector, OR to repeat a string, vector, times!
Overloaded operator summery...
neg unary minus  multiply vector by 1
"" automatic string conversion using stringify() function
+ vector addition
 vector subtraction
/ scalar division (left argument must be the vector)
* scalar multiplication OR MatrixReal multiplication
x vector/cross product of two vectors
. dot product of two vectors OR vector/string concatanationPosible future addition ’~’ to transpose a VectorReal into a MatrixReal column vector (as per that operator on MatrixReal objects). It was not added as it just did not seem to be needed.
The Math::MatrixReal CPAN Module by Steffen Beyer and the Math::MatrixRealExt1 CPAN extension by Mike South
Anthony Thyssen <anthony@cit.gu.edu.au>
Copyright (c) 2001 Anthony Thyssen. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. I would appreciate any suggestions however.
Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 198: You forgot a ’=back’ before ’=head1’ Around line 200: ’=item’ outside of any ’=over’ Around line 372: You forgot a ’=back’ before ’=head2’ Around line 374: ’=item’ outside of any ’=over’
perl v5.20.3  VECTORREAL (3)  20020819 
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.