Manipulate 3D vectors
PhilipRBrenan@yahoo.com, 2004, Perl licence
Example t/vector.t
#_ Vector _____________________________________________________________ # Test 3d vectors # philiprbrenan@yahoo.com, 2004, Perl License #______________________________________________________________________ use Math::Zap::Vector vector=>'v', units=>'u'; use Test::Simple tests=>7; my ($x, $y, $z) = u(); ok(!$x == 1); ok(2*$x+3*$y+4*$z == v( 2, 3, 4)); ok(-$x-$y-$z == v(-1, -1, -1)); ok((2*$x+3*$y+4*$z) + (-$x-$y-$z) == v( 1, 2, 3)); ok((2*$x+3*$y+4*$z) * (-$x-$y-$z) == -9); ok($x*2 == v( 2, 0, 0)); ok($y/2 == v( 0, 0.5, 0));
Manipulate 3 dimensional vectors via operators.
Create a vector from numbers
Unit vectors
Check its a vector
Test its a vector
Get/Set accuracy for comparisons
Round: round to nearest integer if within accuracy of that integer
x,y,z components of vector
Create a vector from another vector
Length of a vector
Print vector
Normalize vector
Dot product
Angle between two vectors
Cross product
Add vectors
Subtract vectors
Vector times a scalar
Vector divided by a non zero scalar
Equals to within accuracy
Operator overloads
Add operator, see "add"
Subtract operator.
Multiply operator, see "multiply"
Divide operator, see "divide"
Cross operator, see "cross"
Angle operator, see "angle"
Equals operator, see "equals"
Print a vector, see "print"
Export "vector", "units", "check", "is"
philiprbrenan@yahoo.com
philiprbrenan@yahoo.com, 2004
Perl License.
To install Math::Zap::Draw, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::Zap::Draw
CPAN shell
perl -MCPAN -e shell install Math::Zap::Draw
For more information on module installation, please visit the detailed CPAN module installation guide.