Cube

Cubes in 3d space

PhilipRBrenan@yahoo.com, 2004, Perl License

Synopsis

Example t/cube.t

 #_ Cube _______________________________________________________________
 # Test cube      
 # philiprbrenan@yahoo.com, 2004, Perl License    
 #______________________________________________________________________
 
 use Math::Zap::Cube unit=>u;
 use Test::Simple tests=>5;
 
 ok(u    eq 'cube(vector(0, 0, 0), vector(1, 0, 0), vector(0, 1, 0), vector(0, 0, 1))');
 ok(u->a eq 'vector(0, 0, 0)');
 ok(u->x eq 'vector(1, 0, 0)');
 ok(u->y eq 'vector(0, 1, 0)');
 ok(u->z eq 'vector(0, 0, 1)');
 

Description

Define and manipulate a cube in 3 dimensions

Constructors

new

Create a rectangle from 3 vectors:

a position of corner
x first side
y second side
z third side

cube

Synonym for "new"

unit

Unit cube

Methods

Check

Check that an anonymous reference is a reference to a cube and confess if it is not.

is

Same as "check" but return the result to the caller.

a, x, y, z

Components of cube

Clone

Create a cube from another cube

Accuracy

Get/Set accuracy for comparisons

Add

Add a vector to a cube

Subtract

Subtract a vector from a cube

Multiply

Cube times a scalar

Divide

Cube divided by a non zero scalar

Print

Print cube

Triangulate

Triangulate cube

Operator Overloads

Operator overloads

Add

Add operator.

Subtract

Subtract operator.

Multiply

Multiply operator.

Divide

Divide operator.

Equals

Equals operator.

Print

Print a cube

Exports

Export "cube", "unit"

Credits

Author

philiprbrenan@yahoo.com

philiprbrenan@yahoo.com, 2004

License

Perl License.