2 Copyright (C) 1997,1998,1999
3 Kenji Hiranabe, Eiwa System Management, Inc.
5 This program is free software.
6 Implemented by Kenji Hiranabe(hiranabe@esm.co.jp),
7 conforming to the Java(TM) 3D API specification by Sun Microsystems.
9 Permission to use, copy, modify, distribute and sell this software
10 and its documentation for any purpose is hereby granted without fee,
11 provided that the above copyright notice appear in all copies and
12 that both that copyright notice and this permission notice appear
13 in supporting documentation. Kenji Hiranabe and Eiwa System Management,Inc.
14 makes no representations about the suitability of this software for any
15 purpose. It is provided "AS IS" with NO WARRANTY.
19 import java.io.Serializable;
22 * A 3-element tuple represented by signed integer x,y,z coordinates.
25 * @version specification 1.2, implementation $Revision: 1.9 $, $Date:
26 * 2006/07/28 17:01:32 $
27 * @author Kenji hiranabe
29 * additions by Bob Hanson hansonr@stolaf.edu 9/30/2012 for unique
30 * constructor and method names for the optimization of compiled
31 * JavaScript using Java2Script
33 public abstract class T3i implements Serializable {
51 * Constructs and initializes a Tuple3i to (0,0,0).
57 * Sets the value of this tuple to to the specified x, y, and z coordinates.
66 public final void set(int x, int y, int z) {
73 * Sets the value of this tuple to the value of tuple t1.
76 * the tuple to be copied.
78 public final void setT(T3i t1) {
85 * Sets the value of this tuple to the sum of itself and t1.
90 public final void add(T3i t) {
97 * Sets the value of this tuple to the scalar multiplication of tuple t1 plus
98 * tuple t2 (this = s*t1 + t2).
103 * the tuple to be multipled
105 * the tuple to be added
107 public final void scaleAdd(int s, T3i t1, T3i t2) {
114 * Returns a hash number based on the data values in this object. Two
115 * different Tuple3i objects with identical data values (ie, returns true for
116 * equals(Tuple3i) ) will return the same hash number. Two vectors with
117 * different data members may return the same hash value, although this is not
121 public int hashCode() {
126 * Returns true if the Object o is of type Tuple3i and all of the data members
127 * of t are equal to the corresponding data members in this Tuple3i.
130 * the object with which the comparison is made.
133 public boolean equals(Object o) {
134 if (!(o instanceof T3i))
137 return (this.x == t.x && this.y == t.y && this.z == t.z);
141 * Returns a string that contains the values of this Tuple3i. The form is
144 * @return the String representation
147 public String toString() {
148 return "(" + x + ", " + y + ", " + z + ")";