| 1 |
|
| 2 |
Math::VectorReal - Module to handle 3D Vector Mathematics |
| 3 |
|
| 4 |
The `Math::VectorReal' package defines a 3D mathematical "vector", in a way |
| 5 |
that is compatible with the previous CPAN module `Math::MatrixReal'. However |
| 6 |
it provides a more vector oriented set of mathematical functions and overload |
| 7 |
operators, to the `MatrixReal' package. For example the normal perl string |
| 8 |
functions "x" and "." have been overloaded to allow vector cross and dot |
| 9 |
product operations. Vector math formula thus looks like vector math formula in |
| 10 |
perl programs using this package. |
| 11 |
|
| 12 |
While this package is compatible with Math::MatrixReal, you DO NOT need to |
| 13 |
have that package to perform purely vector orientated calculations. You will |
| 14 |
need it however if you wish to do matrix operations with these vectors. The |
| 15 |
interface has been designed with this package flexibility in mind. |
| 16 |
|
| 17 |
The vectors are defined in the same way as a "row" `Math::MatrixReal' matrix, |
| 18 |
instead of that packages choice of "column" definition for vector operations. |
| 19 |
Such vectors are multiplied to matrices with the vector on the left and the |
| 20 |
matrix on the right. EG: v * M -> 'v |
| 21 |
|
| 22 |
Not only is this the way I prefer to handle vectors, but it is the way most |
| 23 |
graphics books use vectors. As a bonus it results in no overload conflicts |
| 24 |
between this package and that of Math::MatrixReal, (the left objects overload |
| 25 |
operator is called to do the mathematics). It also is a lot simpler than |
| 26 |
`MatrixReal' column vector methods, which were designed for equation solving |
| 27 |
rather than 3D geometry operations. |
| 28 |
|
| 29 |
The vector_matrix() function provided, simplifies the creation a `MatrixReal' |
| 30 |
object from 3 (usually orthogonal) vectors. This with its vector orientated |
| 31 |
math operators makes it very easy to define orthogonal rotation matrices from |
| 32 |
C<Math::VectorReal' objects. See a rough example in the synopsis above, or in |
| 33 |
the file "matrix_test" in the packages source. |
| 34 |
|
| 35 |
|
| 36 |
Prerequisites: |
| 37 |
-------------- |
| 38 |
|
| 39 |
Perl version 5.000 or higher. But no other modules are required. |
| 40 |
|
| 41 |
Installing Math::MatrixReal is an advantage if you also want to do vector - |
| 42 |
matrix calculations. This Package was designed to work transparently with |
| 43 |
this package if you want to perform such mathematics. But it is NOT required. |
| 44 |
|
| 45 |
|
| 46 |
Installation: |
| 47 |
------------- |
| 48 |
|
| 49 |
The usual drill for Perl CPAN modules... |
| 50 |
perl Makefile.PL |
| 51 |
make |
| 52 |
make test |
| 53 |
make install |
| 54 |
|
| 55 |
|
| 56 |
Anthony Thyssen <[email protected]> http://www.sct.gu.edu.au/~anthony/ |
| 57 |
----------------------------------------------------------------------------- |
| 58 |
We will encourage you to develop the three great virtues of |
| 59 |
a programmer : laziness, impatience and hubris. |
| 60 |
--- Larry Wall - "Programming Perl" |
| 61 |
----------------------------------------------------------------------------- |
| 62 |
Copyright (c) 2001 Anthony Thyssen. All rights reserved. This program is free |
| 63 |
software; you can redistribute it and/or modify it under the same terms as |
| 64 |
Perl itself. I would appreciate any suggestions however. |
| 65 |
|