Math::VectorReal - Module to handle 3D Vector Mathematics
The `Math::VectorReal' package defines a 3D mathematical "vector", in a way
that is compatible with the previous CPAN module `Math::MatrixReal'. However
it provides a more vector oriented set of mathematical functions and overload
operators, to the `MatrixReal' package. For example the normal perl string
functions "x" and "." have been overloaded to allow vector cross and dot
product operations. Vector math formula thus looks like vector math formula in
perl programs using this package.
While this package is compatible with Math::MatrixReal, you DO NOT need to
have that package to perform purely vector orientated calculations. You will
need it however if you wish to do matrix operations with these vectors. The
interface has been designed with this package flexibility in mind.
The vectors are defined in the same way as a "row" `Math::MatrixReal' matrix,
instead of that packages choice of "column" definition for vector operations.
Such vectors are multiplied to matrices with the vector on the left and the
matrix on the right. EG: v * M -> 'v
Not only is this the way I prefer to handle vectors, but it is the way most
graphics books use vectors. As a bonus it results in no overload conflicts
between this package and that of Math::MatrixReal, (the left objects overload
operator is called to do the mathematics). It also is a lot simpler than
`MatrixReal' column vector methods, which were designed for equation solving
rather than 3D geometry operations.
The vector_matrix() function provided, simplifies the creation a `MatrixReal'
object from 3 (usually orthogonal) vectors. This with its vector orientated
math operators makes it very easy to define orthogonal rotation matrices from
C http://www.sct.gu.edu.au/~anthony/
-----------------------------------------------------------------------------
We will encourage you to develop the three great virtues of
a programmer : laziness, impatience and hubris.
--- Larry Wall - "Programming Perl"
-----------------------------------------------------------------------------
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.