keps.math
Class Tuple3

java.lang.Object
  extended by keps.math.Tuple3
Direct Known Subclasses:
Point3, Vector3

public class Tuple3
extends java.lang.Object

GENERAL CONTRACT FOR ALL MATH CLASSES. -- The destination of every method is assumed to be the object the method was called on. For example: c.add(a,b) means c = a + b. -- Whenever one operand of a binary operand is missing, it is assumed to be the object the method was called upon. For example: c.add(a) means c = c + a. Base class for 3d tuples (ie. points and vectors).

Author:
arbree Aug 18, 2005 Tuple3.java Copyright 2005 Program of Computer Graphics, Cornell University

Field Summary
 double x
          The x coordinate of the Tuple3.
 double y
          The y coordinate of the Tuple3.
 double z
          The z coordinate of the Tuple3.
 
Constructor Summary
Tuple3()
          Default constructor.
Tuple3(double newX, double newY, double newZ)
          The explicit constructor.
Tuple3(Tuple3 newTuple)
          Copy constructor.
 
Method Summary
 void scale(double op1)
          Scale this Tuple3 by op1
 void set(double inX, double inY, double inZ)
          Set the value of this Tuple3 to the three input values
 void set(Tuple3 inTuple)
          Sets this tuple to have the contents of another tuple.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x
The x coordinate of the Tuple3.


y

public double y
The y coordinate of the Tuple3.


z

public double z
The z coordinate of the Tuple3.

Constructor Detail

Tuple3

public Tuple3()
Default constructor. Uses explicit constructor to create a zero vector.


Tuple3

public Tuple3(Tuple3 newTuple)
Copy constructor. This constructor simply calls the explicit constructor with the necessary fields from the input as parameters.

Parameters:
newTuple - The vector to copy.

Tuple3

public Tuple3(double newX,
              double newY,
              double newZ)
The explicit constructor. This is the only constructor with any real code in it. Values should be set here, and any variables that need to be calculated should be done here.

Parameters:
newX - The x value of the new vector.
newY - The y value of the new vector.
newZ - The z value of the new vector.
Method Detail

scale

public void scale(double op1)
Scale this Tuple3 by op1

Parameters:
op1 - the scale factor

set

public void set(Tuple3 inTuple)
Sets this tuple to have the contents of another tuple. Allows quick conversion between points and vectors.

Parameters:
inTuple - the input tuple

set

public void set(double inX,
                double inY,
                double inZ)
Set the value of this Tuple3 to the three input values

Parameters:
inX - the new X value
inY - the new Y value
inZ - the new Z value

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()