Package javajs.util

Class T3d

java.lang.Object
javajs.util.T3d
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
V3d

public abstract class T3d extends Object implements Serializable
A generic 3 element tuple that is represented by double precision floating point x,y and z coordinates.
Version:
specification 1.1, implementation $Revision: 1.9 $, $Date: 2006/07/28 17:01:32 $
Author:
Kenji hiranabe additions by Bob Hanson hansonr@stolaf.edu 9/30/2012 for unique constructor and method names for the optimization of compiled JavaScript using Java2Script
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    The x coordinate.
    double
    The y coordinate.
    double
    The z coordinate.
  • Constructor Summary

    Constructors
    Constructor
    Description
    T3d()
    Constructs and initializes a Tuple3d to (0,0,0).
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    add(T3d t1)
    Sets the value of this tuple to the vector sum of itself and tuple t1.
    final void
    add2(T3d t1, T3d t2)
    Sets the value of this tuple to the vector sum of tuples t1 and t2.
    boolean
    Returns true if all of the data members of Tuple3d t1 are equal to the corresponding data members in this
    int
    Returns a hash number based on the data values in this object.
    final void
    scale(double s)
    Sets the value of this tuple to the scalar multiplication of itself.
    final void
    scaleAdd(double s, T3d t1, T3d t2)
    Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*t1 + t2).
    final void
    scaleAdd2(double s, T3d t1, T3d t2)
    Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*t1 + t2).
    final void
    set(double x, double y, double z)
    Sets the value of this tuple to the specified xyz coordinates.
    final void
    setA(double[] t)
    Sets the value of this tuple from the 3 values specified in the array.
    final void
    setT(T3d t1)
    Sets the value of this tuple to the value of the Tuple3d argument.
    final void
    sub(T3d t1)
    Sets the value of this tuple to the vector difference of itself and tuple t1 (this = this - t1).
    final void
    sub2(T3d t1, T3d t2)
    Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2).
    Returns a string that contains the values of this Tuple3d.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • x

      public double x
      The x coordinate.
    • y

      public double y
      The y coordinate.
    • z

      public double z
      The z coordinate.
  • Constructor Details

    • T3d

      public T3d()
      Constructs and initializes a Tuple3d to (0,0,0).
  • Method Details

    • set

      public final void set(double x, double y, double z)
      Sets the value of this tuple to the specified xyz coordinates.
      Parameters:
      x - the x coordinate
      y - the y coordinate
      z - the z coordinate
    • setA

      public final void setA(double[] t)
      Sets the value of this tuple from the 3 values specified in the array.
      Parameters:
      t - the array of length 3 containing xyz in order
    • setT

      public final void setT(T3d t1)
      Sets the value of this tuple to the value of the Tuple3d argument.
      Parameters:
      t1 - the tuple to be copied
    • add2

      public final void add2(T3d t1, T3d t2)
      Sets the value of this tuple to the vector sum of tuples t1 and t2.
      Parameters:
      t1 - the first tuple
      t2 - the second tuple
    • add

      public final void add(T3d t1)
      Sets the value of this tuple to the vector sum of itself and tuple t1.
      Parameters:
      t1 - the other tuple
    • sub2

      public final void sub2(T3d t1, T3d t2)
      Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2).
      Parameters:
      t1 - the first tuple
      t2 - the second tuple
    • sub

      public final void sub(T3d t1)
      Sets the value of this tuple to the vector difference of itself and tuple t1 (this = this - t1).
      Parameters:
      t1 - the other tuple
    • scale

      public final void scale(double s)
      Sets the value of this tuple to the scalar multiplication of itself.
      Parameters:
      s - the scalar value
    • scaleAdd

      public final void scaleAdd(double s, T3d t1, T3d t2)
      Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*t1 + t2).
      Parameters:
      s - the scalar value
      t1 - the tuple to be multipled
      t2 - the tuple to be added
    • scaleAdd2

      public final void scaleAdd2(double s, T3d t1, T3d t2)
      Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*t1 + t2).
      Parameters:
      s - the scalar value
      t1 - the tuple to be multipled
      t2 - the tuple to be added
    • hashCode

      public int hashCode()
      Returns a hash number based on the data values in this object. Two different Tuple3d objects with identical data values (ie, returns true for equals(Tuple3d) ) will return the same hash number. Two vectors with different data members may return the same hash value, although this is not likely.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object t1)
      Returns true if all of the data members of Tuple3d t1 are equal to the corresponding data members in this
      Overrides:
      equals in class Object
      Parameters:
      t1 - the vector with which the comparison is made.
    • toString

      public String toString()
      Returns a string that contains the values of this Tuple3d. The form is (x,y,z).
      Overrides:
      toString in class Object
      Returns:
      the String representation