-
-
14 Jun 2004 22:31:46 UTC
- Distribution: Math-Zap
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (200 / 118 / 0)
- Kwalitee
Bus factor: 1- 67.20% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (62.37KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- none
- Reverse dependencies
- CPAN Testers List
- Dependency graph
Vector
Manipulate 3D vectors
PhilipRBrenan@yahoo.com, 2004, Perl licence
Synopsis
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));
Description
Manipulate 3 dimensional vectors via operators.
Constructors
new
Create a vector from numbers
units
Unit vectors
Methods
check
Check its a vector
is
Test its a vector
accuracy
Get/Set accuracy for comparisons
round
Round: round to nearest integer if within accuracy of that integer
x,y,z
x,y,z components of vector
clone
Create a vector from another vector
length
Length of a vector
print
Print vector
norm
Normalize vector
dot
Dot product
angle
Angle between two vectors
cross
Cross product
add
Add vectors
subtract
Subtract vectors
multiply
Vector times a scalar
divide
Vector divided by a non zero scalar
equals
Equals to within accuracy
Operator Overloads
Operator overloads
Add operator
Add operator, see "add"
Subtract Operator
Subtract operator.
Multiply Operator
Multiply operator, see "multiply"
Divide Operator
Divide operator, see "divide"
Cross Operator
Cross operator, see "cross"
Angle Operator
Angle operator, see "angle"
Equals Operator
Equals operator, see "equals"
Print Operator
Print a vector, see "print"
Export Definitions
Export "vector", "units", "check", "is"
Credits
Author
philiprbrenan@yahoo.com
Copyright
philiprbrenan@yahoo.com, 2004
License
Perl License.
Module Install Instructions
To install Math::Zap::Draw, copy and paste the appropriate command in to your terminal.
cpanm Math::Zap::Draw
perl -MCPAN -e shell install Math::Zap::Draw
For more information on module installation, please visit the detailed CPAN module installation guide.